Skip to main content

Class: RootNode

lexical.RootNode

Hierarchy

Constructors

constructor

new RootNode(): RootNode

Returns

RootNode

Overrides

ElementNode.constructor

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:37

Methods

append

append(...nodesToAppend): this

Parameters

NameType
...nodesToAppendLexicalNode[]

Returns

this

Overrides

ElementNode.append

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:86


collapseAtStart

collapseAtStart(): true

Returns

true

Overrides

ElementNode.collapseAtStart

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:119


exportJSON

exportJSON(): SerializedRootNode<SerializedLexicalNode>

Controls how the this node is serialized to JSON. This is important for copy and paste between Lexical editors sharing the same namespace. It's also important if you're serializing to JSON for persistent storage somewhere. See Serialization & Deserialization.

Returns

SerializedRootNode<SerializedLexicalNode>

Overrides

ElementNode.exportJSON

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

ElementNode.getTextContent

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:49


getTopLevelElementOrThrow

getTopLevelElementOrThrow(): never

Returns

never

Overrides

ElementNode.getTopLevelElementOrThrow

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:42


insertAfter

insertAfter(nodeToInsert): LexicalNode

Parameters

NameType
nodeToInsertLexicalNode

Returns

LexicalNode

Overrides

ElementNode.insertAfter

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:74


insertBefore

insertBefore(nodeToInsert): LexicalNode

Parameters

NameType
nodeToInsertLexicalNode

Returns

LexicalNode

Overrides

ElementNode.insertBefore

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:70


remove

remove(): never

Returns

never

Overrides

ElementNode.remove

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:62


replace

replace<N>(node): never

Type parameters

NameType
NLexicalNode

Parameters

NameType
nodeN

Returns

never

Overrides

ElementNode.replace

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:66


updateDOM

updateDOM(prevNode, dom): false

Parameters

NameType
prevNodeRootNode
domHTMLElement

Returns

false

Overrides

ElementNode.updateDOM

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:80


clone

clone(): RootNode

Returns

RootNode

Overrides

ElementNode.clone

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:33


getType

getType(): string

Returns

string

Overrides

ElementNode.getType

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:29


importJSON

importJSON(serializedNode): RootNode

Parameters

NameType
serializedNodeSerializedRootNode<SerializedLexicalNode>

Returns

RootNode

Overrides

ElementNode.importJSON

Defined in

packages/lexical/src/nodes/LexicalRootNode.ts:99