Skip to content
This page is available as Markdown at /api/editor/type-aliases/editorevent.md. For the full documentation index, see /llms.txt, or the complete corpus at /llms-full.txt.

EditorEvent

EditorEvent = ExternalEditorEvent | ExternalBehaviorEvent | { type: "update value"; value: PortableTextBlock[] | undefined; }

Defined in: packages/editor/src/editor.ts:28

ExternalEditorEvent

ExternalBehaviorEvent

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

type: "update value"

Hands the editor the host’s latest snapshot of the value so it can reconcile. A snapshot equal to the previous one the host sent is ignored, even if the editor’s content has since diverged from it through local edits. Any other snapshot is reconciled against the editor’s current content, block by block: each block that differs from the snapshot is replaced by the snapshot’s version.

This includes blocks with local edits the snapshot doesn’t contain yet, so those edits are lost. Only send snapshots that include everything the editor has emitted. To apply other writers’ changes while the user is editing, send them as patches instead.

Reconciliation is not an edit: it emits no patch or mutation events and adds no history step. While local changes are in flight, it is deferred until they have flushed. undefined and [] are the same empty snapshot: sending either when the previous snapshot was also empty is a no-op and never clears locally typed content.

To change content programmatically, use editing events so the change flows through behaviors and emits patches; to reset the editor wholesale, remount it with a fresh initialValue.

value: PortableTextBlock[] | undefined