Skip to content

EditorEmittedEvent

EditorEmittedEvent = { event: FocusEvent<HTMLDivElement, Element>; type: "blurred"; } | { type: "done loading"; } | { type: "editable"; } | ErrorEvent | { event: FocusEvent<HTMLDivElement, Element>; type: "focused"; } | { resolution: InvalidValueResolution | null; type: "invalid value"; value: PortableTextBlock[] | undefined; } | { type: "loading"; } | MutationEvent | { operation: Operation; type: "operation"; } | PatchEvent | { type: "read only"; } | { type: "ready"; } | { selection: EditorSelection; type: "selection"; } | { type: "value changed"; value: PortableTextBlock[] | undefined; }

Defined in: packages/editor/src/editor/relay.ts:10

{ event: FocusEvent<HTMLDivElement, Element>; type: "blurred"; }

event: FocusEvent<HTMLDivElement, Element>

type: "blurred"

{ type: "done loading"; }

type: "done loading"

{ type: "editable"; }

type: "editable"

ErrorEvent

{ event: FocusEvent<HTMLDivElement, Element>; type: "focused"; }

event: FocusEvent<HTMLDivElement, Element>

type: "focused"

{ resolution: InvalidValueResolution | null; type: "invalid value"; value: PortableTextBlock[] | undefined; }

resolution: InvalidValueResolution | null

type: "invalid value"

value: PortableTextBlock[] | undefined

{ type: "loading"; }

type: "loading"

MutationEvent

{ operation: Operation; type: "operation"; }

operation: Operation

type: "operation"

Emitted synchronously for every document-changing operation the engine applies (set.selection is excluded; the selection event serves selection observers), including operations from initial value sync and normalization, unlike patch and mutation events, which are held back until the editor is dirty. Do not dispatch editor events from a listener; read current state via editor.getSnapshot().

The operation object is the engine’s own, passed by reference: treat it as read-only and copy anything you retain. Normalization fix operations are delivered adjacent to the operation that triggered them, but not in a guaranteed order; see the Operation docs for the delivery-order contract. Subscribers attached after setup receive only subsequent operations: seed derived state from editor.getSnapshot() when subscribing, then apply deltas.

PatchEvent

{ type: "read only"; }

type: "read only"

{ type: "ready"; }

type: "ready"

{ selection: EditorSelection; type: "selection"; }

selection: EditorSelection

type: "selection"

{ type: "value changed"; value: PortableTextBlock[] | undefined; }

type: "value changed"

value: PortableTextBlock[] | undefined