Quick start
Editor.open() is the recommended way to create an editor. It handles DOCX parsing, extension setup, and mounting automatically.
Required parameters
string | File | Blob | Buffer
The document source. Can be a file path (Node.js), File/Blob (browser), or Buffer.
HTMLElement
DOM element where the editor will mount. If omitted, the editor runs in headless mode.
string
Unique identifier for this document instance. Used for collaboration and
storage. Auto-generated if not provided.
Array<Extension>
Extensions that define the editor schema and functionality. If omitted,
Editor.open() uses sensible defaults (getStarterExtensions() for DOCX, getRichTextExtensions() for text/HTML).Modes & permissions
string
default:"'docx'"
Editor rendering mode
string
default:"'editing'"
Current editing state
string
default:"'editor'"
User permission level. Overrides documentMode when more restrictive.
Role always wins over documentMode in permission conflicts
boolean
default:"true"
Whether the editor accepts input
User & collaboration
Object
Current user information
Array<User>
default:"[]"
All users with document access. Used for @mentions and awareness.
Y.Doc
Yjs document for real-time collaboration
HocuspocusProvider
Provider instance for collaboration sync
Content initialization
string
Initialize with HTML content (for
mode: 'html')string
Initialize with Markdown (converts to document)
Object
Use ProseMirror JSON content instead of DOCX parsing
function
Callback invoked with HTML elements that were dropped during import because they have no schema representation. Receives an array of
{ tagName, outerHTML, count } items. When provided, console.warn is suppressed.boolean
default:"false"
Log a
console.warn listing HTML elements dropped during import. Ignored when onUnsupportedContent is provided.Features
boolean
default:"false"
Enable comments system
boolean
default:"false"
Enable field annotations
boolean
default:"false"
Enable page-based layout
Advanced options
boolean
default:"false"
Run without mounting an editor view (Node.js/server-side processing).
Automatically set to
true when no element is provided to Editor.open().Document
DOM Document for serialization in headless mode (e.g.,
window.document from JSDOM).YXmlFragment
Y.Doc XML fragment for collaborative document content. Use with headless mode to read Y.Doc content.
function
Custom image upload handler
Configuration patterns
Full DOCX editor
Headless converter (Node.js)
Convert DOCX files server-side without a browser using JSDOM.See the headless
example
for a complete implementation.
Headless Y.Doc to HTML (collaboration)
Read content from a collaborative Y.Doc in your backend — useful for AI agents or APIs that need to access document content without a browser.Even with headless mode, methods like
getHTML() need a DOM for serialization. JSDOM is set up automatically in Node.js when using Editor.open().
