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
toggleRuler
Toggle ruler visibility.
togglePagination
Toggle pagination mode.
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 Methods
destroy
Completely destroy the SuperDoc instance.
This is irreversible. Cleans up all resources, events, and DOM.
Event Methods
on
Subscribe to an event.
Event name
Event handler
once
Subscribe to an event once.
Event name
Event handler
off
Unsubscribe from an event.
Event name
Handler to remove
Method Patterns
Async Operations
Waiting for Ready
Some methods require SuperDoc to be ready