Skip to main content

Module: @lexical/table

Classes

Type Aliases

HTMLTableElementWithWithTableSelectionState

Ƭ HTMLTableElementWithWithTableSelectionState: HTMLTableElement & { __lexicalTableSelection?: TableObserver }

Defined in

packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1077


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 ; width?: number }, SerializedElementNode>

Defined in

packages/lexical-table/src/LexicalTableCellNode.ts:43


SerializedTableNode

Ƭ SerializedTableNode: Spread<{ colWidths?: readonly number[] ; rowStriping?: boolean }, SerializedElementNode>

Defined in

packages/lexical-table/src/LexicalTableNode.ts:39


SerializedTableRowNode

Ƭ SerializedTableRowNode: Spread<{ height?: number }, SerializedElementNode>

Defined in

packages/lexical-table/src/LexicalTableRowNode.ts:25


TableDOMCell

Ƭ TableDOMCell: Object

Type declaration

NameType
elemHTMLElement
hasBackgroundColorboolean
highlightedboolean
xnumber
ynumber

Defined in

packages/lexical-table/src/LexicalTableObserver.ts:48


TableMapType

Ƭ TableMapType: TableMapValueType[][]

Defined in

packages/lexical-table/src/LexicalTableSelection.ts:50


TableMapValueType

Ƭ TableMapValueType: Object

Type declaration

NameType
cellTableCellNode
startColumnnumber
startRownumber

Defined in

packages/lexical-table/src/LexicalTableSelection.ts:45


TableSelectionShape

Ƭ TableSelectionShape: Object

Type declaration

NameType
fromXnumber
fromYnumber
toXnumber
toYnumber

Defined in

packages/lexical-table/src/LexicalTableSelection.ts:38

Variables

INSERT_TABLE_COMMAND

Const INSERT_TABLE_COMMAND: LexicalCommand<InsertTableCommandPayload>

Defined in

packages/lexical-table/src/LexicalTableCommands.ts:26


TableCellHeaderStates

Const TableCellHeaderStates: Object

Type declaration

NameType
BOTHnumber
COLUMNnumber
NO_STATUSnumber
ROWnumber

Defined in

packages/lexical-table/src/LexicalTableCellNode.ts:33

Functions

$computeTableMap

$computeTableMap(tableNode, cellA, cellB): [TableMapType, TableMapValueType, TableMapValueType]

Parameters

NameType
tableNodeTableNode
cellATableCellNode
cellBTableCellNode

Returns

[TableMapType, TableMapValueType, TableMapValueType]

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:790


$computeTableMapSkipCellCheck

$computeTableMapSkipCellCheck(tableNode, cellA, cellB): [tableMap: TableMapType, cellAValue: TableMapValueType | null, cellBValue: TableMapValueType | null]

Parameters

NameType
tableNodeTableNode
cellAnull | TableCellNode
cellBnull | TableCellNode

Returns

[tableMap: TableMapType, cellAValue: TableMapValueType | null, cellBValue: TableMapValueType | null]

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:805


$createTableCellNode

$createTableCellNode(headerState, colSpan?, width?): TableCellNode

Parameters

NameTypeDefault value
headerStatenumberundefined
colSpannumber1
width?numberundefined

Returns

TableCellNode

Defined in

packages/lexical-table/src/LexicalTableCellNode.ts:363


$createTableNode

$createTableNode(): TableNode

Returns

TableNode

Defined in

packages/lexical-table/src/LexicalTableNode.ts:432


$createTableNodeWithDimensions

$createTableNodeWithDimensions(rowCount, columnCount, includeHeaders?): TableNode

Parameters

NameTypeDefault value
rowCountnumberundefined
columnCountnumberundefined
includeHeadersInsertTableCommandPayloadHeaderstrue

Returns

TableNode

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:39


$createTableRowNode

$createTableRowNode(height?): TableRowNode

Parameters

NameType
height?number

Returns

TableRowNode

Defined in

packages/lexical-table/src/LexicalTableRowNode.ts:122


$createTableSelection

$createTableSelection(): TableSelection

Returns

TableSelection

Defined in

packages/lexical-table/src/LexicalTableSelection.ts:375


$deleteTableColumn

$deleteTableColumn(tableNode, targetIndex): TableNode

Parameters

NameType
tableNodeTableNode
targetIndexnumber

Returns

TableNode

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:503


$deleteTableColumn__EXPERIMENTAL

$deleteTableColumn__EXPERIMENTAL(): void

Returns

void

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:603


$deleteTableRow__EXPERIMENTAL

$deleteTableRow__EXPERIMENTAL(): void

Returns

void

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:526


$findCellNode

$findCellNode(node): null | TableCellNode

Parameters

NameType
nodeLexicalNode

Returns

null | TableCellNode

Defined in

packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1586


$findTableNode

$findTableNode(node): null | TableNode

Parameters

NameType
nodeLexicalNode

Returns

null | TableNode

Defined in

packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1591


$getElementForTableNode

$getElementForTableNode(editor, tableNode): TableDOMTable

Parameters

NameType
editorLexicalEditor
tableNodeTableNode

Returns

TableDOMTable

Defined in

packages/lexical-table/src/LexicalTableNode.ts:395


$getNodeTriplet

$getNodeTriplet(source): [TableCellNode, TableRowNode, TableNode]

Parameters

NameType
sourceLexicalNode | PointType | TableCellNode

Returns

[TableCellNode, TableRowNode, TableNode]

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:878


$getTableAndElementByKey

$getTableAndElementByKey(tableNodeKey, editor?): Object

Parameters

NameType
tableNodeKeystring
editorLexicalEditor

Returns

Object

NameType
tableElementHTMLTableElementWithWithTableSelectionState
tableNodeTableNode

Defined in

packages/lexical-table/src/LexicalTableObserver.ts:64


$getTableCellNodeFromLexicalNode

$getTableCellNodeFromLexicalNode(startingNode): TableCellNode | null

Parameters

NameType
startingNodeLexicalNode

Returns

TableCellNode | null

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:81


$getTableCellNodeRect

$getTableCellNodeRect(tableCellNode): { colSpan: number ; columnIndex: number ; rowIndex: number ; rowSpan: number } | null

Parameters

NameType
tableCellNodeTableCellNode

Returns

{ colSpan: number ; columnIndex: number ; rowIndex: number ; rowSpan: number } | null

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:1024


$getTableColumnIndexFromTableCellNode

$getTableColumnIndexFromTableCellNode(tableCellNode): number

Parameters

NameType
tableCellNodeTableCellNode

Returns

number

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:125


$getTableNodeFromLexicalNodeOrThrow

$getTableNodeFromLexicalNodeOrThrow(startingNode): TableNode

Parameters

NameType
startingNodeLexicalNode

Returns

TableNode

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:105


$getTableRowIndexFromTableCellNode

$getTableRowIndexFromTableCellNode(tableCellNode): number

Parameters

NameType
tableCellNodeTableCellNode

Returns

number

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:117


$getTableRowNodeFromTableCellNodeOrThrow

$getTableRowNodeFromTableCellNodeOrThrow(startingNode): TableRowNode

Parameters

NameType
startingNodeLexicalNode

Returns

TableRowNode

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:93


$insertTableColumn

$insertTableColumn(tableNode, targetIndex, shouldInsertAfter?, columnCount, table): TableNode

Parameters

NameTypeDefault value
tableNodeTableNodeundefined
targetIndexnumberundefined
shouldInsertAfterbooleantrue
columnCountnumberundefined
tableTableDOMTableundefined

Returns

TableNode

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:328


$insertTableColumn__EXPERIMENTAL

$insertTableColumn__EXPERIMENTAL(insertAfter?): TableCellNode | null

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

NameTypeDefault value
insertAfterbooleantrue

Returns

TableCellNode | null

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:392


$insertTableRow

$insertTableRow(tableNode, targetIndex, shouldInsertAfter?, rowCount, table): TableNode

Parameters

NameTypeDefault value
tableNodeTableNodeundefined
targetIndexnumberundefined
shouldInsertAfterbooleantrue
rowCountnumberundefined
tableTableDOMTableundefined

Returns

TableNode

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:168


$insertTableRow__EXPERIMENTAL

$insertTableRow__EXPERIMENTAL(insertAfter?): TableRowNode | null

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

NameTypeDefault value
insertAfterbooleantrue

Returns

TableRowNode | null

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:253


$isScrollableTablesActive

$isScrollableTablesActive(editor?): boolean

Parameters

NameType
editorLexicalEditor

Returns

boolean

Defined in

packages/lexical-table/src/LexicalTableNode.ts:85


$isTableCellNode

$isTableCellNode(node): node is TableCellNode

Parameters

NameType
nodeundefined | null | LexicalNode

Returns

node is TableCellNode

Defined in

packages/lexical-table/src/LexicalTableCellNode.ts:371


$isTableNode

$isTableNode(node): node is TableNode

Parameters

NameType
nodeundefined | null | LexicalNode

Returns

node is TableNode

Defined in

packages/lexical-table/src/LexicalTableNode.ts:436


$isTableRowNode

$isTableRowNode(node): node is TableRowNode

Parameters

NameType
nodeundefined | null | LexicalNode

Returns

node is TableRowNode

Defined in

packages/lexical-table/src/LexicalTableRowNode.ts:126


$isTableSelection

$isTableSelection(x): x is TableSelection

Parameters

NameType
xunknown

Returns

x is TableSelection

Defined in

packages/lexical-table/src/LexicalTableSelection.ts:371


$removeTableRowAtIndex

$removeTableRowAtIndex(tableNode, indexToDelete): TableNode

Parameters

NameType
tableNodeTableNode
indexToDeletenumber

Returns

TableNode

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:153


$unmergeCell

$unmergeCell(): void

Returns

void

Defined in

packages/lexical-table/src/LexicalTableUtils.ts:700


applyTableHandlers

applyTableHandlers(tableNode, element, editor, hasTabHandler): TableObserver

Parameters

NameType
tableNodeTableNode
elementHTMLElement
editorLexicalEditor
hasTabHandlerboolean

Returns

TableObserver

Defined in

packages/lexical-table/src/LexicalTableSelectionHelpers.ts:154


getDOMCellFromTarget

getDOMCellFromTarget(node): TableDOMCell | null

Parameters

NameType
nodeNode

Returns

TableDOMCell | null

Defined in

packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1107


getTableElement

getTableElement<T>(tableNode, dom): HTMLTableElementWithWithTableSelectionState | T & null

Type parameters

NameType
Textends null | HTMLElement

Parameters

NameType
tableNodeTableNode
domT

Returns

HTMLTableElementWithWithTableSelectionState | T & null

Defined in

packages/lexical-table/src/LexicalTableSelectionHelpers.ts:98


getTableObserverFromTableElement

getTableObserverFromTableElement(tableElement): TableObserver | null

Parameters

NameType
tableElementHTMLTableElementWithWithTableSelectionState

Returns

TableObserver | null

Defined in

packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1101


setScrollableTablesActive

setScrollableTablesActive(editor, active): void

Parameters

NameType
editorLexicalEditor
activeboolean

Returns

void

Defined in

packages/lexical-table/src/LexicalTableNode.ts:91