Editor events

Subscribe with editor.on(name, listener) or the corresponding Slot.configure() callback. Remove listeners with editor.off(name, listener).

const onValidation = ({ state }: SlotValidationUpdateEvent) => showValidation(state)
editor.on('slotValidationUpdate', onValidation)
// When disposing the UI:
editor.off('slotValidationUpdate', onValidation)

Import payload types from @tiptap-pro/extension-slot. Editor comes from @tiptap/core.

slotsUpdate

Emitted for the initial index and each applied document change. Option: onSlotsUpdate.

Payload (SlotsUpdateEvent)

  • editor (Editor): Source editor.
  • snapshot (SlotSnapshot): Updated document and index.

activeSlotChange

Emitted initially and when the active entry changes. Option: onActiveSlotChange.

Payload (ActiveSlotChangeEvent)

  • editor (Editor): Source editor.
  • slot (SlotEntry | null): Active Slot, or null outside Slots.

slotValidationUpdate

Emitted when validation becomes pending, current or unvalidated, including explicit context invalidation. Option: onValidationUpdate.

Payload (SlotValidationUpdateEvent)

  • editor (Editor): Source editor.
  • state (SlotValidationState): Updated validation storage.

slotValidationError

Emitted when an editor-bound validator throws, rejects or returns malformed findings. Option: onValidationError.

Payload (SlotValidationErrorEvent)

Extends SlotValidationError with:

  • editor (Editor): Source editor.

Missing validators and aborted requests do not emit this event.

slotCommandRejected

Emitted when an actual Slot command is refused, including preflight refusal. Option: onCommandRejected.

Payload (SlotCommandRejectedEvent)

Extends SlotCommandRejection with:

  • editor (Editor): Source editor.

Delivery

  • Option callbacks and editor listeners receive the same payload. Registering both creates two subscriptions.
  • Initial index and active-Slot events follow editor creation. Late subscribers read storage; events are not replayed.
  • Update events follow storage updates. Refusal events follow the decision; listener return values do not change it.
  • Payload data is read-only. Application UI must respect read permissions before displaying it.
  • editor.can() and pure validation functions emit no editor events.
  • validateEditorSlots emits validation events. Validator errors precede the final validation-state update.
  • Follow-up writes should be scheduled by the application.
  • Extension-owned listeners and pending validation are cleaned up on editor destruction.

See Content Protection events for policy updates and protection refusals.