Module: @lexical/table
Classes
Type Aliases
HTMLTableElementWithWithTableSelectionState
Ƭ HTMLTableElementWithWithTableSelectionState: HTMLTableElement
& { __lexicalTableSelection?
: TableObserver
}
Defined in
packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1073
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:44
SerializedTableNode
Ƭ SerializedTableNode: Spread
<{ colWidths?
: readonly number
[] ; rowStriping?
: boolean
}, SerializedElementNode
>
Defined in
packages/lexical-table/src/LexicalTableNode.ts:45
SerializedTableRowNode
Ƭ SerializedTableRowNode: Spread
<{ height?
: number
}, SerializedElementNode
>
Defined in
packages/lexical-table/src/LexicalTableRowNode.ts:26
TableDOMCell
Ƭ TableDOMCell: Object
Type declaration
Name | Type |
---|---|
elem | HTMLElement |
hasBackgroundColor | boolean |
highlighted | boolean |
x | number |
y | number |
Defined in
packages/lexical-table/src/LexicalTableObserver.ts:47
TableMapType
Ƭ TableMapType: TableMapValueType
[][]
Defined in
packages/lexical-table/src/LexicalTableSelection.ts:50
TableMapValueType
Ƭ TableMapValueType: Object
Type declaration
Name | Type |
---|---|
cell | TableCellNode |
startColumn | number |
startRow | number |
Defined in
packages/lexical-table/src/LexicalTableSelection.ts:45
TableSelectionShape
Ƭ TableSelectionShape: Object
Type declaration
Name | Type |
---|---|
fromX | number |
fromY | number |
toX | number |
toY | number |
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
Name | Type |
---|---|
BOTH | number |
COLUMN | number |
NO_STATUS | number |
ROW | number |
Defined in
packages/lexical-table/src/LexicalTableCellNode.ts:34
Functions
$computeTableMap
▸ $computeTableMap(tableNode
, cellA
, cellB
): [TableMapType
, TableMapValueType
, TableMapValueType
]
Parameters
Name | Type |
---|---|
tableNode | TableNode |
cellA | TableCellNode |
cellB | TableCellNode |
Returns
[TableMapType
, TableMapValueType
, TableMapValueType
]
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:806
$computeTableMapSkipCellCheck
▸ $computeTableMapSkipCellCheck(tableNode
, cellA
, cellB
): [tableMap: TableMapType, cellAValue: TableMapValueType | null, cellBValue: TableMapValueType | null]
Parameters
Name | Type |
---|---|
tableNode | TableNode |
cellA | null | TableCellNode |
cellB | null | TableCellNode |
Returns
[tableMap: TableMapType, cellAValue: TableMapValueType | null, cellBValue: TableMapValueType | null]
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:821
$createTableCellNode
▸ $createTableCellNode(headerState?
, colSpan?
, width?
): TableCellNode
Parameters
Name | Type | Default value |
---|---|---|
headerState | number | TableCellHeaderStates.NO_STATUS |
colSpan | number | 1 |
width? | number | undefined |
Returns
Defined in
packages/lexical-table/src/LexicalTableCellNode.ts:368
$createTableNode
▸ $createTableNode(): TableNode
Returns
Defined in
packages/lexical-table/src/LexicalTableNode.ts:507
$createTableNodeWithDimensions
▸ $createTableNodeWithDimensions(rowCount
, columnCount
, includeHeaders?
): TableNode
Parameters
Name | Type | Default value |
---|---|---|
rowCount | number | undefined |
columnCount | number | undefined |
includeHeaders | InsertTableCommandPayloadHeaders | true |
Returns
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:39
$createTableRowNode
▸ $createTableRowNode(height?
): TableRowNode
Parameters
Name | Type |
---|---|
height? | number |
Returns
Defined in
packages/lexical-table/src/LexicalTableRowNode.ts:134
$createTableSelection
▸ $createTableSelection(): TableSelection
Returns
Defined in
packages/lexical-table/src/LexicalTableSelection.ts:375
$deleteTableColumn
▸ $deleteTableColumn(tableNode
, targetIndex
): TableNode
Parameters
Name | Type |
---|---|
tableNode | TableNode |
targetIndex | number |
Returns
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:503
$deleteTableColumn__EXPERIMENTAL
▸ $deleteTableColumn__EXPERIMENTAL(): void
Returns
void
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:619
$deleteTableRow__EXPERIMENTAL
▸ $deleteTableRow__EXPERIMENTAL(): void
Returns
void
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:526
$findCellNode
▸ $findCellNode(node
): null
| TableCellNode
Parameters
Name | Type |
---|---|
node | LexicalNode |
Returns
null
| TableCellNode
Defined in
packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1612
$findTableNode
▸ $findTableNode(node
): null
| TableNode
Parameters
Name | Type |
---|---|
node | LexicalNode |
Returns
null
| TableNode
Defined in
packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1617
$getElementForTableNode
▸ $getElementForTableNode(editor
, tableNode
): TableDOMTable
Parameters
Name | Type |
---|---|
editor | LexicalEditor |
tableNode | TableNode |
Returns
TableDOMTable
Defined in
packages/lexical-table/src/LexicalTableNode.ts:467
$getNodeTriplet
▸ $getNodeTriplet(source
): [TableCellNode
, TableRowNode
, TableNode
]
Parameters
Name | Type |
---|---|
source | LexicalNode | PointType | TableCellNode |
Returns
[TableCellNode
, TableRowNode
, TableNode
]
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:894
$getTableAndElementByKey
▸ $getTableAndElementByKey(tableNodeKey
, editor?
): Object
Parameters
Name | Type |
---|---|
tableNodeKey | string |
editor | LexicalEditor |
Returns
Object
Name | Type |
---|---|
tableElement | HTMLTableElementWithWithTableSelectionState |
tableNode | TableNode |
Defined in
packages/lexical-table/src/LexicalTableObserver.ts:63
$getTableCellNodeFromLexicalNode
▸ $getTableCellNodeFromLexicalNode(startingNode
): TableCellNode
| null
Parameters
Name | Type |
---|---|
startingNode | LexicalNode |
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
Name | Type |
---|---|
tableCellNode | TableCellNode |
Returns
{ colSpan
: number
; columnIndex
: number
; rowIndex
: number
; rowSpan
: number
} | null
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:1040
$getTableColumnIndexFromTableCellNode
▸ $getTableColumnIndexFromTableCellNode(tableCellNode
): number
Parameters
Name | Type |
---|---|
tableCellNode | TableCellNode |
Returns
number
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:125
$getTableNodeFromLexicalNodeOrThrow
▸ $getTableNodeFromLexicalNodeOrThrow(startingNode
): TableNode
Parameters
Name | Type |
---|---|
startingNode | LexicalNode |
Returns
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:105
$getTableRowIndexFromTableCellNode
▸ $getTableRowIndexFromTableCellNode(tableCellNode
): number
Parameters
Name | Type |
---|---|
tableCellNode | TableCellNode |
Returns
number
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:117
$getTableRowNodeFromTableCellNodeOrThrow
▸ $getTableRowNodeFromTableCellNodeOrThrow(startingNode
): TableRowNode
Parameters
Name | Type |
---|---|
startingNode | LexicalNode |
Returns
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:93
$insertTableColumn
▸ $insertTableColumn(tableNode
, targetIndex
, shouldInsertAfter?
, columnCount
, table
): TableNode
Parameters
Name | Type | Default value |
---|---|---|
tableNode | TableNode | undefined |
targetIndex | number | undefined |
shouldInsertAfter | boolean | true |
columnCount | number | undefined |
table | TableDOMTable | undefined |
Returns
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
Name | Type | Default value |
---|---|---|
insertAfter | boolean | true |
Returns
TableCellNode
| null
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:392
$insertTableRow
▸ $insertTableRow(tableNode
, targetIndex
, shouldInsertAfter?
, rowCount
, table
): TableNode
Parameters
Name | Type | Default value |
---|---|---|
tableNode | TableNode | undefined |
targetIndex | number | undefined |
shouldInsertAfter | boolean | true |
rowCount | number | undefined |
table | TableDOMTable | undefined |
Returns
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
Name | Type | Default value |
---|---|---|
insertAfter | boolean | true |
Returns
TableRowNode
| null
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:253
$isScrollableTablesActive
▸ $isScrollableTablesActive(editor?
): boolean
Parameters
Name | Type |
---|---|
editor | LexicalEditor |
Returns
boolean
Defined in
packages/lexical-table/src/LexicalTableNode.ts:91
$isTableCellNode
▸ $isTableCellNode(node
): node is TableCellNode
Parameters
Name | Type |
---|---|
node | undefined | null | LexicalNode |
Returns
node is TableCellNode
Defined in
packages/lexical-table/src/LexicalTableCellNode.ts:376
$isTableNode
▸ $isTableNode(node
): node is TableNode
Parameters
Name | Type |
---|---|
node | undefined | null | LexicalNode |
Returns
node is TableNode
Defined in
packages/lexical-table/src/LexicalTableNode.ts:511
$isTableRowNode
▸ $isTableRowNode(node
): node is TableRowNode
Parameters
Name | Type |
---|---|
node | undefined | null | LexicalNode |
Returns
node is TableRowNode
Defined in
packages/lexical-table/src/LexicalTableRowNode.ts:138
$isTableSelection
▸ $isTableSelection(x
): x is TableSelection
Parameters
Name | Type |
---|---|
x | unknown |
Returns
x is TableSelection
Defined in
packages/lexical-table/src/LexicalTableSelection.ts:371
$removeTableRowAtIndex
▸ $removeTableRowAtIndex(tableNode
, indexToDelete
): TableNode
Parameters
Name | Type |
---|---|
tableNode | TableNode |
indexToDelete | number |
Returns
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:153
$unmergeCell
▸ $unmergeCell(): void
Returns
void
Defined in
packages/lexical-table/src/LexicalTableUtils.ts:716
applyTableHandlers
▸ applyTableHandlers(tableNode
, element
, editor
, hasTabHandler
): TableObserver
Parameters
Name | Type |
---|---|
tableNode | TableNode |
element | HTMLElement |
editor | LexicalEditor |
hasTabHandler | boolean |
Returns
Defined in
packages/lexical-table/src/LexicalTableSelectionHelpers.ts:156
getDOMCellFromTarget
▸ getDOMCellFromTarget(node
): TableDOMCell
| null
Parameters
Name | Type |
---|---|
node | Node |
Returns
TableDOMCell
| null
Defined in
packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1103
getTableElement
▸ getTableElement<T
>(tableNode
, dom
): HTMLTableElementWithWithTableSelectionState
| T
& null
Type parameters
Name | Type |
---|---|
T | extends null | HTMLElement |
Parameters
Name | Type |
---|---|
tableNode | TableNode |
dom | T |
Returns
HTMLTableElementWithWithTableSelectionState
| T
& null
Defined in
packages/lexical-table/src/LexicalTableSelectionHelpers.ts:100
getTableObserverFromTableElement
▸ getTableObserverFromTableElement(tableElement
): TableObserver
| null
Parameters
Name | Type |
---|---|
tableElement | HTMLTableElementWithWithTableSelectionState |
Returns
TableObserver
| null
Defined in
packages/lexical-table/src/LexicalTableSelectionHelpers.ts:1097
registerTableCellUnmergeTransform
▸ registerTableCellUnmergeTransform(editor
): () => void
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
Name | Type | Description |
---|---|---|
editor | LexicalEditor | The editor |
Returns
fn
An unregister callback
▸ (): void
Returns
void
Defined in
packages/lexical-table/src/LexicalTablePluginHelpers.ts:132
registerTablePlugin
▸ registerTablePlugin(editor
): () => void
Register the INSERT_TABLE_COMMAND listener and the table integrity transforms. The table selection observer should be registered separately after this with registerTableSelectionObserver.
Parameters
Name | Type | Description |
---|---|---|
editor | LexicalEditor | The editor |
Returns
fn
An unregister callback
▸ (): void
Returns
void
Defined in
packages/lexical-table/src/LexicalTablePluginHelpers.ts:261
registerTableSelectionObserver
▸ registerTableSelectionObserver(editor
, hasTabHandler?
): () => void
Parameters
Name | Type | Default value |
---|---|---|
editor | LexicalEditor | undefined |
hasTabHandler | boolean | true |
Returns
fn
▸ (): void
Returns
void
Defined in
packages/lexical-table/src/LexicalTablePluginHelpers.ts:187
setScrollableTablesActive
▸ setScrollableTablesActive(editor
, active
): void
Parameters
Name | Type |
---|---|
editor | LexicalEditor |
active | boolean |
Returns
void