Class: RootNode
lexical.RootNode
Hierarchy
-
↳
RootNode
Constructors
constructor
• new RootNode(): RootNode
Returns
Overrides
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:37
Methods
append
▸ append(...nodesToAppend
): this
Parameters
Name | Type |
---|---|
...nodesToAppend | LexicalNode [] |
Returns
this
Overrides
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:86
collapseAtStart
▸ collapseAtStart(): true
Returns
true
Overrides
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:108
getTextContent
▸ getTextContent(): string
Returns the text content of the node. Override this for custom nodes that should have a representation in plain text format (for copy + paste, for example)
Returns
string
Overrides
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:49
getTopLevelElementOrThrow
▸ getTopLevelElementOrThrow(): never
Returns the highest (in the EditorState tree) non-root ancestor of this node, or throws if none is found. See $isRootOrShadowRoot for more information on which Elements comprise "roots".
Returns
never
Overrides
ElementNode.getTopLevelElementOrThrow
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:42
insertAfter
▸ insertAfter(nodeToInsert
): LexicalNode
Inserts a node after this LexicalNode (as the next sibling).
Parameters
Name | Type | Description |
---|---|---|
nodeToInsert | LexicalNode | The node to insert after this one. |
Returns
Overrides
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:74
insertBefore
▸ insertBefore(nodeToInsert
): LexicalNode
Inserts a node before this LexicalNode (as the previous sibling).
Parameters
Name | Type | Description |
---|---|---|
nodeToInsert | LexicalNode | The node to insert before this one. |
Returns
Overrides
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:70
remove
▸ remove(): never
Removes this LexicalNode from the EditorState. If the node isn't re-inserted somewhere, the Lexical garbage collector will eventually clean it up.
Returns
never
Overrides
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:62
replace
▸ replace<N
>(node
): never
Replaces this LexicalNode with the provided node, optionally transferring the children of the replaced node to the replacing node.
Type parameters
Name | Type |
---|---|
N | LexicalNode |
Parameters
Name | Type | Description |
---|---|---|
node | N | The node to replace this one with. |
Returns
never
Overrides
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:66
updateDOM
▸ updateDOM(prevNode
, dom
): false
Called when a node changes and should update the DOM in whatever way is necessary to make it align with any changes that might have happened during the update.
Returning "true" here will cause lexical to unmount and recreate the DOM node (by calling createDOM). You would need to do this if the element tag changes, for instance.
Parameters
Name | Type |
---|---|
prevNode | this |
dom | HTMLElement |
Returns
false
Overrides
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:80
clone
▸ clone(): RootNode
Clones this node, creating a new node with a different key and adding it to the EditorState (but not attaching it anywhere!). All nodes must implement this method.
Returns
Overrides
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:33
getType
▸ getType(): string
Returns the string type of this node. Every node must implement this and it MUST BE UNIQUE amongst nodes registered on the editor.
Returns
string
Overrides
Defined in
packages/lexical/src/nodes/LexicalRootNode.ts:29
importJSON
▸ importJSON(serializedNode
): RootNode
Controls how the this node is deserialized from JSON. This is usually boilerplate, but provides an abstraction between the node implementation and serialized interface that can be important if you ever make breaking changes to a node schema (by adding or removing properties). See Serialization & Deserialization.
Parameters
Name | Type |
---|---|
serializedNode | SerializedRootNode <SerializedLexicalNode > |