Document lifecycle
open
Open a document from a file, URL, or buffer.
Document source. Omit for a blank document.
This is the instance method. For one-liner creation, use the static
Editor.open() factory — see Configuration.close
Close the current document. The editor instance stays alive for reuse.
save
Save back to the original source path (Node.js only).
saveTo
Save to a specific path (Node.js only).
File path
exportDocument
Export as a Blob (browser) or Buffer (Node.js).
exportDocx
Lower-level export with additional control.
replaceFile
Replace the current DOCX with a new file.
Content
getHTML
getJSON
getMarkdown
replaceContent
Replace the entire document content.
replaceNodeWithHTML
Replace a specific node with HTML.
Editor control
mount / unmount
destroy
Permanently destroy the editor.
focus / blur
setEditable
setDocumentMode
Commands
All commands are accessed viaeditor.commands:
insertContent
Insert content with automatic format detection.
Content to insert
HTML and Markdown inline styles are stripped on import to ensure Word compatibility.
Document metadata
getMetadata
getDocumentIdentifier
Get a stable identifier (GUID or content hash).
isDocumentModified
Schema
getSchemaSummaryJSON
Generate a summary of the document schema. Useful for AI agents that need to understand the document structure.
Position & coordinates
getElementAtPos
Get the DOM element at a document position.
Document position
getNodesOfType
Get all nodes of a specific type.
isActive
Check if a node or mark is active.
getAttributes
Get attributes of the active node or mark.
Page & layout
getPageStyles
updatePageStyle
Search
Properties
| Property | Type | Description |
|---|---|---|
lifecycleState | string | 'initialized', 'documentLoading', 'ready', 'saving', 'closed', 'destroyed' |
isEditable | boolean | Whether editor accepts input |
isDestroyed | boolean | Whether editor has been destroyed |
isFocused | boolean | Whether editor has focus |
docChanged | boolean | Whether any edits have been made |
sourcePath | string | null | Source file path (null if opened from Blob) |

