@lexical/table
Classes
TableCellNode
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:59
Extends
Constructors
Constructor
new TableCellNode(
headerState
,colSpan
,width?
,key?
):TableCellNode
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:123
Parameters
headerState
number
= TableCellHeaderStates.NO_STATUS
colSpan
number
= 1
width?
number
key?
string
Returns
Overrides
Methods
afterCloneFrom()
afterCloneFrom(
node
):void
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:86
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
node
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;
}
}
Overrides
canBeEmpty()
canBeEmpty():
false
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:314
Returns
false
Overrides
canIndent()
canIndent():
false
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:318
Returns
false
Overrides
collapseAtStart()
collapseAtStart():
true
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:310
Returns
true
Overrides
createDOM()
createDOM(
config
):HTMLTableCellElement
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:138
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 lifecycle.
Parameters
config
Returns
HTMLTableCellElement
Overrides
exportDOM()
exportDOM(
editor
):DOMExportOutput
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:166
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
editor
Returns
Overrides
exportJSON()
exportJSON():
SerializedTableCellNode
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:194
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
Overrides
getBackgroundColor()
getBackgroundColor():
null
|string
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:255
Returns
null
| string
getColSpan()
getColSpan():
number
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:208
Returns
number
getHeaderStyles()
getHeaderStyles():
number
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:241
Returns
number
getRowSpan()
getRowSpan():
number
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:218
Returns
number
getTag()
getTag():
"td"
|"th"
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:228
Returns
"td"
| "th"
getVerticalAlign()
getVerticalAlign():
undefined
|string
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:265
Returns
undefined
| string
getWidth()
getWidth():
undefined
|number
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:251
Returns
undefined
| number
hasHeader()
hasHeader():
boolean
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:291
Returns
boolean
hasHeaderState()
hasHeaderState(
headerState
):boolean
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:287
Parameters
headerState
number
Returns
boolean
isShadowRoot()
isShadowRoot():
boolean
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:306
Returns
boolean
Overrides
setBackgroundColor()
setBackgroundColor(
newBackgroundColor
):this
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:259
Parameters
newBackgroundColor
null
| string
Returns
this
setColSpan()
setColSpan(
colSpan
):this
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:212
Parameters
colSpan
number
Returns
this
setHeaderStyles()
setHeaderStyles(
headerState
,mask
):this
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:232
Parameters
headerState
number
mask
number
= TableCellHeaderStates.BOTH
Returns
this
setRowSpan()
setRowSpan(
rowSpan
):this
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:222
Parameters
rowSpan
number
Returns
this
setVerticalAlign()
setVerticalAlign(
newVerticalAlign
):this
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:269
Parameters
newVerticalAlign
undefined
| null
| string
Returns
this
setWidth()
setWidth(
width
):this
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:245
Parameters
width
undefined
| number
Returns
this
toggleHeaderStyle()
toggleHeaderStyle(
headerStateToToggle
):this
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:275
Parameters
headerStateToToggle
number
Returns
this
updateDOM()
updateDOM(
prevNode
):boolean
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:295
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
prevNode
this
Returns
boolean
Overrides
updateFromJSON()
updateFromJSON(
serializedNode
):this
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:110
Update this LexicalNode instance from serialized JSON. It's recommended to implement as much logic as possible in this method instead of the static importJSON method, so that the functionality can be inherited in subclasses.
The LexicalUpdateJSON utility type should be used to ignore any type, version, or children properties in the JSON so that the extended JSON from subclasses are acceptable parameters for the super call.
If overridden, this method must call super.
Parameters
serializedNode
LexicalUpdateJSON
<SerializedTableCellNode
>
Returns
this
Example
class MyTextNode extends TextNode {
// ...
static importJSON(serializedNode: SerializedMyTextNode): MyTextNode {
return $createMyTextNode()
.updateFromJSON(serializedNode);
}
updateFromJSON(
serializedNode: LexicalUpdateJSON<SerializedMyTextNode>,
): this {
return super.updateFromJSON(serializedNode)
.setMyProperty(serializedNode.myProperty);
}
}
Overrides
clone()
static
clone(node
):TableCellNode
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:77
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
node
Returns
Overrides
getType()
static
getType():string
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:73
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
importDOM()
static
importDOM():null
|DOMConversionMap
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:93
Returns
null
| DOMConversionMap
Overrides
ElementNode.importDOM
importJSON()
static
importJSON(serializedNode
):TableCellNode
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:106
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
serializedNode
Returns
Overrides
TableNode
Defined in: packages/lexical-table/src/LexicalTableNode.ts:174
Extends
Constructors
Constructor
new TableNode(
key?
):TableNode
Defined in: packages/lexical-table/src/LexicalTableNode.ts:232
Parameters
key?
string
Returns
Overrides
Properties
__colWidths?
optional
__colWidths: readonlynumber
[]
Defined in: packages/lexical-table/src/LexicalTableNode.ts:179
__frozenColumnCount
__frozenColumnCount:
number
Defined in: packages/lexical-table/src/LexicalTableNode.ts:177
__frozenRowCount
__frozenRowCount:
number
Defined in: packages/lexical-table/src/LexicalTableNode.ts:178
Methods
afterCloneFrom()
afterCloneFrom(
prevNode
):void
Defined in: packages/lexical-table/src/LexicalTableNode.ts:202
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
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;
}
}
Overrides
canBeEmpty()
canBeEmpty():
false
Defined in: packages/lexical-table/src/LexicalTableNode.ts:434
Returns
false
Overrides
canIndent()
canIndent():
false
Defined in: packages/lexical-table/src/LexicalTableNode.ts:577
Returns
false
Overrides
canSelectBefore()
canSelectBefore():
true
Defined in: packages/lexical-table/src/LexicalTableNode.ts:573
Returns
true
createDOM()
createDOM(
config
,editor?
):HTMLElement
Defined in: packages/lexical-table/src/LexicalTableNode.ts:273
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 lifecycle.
Parameters
config
editor?
Returns
HTMLElement
Overrides
exportDOM()
exportDOM(
editor
):DOMExportOutput
Defined in: packages/lexical-table/src/LexicalTableNode.ts:352
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
editor
Returns
Overrides
exportJSON()
exportJSON():
SerializedTableNode
Defined in: packages/lexical-table/src/LexicalTableNode.ts:239
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
Overrides
extractWithChild()
extractWithChild(
child
,selection
,destination
):boolean
Defined in: packages/lexical-table/src/LexicalTableNode.ts:251
Parameters
child
selection
null
| BaseSelection
destination
"clone"
| "html"
Returns
boolean
Overrides
getCellNodeFromCords()
getCellNodeFromCords(
x
,y
,table
):null
|TableCellNode
Defined in: packages/lexical-table/src/LexicalTableNode.ts:509
Parameters
x
number
y
number
table
TableDOMTable
Returns
null
| TableCellNode
getCellNodeFromCordsOrThrow()
getCellNodeFromCordsOrThrow(
x
,y
,table
):TableCellNode
Defined in: packages/lexical-table/src/LexicalTableNode.ts:529
Parameters
x
number
y
number
table
TableDOMTable
Returns
getColumnCount()
getColumnCount():
number
Defined in: packages/lexical-table/src/LexicalTableNode.ts:581
Returns
number
getColWidths()
getColWidths():
undefined
| readonlynumber
[]
Defined in: packages/lexical-table/src/LexicalTableNode.ts:185
Returns
undefined
| readonly number
[]
getCordsFromCellNode()
getCordsFromCellNode(
tableCellNode
,table
):object
Defined in: packages/lexical-table/src/LexicalTableNode.ts:442
Parameters
tableCellNode
table
TableDOMTable
Returns
object
x
x:
number
y
y:
number
getDOMCellFromCords()
getDOMCellFromCords(
x
,y
,table
):null
|TableDOMCell
Defined in: packages/lexical-table/src/LexicalTableNode.ts:471
Parameters
x
number
y
number
table
TableDOMTable
Returns
null
| TableDOMCell
getDOMCellFromCordsOrThrow()
getDOMCellFromCordsOrThrow(
x
,y
,table
):TableDOMCell
Defined in: packages/lexical-table/src/LexicalTableNode.ts:495
Parameters
x
number
y
number
table
TableDOMTable
Returns
getFrozenColumns()
getFrozenColumns():
number
Defined in: packages/lexical-table/src/LexicalTableNode.ts:559
Returns
number
getFrozenRows()
getFrozenRows():
number
Defined in: packages/lexical-table/src/LexicalTableNode.ts:569
Returns
number
getRowStriping()
getRowStriping():
boolean
Defined in: packages/lexical-table/src/LexicalTableNode.ts:543
Returns
boolean
isShadowRoot()
isShadowRoot():
boolean
Defined in: packages/lexical-table/src/LexicalTableNode.ts:438
Returns
boolean
Overrides
setColWidths()
setColWidths(
colWidths
):this
Defined in: packages/lexical-table/src/LexicalTableNode.ts:190
Parameters
colWidths
undefined
| readonly number
[]
Returns
this
setFrozenColumns()
setFrozenColumns(
columnCount
):this
Defined in: packages/lexical-table/src/LexicalTableNode.ts:553
Parameters
columnCount
number
Returns
this
setFrozenRows()
setFrozenRows(
rowCount
):this
Defined in: packages/lexical-table/src/LexicalTableNode.ts:563
Parameters
rowCount
number
Returns
this
setRowStriping()
setRowStriping(
newRowStriping
):this
Defined in: packages/lexical-table/src/LexicalTableNode.ts:547
Parameters
newRowStriping
boolean
Returns
this
updateDOM()
updateDOM(
prevNode
,dom
,config
):boolean
Defined in: packages/lexical-table/src/LexicalTableNode.ts:339
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
prevNode
this
dom
HTMLElement
config
Returns
boolean
Overrides
updateFromJSON()
updateFromJSON(
serializedNode
):this
Defined in: packages/lexical-table/src/LexicalTableNode.ts:223
Update this LexicalNode instance from serialized JSON. It's recommended to implement as much logic as possible in this method instead of the static importJSON method, so that the functionality can be inherited in subclasses.
The LexicalUpdateJSON utility type should be used to ignore any type, version, or children properties in the JSON so that the extended JSON from subclasses are acceptable parameters for the super call.
If overridden, this method must call super.
Parameters
serializedNode
LexicalUpdateJSON
<SerializedTableNode
>
Returns
this
Example
class MyTextNode extends TextNode {
// ...
static importJSON(serializedNode: SerializedMyTextNode): MyTextNode {
return $createMyTextNode()
.updateFromJSON(serializedNode);
}
updateFromJSON(
serializedNode: LexicalUpdateJSON<SerializedMyTextNode>,
): this {
return super.updateFromJSON(serializedNode)
.setMyProperty(serializedNode.myProperty);
}
}
Overrides
updateTableElement()
updateTableElement(
prevNode
,tableElement
,config
):void
Defined in: packages/lexical-table/src/LexicalTableNode.ts:319
Parameters
prevNode
null
| TableNode
tableElement
HTMLTableElement
config
Returns
void
updateTableWrapper()
updateTableWrapper(
prevNode
,tableWrapper
,tableElement
,config
):void
Defined in: packages/lexical-table/src/LexicalTableNode.ts:298
Parameters
prevNode
null
| TableNode
tableWrapper
HTMLDivElement
tableElement
HTMLTableElement
config
Returns
void
clone()
static
clone(node
):TableNode
Defined in: packages/lexical-table/src/LexicalTableNode.ts:198
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
node
Returns
Overrides
getType()
static
getType():string
Defined in: packages/lexical-table/src/LexicalTableNode.ts:181
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
importDOM()
static
importDOM():null
|DOMConversionMap
Defined in: packages/lexical-table/src/LexicalTableNode.ts:210
Returns
null
| DOMConversionMap
Overrides
ElementNode.importDOM
importJSON()
static
importJSON(serializedNode
):TableNode
Defined in: packages/lexical-table/src/LexicalTableNode.ts:219
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
serializedNode
Returns
Overrides
TableObserver
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:90
Constructors
Constructor
new TableObserver(
editor
,tableNodeKey
):TableObserver
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:113
Parameters
editor
tableNodeKey
string
Returns
Properties
abortController
abortController:
AbortController
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:109
anchorCell
anchorCell:
null
|TableDOMCell
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:99
anchorCellNodeKey
anchorCellNodeKey:
null
|string
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:101
anchorX
anchorX:
number
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:96
anchorY
anchorY:
number
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:97
editor
editor:
LexicalEditor
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:103
focusCell
focusCell:
null
|TableDOMCell
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:100
focusCellNodeKey
focusCellNodeKey:
null
|string
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:102
focusX
focusX:
number
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:91
focusY
focusY:
number
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:92
hasHijackedSelectionStyles
hasHijackedSelectionStyles:
boolean
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:105
isHighlightingCells
isHighlightingCells:
boolean
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:95
isSelecting
isSelecting:
boolean
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:106
listenerOptions
listenerOptions:
object
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:110
signal
signal:
AbortSignal
listenersToRemove
listenersToRemove:
Set
<() =>void
>
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:93
nextFocus
nextFocus:
null
| {focusCell
:TableDOMCell
;override
:boolean
; }
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:111
pointerType
pointerType:
null
|string
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:107
shouldCheckSelection
shouldCheckSelection:
boolean
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:108
table
table:
TableDOMTable
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:94
tableNodeKey
tableNodeKey:
string
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:98
tableSelection
tableSelection:
null
|TableSelection
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:104
Methods
$clearHighlight()
$clearHighlight():
void
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:207
Returns
void
$clearText()
$clearText():
void
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:459
Returns
void
$disableHighlightStyle()
$disableHighlightStyle():
void
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:244
Returns
void
$enableHighlightStyle()
$enableHighlightStyle():
void
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:232
Returns
void
$formatCells()
$formatCells(
type
):void
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:431
Parameters
type
Returns
void
$getAnchorTableCell()
$getAnchorTableCell():
null
|TableCellNode
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:385
Returns
null
| TableCellNode
$getAnchorTableCellOrThrow()
$getAnchorTableCellOrThrow():
TableCellNode
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:390
Returns
$getFocusTableCell()
$getFocusTableCell():
null
|TableCellNode
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:399
Returns
null
| TableCellNode
$getFocusTableCellOrThrow()
$getFocusTableCellOrThrow():
TableCellNode
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:403
Returns
$lookup()
$lookup():
object
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:154
Returns
object
tableElement
tableElement:
HTMLTableElementWithWithTableSelectionState
tableNode
tableNode:
TableNode
$setAnchorCellForSelection()
$setAnchorCellForSelection(
cell
):void
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:409
Parameters
cell
Returns
void
$setFocusCellForSelection()
$setFocusCellForSelection(
cell
,ignoreStart
):boolean
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:335
Parameters
cell
ignoreStart
boolean
= false
Returns
boolean
$updateTableTableSelection()
$updateTableTableSelection(
selection
):void
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:253
Parameters
selection
null
| TableSelection
Returns
void
getTable()
getTable():
TableDOMTable
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:142
Returns
TableDOMTable
removeListeners()
removeListeners():
void
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:146
Returns
void
trackTable()
trackTable():
void
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:161
Returns
void
TableRowNode
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:34
Extends
Constructors
Constructor
new TableRowNode(
height?
,key?
):TableRowNode
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:67
Parameters
height?
number
key?
string
Returns
Overrides
Methods
canBeEmpty()
canBeEmpty():
false
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:118
Returns
false
Overrides
canIndent()
canIndent():
false
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:122
Returns
false
Overrides
createDOM()
createDOM(
config
):HTMLElement
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:80
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 lifecycle.
Parameters
config
Returns
HTMLElement
Overrides
exportJSON()
exportJSON():
SerializedTableRowNode
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:72
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
Overrides
extractWithChild()
extractWithChild(
child
,selection
,destination
):boolean
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:92
Parameters
child
selection
null
| BaseSelection
destination
"clone"
| "html"
Returns
boolean
Overrides
getHeight()
getHeight():
undefined
|number
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:110
Returns
undefined
| number
isShadowRoot()
isShadowRoot():
boolean
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:100
Returns
boolean
Overrides
setHeight()
setHeight(
height?
):this
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:104
Parameters
height?
number
Returns
this
updateDOM()
updateDOM(
prevNode
):boolean
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:114
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
prevNode
this
Returns
boolean
Overrides
updateFromJSON()
updateFromJSON(
serializedNode
):this
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:59
Update this LexicalNode instance from serialized JSON. It's recommended to implement as much logic as possible in this method instead of the static importJSON method, so that the functionality can be inherited in subclasses.
The LexicalUpdateJSON utility type should be used to ignore any type, version, or children properties in the JSON so that the extended JSON from subclasses are acceptable parameters for the super call.
If overridden, this method must call super.
Parameters
serializedNode
LexicalUpdateJSON
<SerializedTableRowNode
>
Returns
this
Example
class MyTextNode extends TextNode {
// ...
static importJSON(serializedNode: SerializedMyTextNode): MyTextNode {
return $createMyTextNode()
.updateFromJSON(serializedNode);
}
updateFromJSON(
serializedNode: LexicalUpdateJSON<SerializedMyTextNode>,
): this {
return super.updateFromJSON(serializedNode)
.setMyProperty(serializedNode.myProperty);
}
}
Overrides
clone()
static
clone(node
):TableRowNode
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:42
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
node
Returns
Overrides
getType()
static
getType():string
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:38
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
importDOM()
static
importDOM():null
|DOMConversionMap
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:46
Returns
null
| DOMConversionMap
Overrides
ElementNode.importDOM
importJSON()
static
importJSON(serializedNode
):TableRowNode
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:55
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
serializedNode
Returns
Overrides
Interfaces
TableSelection
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:108
Implements
Properties
_cachedNodes
_cachedNodes:
null
|LexicalNode
[]
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:112
Implementation of
BaseSelection._cachedNodes
anchor
anchor:
PointType
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:110
dirty
dirty:
boolean
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:113
Implementation of
BaseSelection.dirty
focus
focus:
PointType
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:111
tableKey
tableKey:
string
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:109
Methods
clone()
clone():
TableSelection
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:185
Returns
Implementation of
BaseSelection.clone
extract()
extract():
LexicalNode
[]
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:197
Returns
Implementation of
BaseSelection.extract
getCachedNodes()
getCachedNodes():
null
|LexicalNode
[]
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:155
Returns
null
| LexicalNode
[]
Implementation of
BaseSelection.getCachedNodes
getNodes()
getNodes():
LexicalNode
[]
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:283
Returns
Implementation of
BaseSelection.getNodes
getShape()
getShape():
TableSelectionShape
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:244
Returns
getStartEndPoints()
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:125
Returns
Implementation of
BaseSelection.getStartEndPoints
getTextContent()
getTextContent():
string
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:358
Returns
string
Implementation of
BaseSelection.getTextContent
hasFormat()
hasFormat(
type
):boolean
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:216
Returns whether the provided TextFormatType is present on the Selection. This will be true if any paragraph in table cells has the specified format.
Parameters
type
the TextFormatType to check for.
Returns
boolean
true if the provided format is currently toggled on on the Selection, false otherwise.
insertNodes()
insertNodes(
nodes
):void
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:231
Parameters
nodes
Returns
void
Implementation of
BaseSelection.insertNodes
insertRawText()
insertRawText(
text
):void
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:201
Parameters
text
string
Returns
void
Implementation of
BaseSelection.insertRawText
insertText()
insertText():
void
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:205
Returns
void
Implementation of
BaseSelection.insertText
is()
is(
selection
):boolean
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:163
Parameters
selection
null
| BaseSelection
Returns
boolean
Implementation of
BaseSelection.is
isBackward()
isBackward():
boolean
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:151
Returns whether the Selection is "backwards", meaning the focus logically precedes the anchor in the EditorState.
Returns
boolean
true if the Selection is backwards, false otherwise.
Implementation of
BaseSelection.isBackward
isCollapsed()
isCollapsed():
boolean
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:193
Returns
boolean
Implementation of
BaseSelection.isCollapsed
isValid()
isValid():
boolean
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:136
$createTableSelection unfortunately makes it very easy to create nonsense selections, so we have a method to see if the selection probably makes sense.
Returns
boolean
true if the TableSelection is (probably) valid
set()
set(
tableKey
,anchorCellKey
,focusCellKey
):void
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:172
Parameters
tableKey
string
anchorCellKey
string
focusCellKey
string
Returns
void
setCachedNodes()
setCachedNodes(
nodes
):void
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:159
Parameters
nodes
null
| LexicalNode
[]
Returns
void
Implementation of
BaseSelection.setCachedNodes
Type Aliases
HTMLTableElementWithWithTableSelectionState
HTMLTableElementWithWithTableSelectionState =
HTMLTableElement
&object
Defined in: packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1247
Type Declaration
__lexicalTableSelection?
optional
__lexicalTableSelection:TableObserver
InsertTableCommandPayload
InsertTableCommandPayload =
Readonly
<{columns
:string
;includeHeaders?
:InsertTableCommandPayloadHeaders
;rows
:string
; }>
Defined in: packages/lexical-table/src/LexicalTableCommands.ts:20
InsertTableCommandPayloadHeaders
InsertTableCommandPayloadHeaders =
Readonly
<{columns
:boolean
;rows
:boolean
; }> |boolean
Defined in: packages/lexical-table/src/LexicalTableCommands.ts:13
SerializedTableCellNode
SerializedTableCellNode =
Spread
<{backgroundColor?
:null
|string
;colSpan?
:number
;headerState
:TableCellHeaderState
;rowSpan?
:number
;verticalAlign?
:string
;width?
:number
; },SerializedElementNode
>
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:46
SerializedTableNode
SerializedTableNode =
Spread
<{colWidths?
: readonlynumber
[];frozenColumnCount?
:number
;frozenRowCount?
:number
;rowStriping?
:boolean
; },SerializedElementNode
>
Defined in: packages/lexical-table/src/LexicalTableNode.ts:52
SerializedTableRowNode
SerializedTableRowNode =
Spread
<{height?
:number
; },SerializedElementNode
>
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:26
TableDOMCell
TableDOMCell =
object
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:49
Properties
elem
elem:
HTMLElement
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:50
hasBackgroundColor
hasBackgroundColor:
boolean
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:52
highlighted
highlighted:
boolean
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:51
x
x:
number
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:53
y
y:
number
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:54
TableMapType
TableMapType =
TableMapValueType
[][]
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:50
TableMapValueType
TableMapValueType =
object
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:45
Properties
cell
cell:
TableCellNode
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:46
startColumn
startColumn:
number
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:48
startRow
startRow:
number
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:47
TableSelectionShape
TableSelectionShape =
object
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:38
Properties
fromX
fromX:
number
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:39
fromY
fromY:
number
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:40
toX
toX:
number
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:41
toY
toY:
number
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:42
Variables
$deleteTableColumn__EXPERIMENTAL()
const
$deleteTableColumn__EXPERIMENTAL: () =>void
=$deleteTableColumnAtSelection
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:797
Returns
void
Deprecated
renamed to $deleteTableColumnAtSelection
$deleteTableRow__EXPERIMENTAL()
const
$deleteTableRow__EXPERIMENTAL: () =>void
=$deleteTableRowAtSelection
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:713
Returns
void
Deprecated
renamed to $deleteTableRowAtSelection
$insertTableColumn__EXPERIMENTAL()
const
$insertTableColumn__EXPERIMENTAL: (insertAfter
) =>null
|TableCellNode
=$insertTableColumnAtSelection
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:478
Inserts a column before or after the current focus cell node, taking into account any spans. If successful, returns the first inserted cell node.
Parameters
insertAfter
boolean
= true
Returns
null
| TableCellNode
Deprecated
renamed to $insertTableColumnAtSelection
$insertTableRow__EXPERIMENTAL()
const
$insertTableRow__EXPERIMENTAL: (insertAfter
) =>null
|TableRowNode
=$insertTableRowAtSelection
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:295
Inserts a table row before or after the current focus cell node, taking into account any spans. If successful, returns the inserted table row node.
Parameters
insertAfter
boolean
= true
Returns
null
| TableRowNode
Deprecated
renamed to $insertTableRowAtSelection
INSERT_TABLE_COMMAND
const
INSERT_TABLE_COMMAND:LexicalCommand
<InsertTableCommandPayload
>
Defined in: packages/lexical-table/src/LexicalTableCommands.ts:26
TableCellHeaderStates
const
TableCellHeaderStates:object
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:36
Type Declaration
BOTH
BOTH:
number
=3
COLUMN
COLUMN:
number
=2
NO_STATUS
NO_STATUS:
number
=0
ROW
ROW:
number
=1
Functions
$computeTableMap()
$computeTableMap(
tableNode
,cellA
,cellB
): [TableMapType
,TableMapValueType
,TableMapValueType
]
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:1025
Parameters
tableNode
cellA
cellB
Returns
[TableMapType
, TableMapValueType
, TableMapValueType
]
$computeTableMapSkipCellCheck()
$computeTableMapSkipCellCheck(
tableNode
,cellA
,cellB
): [TableMapType
,null
|TableMapValueType
,null
|TableMapValueType
]
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:1040
Parameters
tableNode
cellA
null
| TableCellNode
cellB
null
| TableCellNode
Returns
[TableMapType
, null
| TableMapValueType
, null
| TableMapValueType
]
$createTableCellNode()
$createTableCellNode(
headerState
,colSpan
,width?
):TableCellNode
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:428
Parameters
headerState
number
= TableCellHeaderStates.NO_STATUS
colSpan
number
= 1
width?
number
Returns
$createTableNode()
$createTableNode():
TableNode
Defined in: packages/lexical-table/src/LexicalTableNode.ts:648
Returns
$createTableNodeWithDimensions()
$createTableNodeWithDimensions(
rowCount
,columnCount
,includeHeaders
):TableNode
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:40
Parameters
rowCount
number
columnCount
number
includeHeaders
InsertTableCommandPayloadHeaders
= true
Returns
$createTableRowNode()
$createTableRowNode(
height?
):TableRowNode
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:141
Parameters
height?
number
Returns
$createTableSelection()
$createTableSelection():
TableSelection
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:375
Returns
$createTableSelectionFrom()
$createTableSelectionFrom(
tableNode
,anchorCell
,focusCell
):TableSelection
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:386
Parameters
tableNode
anchorCell
focusCell
Returns
$deleteTableColumn()
$deleteTableColumn(
tableNode
,targetIndex
):TableNode
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:585
Parameters
tableNode
targetIndex
number
Returns
Deprecated
This function does not support merged cells. Use $deleteTableColumnAtSelection instead.
$deleteTableColumnAtSelection()
$deleteTableColumnAtSelection():
void
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:715
Returns
void
$deleteTableRowAtSelection()
$deleteTableRowAtSelection():
void
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:608
Returns
void
$findCellNode()
$findCellNode(
node
):null
|TableCellNode
Defined in: packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1832
Parameters
node
Returns
null
| TableCellNode
$findTableNode()
$findTableNode(
node
):null
|TableNode
Defined in: packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1837
Parameters
node
Returns
null
| TableNode
$getElementForTableNode()
$getElementForTableNode(
editor
,tableNode
):TableDOMTable
Defined in: packages/lexical-table/src/LexicalTableNode.ts:598
Parameters
editor
tableNode
Returns
TableDOMTable
$getNodeTriplet()
$getNodeTriplet(
source
): [TableCellNode
,TableRowNode
,TableNode
]
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:1113
Parameters
source
LexicalNode
| PointType
| TableCellNode
Returns
[TableCellNode
, TableRowNode
, TableNode
]
$getTableAndElementByKey()
$getTableAndElementByKey(
tableNodeKey
,editor
):object
Defined in: packages/lexical-table/src/LexicalTableObserver.ts:65
Parameters
tableNodeKey
string
editor
LexicalEditor
= ...
Returns
object
tableElement
tableElement:
HTMLTableElementWithWithTableSelectionState
tableNode
tableNode:
TableNode
$getTableCellNodeFromLexicalNode()
$getTableCellNodeFromLexicalNode(
startingNode
):null
|TableCellNode
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:82
Parameters
startingNode
Returns
null
| TableCellNode
$getTableCellNodeRect()
$getTableCellNodeRect(
tableCellNode
):null
| {colSpan
:number
;columnIndex
:number
;rowIndex
:number
;rowSpan
:number
; }
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:1256
Parameters
tableCellNode
Returns
null
| { colSpan
: number
; columnIndex
: number
; rowIndex
: number
; rowSpan
: number
; }
$getTableColumnIndexFromTableCellNode()
$getTableColumnIndexFromTableCellNode(
tableCellNode
):number
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:126
Parameters
tableCellNode
Returns
number
$getTableNodeFromLexicalNodeOrThrow()
$getTableNodeFromLexicalNodeOrThrow(
startingNode
):TableNode
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:106
Parameters
startingNode
Returns
$getTableRowIndexFromTableCellNode()
$getTableRowIndexFromTableCellNode(
tableCellNode
):number
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:118
Parameters
tableCellNode
Returns
number
$getTableRowNodeFromTableCellNodeOrThrow()
$getTableRowNodeFromTableCellNodeOrThrow(
startingNode
):TableRowNode
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:94
Parameters
startingNode
Returns
$insertTableColumn()
$insertTableColumn(
tableNode
,targetIndex
,shouldInsertAfter
,columnCount
,table
):TableNode
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:376
Parameters
tableNode
targetIndex
number
shouldInsertAfter
boolean
= true
columnCount
number
table
TableDOMTable
Returns
Deprecated
This function does not support merged cells. Use $insertTableColumnAtSelection or $insertTableColumnAtNode instead.
$insertTableColumnAtSelection()
$insertTableColumnAtSelection(
insertAfter
):null
|TableCellNode
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:440
Inserts a column before or after the current focus cell node, taking into account any spans. If successful, returns the first inserted cell node.
Parameters
insertAfter
boolean
= true
Returns
null
| TableCellNode
$insertTableRow()
$insertTableRow(
tableNode
,targetIndex
,shouldInsertAfter
,rowCount
,table
):TableNode
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:172
Parameters
tableNode
targetIndex
number
shouldInsertAfter
boolean
= true
rowCount
number
table
TableDOMTable
Returns
Deprecated
This function does not support merged cells. Use $insertTableRowAtSelection or $insertTableRowAtNode instead.
$insertTableRowAtSelection()
$insertTableRowAtSelection(
insertAfter
):null
|TableRowNode
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:257
Inserts a table row before or after the current focus cell node, taking into account any spans. If successful, returns the inserted table row node.
Parameters
insertAfter
boolean
= true
Returns
null
| TableRowNode
$isScrollableTablesActive()
$isScrollableTablesActive(
editor
):boolean
Defined in: packages/lexical-table/src/LexicalTableNode.ts:151
Parameters
editor
LexicalEditor
= ...
Returns
boolean
$isTableCellNode()
$isTableCellNode(
node
):node is TableCellNode
Defined in: packages/lexical-table/src/LexicalTableCellNode.ts:436
Parameters
node
undefined
| null
| LexicalNode
Returns
node is TableCellNode
$isTableNode()
$isTableNode(
node
):node is TableNode
Defined in: packages/lexical-table/src/LexicalTableNode.ts:652
Parameters
node
undefined
| null
| LexicalNode
Returns
node is TableNode
$isTableRowNode()
$isTableRowNode(
node
):node is TableRowNode
Defined in: packages/lexical-table/src/LexicalTableRowNode.ts:145
Parameters
node
undefined
| null
| LexicalNode
Returns
node is TableRowNode
$isTableSelection()
$isTableSelection(
x
):x is TableSelection
Defined in: packages/lexical-table/src/LexicalTableSelection.ts:371
Parameters
x
unknown
Returns
x is TableSelection
$mergeCells()
$mergeCells(
cellNodes
):null
|TableCellNode
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:817
Parameters
cellNodes
Returns
null
| TableCellNode
$removeTableRowAtIndex()
$removeTableRowAtIndex(
tableNode
,indexToDelete
):TableNode
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:154
Parameters
tableNode
indexToDelete
number
Returns
$unmergeCell()
$unmergeCell():
void
Defined in: packages/lexical-table/src/LexicalTableUtils.ts:926
Returns
void
applyTableHandlers()
applyTableHandlers(
tableNode
,element
,editor
,hasTabHandler
):TableObserver
Defined in: packages/lexical-table/src/LexicalTableSelectionHelpers.ts:180
Parameters
tableNode
element
HTMLElement
editor
hasTabHandler
boolean
Returns
getDOMCellFromTarget()
getDOMCellFromTarget(
node
):null
|TableDOMCell
Defined in: packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1277
Parameters
node
null
| Node
Returns
null
| TableDOMCell
getTableElement()
getTableElement<
T
>(tableNode
,dom
):HTMLTableElementWithWithTableSelectionState
|T
&null
Defined in: packages/lexical-table/src/LexicalTableSelectionHelpers.ts:124
Type Parameters
T
T
extends null
| HTMLElement
Parameters
tableNode
dom
T
Returns
HTMLTableElementWithWithTableSelectionState
| T
& null
getTableObserverFromTableElement()
getTableObserverFromTableElement(
tableElement
):null
|TableObserver
Defined in: packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1271
Parameters
tableElement
HTMLTableElementWithWithTableSelectionState
Returns
null
| TableObserver
registerTableCellUnmergeTransform()
registerTableCellUnmergeTransform(
editor
): () =>void
Defined in: packages/lexical-table/src/LexicalTablePluginHelpers.ts:176
Register a transform to ensure that all TableCellNode have a colSpan and rowSpan of 1. This should only be registered when you do not want to support merged cells.
Parameters
editor
The editor
Returns
An unregister callback
():
void
Returns
void
registerTablePlugin()
registerTablePlugin(
editor
): () =>void
Defined in: packages/lexical-table/src/LexicalTablePluginHelpers.ts:305
Register the INSERT_TABLE_COMMAND listener and the table integrity transforms. The table selection observer should be registered separately after this with registerTableSelectionObserver.
Parameters
editor
The editor
Returns
An unregister callback
():
void
Returns
void
registerTableSelectionObserver()
registerTableSelectionObserver(
editor
,hasTabHandler
): () =>void
Defined in: packages/lexical-table/src/LexicalTablePluginHelpers.ts:231
Parameters
editor
hasTabHandler
boolean
= true
Returns
():
void
Returns
void
setScrollableTablesActive()
setScrollableTablesActive(
editor
,active
):void
Defined in: packages/lexical-table/src/LexicalTableNode.ts:157
Parameters
editor
active
boolean
Returns
void