Skip to main content
Methods are functions you call on the SuperDoc instance to perform actions.

Document operations

export

Export the document with various options.
Object
Export configuration
Returns: Promise<Blob> - Document blob

save

Save document if in collaboration mode. Returns: Promise<void>

getHTML

Get HTML content of all editors.
Object
HTML options
Returns: string[] - Array of HTML strings, one per editor

Mode control

setDocumentMode

Change the document mode.
string
required
New document mode

lockSuperdoc

Lock or unlock the document.
boolean
required
Lock state
User
User who locked the document

setHighContrastMode

Enable/disable high contrast mode.
boolean
required
High contrast state

UI methods

setActiveEditor

Set which editor is currently active. Useful when working with multiple documents.
Editor
required
Editor instance to set as active

setDisableContextMenu

Toggle the custom context menu at runtime.
boolean
default:"true"
Whether to disable the context menu

setTrackedChangesPreferences

Override how tracked changes are rendered in the layout engine.
Object

toggleRuler

Toggle ruler visibility.
string
deprecated
Removed in v1.0 — Pagination is now handled by the layout engine. Use viewOptions.layout in configuration instead.

getZoom

Get the current zoom level as a percentage. Returns: number - Current zoom level (e.g., 100, 150, 200). Defaults to 100.

setZoom

Set the zoom level for all documents. Propagates to all presentation editors, PDF viewers, and whiteboard layers.
number
required
Zoom level as a percentage (e.g., 100, 150, 200). Must be a positive finite number.

focus

Focus the active editor or first available.

Search methods

Search for text or regex in active editor.
string | RegExp
required
Search query
Returns: Array<SearchResult> - Search matches

goToSearchResult

Navigate to a search result.
SearchResult
required
Search result to navigate to

Comments methods

addCommentsList

Add a comments list to the specified element.
string | HTMLElement
required
Container for comments list

removeCommentsList

Remove the comments list.

User management

addSharedUser

Add a user to the shared users list.
User
required
User to add

removeSharedUser

Remove a user from shared users.
string
required
Email of user to remove

Lifecycle

destroy

Completely destroy the SuperDoc instance.
This is irreversible. Cleans up all resources, events, and DOM.

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.
Object

TypeScript types

SuperDoc exports TypeScript interfaces for all node and mark types:
Available 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.
Always check for null before accessing.