Skip to main content
SuperDoc uses an event system for lifecycle hooks and change notifications.
Driving live React UI state? Prefer superdoc/ui subscriptions. useSuperDocSelection, useSuperDocComments, useSuperDocTrackChanges, useSuperDocDocument, and useSuperDocCommand give you typed, memoized, per-slice state with one re-render per change instead of a manual superdoc.on('editor-update', ...) loop. See Custom UI.The events on this page are for lifecycle (ready, editor-create), integration (error, comment-changed), analytics, and compatibility with code that doesn’t use the React surface.

Subscribing to events

Lifecycle events

ready

Fired when SuperDoc is fully initialized.

editorBeforeCreate

Fired before an editor is created. Use this to configure extensions or set up services.

editorCreate

When an editor is created.

editorDestroy

When an editor is destroyed.

Content events

editor-update

When editor content changes. Use this to refresh live UI state like word counts or auto-save.
Live counter example: Read editor.doc.info() inside the handler to build a live document-stats panel without polling.

content-error

When content processing fails.

fonts-resolved

When document fonts are resolved.

Comments events

comments-update

When comments are modified.

Collaboration events

collaboration-ready

When collaboration is initialized.

awareness-update

When user presence changes.

locked

When document lock state changes.

Pagination events

pagination-update

Fired after each layout pass with the current page count. Use this to know when page data is available: activeEditor.currentTotalPages is only populated after the first layout completes, which happens after the ready event.

UI events

zoomChange

When the zoom level changes via setZoom().
When the comments sidebar is toggled.

Error events

exception

When an error occurs during document processing or runtime.

Configuration-based events

Events can also be set during initialization:

Event order

  1. editorBeforeCreate: Before editor mounts
  2. editorCreate: Editor ready
  3. ready: All editors ready
  4. collaboration-ready: If collaboration enabled
  5. pagination-update: After each layout pass (page count available)
  6. Runtime events (editor-update, comments-update, sidebar-toggle, etc.)
  7. editorDestroy: Cleanup