Class: ScrollableNode
@lexical/table.ScrollableNode
Hierarchy
-
↳
ScrollableNode
Constructors
constructor
• new ScrollableNode(key?
): ScrollableNode
Parameters
Name | Type |
---|---|
key? | string |
Returns
Inherited from
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
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
Name | Type |
---|---|
prevNode | this |
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
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:96
append
▸ append(...nodesToAppend
): this
Parameters
Name | Type |
---|---|
...nodesToAppend | LexicalNode [] |
Returns
this
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:373
canBeEmpty
▸ canBeEmpty(): boolean
Returns
boolean
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:566
canIndent
▸ canIndent(): boolean
Returns
boolean
Overrides
Defined in
packages/lexical-table/src/LexicalScrollableNode.ts:47
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
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:610
clear
▸ clear(): this
Returns
this
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:367
collapseAtStart
▸ collapseAtStart(selection
): boolean
Parameters
Name | Type |
---|---|
selection | RangeSelection |
Returns
boolean
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:552
createDOM
▸ createDOM(_config
, _editor
): 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
Name | Type | Description |
---|---|---|
_config | EditorConfig | allows access to things like the EditorTheme (to apply classes) during reconciliation. |
_editor | LexicalEditor | allows access to the editor for context during reconciliation. |
Returns
HTMLElement
Overrides
Defined in
packages/lexical-table/src/LexicalScrollableNode.ts:36
createParentElementNode
▸ createParentElementNode(): ElementNode
The creation logic for any required parent. Should be implemented if isParentRequired returns true.
Returns
Inherited from
ElementNode.createParentElementNode
Defined in
packages/lexical/src/LexicalNode.ts:1099
excludeFromCopy
▸ excludeFromCopy(destination?
): boolean
Parameters
Name | Type |
---|---|
destination? | "clone" | "html" |
Returns
boolean
Inherited from
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
Name | Type |
---|---|
editor | LexicalEditor |
Returns
Overrides
Defined in
packages/lexical-table/src/LexicalScrollableNode.ts:63
exportJSON
▸ exportJSON(): Object
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
Object
Name | Type |
---|---|
children | SerializedLexicalNode [] |
direction | null | "ltr" | "rtl" |
format | ElementFormatType |
indent | number |
type | string |
version | number |
Overrides
Defined in
packages/lexical-table/src/LexicalScrollableNode.ts:51
extractWithChild
▸ extractWithChild(child
, selection
, destination
): boolean
Parameters
Name | Type |
---|---|
child | LexicalNode |
selection | null | BaseSelection |
destination | "clone" | "html" |
Returns
boolean
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:589
getAllTextNodes
▸ getAllTextNodes(): TextNode
[]
Returns
TextNode
[]
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:158
getChildAtIndex
▸ getChildAtIndex<T
>(index
): null
| T
Type parameters
Name | Type |
---|---|
T | extends LexicalNode |
Parameters
Name | Type |
---|---|
index | number |
Returns
null
| T
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:239
getChildren
▸ getChildren<T
>(): T
[]
Type parameters
Name | Type |
---|---|
T | extends LexicalNode |
Returns
T
[]
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:123
getChildrenKeys
▸ getChildrenKeys(): string
[]
Returns
string
[]
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:132
getChildrenSize
▸ getChildrenSize(): number
Returns
number
Inherited from
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
Name | Type |
---|---|
T | extends ElementNode = ElementNode |
Parameters
Name | Type | Description |
---|---|---|
node | LexicalNode | the other node to find the common ancestor of. |
Returns
null
| T
Inherited from
Defined in
packages/lexical/src/LexicalNode.ts:558
getDescendantByIndex
▸ getDescendantByIndex<T
>(index
): null
| T
Type parameters
Name | Type |
---|---|
T | extends LexicalNode |
Parameters
Name | Type |
---|---|
index | number |
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
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:300
getFirstChild
▸ getFirstChild<T
>(): null
| T
Type parameters
Name | Type |
---|---|
T | extends LexicalNode |
Returns
null
| T
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:215
getFirstChildOrThrow
▸ getFirstChildOrThrow<T
>(): T
Type parameters
Name | Type |
---|---|
T | extends LexicalNode |
Returns
T
Inherited from
ElementNode.getFirstChildOrThrow
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:220
getFirstDescendant
▸ getFirstDescendant<T
>(): null
| T
Type parameters
Name | Type |
---|---|
T | extends LexicalNode |
Returns
null
| T
Inherited from
ElementNode.getFirstDescendant
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:173
getFormat
▸ getFormat(): number
Returns
number
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:107
getFormatType
▸ getFormatType(): ElementFormatType
Returns
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:111
getIndent
▸ getIndent(): number
Returns
number
Inherited from
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
Defined in
packages/lexical/src/LexicalNode.ts:378
getLastChild
▸ getLastChild<T
>(): null
| T
Type parameters
Name | Type |
---|---|
T | extends LexicalNode |
Returns
null
| T
Inherited from
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:227
getLastChildOrThrow
▸ getLastChildOrThrow<T
>(): T
Type parameters
Name | Type |
---|---|
T | extends LexicalNode |
Returns
T
Inherited from
ElementNode.getLastChildOrThrow
Defined in
packages/lexical/src/nodes/LexicalElementNode.ts:232