Skip to content

Events Reference

Events are accessed via the imperative API (editor.value.on()), not Vue's @event syntax.

Event Map

ts
interface EditorEventMap {
  'editor:ready': { document: EmailDocument }
  'editor:change': { document: EmailDocument }
  'node:selected': { nodeId: NodeId; node: EmailNode }
  'node:deselected': { nodeId: NodeId }
  'node:deleted': { nodeId: NodeId }
  'node:moved': { nodeId: NodeId; fromParentId: NodeId; toParentId: NodeId }
  'node:duplicated': { originalId: NodeId; newId: NodeId }
  'block:dropped': { blockId: string; parentId: NodeId }
  'history:undo': { canUndo: boolean; canRedo: boolean }
  'history:redo': { canUndo: boolean; canRedo: boolean }
  'property:changed': { nodeId: NodeId; key: string; value: string }
}

Usage

ts
// Subscribe
editor.value.on('editor:change', ({ document }) => {
  console.log('Changed')
})

// Unsubscribe
const handler = (payload) => { /* ... */ }
editor.value.on('node:selected', handler)
editor.value.off('node:selected', handler)

Event Descriptions

EventWhen It Fires
editor:readyEditor mounted and initialized
editor:changeAny document mutation
node:selectedUser clicks a node or selectNode() is called
node:deselectedSelection is cleared
node:deletedA node is removed
node:movedA node changes parent via drag or move up/down
node:duplicatedA node is cloned
block:droppedA block from the sidebar is dropped onto the canvas
history:undoUndo is performed
history:redoRedo is performed
property:changedAn attribute is updated via the properties panel

See the Events guide for detailed examples.

Released under the MIT License.