Document operations
export
Export the document with various options.
Export configuration
Promise<Blob> - Document blob
save
Save document if in collaboration mode.
Returns: Promise<void>
getHTML
Get HTML content of all editors.
HTML options
string[] - Array of HTML strings, one per editor
Mode control
setDocumentMode
Change the document mode.
New document mode
lockSuperdoc
Lock or unlock the document.
Lock state
User who locked the document
setHighContrastMode
Enable/disable high contrast mode.
High contrast state
UI methods
setActiveEditor
Set which editor is currently active. Useful when working with multiple documents.
Editor instance to set as active
setDisableContextMenu
Toggle the custom context menu at runtime.
Whether to disable the context menu
setTrackedChangesPreferences
Override how tracked changes are rendered in the layout engine.
toggleRuler
Toggle ruler visibility.
focus
Focus the active editor or first available.
Search methods
search
Search for text or regex in active editor.
Search query
Array<SearchResult> - Search matches
goToSearchResult
Navigate to a search result.
Search result to navigate to
Comments methods
addCommentsList
Add a comments list to the specified element.
Container for comments list
removeCommentsList
Remove the comments list.
User management
addSharedUser
Add a user to the shared users list.
User to add
removeSharedUser
Remove a user from shared users.
Email of user to remove
Lifecycle
destroy
Completely destroy the SuperDoc instance.
Event methods
on
Subscribe to an event.
once
Subscribe to an event once.
off
Unsubscribe from an event.
Schema introspection
getSchemaIntrospection
Returns a JSON schema summary with all nodes, marks, and their attributes. Useful for AI agents that need schema context.
TypeScript types
SuperDoc exports TypeScript interfaces for all node and mark types:NodeName, NodeAttrs<N>, MarkName, MarkAttrs<M>, and specific interfaces like ParagraphAttrs, TableAttrs, ImageAttrs, etc.
Properties
activeEditor
Currently active editor instance. Returns null before the ready event.
| Property | Type | Description |
|---|---|---|
superdocId | string | Unique identifier for this instance |
version | string | SuperDoc version number |
activeEditor | Editor | null | Currently active editor |
element | HTMLElement | null | Container DOM element |
state | { documents, users } | Current state snapshot |
isLocked | boolean | Whether the document is locked |
lockedBy | User | null | User who locked the document |
isCollaborative | boolean | Whether collaboration is enabled |
user | User | Current user information |
users | User[] | All users with document access |
toolbar | Toolbar | null | Toolbar instance if configured |

