Skip to main content

Class: LineBreakNode

lexical.LineBreakNode

Hierarchy

Constructors

constructor

new LineBreakNode(key?)

Parameters

NameType
key?string

Overrides

LexicalNode.constructor

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:31

Methods

createDOM

createDOM(): HTMLElement

Called during the reconciliation process to determine which nodes to insert into the DOM for this Lexical Node.

This method must return exactly one HTMLElement. Nested elements are not supported.

Do not attempt to update the Lexical EditorState during this phase of the update lifecyle.

Returns

HTMLElement

Overrides

LexicalNode.createDOM

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:39


exportJSON

exportJSON(): 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

SerializedLexicalNode

Overrides

LexicalNode.exportJSON

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:73


getTextContent

getTextContent(): "\n"

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

"\n"

Overrides

LexicalNode.getTextContent

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:35


updateDOM

updateDOM(): 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.

Returns

false

Overrides

LexicalNode.updateDOM

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:43


clone

Static clone(node): LineBreakNode

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.

Parameters

NameType
nodeLineBreakNode

Returns

LineBreakNode

Overrides

LexicalNode.clone

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:27


getType

Static 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

LexicalNode.getType

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:23


importDOM

Static importDOM(): null | DOMConversionMap<HTMLElement>

Returns

null | DOMConversionMap<HTMLElement>

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:47


importJSON

Static importJSON(serializedLineBreakNode): LineBreakNode

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

NameType
serializedLineBreakNodeSerializedLexicalNode

Returns

LineBreakNode

Overrides

LexicalNode.importJSON

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:67