Skip to main content
SuperDoc uses an event system for lifecycle hooks and change notifications.

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.

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