Skip to main content

Class: ArtificialNode__DO_NOT_USE

lexical.ArtificialNode__DO_NOT_USE

Hierarchy

Constructors

constructor

new ArtificialNode__DO_NOT_USE(key?): ArtificialNode__DO_NOT_USE

Parameters

NameType
key?string

Returns

ArtificialNode__DO_NOT_USE

Inherited from

ElementNode.constructor

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:85

Properties

constructor

constructor: KlassConstructor<typeof ElementNode>

Inherited from

ElementNode.constructor

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:69


importDOM

Static Optional importDOM: () => null | DOMConversionMap<any>

Type declaration

▸ (): null | DOMConversionMap<any>

Returns

null | DOMConversionMap<any>

Inherited from

ElementNode.importDOM

Defined in

packages/lexical/src/LexicalNode.ts:270

Methods

afterCloneFrom

afterCloneFrom(prevNode): void

Perform any state updates on the clone of prevNode that are not already handled by the constructor call in the static clone method. If you have state to update in your clone that is not handled directly by the constructor, it is advisable to override this method but it is required to include a call to super.afterCloneFrom(prevNode) in your implementation. This is only intended to be called by $cloneWithProperties function or via a super call.

Parameters

NameType
prevNodethis

Returns

void

Example

class ClassesTextNode extends TextNode {
// Not shown: static getType, static importJSON, exportJSON, createDOM, updateDOM
__classes = new Set<string>();
static clone(node: ClassesTextNode): ClassesTextNode {
// The inherited TextNode constructor is used here, so
// classes is not set by this method.
return new ClassesTextNode(node.__text, node.__key);
}
afterCloneFrom(node: this): void {
// This calls TextNode.afterCloneFrom and LexicalNode.afterCloneFrom
// for necessary state updates
super.afterCloneFrom(node);
this.__addClasses(node.__classes);
}
// This method is a private implementation detail, it is not
// suitable for the public API because it does not call getWritable
__addClasses(classNames: Iterable<string>): this {
for (const className of classNames) {
this.__classes.add(className);
}
return this;
}
addClass(...classNames: string[]): this {
return this.getWritable().__addClasses(classNames);
}
removeClass(...classNames: string[]): this {
const node = this.getWritable();
for (const className of classNames) {
this.__classes.delete(className);
}
return this;
}
getClasses(): Set<string> {
return this.getLatest().__classes;
}
}

Inherited from

ElementNode.afterCloneFrom

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:96


append

append(...nodesToAppend): this

Parameters

NameType
...nodesToAppendLexicalNode[]

Returns

this

Inherited from

ElementNode.append

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:373


canBeEmpty

canBeEmpty(): boolean

Returns

boolean

Inherited from

ElementNode.canBeEmpty

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:566


canIndent

canIndent(): boolean

Returns

boolean

Inherited from

ElementNode.canIndent

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:544


canInsertTextAfter

canInsertTextAfter(): boolean

Returns

boolean

Inherited from

ElementNode.canInsertTextAfter

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:572


canInsertTextBefore

canInsertTextBefore(): boolean

Returns

boolean

Inherited from

ElementNode.canInsertTextBefore

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:569


canMergeWhenEmpty

canMergeWhenEmpty(): boolean

Determines whether this node, when empty, can merge with a first block of nodes being inserted.

This method is specifically called in RangeSelection.insertNodes to determine merging behavior during nodes insertion.

Returns

boolean

Example

// In a ListItemNode or QuoteNode implementation:
canMergeWhenEmpty(): true {
return true;
}

Inherited from

ElementNode.canMergeWhenEmpty

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:610


clear

clear(): this

Returns

this

Inherited from

ElementNode.clear

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:367


collapseAtStart

collapseAtStart(selection): boolean

Parameters

NameType
selectionRangeSelection

Returns

boolean

Inherited from

ElementNode.collapseAtStart

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:552


createDOM

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

Parameters

NameTypeDescription
configEditorConfigallows access to things like the EditorTheme (to apply classes) during reconciliation.

Returns

HTMLElement

Overrides

ElementNode.createDOM

Defined in

packages/lexical/src/nodes/ArtificialNode.ts:18


createParentElementNode

createParentElementNode(): ElementNode

The creation logic for any required parent. Should be implemented if isParentRequired returns true.

Returns

ElementNode

Inherited from

ElementNode.createParentElementNode

Defined in

packages/lexical/src/LexicalNode.ts:1099


excludeFromCopy

excludeFromCopy(destination?): boolean

Parameters

NameType
destination?"clone" | "html"

Returns

boolean

Inherited from

ElementNode.excludeFromCopy

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:555


exportDOM

exportDOM(editor): DOMExportOutput

Controls how the this node is serialized to HTML. This is important for copy and paste between Lexical and non-Lexical editors, or Lexical editors with different namespaces, in which case the primary transfer format is HTML. It's also important if you're serializing to HTML for any other reason via $generateHtmlFromNodes. You could also use this method to build your own HTML renderer.

Parameters

NameType
editorLexicalEditor

Returns

DOMExportOutput

Inherited from

ElementNode.exportDOM

Defined in

packages/lexical/src/LexicalNode.ts:850


exportJSON

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

SerializedElementNode<SerializedLexicalNode>

Inherited from

ElementNode.exportJSON

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:527


extractWithChild

extractWithChild(child, selection, destination): boolean

Parameters

NameType
childLexicalNode
selectionnull | BaseSelection
destination"clone" | "html"

Returns

boolean

Inherited from

ElementNode.extractWithChild

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:589


getAllTextNodes

getAllTextNodes(): TextNode[]

Returns

TextNode[]

Inherited from

ElementNode.getAllTextNodes

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:158


getChildAtIndex

getChildAtIndex<T>(index): null | T

Type parameters

NameType
Textends LexicalNode

Parameters

NameType
indexnumber

Returns

null | T

Inherited from

ElementNode.getChildAtIndex

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:239


getChildren

getChildren<T>(): T[]

Type parameters

NameType
Textends LexicalNode

Returns

T[]

Inherited from

ElementNode.getChildren

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:123


getChildrenKeys

getChildrenKeys(): string[]

Returns

string[]

Inherited from

ElementNode.getChildrenKeys

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:132


getChildrenSize

getChildrenSize(): number

Returns

number

Inherited from

ElementNode.getChildrenSize

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:141


getCommonAncestor

getCommonAncestor<T>(node): null | T

Returns the closest common ancestor of this node and the provided one or null if one cannot be found.

Type parameters

NameType
Textends ElementNode = ElementNode

Parameters

NameTypeDescription
nodeLexicalNodethe other node to find the common ancestor of.

Returns

null | T

Inherited from

ElementNode.getCommonAncestor

Defined in

packages/lexical/src/LexicalNode.ts:558


getDescendantByIndex

getDescendantByIndex<T>(index): null | T

Type parameters

NameType
Textends LexicalNode

Parameters

NameType
indexnumber

Returns

null | T

Inherited from

ElementNode.getDescendantByIndex

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:195


getDirection

getDirection(): null | "ltr" | "rtl"

Returns

null | "ltr" | "rtl"

Inherited from

ElementNode.getDirection

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:300


getFirstChild

getFirstChild<T>(): null | T

Type parameters

NameType
Textends LexicalNode

Returns

null | T

Inherited from

ElementNode.getFirstChild

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:215


getFirstChildOrThrow

getFirstChildOrThrow<T>(): T

Type parameters

NameType
Textends LexicalNode

Returns

T

Inherited from

ElementNode.getFirstChildOrThrow

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:220


getFirstDescendant

getFirstDescendant<T>(): null | T

Type parameters

NameType
Textends LexicalNode

Returns

null | T

Inherited from

ElementNode.getFirstDescendant

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:173


getFormat

getFormat(): number

Returns

number

Inherited from

ElementNode.getFormat

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:107


getFormatType

getFormatType(): ElementFormatType

Returns

ElementFormatType

Inherited from

ElementNode.getFormatType

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:111


getIndent

getIndent(): number

Returns

number

Inherited from

ElementNode.getIndent

Defined in

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


getIndexWithinParent

getIndexWithinParent(): number

Returns the zero-based index of this node within the parent.

Returns

number

Inherited from

ElementNode.getIndexWithinParent

Defined in

packages/lexical/src/LexicalNode.ts:386


getKey

getKey(): string

Returns this nodes key.

Returns

string

Inherited from

ElementNode.getKey

Defined in

packages/lexical/src/LexicalNode.ts:378


getLastChild

getLastChild<T>(): null | T

Type parameters

NameType
Textends LexicalNode

Returns

null | T

Inherited from

ElementNode.getLastChild

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:227


getLastChildOrThrow

getLastChildOrThrow<T>(): T

Type parameters

NameType
Textends LexicalNode

Returns

T

Inherited from

ElementNode.getLastChildOrThrow

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:232


getLastDescendant

getLastDescendant<T>(): null | T

Type parameters

NameType
Textends LexicalNode

Returns

null | T

Inherited from

ElementNode.getLastDescendant

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:184


getLatest

getLatest(): this

Returns the latest version of the node from the active EditorState. This is used to avoid getting values from stale node references.

Returns

this

Inherited from

ElementNode.getLatest

Defined in

packages/lexical/src/LexicalNode.ts:744


getNextSibling

getNextSibling<T>(): null | T

Returns the "next" siblings - that is, the node that comes after this one in the same parent

Type parameters

NameType
Textends LexicalNode

Returns

null | T

Inherited from

ElementNode.getNextSibling

Defined in

packages/lexical/src/LexicalNode.ts:531


getNextSiblings

getNextSiblings<T>(): T[]

Returns all "next" siblings - that is, the nodes that come between this one and the last child of it's parent, inclusive.

Type parameters

NameType
Textends LexicalNode

Returns

T[]

Inherited from

ElementNode.getNextSiblings

Defined in

packages/lexical/src/LexicalNode.ts:542


getNodesBetween

getNodesBetween(targetNode): LexicalNode[]

Returns a list of nodes that are between this node and the target node in the EditorState.

Parameters

NameTypeDescription
targetNodeLexicalNodethe node that marks the other end of the range of nodes to be returned.

Returns

LexicalNode[]

Inherited from

ElementNode.getNodesBetween

Defined in

packages/lexical/src/LexicalNode.ts:663


getParent

getParent<T>(): null | T

Returns the parent of this node, or null if none is found.

Type parameters

NameType
Textends ElementNode

Returns

null | T

Inherited from

ElementNode.getParent

Defined in

packages/lexical/src/LexicalNode.ts:406


getParentKeys

getParentKeys(): string[]

Returns a list of the keys of every ancestor of this node, all the way up to the RootNode.

Returns

string[]

Inherited from

ElementNode.getParentKeys

Defined in

packages/lexical/src/LexicalNode.ts:483


getParentOrThrow

getParentOrThrow<T>(): T

Returns the parent of this node, or throws if none is found.

Type parameters

NameType
Textends ElementNode

Returns

T

Inherited from

ElementNode.getParentOrThrow

Defined in

packages/lexical/src/LexicalNode.ts:417


getParents

getParents(): ElementNode[]

Returns a list of the every ancestor of this node, all the way up to the RootNode.

Returns

ElementNode[]

Inherited from

ElementNode.getParents

Defined in

packages/lexical/src/LexicalNode.ts:468


getPreviousSibling

getPreviousSibling<T>(): null | T

Returns the "previous" siblings - that is, the node that comes before this one in the same parent.

Type parameters

NameType
Textends LexicalNode

Returns

null | T

Inherited from

ElementNode.getPreviousSibling

Defined in

packages/lexical/src/LexicalNode.ts:498


getPreviousSiblings

getPreviousSiblings<T>(): T[]

Returns the "previous" siblings - that is, the nodes that come between this one and the first child of it's parent, inclusive.

Type parameters

NameType
Textends LexicalNode

Returns

T[]

Inherited from

ElementNode.getPreviousSiblings

Defined in

packages/lexical/src/LexicalNode.ts:509


getStyle

getStyle(): string

Returns

string

Inherited from

ElementNode.getStyle

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:115


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

Inherited from

ElementNode.getTextContent

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:266


getTextContentSize

getTextContentSize(): number

Returns the length of the string produced by calling getTextContent on this node.

Returns

number

Inherited from

ElementNode.getTextContentSize

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:283


getTopLevelElement

getTopLevelElement(): null | ElementNode

Returns the highest (in the EditorState tree) non-root ancestor of this node, or null if none is found. See $isRootOrShadowRoot for more information on which Elements comprise "roots".

Returns

null | ElementNode

Inherited from

ElementNode.getTopLevelElement

Defined in

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


getTopLevelElementOrThrow

getTopLevelElementOrThrow(): ElementNode

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

ElementNode

Inherited from

ElementNode.getTopLevelElementOrThrow

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:63


getType

getType(): string

Returns the string type of this node.

Returns

string

Inherited from

ElementNode.getType

Defined in

packages/lexical/src/LexicalNode.ts:291


getWritable

getWritable(): this

Returns a mutable version of the node using $cloneWithProperties if necessary. Will throw an error if called outside of a Lexical Editor LexicalEditor.update callback.

Returns

this

Inherited from

ElementNode.getWritable

Defined in

packages/lexical/src/LexicalNode.ts:761


hasFormat

hasFormat(type): boolean

Parameters

NameType
typeElementFormatType

Returns

boolean

Inherited from

ElementNode.hasFormat

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:304


insertAfter

insertAfter(nodeToInsert, restoreSelection?): LexicalNode

Inserts a node after this LexicalNode (as the next sibling).

Parameters

NameTypeDefault valueDescription
nodeToInsertLexicalNodeundefinedThe node to insert after this one.
restoreSelectionbooleantrueWhether or not to attempt to resolve the selection to the appropriate place after the operation is complete.

Returns

LexicalNode

Inherited from

ElementNode.insertAfter

Defined in

packages/lexical/src/LexicalNode.ts:984


insertBefore

insertBefore(nodeToInsert, restoreSelection?): LexicalNode

Inserts a node before this LexicalNode (as the previous sibling).

Parameters

NameTypeDefault valueDescription
nodeToInsertLexicalNodeundefinedThe node to insert before this one.
restoreSelectionbooleantrueWhether or not to attempt to resolve the selection to the appropriate place after the operation is complete.

Returns

LexicalNode

Inherited from

ElementNode.insertBefore

Defined in

packages/lexical/src/LexicalNode.ts:1051


insertNewAfter

insertNewAfter(selection, restoreSelection?): null | LexicalNode

Parameters

NameType
selectionRangeSelection
restoreSelection?boolean

Returns

null | LexicalNode

Inherited from

ElementNode.insertNewAfter

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:538


is

is(object): boolean

Returns true if the provided node is the exact same one as this node, from Lexical's perspective. Always use this instead of referential equality.

Parameters

NameTypeDescription
objectundefined | null | LexicalNodethe node to perform the equality comparison on.

Returns

boolean

Inherited from

ElementNode.is

Defined in

packages/lexical/src/LexicalNode.ts:590


isAttached

isAttached(): boolean

Returns true if there is a path between this node and the RootNode, false otherwise. This is a way of determining if the node is "attached" EditorState. Unattached nodes won't be reconciled and will ultimatelt be cleaned up by the Lexical GC.

Returns

boolean

Inherited from

ElementNode.isAttached

Defined in

packages/lexical/src/LexicalNode.ts:308


isBefore

isBefore(targetNode): boolean

Returns true if this node logical precedes the target node in the editor state.

Parameters

NameTypeDescription
targetNodeLexicalNodethe node we're testing to see if it's after this one.

Returns

boolean

Inherited from

ElementNode.isBefore

Defined in

packages/lexical/src/LexicalNode.ts:602


isDirty

isDirty(): boolean

Returns true if this node has been marked dirty during this update cycle.

Returns

boolean

Inherited from

ElementNode.isDirty

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:148


isEmpty

isEmpty(): boolean

Returns

boolean

Inherited from

ElementNode.isEmpty

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:145


isInline

isInline(): boolean

Returns

boolean

Inherited from

ElementNode.isInline

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:575


isLastChild

isLastChild(): boolean

Returns

boolean

Inherited from

ElementNode.isLastChild

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:153


isParentOf

isParentOf(targetNode): boolean

Returns true if this node is the parent of the target node, false otherwise.

Parameters

NameTypeDescription
targetNodeLexicalNodethe would-be child node.

Returns

boolean

Inherited from

ElementNode.isParentOf

Defined in

packages/lexical/src/LexicalNode.ts:641


isParentRequired

isParentRequired(): boolean

Whether or not this node has a required parent. Used during copy + paste operations to normalize nodes that would otherwise be orphaned. For example, ListItemNodes without a ListNode parent or TextNodes with a ParagraphNode parent.

Returns

boolean

Inherited from

ElementNode.isParentRequired

Defined in

packages/lexical/src/LexicalNode.ts:1091


isSelected

isSelected(selection?): boolean

Returns true if this node is contained within the provided Selection., false otherwise. Relies on the algorithms implemented in BaseSelection.getNodes to determine what's included.

Parameters

NameTypeDescription
selection?null | BaseSelectionThe selection that we want to determine if the node is in.

Returns

boolean

Inherited from

ElementNode.isSelected

Defined in

packages/lexical/src/LexicalNode.ts:332


isShadowRoot

isShadowRoot(): boolean

Returns

boolean

Inherited from

ElementNode.isShadowRoot

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:582


markDirty

markDirty(): void

Marks a node dirty, triggering transforms and forcing it to be reconciled during the update cycle.

Returns

void

Inherited from

ElementNode.markDirty

Defined in

packages/lexical/src/LexicalNode.ts:1160


remove

remove(preserveEmptyParent?): void

Removes this LexicalNode from the EditorState. If the node isn't re-inserted somewhere, the Lexical garbage collector will eventually clean it up.

Parameters

NameTypeDescription
preserveEmptyParent?booleanIf falsy, the node's parent will be removed if it's empty after the removal operation. This is the default behavior, subject to other node heuristics such as ElementNode#canBeEmpty

Returns

void

Inherited from

ElementNode.remove

Defined in

packages/lexical/src/LexicalNode.ts:903


replace

replace<N>(replaceWith, includeChildren?): N

Replaces this LexicalNode with the provided node, optionally transferring the children of the replaced node to the replacing node.

Type parameters

NameType
Nextends LexicalNode

Parameters

NameTypeDescription
replaceWithNThe node to replace this one with.
includeChildren?booleanWhether or not to transfer the children of this node to the replacing node.

Returns

N

Inherited from

ElementNode.replace

Defined in

packages/lexical/src/LexicalNode.ts:914


select

select(_anchorOffset?, _focusOffset?): RangeSelection

Parameters

NameType
_anchorOffset?number
_focusOffset?number

Returns

RangeSelection

Inherited from

ElementNode.select

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:314


selectEnd

selectEnd(): RangeSelection

Returns

RangeSelection

Inherited from

ElementNode.selectEnd

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:363


selectNext

selectNext(anchorOffset?, focusOffset?): RangeSelection

Moves selection to the next sibling of this node, at the specified offsets.

Parameters

NameTypeDescription
anchorOffset?numberThe anchor offset for selection.
focusOffset?numberThe focus offset for selection

Returns

RangeSelection

Inherited from

ElementNode.selectNext

Defined in

packages/lexical/src/LexicalNode.ts:1139


selectPrevious

selectPrevious(anchorOffset?, focusOffset?): RangeSelection

Moves selection to the previous sibling of this node, at the specified offsets.

Parameters

NameTypeDescription
anchorOffset?numberThe anchor offset for selection.
focusOffset?numberThe focus offset for selection

Returns

RangeSelection

Inherited from

ElementNode.selectPrevious

Defined in

packages/lexical/src/LexicalNode.ts:1117


selectStart

selectStart(): RangeSelection

Returns

RangeSelection

Inherited from

ElementNode.selectStart

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:359


setDirection

setDirection(direction): this

Parameters

NameType
directionnull | "ltr" | "rtl"

Returns

this

Inherited from

ElementNode.setDirection

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:376


setFormat

setFormat(type): this

Parameters

NameType
typeElementFormatType

Returns

this

Inherited from

ElementNode.setFormat

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:381


setIndent

setIndent(indentLevel): this

Parameters

NameType
indentLevelnumber

Returns

this

Inherited from

ElementNode.setIndent

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:391


setStyle

setStyle(style): this

Parameters

NameType
stylestring

Returns

this

Inherited from

ElementNode.setStyle

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:386


splice

splice(start, deleteCount, nodesToInsert): this

Parameters

NameType
startnumber
deleteCountnumber
nodesToInsertLexicalNode[]

Returns

this

Inherited from

ElementNode.splice

Defined in

packages/lexical/src/nodes/LexicalElementNode.ts:396


updateDOM

updateDOM(_prevNode, _dom, _config): boolean

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

NameType
_prevNodeunknown
_domHTMLElement
_configEditorConfig

Returns

boolean

Inherited from

ElementNode.updateDOM

Defined in

packages/lexical/src/LexicalNode.ts:834


clone

clone(_data): LexicalNode

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
_dataunknown

Returns

LexicalNode

Inherited from

ElementNode.clone

Defined in

packages/lexical/src/LexicalNode.ts:205


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

ElementNode.getType

Defined in

packages/lexical/src/nodes/ArtificialNode.ts:14


importJSON

importJSON(_serializedNode): LexicalNode

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
_serializedNodeSerializedLexicalNode

Returns

LexicalNode

Inherited from

ElementNode.importJSON

Defined in

packages/lexical/src/LexicalNode.ts:873


transform

transform(): null | (node: LexicalNode) => void

Registers the returned function as a transform on the node during Editor initialization. Most such use cases should be addressed via the LexicalEditor.registerNodeTransform API.

Experimental - use at your own risk.

Returns

null | (node: LexicalNode) => void

Inherited from

ElementNode.transform

Defined in

packages/lexical/src/LexicalNode.ts:889