@lexical/table 0.3.2 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1385,14 +1385,14 @@ class TableNode extends lexical.GridNode {
1385
1385
 
1386
1386
  static importDOM() {
1387
1387
  return {
1388
- table: node => ({
1388
+ table: _node => ({
1389
1389
  conversion: convertTableElement,
1390
1390
  priority: 0
1391
1391
  })
1392
1392
  };
1393
1393
  }
1394
1394
 
1395
- static importJSON(serializedNode) {
1395
+ static importJSON(_serializedNode) {
1396
1396
  return $createTableNode();
1397
1397
  }
1398
1398
 
@@ -1557,7 +1557,7 @@ function $getElementGridForTableNode(editor, tableNode) {
1557
1557
 
1558
1558
  return getTableGrid(tableElement);
1559
1559
  }
1560
- function convertTableElement(domNode) {
1560
+ function convertTableElement(_domNode) {
1561
1561
  return {
1562
1562
  node: $createTableNode()
1563
1563
  };
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { DOMConversionMap, DOMConversionOutput, DOMExportOutput, EditorConfig, LexicalEditor, LexicalNode, NodeKey, SerializedGridCellNode, Spread } from 'lexical';
9
+ import { GridCellNode } from 'lexical';
10
+ export declare const TableCellHeaderStates: {
11
+ BOTH: number;
12
+ COLUMN: number;
13
+ NO_STATUS: number;
14
+ ROW: number;
15
+ };
16
+ export declare type TableCellHeaderState = typeof TableCellHeaderStates[keyof typeof TableCellHeaderStates];
17
+ export declare type SerializedTableCellNode = Spread<{
18
+ headerState: TableCellHeaderState;
19
+ type: 'tablecell';
20
+ width: number;
21
+ }, SerializedGridCellNode>;
22
+ export declare class TableCellNode extends GridCellNode {
23
+ __headerState: TableCellHeaderState;
24
+ __width: number;
25
+ static getType(): 'tablecell';
26
+ static clone(node: TableCellNode): TableCellNode;
27
+ static importDOM(): DOMConversionMap | null;
28
+ static importJSON(serializedNode: SerializedTableCellNode): TableCellNode;
29
+ constructor(headerState?: number, colSpan?: number, width?: number, key?: NodeKey);
30
+ createDOM(config: EditorConfig): HTMLElement;
31
+ exportDOM(editor: LexicalEditor): DOMExportOutput;
32
+ exportJSON(): SerializedTableCellNode;
33
+ getTag(): string;
34
+ setHeaderStyles(headerState: TableCellHeaderState): TableCellHeaderState;
35
+ getHeaderStyles(): TableCellHeaderState;
36
+ setWidth(width: number): number;
37
+ getWidth(): number;
38
+ toggleHeaderStyle(headerStateToToggle: TableCellHeaderState): TableCellNode;
39
+ hasHeaderState(headerState: TableCellHeaderState): boolean;
40
+ hasHeader(): boolean;
41
+ updateDOM(prevNode: TableCellNode): boolean;
42
+ collapseAtStart(): true;
43
+ canBeEmpty(): false;
44
+ canIndent(): false;
45
+ }
46
+ export declare function convertTableCellNodeElement(domNode: Node): DOMConversionOutput;
47
+ export declare function $createTableCellNode(headerState: TableCellHeaderState, colSpan?: number, width?: number): TableCellNode;
48
+ export declare function $isTableCellNode(node: LexicalNode | null | undefined): node is TableCellNode;
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { TableCellNode } from './LexicalTableCellNode';
9
+ import type { Cell, Grid } from './LexicalTableSelection';
10
+ import type { DOMConversionMap, DOMConversionOutput, DOMExportOutput, EditorConfig, LexicalEditor, LexicalNode, NodeKey, SerializedElementNode, Spread } from 'lexical';
11
+ import { GridNode } from 'lexical';
12
+ export declare type SerializedTableNode = Spread<{
13
+ type: 'table';
14
+ version: 1;
15
+ }, SerializedElementNode>;
16
+ export declare class TableNode extends GridNode {
17
+ __grid: Grid;
18
+ static getType(): 'table';
19
+ static clone(node: TableNode): TableNode;
20
+ static importDOM(): DOMConversionMap | null;
21
+ static importJSON(_serializedNode: SerializedTableNode): TableNode;
22
+ constructor(key?: NodeKey);
23
+ exportJSON(): SerializedElementNode;
24
+ createDOM(config: EditorConfig, editor?: LexicalEditor): HTMLElement;
25
+ updateDOM(): boolean;
26
+ exportDOM(editor: LexicalEditor): DOMExportOutput;
27
+ canExtractContents(): false;
28
+ canBeEmpty(): false;
29
+ getCordsFromCellNode(tableCellNode: TableCellNode, grid: Grid): {
30
+ x: number;
31
+ y: number;
32
+ };
33
+ getCellFromCords(x: number, y: number, grid: Grid): Cell | null;
34
+ getCellFromCordsOrThrow(x: number, y: number, grid: Grid): Cell;
35
+ getCellNodeFromCords(x: number, y: number, grid: Grid): TableCellNode | null;
36
+ getCellNodeFromCordsOrThrow(x: number, y: number, grid: Grid): TableCellNode;
37
+ canSelectBefore(): true;
38
+ canIndent(): false;
39
+ }
40
+ export declare function $getElementGridForTableNode(editor: LexicalEditor, tableNode: TableNode): Grid;
41
+ export declare function convertTableElement(_domNode: Node): DOMConversionOutput;
42
+ export declare function $createTableNode(): TableNode;
43
+ export declare function $isTableNode(node: LexicalNode | null | undefined): node is TableNode;
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { Spread } from 'lexical';
9
+ import { DOMConversionMap, DOMConversionOutput, EditorConfig, GridRowNode, LexicalNode, NodeKey, SerializedElementNode } from 'lexical';
10
+ export declare type SerializedTableRowNode = Spread<{
11
+ height: number;
12
+ type: 'tablerow';
13
+ version: 1;
14
+ }, SerializedElementNode>;
15
+ export declare class TableRowNode extends GridRowNode {
16
+ __height: number;
17
+ static getType(): 'tablerow';
18
+ static clone(node: TableRowNode): TableRowNode;
19
+ static importDOM(): DOMConversionMap | null;
20
+ static importJSON(serializedNode: SerializedTableRowNode): TableRowNode;
21
+ constructor(height?: number, key?: NodeKey);
22
+ exportJSON(): SerializedElementNode;
23
+ createDOM(config: EditorConfig): HTMLElement;
24
+ setHeight(height: number): number;
25
+ getHeight(): number;
26
+ updateDOM(prevNode: TableRowNode): boolean;
27
+ canBeEmpty(): false;
28
+ canIndent(): false;
29
+ }
30
+ export declare function convertTableRowElement(domNode: Node): DOMConversionOutput;
31
+ export declare function $createTableRowNode(height?: number): TableRowNode;
32
+ export declare function $isTableRowNode(node: LexicalNode | null | undefined): node is TableRowNode;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { GridSelection, LexicalEditor, NodeKey, TextFormatType } from 'lexical';
9
+ export declare type Cell = {
10
+ elem: HTMLElement;
11
+ highlighted: boolean;
12
+ x: number;
13
+ y: number;
14
+ };
15
+ export declare type Cells = Array<Array<Cell>>;
16
+ export declare type Grid = {
17
+ cells: Cells;
18
+ columns: number;
19
+ rows: number;
20
+ };
21
+ export declare class TableSelection {
22
+ currentX: number;
23
+ currentY: number;
24
+ listenersToRemove: Set<() => void>;
25
+ domListeners: Set<() => void>;
26
+ grid: Grid;
27
+ isHighlightingCells: boolean;
28
+ startX: number;
29
+ startY: number;
30
+ tableNodeKey: NodeKey;
31
+ anchorCell: Cell | null;
32
+ focusCell: Cell | null;
33
+ anchorCellNodeKey: NodeKey | null;
34
+ focusCellNodeKey: NodeKey | null;
35
+ editor: LexicalEditor;
36
+ gridSelection: GridSelection | null;
37
+ hasHijackedSelectionStyles: boolean;
38
+ constructor(editor: LexicalEditor, tableNodeKey: string);
39
+ getGrid(): Grid;
40
+ removeListeners(): void;
41
+ trackTableGrid(): void;
42
+ clearHighlight(): void;
43
+ enableHighlightStyle(): void;
44
+ disableHighlightStyle(): void;
45
+ updateTableGridSelection(selection: GridSelection | null): void;
46
+ adjustFocusCellForSelection(cell: Cell, ignoreStart?: boolean): void;
47
+ setAnchorCellForSelection(cell: Cell): void;
48
+ formatCells(type: TextFormatType): void;
49
+ clearText(): void;
50
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { TableNode } from './LexicalTableNode';
9
+ import type { Cell, Grid } from './LexicalTableSelection';
10
+ import type { GridSelection, LexicalEditor, LexicalNode, RangeSelection } from 'lexical';
11
+ import { TableSelection } from './LexicalTableSelection';
12
+ export declare function applyTableHandlers(tableNode: TableNode, tableElement: HTMLElement, editor: LexicalEditor): TableSelection;
13
+ export declare function attachTableSelectionToTableElement(tableElement: HTMLElement, tableSelection: TableSelection): void;
14
+ export declare function getTableSelectionFromTableElement(tableElement: HTMLElement): TableSelection;
15
+ export declare function getCellFromTarget(node: Node): Cell | null;
16
+ export declare function getTableGrid(tableElement: HTMLElement): Grid;
17
+ export declare function $updateDOMForSelection(grid: Grid, selection: GridSelection | RangeSelection | null): Array<Cell>;
18
+ export declare function $forEachGridCell(grid: Grid, cb: (cell: Cell, lexicalNode: LexicalNode, cords: {
19
+ x: number;
20
+ y: number;
21
+ }) => void): void;
22
+ export declare function $addHighlightStyleToTable(tableSelection: TableSelection): void;
23
+ export declare function $removeHighlightStyleToTable(tableSelection: TableSelection): void;
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { Grid } from './LexicalTableSelection';
9
+ import type { LexicalNode } from 'lexical';
10
+ import { TableCellNode } from './LexicalTableCellNode';
11
+ import { TableNode } from './LexicalTableNode';
12
+ import { TableRowNode } from './LexicalTableRowNode';
13
+ export declare function $createTableNodeWithDimensions(rowCount: number, columnCount: number, includeHeaders?: boolean): TableNode;
14
+ export declare function $getTableCellNodeFromLexicalNode(startingNode: LexicalNode): TableCellNode | null;
15
+ export declare function $getTableRowNodeFromTableCellNodeOrThrow(startingNode: LexicalNode): TableRowNode;
16
+ export declare function $getTableNodeFromLexicalNodeOrThrow(startingNode: LexicalNode): TableNode;
17
+ export declare function $getTableRowIndexFromTableCellNode(tableCellNode: TableCellNode): number;
18
+ export declare function $getTableColumnIndexFromTableCellNode(tableCellNode: TableCellNode): number;
19
+ export declare type TableCellSiblings = {
20
+ above: TableCellNode | null | undefined;
21
+ below: TableCellNode | null | undefined;
22
+ left: TableCellNode | null | undefined;
23
+ right: TableCellNode | null | undefined;
24
+ };
25
+ export declare function $getTableCellSiblingsFromTableCellNode(tableCellNode: TableCellNode, grid: Grid): TableCellSiblings;
26
+ export declare function $removeTableRowAtIndex(tableNode: TableNode, indexToDelete: number): TableNode;
27
+ export declare function $insertTableRow(tableNode: TableNode, targetIndex: number, shouldInsertAfter: boolean, rowCount: number, grid: Grid): TableNode;
28
+ export declare function $insertTableColumn(tableNode: TableNode, targetIndex: number, shouldInsertAfter: boolean, columnCount: number): TableNode;
29
+ export declare function $deleteTableColumn(tableNode: TableNode, targetIndex: number): TableNode;
package/index.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { Cell } from './LexicalTableSelection';
9
+ import type { LexicalCommand } from 'lexical';
10
+ import { $createTableCellNode, $isTableCellNode, TableCellHeaderStates, TableCellNode } from './LexicalTableCellNode';
11
+ import { $createTableNode, $getElementGridForTableNode, $isTableNode, TableNode } from './LexicalTableNode';
12
+ import { $createTableRowNode, $isTableRowNode, TableRowNode } from './LexicalTableRowNode';
13
+ import { TableSelection } from './LexicalTableSelection';
14
+ import { applyTableHandlers, getCellFromTarget, getTableSelectionFromTableElement } from './LexicalTableSelectionHelpers';
15
+ import { $createTableNodeWithDimensions, $deleteTableColumn, $getTableCellNodeFromLexicalNode, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $getTableRowNodeFromTableCellNodeOrThrow, $insertTableColumn, $insertTableRow, $removeTableRowAtIndex } from './LexicalTableUtils';
16
+ export { $createTableCellNode, $createTableNode, $createTableNodeWithDimensions, $createTableRowNode, $deleteTableColumn, $getElementGridForTableNode, $getTableCellNodeFromLexicalNode, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $getTableRowNodeFromTableCellNodeOrThrow, $insertTableColumn, $insertTableRow, $isTableCellNode, $isTableNode, $isTableRowNode, $removeTableRowAtIndex, applyTableHandlers, Cell, getCellFromTarget, getTableSelectionFromTableElement, TableCellHeaderStates, TableCellNode, TableNode, TableRowNode, TableSelection, };
17
+ export declare type InsertTableCommandPayload = Readonly<{
18
+ columns: string;
19
+ rows: string;
20
+ includeHeaders?: boolean;
21
+ }>;
22
+ export declare const INSERT_TABLE_COMMAND: LexicalCommand<InsertTableCommandPayload>;
package/package.json CHANGED
@@ -8,13 +8,13 @@
8
8
  "table"
9
9
  ],
10
10
  "license": "MIT",
11
- "version": "0.3.2",
11
+ "version": "0.3.5",
12
12
  "main": "LexicalTable.js",
13
13
  "peerDependencies": {
14
- "lexical": "0.3.2"
14
+ "lexical": "0.3.5"
15
15
  },
16
16
  "dependencies": {
17
- "@lexical/utils": "0.3.2"
17
+ "@lexical/utils": "0.3.5"
18
18
  },
19
19
  "repository": {
20
20
  "type": "git",
package/utils.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { Grid } from './LexicalTableSelection';
9
+ import type { LexicalNode } from 'lexical';
10
+ import { TableCellNode } from './LexicalTableCellNode';
11
+ import { TableNode } from './LexicalTableNode';
12
+ import { TableRowNode } from './LexicalTableRowNode';
13
+ export declare function $createTableNodeWithDimensions(rowCount: number, columnCount: number, includeHeaders?: boolean): TableNode;
14
+ export declare function $getTableCellNodeFromLexicalNode(startingNode: LexicalNode): TableCellNode | null;
15
+ export declare function $getTableRowNodeFromTableCellNodeOrThrow(startingNode: LexicalNode): TableRowNode;
16
+ export declare function $getTableNodeFromLexicalNodeOrThrow(startingNode: LexicalNode): TableNode;
17
+ export declare function $getTableRowIndexFromTableCellNode(tableCellNode: TableCellNode): number;
18
+ export declare function $getTableColumnIndexFromTableCellNode(tableCellNode: TableCellNode): number;
19
+ export declare type TableCellSiblings = {
20
+ above: TableCellNode | null | undefined;
21
+ below: TableCellNode | null | undefined;
22
+ left: TableCellNode | null | undefined;
23
+ right: TableCellNode | null | undefined;
24
+ };
25
+ export declare function $getTableCellSiblingsFromTableCellNode(tableCellNode: TableCellNode, grid: Grid): TableCellSiblings;
26
+ export declare function $removeTableRowAtIndex(tableNode: TableNode, indexToDelete: number): TableNode;
27
+ export declare function $insertTableRow(tableNode: TableNode, targetIndex: number, shouldInsertAfter: boolean, rowCount: number, grid: Grid): TableNode;
28
+ export declare function $insertTableColumn(tableNode: TableNode, targetIndex: number, shouldInsertAfter: boolean, columnCount: number): TableNode;
29
+ export declare function $deleteTableColumn(tableNode: TableNode, targetIndex: number): TableNode;
package/LexicalTable.d.ts DELETED
@@ -1,229 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
-
9
- import type {
10
- EditorConfig,
11
- LexicalNode,
12
- NodeKey,
13
- ParagraphNode,
14
- RangeSelection,
15
- ElementNode,
16
- LexicalEditor,
17
- TextFormatType,
18
- LexicalCommand,
19
- } from 'lexical';
20
-
21
- export enum TableCellHeaderStates {
22
- NO_STATUS = 0,
23
- ROW = 1,
24
- COLUMN = 2,
25
- BOTH = 3,
26
- }
27
-
28
- /**
29
- * LexicalTableCellNode
30
- */
31
- export declare class TableCellNode extends ElementNode {
32
- static getType(): string;
33
- static clone(node: TableCellNode): TableCellNode;
34
- constructor(
35
- headerState?: TableCellHeaderStates,
36
- colSpan?: number,
37
- width?: number | null | undefined,
38
- key?: NodeKey,
39
- );
40
- __headerState: TableCellHeaderStates;
41
- createDOM(config: EditorConfig): HTMLElement;
42
- updateDOM(prevNode: TableCellNode, dom: HTMLElement): boolean;
43
- insertNewAfter(
44
- selection: RangeSelection,
45
- ): null | ParagraphNode | TableCellNode;
46
- collapseAtStart(): true;
47
- getTag(): string;
48
- setHeaderState(headerState: TableCellHeaderStates): TableCellHeaderStates;
49
- getHeaderState(): TableCellHeaderStates;
50
- toggleHeaderState(headerState: TableCellHeaderStates): TableCellNode;
51
- hasHeader(): boolean;
52
- setWidth(width: number): number | null | undefined;
53
- getWidth(): number | null | undefined;
54
- toggleHeaderStyle(headerState: TableCellHeaderStates): TableCellNode;
55
- updateDOM(prevNode: TableCellNode): boolean;
56
- collapseAtStart(): true;
57
- canBeEmpty(): false;
58
- }
59
- declare function $createTableCellNode(
60
- headerState: TableCellHeaderStates,
61
- colSpan?: number,
62
- width?: number | null | undefined,
63
- ): TableCellNode;
64
- export declare function $isTableCellNode(
65
- node?: LexicalNode,
66
- ): node is TableCellNode;
67
-
68
- /**
69
- * LexicalTableNode
70
- */
71
- export declare class TableNode extends ElementNode {
72
- static getType(): string;
73
- static clone(node: TableNode): TableNode;
74
- constructor(grid?: Grid, key?: NodeKey);
75
- createDOM(config: EditorConfig): HTMLElement;
76
- updateDOM(prevNode: TableNode, dom: HTMLElement): boolean;
77
- insertNewAfter(selection: RangeSelection): null | ParagraphNode | TableNode;
78
- collapseAtStart(): true;
79
- getCordsFromCellNode(tableCellNode: TableCellNode): {x: number; y: number};
80
- getCellFromCords(x: number, y: number, grid: Grid): Cell | null | undefined;
81
- getCellFromCordsOrThrow(x: number, y: number, grid: Grid): Cell;
82
- getCellNodeFromCords(x: number, y: number): TableCellNode | null;
83
- getCellNodeFromCordsOrThrow(x: number, y: number): TableCellNode;
84
- setGrid(grid?: Grid): TableNode;
85
- getGrid(): Grid | null;
86
- canSelectBefore(): true;
87
- }
88
- declare function $createTableNode(): TableNode;
89
- declare function $isTableNode(node?: LexicalNode): node is TableNode;
90
-
91
- /**
92
- * LexicalTableRowNode
93
- */
94
-
95
- declare class TableRowNode extends ElementNode {
96
- static getType(): string;
97
- static clone(node: TableRowNode): TableRowNode;
98
- constructor(key?: NodeKey, height?: number | null | undefined);
99
- createDOM(config: EditorConfig): HTMLElement;
100
- updateDOM(prevNode: TableRowNode, dom: HTMLElement): boolean;
101
- insertNewAfter(
102
- selection: RangeSelection,
103
- ): null | ParagraphNode | TableRowNode;
104
- setHeight(height: number): number | null | undefined;
105
- getHeight(): number | null | undefined;
106
- collapseAtStart(): true;
107
- }
108
- declare function $createTableRowNode(): TableRowNode;
109
- declare function $isTableRowNode(node?: LexicalNode): node is TableRowNode;
110
-
111
- /**
112
- * LexicalTableSelectionHelpers
113
- */
114
- export type Cell = {
115
- elem: HTMLElement;
116
- highlighted: boolean;
117
- x: number;
118
- y: number;
119
- };
120
- export type Cells = Array<Array<Cell>>;
121
- export type Grid = {
122
- cells: Cells;
123
- columns: number;
124
- rows: number;
125
- };
126
-
127
- declare function applyTableHandlers(
128
- tableNode: TableNode,
129
- tableElement: HTMLElement,
130
- editor: LexicalEditor,
131
- ): TableSelection;
132
-
133
- declare function $getElementGridForTableNode(
134
- editor: LexicalEditor,
135
- tableNode: TableNode,
136
- ): Grid;
137
-
138
- declare function getTableSelectionFromTableElement(
139
- tableElement: HTMLElement,
140
- ): TableSelection;
141
-
142
- declare function getCellFromTarget(node: Node): Cell | null;
143
-
144
- /**
145
- * LexicalTableUtils
146
- */
147
-
148
- declare function $createTableNodeWithDimensions(
149
- rowCount: number,
150
- columnCount: number,
151
- includeHeaders?: boolean,
152
- ): TableNode;
153
-
154
- declare function $getTableCellNodeFromLexicalNode(
155
- startingNode: LexicalNode,
156
- ): TableCellNode | null;
157
-
158
- declare function $getTableRowNodeFromTableCellNodeOrThrow(
159
- startingNode: LexicalNode,
160
- ): TableRowNode;
161
-
162
- declare function $getTableNodeFromLexicalNodeOrThrow(
163
- startingNode: LexicalNode,
164
- ): TableNode;
165
-
166
- declare function $getTableRowIndexFromTableCellNode(
167
- tableCellNode: TableCellNode,
168
- ): number;
169
-
170
- declare function $getTableColumnIndexFromTableCellNode(
171
- tableCellNode: TableCellNode,
172
- ): number;
173
-
174
- declare function $removeTableRowAtIndex(
175
- tableNode: TableNode,
176
- indexToDelete: number,
177
- ): TableNode;
178
-
179
- declare function $insertTableRow(
180
- tableNode: TableNode,
181
- targetIndex: number,
182
- shouldInsertAfter: boolean,
183
- rowCount: number,
184
- grid: Grid,
185
- ): TableNode;
186
-
187
- declare function $insertTableColumn(
188
- tableNode: TableNode,
189
- targetIndex: number,
190
- shouldInsertAfter: boolean,
191
- columnCount: number,
192
- ): TableNode;
193
-
194
- declare function $deleteTableColumn(
195
- tableNode: TableNode,
196
- targetIndex: number,
197
- ): TableNode;
198
-
199
- /**
200
- * LexicalTableSelection.js
201
- */
202
- export declare class TableSelection {
203
- currentX: number;
204
- currentY: number;
205
- listenersToRemove: Set<() => void>;
206
- domListeners: Set<() => void>;
207
- grid: Grid;
208
- isHighlightingCells: boolean;
209
- isMouseDown: boolean;
210
- startX: number;
211
- startY: number;
212
- nodeKey: string;
213
- editor: LexicalEditor;
214
- constructor(editor: LexicalEditor, nodeKey: string);
215
- getGrid(): Grid;
216
- removeListeners(): void;
217
- trackTableGrid(): void;
218
- clearHighlight(): void;
219
- adjustFocusCellForSelection(cell: Cell): void;
220
- setAnchorCellForSelection(cell: Cell): void;
221
- formatCells(type: TextFormatType): void;
222
- clearText(): void;
223
- }
224
- export type InsertTableCommandPayload = Readonly<{
225
- columns: string;
226
- rows: string;
227
- includeHeaders?: boolean;
228
- }>;
229
- export const INSERT_TABLE_COMMAND: LexicalCommand<InsertTableCommandPayload>;