EditorEmittedEvent
EditorEmittedEvent = {
event:FocusEvent<HTMLDivElement,Element>;type:"blurred"; } | {type:"editable"; } | {event:FocusEvent<HTMLDivElement,Element>;type:"focused"; } | {resolution:InvalidValueResolution|null;type:"invalid value";value:PortableTextBlock[] |undefined; } |MutationEvent| {operation:Operation;origin:"local"|"remote";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
Type Declaration
Section titled “Type Declaration”{ event: FocusEvent<HTMLDivElement, Element>; type: "blurred"; }
event:
FocusEvent<HTMLDivElement,Element>
type:
"blurred"
{ type: "editable"; }
type:
"editable"
{ event: FocusEvent<HTMLDivElement, Element>; type: "focused"; }
event:
FocusEvent<HTMLDivElement,Element>
type:
"focused"
{ resolution: InvalidValueResolution | null; type: "invalid value"; value: PortableTextBlock[] | undefined; }
resolution
Section titled “resolution”resolution:
InvalidValueResolution|null
type:
"invalid value"
value:
PortableTextBlock[] |undefined
{ operation: Operation; origin: "local" | "remote"; type: "operation"; }
operation
Section titled “operation”operation:
Operation
origin
Section titled “origin”origin:
"local"|"remote"
Where the change that produced this operation came from:
'local' for changes made in this editor (edits, undo/redo),
'remote' for changes applied from the outside (patches,
update value, and the initial value sync). A normalization fix
(a repaired key, a merged span) reports the origin of the change
that triggered it.
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
Section titled “selection”selection:
EditorSelection
type:
"selection"
{ type: "value changed"; value: PortableTextBlock[] | undefined; }
type:
"value changed"
value:
PortableTextBlock[] |undefined