Class: ElementDOMSlot
lexical.ElementDOMSlot
A utility class for managing the DOM children of an ElementNode
Constructors
constructor
• new ElementDOMSlot(element
, before?
, after?
): ElementDOMSlot
Parameters
Name | Type | Description |
---|---|---|
element | HTMLElement | The element returned by createDOM |
before? | null | Node | All managed children will be inserted before this node, if defined |
after? | null | Node | All managed children will be inserted after this node, if defined |
Returns
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:80
Properties
after
• after: null
| Node
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:79
before
• before: null
| Node
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:78
element
• element: HTMLElement
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:77
Methods
getFirstChild
▸ getFirstChild(): null
| ChildNode
Returns the first managed child of this node, which will either be this.after.nextSibling or this.element.firstChild, and will never be this.before if it is defined.
Returns
null
| ChildNode
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:153
insertChild
▸ insertChild(dom
): this
Insert the given child before this.before and any reconciler managed line break node, or append it if this.before is not defined
Parameters
Name | Type |
---|---|
dom | Node |
Returns
this
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:114
removeChild
▸ removeChild(dom
): this
Remove the managed child from this container, will throw if it was not already there
Parameters
Name | Type |
---|---|
dom | Node |
Returns
this
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:126
replaceChild
▸ replaceChild(dom
, prevDom
): this
Replace managed child prevDom with dom. Will throw if prevDom is not a child
Parameters
Name | Type | Description |
---|---|---|
dom | Node | The new node to replace prevDom |
prevDom | Node | the node that will be replaced |
Returns
this
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:140
withAfter
▸ withAfter(after
): ElementDOMSlot
Return a new ElementDOMSlot where all managed children will be inserted after this node
Parameters
Name | Type |
---|---|
after | undefined | null | Node |
Returns
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:101
withBefore
▸ withBefore(before
): ElementDOMSlot
Return a new ElementDOMSlot where all managed children will be inserted before this node
Parameters
Name | Type |
---|---|
before | undefined | null | Node |
Returns
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:95
withElement
▸ withElement(element
): ElementDOMSlot
Return a new ElementDOMSlot with an updated root element
Parameters
Name | Type |
---|---|
element | HTMLElement |