Skip to main content

Class: LineBreakNode

lexical.LineBreakNode

Hierarchy

Constructors

constructor

new LineBreakNode(key?): LineBreakNode

Parameters

NameType
key?string

Returns

LineBreakNode

Overrides

LexicalNode.constructor

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:34

Properties

constructor

constructor: KlassConstructor<typeof LineBreakNode>

Overrides

LexicalNode.constructor

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:25

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:42


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:70


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:38


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:46


clone

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:30


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

LexicalNode.getType

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:26


importDOM

importDOM(): null | DOMConversionMap

Returns

null | DOMConversionMap

Overrides

LexicalNode.importDOM

Defined in

lexical/src/nodes/LexicalLineBreakNode.ts:50


importJSON

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:64