Skip to main content

@lexical/extension/NodeStructureExtension

Interfaces​

NodeStructureConfig​

Defined in: packages/lexical-extension/src/NodeStructureExtension.ts:28

Experimental

node-structure

Configuration of NodeStructureExtension (each key is also a signal in its output).

Properties​

disabled​

disabled: boolean

Defined in: packages/lexical-extension/src/NodeStructureExtension.ts:33

Experimental

true removes the normalization transforms (the declarations are then only read, never enforced). Default false.

Variables​

NodeStructureExtension​

const NodeStructureExtension: LexicalExtension<NodeStructureConfig, "@lexical/NodeStructure", NamedSignalsOutput<NodeStructureConfig>, unknown>

Defined in: packages/lexical-extension/src/NodeStructureExtension.ts:84

Experimental

node-structure

Enforces the structure node classes declare in $config(): children (a block lifted out of a node that holds inline content, inline content wrapped in a paragraph in a node that holds blocks, a disallowed child wrapped in the first listed class) and mergeAdjacent (equal adjacent siblings merged). It runs as a transform on every dirty element of a class that declares either, in the same update, and only moves content.

Opt-in: without it, the declarations change nothing at runtime. Collaboration bindings that derive storage from the declarations (@lexical/y) depend on it, so that every peer holds the same normalized tree.

Functions​

registerNodeStructure()​

registerNodeStructure(editor): () => void

Defined in: packages/lexical-extension/src/NodeStructureExtension.ts:48

Experimental

node-structure

Registers the normalization NodeStructureExtension runs, as a transform on every registered element class that declares children or mergeAdjacent. Idempotent (one shared transform per class). For code that builds an editor without extensions, such as a collaboration binding.

Parameters​

editor​

LexicalEditor

Returns​

A function that removes the transforms it added

() => void