Listener class provides a callback-based event system where you can attach single callback functions to various editor events.
Overview
Access the listener through the editor instance:Available Listeners
rangeStyleChange
Fired when the selection style changes (format of selected text).IRangeStyle
visiblePageNoListChange
Fired when the list of visible pages changes during scrolling.number[] - Array of visible page numbers
Example:
intersectionPageNoChange
Fired when the primary intersecting page changes.number - Current page number (0-indexed)
Example:
pageSizeChange
Fired when the total number of pages changes.number - Total page count
Example:
pageScaleChange
Fired when the zoom level changes.number - Scale factor (e.g., 1 = 100%, 1.5 = 150%)
Example:
saved
Fired when the document is saved (via save shortcut or command).IEditorResult
contentChange
Fired whenever document content changes.void (no payload)
Example:
controlChange
Fired when a control’s state changes (active/inactive).IControlChangeResult
controlContentChange
Fired when a control’s content/value changes.IControlContentChangeResult
pageModeChange
Fired when page mode changes.PageMode - PAGING or CONTINUITY
Example:
zoneChange
Fired when the cursor moves between zones (header/main/footer).EditorZone - HEADER, MAIN, or FOOTER
Example:
Complete Example
Removing Listeners
To remove a listener, set it tonull:
Listener vs EventBus
Listener (callback-based):- Single callback per event
- Simple assignment
- Good for primary event handlers
- Multiple subscribers per event
- Requires explicit subscription/unsubscription
- Good for plugins and multiple components