docstudio/designer
The React designer, headless editor and editing helpers. API reference in the DocStudio developer reference.
The designer module contains the React Designer component, the headless editor and the helpers around them. It needs React 18 or later and @dnd-kit/core as peers.
import { Designer, createEditor } from 'docstudio/designer';Areas
| Area | Main exports |
|---|---|
| Component | Designer and its DesignerProps type, DEFAULT_MESSAGES |
| Headless editor | createEditor, applyPatch, applyOp and the Command, Editor, EditorState types |
| Canvas | buildCanvasHtml, buildIndex |
| Actions | The actions, onView, onPrint and onSubmit props and the DesignerActions and DocumentPayload types |
| Data and expressions | createDataContext, scopeFor, pathChoices, previewExpression, expression operations (setPath, setFunction, addArg, wrapInCall) |
| Library | createMemoryLibrary, libraryStore, planPublish, executePublish, findDependents, repin, upgradeAllToLatest |
| Migration | prepareTemplate, isPending |
Props that matter
defaultTemplate or editor, actions, onView, onPrint, onSubmit, sampleData, registry, formatters, dataSchema, onChange, onSampleDataChange, locks, messages, direction, readOnly, initialFit, themes, library, catalog, migrations, mode, sampleProps, onPublish. The themes prop lists the theme names offered in the Theme dropdown. mode only applies when the designer creates its own editor: when you pass editor, create it with createEditor({ component: true }) for component authoring. See the DesignerProps entry below and Designer reference.
Reference
The sections below are generated from the exported source.