@lexical/table 0.14.5 → 0.16.0
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.
- package/LexicalTable.dev.js +90 -35
- package/LexicalTable.dev.mjs +91 -37
- package/LexicalTable.js +2 -0
- package/LexicalTable.mjs +3 -0
- package/LexicalTable.node.mjs +3 -0
- package/LexicalTable.prod.js +78 -76
- package/LexicalTable.prod.mjs +3 -1
- package/LexicalTableCellNode.d.ts +1 -1
- package/LexicalTableNode.d.ts +1 -1
- package/LexicalTableRowNode.d.ts +1 -1
- package/LexicalTableUtils.d.ts +1 -0
- package/constants.d.ts +1 -0
- package/index.d.ts +2 -2
- package/package.json +3 -3
package/LexicalTable.dev.mjs
CHANGED
@@ -3,9 +3,11 @@
|
|
3
3
|
*
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
6
7
|
*/
|
8
|
+
|
7
9
|
import { addClassNamesToElement, $findMatchingParent, removeClassNamesFromElement, isHTMLElement } from '@lexical/utils';
|
8
|
-
import { ElementNode, $
|
10
|
+
import { ElementNode, $createParagraphNode, $isElementNode, $isLineBreakNode, $isTextNode, $applyNodeReplacement, createCommand, $createTextNode, $getSelection, $isRangeSelection, $createPoint, $normalizeSelection__EXPERIMENTAL, $getNodeByKey, isCurrentlyReadOnlyMode, $setSelection, SELECTION_CHANGE_COMMAND, $getNearestNodeFromDOMNode, $createRangeSelection, $getRoot, KEY_ARROW_DOWN_COMMAND, COMMAND_PRIORITY_HIGH, KEY_ARROW_UP_COMMAND, KEY_ARROW_LEFT_COMMAND, KEY_ARROW_RIGHT_COMMAND, KEY_ESCAPE_COMMAND, DELETE_WORD_COMMAND, DELETE_LINE_COMMAND, DELETE_CHARACTER_COMMAND, COMMAND_PRIORITY_CRITICAL, KEY_BACKSPACE_COMMAND, KEY_DELETE_COMMAND, FORMAT_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, CONTROLLED_TEXT_INSERTION_COMMAND, KEY_TAB_COMMAND, FOCUS_COMMAND, SELECTION_INSERT_CLIPBOARD_NODES_COMMAND, $getPreviousSelection, $createRangeSelectionFromDom, INSERT_PARAGRAPH_COMMAND, $isDecoratorNode } from 'lexical';
|
9
11
|
|
10
12
|
/**
|
11
13
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
@@ -17,6 +19,10 @@ import { ElementNode, $applyNodeReplacement, $createParagraphNode, $isElementNod
|
|
17
19
|
|
18
20
|
const PIXEL_VALUE_REG_EXP = /^(\d+(?:\.\d+)?)px$/;
|
19
21
|
|
22
|
+
// .PlaygroundEditorTheme__tableCell width value from
|
23
|
+
// packages/lexical-playground/src/themes/PlaygroundEditorTheme.css
|
24
|
+
const COLUMN_WIDTH = 75;
|
25
|
+
|
20
26
|
/**
|
21
27
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
22
28
|
*
|
@@ -24,6 +30,7 @@ const PIXEL_VALUE_REG_EXP = /^(\d+(?:\.\d+)?)px$/;
|
|
24
30
|
* LICENSE file in the root directory of this source tree.
|
25
31
|
*
|
26
32
|
*/
|
33
|
+
|
27
34
|
const TableCellHeaderStates = {
|
28
35
|
BOTH: 3,
|
29
36
|
COLUMN: 2,
|
@@ -54,11 +61,11 @@ class TableCellNode extends ElementNode {
|
|
54
61
|
static importDOM() {
|
55
62
|
return {
|
56
63
|
td: node => ({
|
57
|
-
conversion: convertTableCellNodeElement,
|
64
|
+
conversion: $convertTableCellNodeElement,
|
58
65
|
priority: 0
|
59
66
|
}),
|
60
67
|
th: node => ({
|
61
|
-
conversion: convertTableCellNodeElement,
|
68
|
+
conversion: $convertTableCellNodeElement,
|
62
69
|
priority: 0
|
63
70
|
})
|
64
71
|
};
|
@@ -102,8 +109,6 @@ class TableCellNode extends ElementNode {
|
|
102
109
|
} = super.exportDOM(editor);
|
103
110
|
if (element) {
|
104
111
|
const element_ = element;
|
105
|
-
const maxWidth = 700;
|
106
|
-
const colCount = this.getParentOrThrow().getChildrenSize();
|
107
112
|
element_.style.border = '1px solid black';
|
108
113
|
if (this.__colSpan > 1) {
|
109
114
|
element_.colSpan = this.__colSpan;
|
@@ -111,7 +116,7 @@ class TableCellNode extends ElementNode {
|
|
111
116
|
if (this.__rowSpan > 1) {
|
112
117
|
element_.rowSpan = this.__rowSpan;
|
113
118
|
}
|
114
|
-
element_.style.width = `${this.getWidth() ||
|
119
|
+
element_.style.width = `${this.getWidth() || COLUMN_WIDTH}px`;
|
115
120
|
element_.style.verticalAlign = 'top';
|
116
121
|
element_.style.textAlign = 'start';
|
117
122
|
const backgroundColor = this.getBackgroundColor();
|
@@ -206,7 +211,7 @@ class TableCellNode extends ElementNode {
|
|
206
211
|
return false;
|
207
212
|
}
|
208
213
|
}
|
209
|
-
function convertTableCellNodeElement(domNode) {
|
214
|
+
function $convertTableCellNodeElement(domNode) {
|
210
215
|
const domNode_ = domNode;
|
211
216
|
const nodeName = domNode.nodeName.toLowerCase();
|
212
217
|
let width = undefined;
|
@@ -220,10 +225,11 @@ function convertTableCellNodeElement(domNode) {
|
|
220
225
|
tableCellNode.__backgroundColor = backgroundColor;
|
221
226
|
}
|
222
227
|
const style = domNode_.style;
|
228
|
+
const textDecoration = style.textDecoration.split(' ');
|
223
229
|
const hasBoldFontWeight = style.fontWeight === '700' || style.fontWeight === 'bold';
|
224
|
-
const hasLinethroughTextDecoration =
|
230
|
+
const hasLinethroughTextDecoration = textDecoration.includes('line-through');
|
225
231
|
const hasItalicFontStyle = style.fontStyle === 'italic';
|
226
|
-
const hasUnderlineTextDecoration =
|
232
|
+
const hasUnderlineTextDecoration = textDecoration.includes('underline');
|
227
233
|
return {
|
228
234
|
after: childLexicalNodes => {
|
229
235
|
if (childLexicalNodes.length === 0) {
|
@@ -273,6 +279,7 @@ function $isTableCellNode(node) {
|
|
273
279
|
* LICENSE file in the root directory of this source tree.
|
274
280
|
*
|
275
281
|
*/
|
282
|
+
|
276
283
|
const INSERT_TABLE_COMMAND = createCommand('INSERT_TABLE_COMMAND');
|
277
284
|
|
278
285
|
/**
|
@@ -282,6 +289,7 @@ const INSERT_TABLE_COMMAND = createCommand('INSERT_TABLE_COMMAND');
|
|
282
289
|
* LICENSE file in the root directory of this source tree.
|
283
290
|
*
|
284
291
|
*/
|
292
|
+
|
285
293
|
/** @noInheritDoc */
|
286
294
|
class TableRowNode extends ElementNode {
|
287
295
|
/** @internal */
|
@@ -295,7 +303,7 @@ class TableRowNode extends ElementNode {
|
|
295
303
|
static importDOM() {
|
296
304
|
return {
|
297
305
|
tr: node => ({
|
298
|
-
conversion: convertTableRowElement,
|
306
|
+
conversion: $convertTableRowElement,
|
299
307
|
priority: 0
|
300
308
|
})
|
301
309
|
};
|
@@ -346,7 +354,7 @@ class TableRowNode extends ElementNode {
|
|
346
354
|
return false;
|
347
355
|
}
|
348
356
|
}
|
349
|
-
function convertTableRowElement(domNode) {
|
357
|
+
function $convertTableRowElement(domNode) {
|
350
358
|
const domNode_ = domNode;
|
351
359
|
let height = undefined;
|
352
360
|
if (PIXEL_VALUE_REG_EXP.test(domNode_.style.height)) {
|
@@ -380,6 +388,7 @@ const CAN_USE_DOM = typeof window !== 'undefined' && typeof window.document !==
|
|
380
388
|
* LICENSE file in the root directory of this source tree.
|
381
389
|
*
|
382
390
|
*/
|
391
|
+
|
383
392
|
function $createTableNodeWithDimensions(rowCount, columnCount, includeHeaders = true) {
|
384
393
|
const tableNode = $createTableNode();
|
385
394
|
for (let iRow = 0; iRow < rowCount; iRow++) {
|
@@ -912,6 +921,16 @@ function $unmergeCell() {
|
|
912
921
|
}
|
913
922
|
}
|
914
923
|
function $computeTableMap(grid, cellA, cellB) {
|
924
|
+
const [tableMap, cellAValue, cellBValue] = $computeTableMapSkipCellCheck(grid, cellA, cellB);
|
925
|
+
if (!(cellAValue !== null)) {
|
926
|
+
throw Error(`Anchor not found in Grid`);
|
927
|
+
}
|
928
|
+
if (!(cellBValue !== null)) {
|
929
|
+
throw Error(`Focus not found in Grid`);
|
930
|
+
}
|
931
|
+
return [tableMap, cellAValue, cellBValue];
|
932
|
+
}
|
933
|
+
function $computeTableMapSkipCellCheck(grid, cellA, cellB) {
|
915
934
|
const tableMap = [];
|
916
935
|
let cellAValue = null;
|
917
936
|
let cellBValue = null;
|
@@ -931,10 +950,10 @@ function $computeTableMap(grid, cellA, cellB) {
|
|
931
950
|
tableMap[startRow + i][startColumn + j] = value;
|
932
951
|
}
|
933
952
|
}
|
934
|
-
if (cellA.is(cell)) {
|
953
|
+
if (cellA !== null && cellA.is(cell)) {
|
935
954
|
cellAValue = value;
|
936
955
|
}
|
937
|
-
if (cellB.is(cell)) {
|
956
|
+
if (cellB !== null && cellB.is(cell)) {
|
938
957
|
cellBValue = value;
|
939
958
|
}
|
940
959
|
}
|
@@ -960,12 +979,6 @@ function $computeTableMap(grid, cellA, cellB) {
|
|
960
979
|
j += cell.__colSpan;
|
961
980
|
}
|
962
981
|
}
|
963
|
-
if (!(cellAValue !== null)) {
|
964
|
-
throw Error(`Anchor not found in Grid`);
|
965
|
-
}
|
966
|
-
if (!(cellBValue !== null)) {
|
967
|
-
throw Error(`Focus not found in Grid`);
|
968
|
-
}
|
969
982
|
return [tableMap, cellAValue, cellBValue];
|
970
983
|
}
|
971
984
|
function $getNodeTriplet(source) {
|
@@ -1048,6 +1061,7 @@ function $getTableCellNodeRect(tableCellNode) {
|
|
1048
1061
|
* LICENSE file in the root directory of this source tree.
|
1049
1062
|
*
|
1050
1063
|
*/
|
1064
|
+
|
1051
1065
|
class TableSelection {
|
1052
1066
|
constructor(tableKey, anchor, focus) {
|
1053
1067
|
this.anchor = anchor;
|
@@ -1313,6 +1327,7 @@ function $getChildrenRecursively(node) {
|
|
1313
1327
|
* LICENSE file in the root directory of this source tree.
|
1314
1328
|
*
|
1315
1329
|
*/
|
1330
|
+
|
1316
1331
|
class TableObserver {
|
1317
1332
|
constructor(editor, tableNodeKey) {
|
1318
1333
|
this.isHighlightingCells = false;
|
@@ -1351,7 +1366,7 @@ class TableObserver {
|
|
1351
1366
|
const record = records[i];
|
1352
1367
|
const target = record.target;
|
1353
1368
|
const nodeName = target.nodeName;
|
1354
|
-
if (nodeName === 'TABLE' || nodeName === 'TR') {
|
1369
|
+
if (nodeName === 'TABLE' || nodeName === 'TBODY' || nodeName === 'THEAD' || nodeName === 'TR') {
|
1355
1370
|
gridNeedsRedraw = true;
|
1356
1371
|
break;
|
1357
1372
|
}
|
@@ -1572,8 +1587,12 @@ class TableObserver {
|
|
1572
1587
|
* LICENSE file in the root directory of this source tree.
|
1573
1588
|
*
|
1574
1589
|
*/
|
1590
|
+
|
1575
1591
|
const LEXICAL_ELEMENT_KEY = '__lexicalTableSelection';
|
1576
1592
|
const getDOMSelection = targetWindow => CAN_USE_DOM ? (targetWindow || window).getSelection() : null;
|
1593
|
+
const isMouseDownOnEvent = event => {
|
1594
|
+
return (event.buttons & 1) === 1;
|
1595
|
+
};
|
1577
1596
|
function applyTableHandlers(tableNode, tableElement, editor, hasTabHandler) {
|
1578
1597
|
const rootElement = editor.getRootElement();
|
1579
1598
|
if (rootElement === null) {
|
@@ -1589,11 +1608,20 @@ function applyTableHandlers(tableNode, tableElement, editor, hasTabHandler) {
|
|
1589
1608
|
editorWindow.removeEventListener('mousemove', onMouseMove);
|
1590
1609
|
};
|
1591
1610
|
const onMouseMove = moveEvent => {
|
1592
|
-
|
1593
|
-
|
1594
|
-
moveEvent.
|
1595
|
-
|
1596
|
-
|
1611
|
+
// delaying mousemove handler to allow selectionchange handler from LexicalEvents.ts to be executed first
|
1612
|
+
setTimeout(() => {
|
1613
|
+
if (!isMouseDownOnEvent(moveEvent) && tableObserver.isSelecting) {
|
1614
|
+
tableObserver.isSelecting = false;
|
1615
|
+
editorWindow.removeEventListener('mouseup', onMouseUp);
|
1616
|
+
editorWindow.removeEventListener('mousemove', onMouseMove);
|
1617
|
+
return;
|
1618
|
+
}
|
1619
|
+
const focusCell = getDOMCellFromTarget(moveEvent.target);
|
1620
|
+
if (focusCell !== null && (tableObserver.anchorX !== focusCell.x || tableObserver.anchorY !== focusCell.y)) {
|
1621
|
+
moveEvent.preventDefault();
|
1622
|
+
tableObserver.setFocusCellForSelection(focusCell);
|
1623
|
+
}
|
1624
|
+
}, 0);
|
1597
1625
|
};
|
1598
1626
|
return {
|
1599
1627
|
onMouseMove: onMouseMove,
|
@@ -1691,7 +1719,7 @@ function applyTableHandlers(tableNode, tableElement, editor, hasTabHandler) {
|
|
1691
1719
|
[DELETE_WORD_COMMAND, DELETE_LINE_COMMAND, DELETE_CHARACTER_COMMAND].forEach(command => {
|
1692
1720
|
tableObserver.listenersToRemove.add(editor.registerCommand(command, deleteTextHandler(command), COMMAND_PRIORITY_CRITICAL));
|
1693
1721
|
});
|
1694
|
-
const deleteCellHandler = event => {
|
1722
|
+
const $deleteCellHandler = event => {
|
1695
1723
|
const selection = $getSelection();
|
1696
1724
|
if (!$isSelectionInTable(selection, tableNode)) {
|
1697
1725
|
return false;
|
@@ -1709,8 +1737,8 @@ function applyTableHandlers(tableNode, tableElement, editor, hasTabHandler) {
|
|
1709
1737
|
}
|
1710
1738
|
return false;
|
1711
1739
|
};
|
1712
|
-
tableObserver.listenersToRemove.add(editor.registerCommand(KEY_BACKSPACE_COMMAND, deleteCellHandler, COMMAND_PRIORITY_CRITICAL));
|
1713
|
-
tableObserver.listenersToRemove.add(editor.registerCommand(KEY_DELETE_COMMAND, deleteCellHandler, COMMAND_PRIORITY_CRITICAL));
|
1740
|
+
tableObserver.listenersToRemove.add(editor.registerCommand(KEY_BACKSPACE_COMMAND, $deleteCellHandler, COMMAND_PRIORITY_CRITICAL));
|
1741
|
+
tableObserver.listenersToRemove.add(editor.registerCommand(KEY_DELETE_COMMAND, $deleteCellHandler, COMMAND_PRIORITY_CRITICAL));
|
1714
1742
|
tableObserver.listenersToRemove.add(editor.registerCommand(FORMAT_TEXT_COMMAND, payload => {
|
1715
1743
|
const selection = $getSelection();
|
1716
1744
|
if (!$isSelectionInTable(selection, tableNode)) {
|
@@ -1908,7 +1936,7 @@ function applyTableHandlers(tableNode, tableElement, editor, hasTabHandler) {
|
|
1908
1936
|
if (isPartialyWithinTable) {
|
1909
1937
|
const newSelection = selection.clone();
|
1910
1938
|
if (isFocusInside) {
|
1911
|
-
newSelection.focus.set(tableNode.getParentOrThrow().getKey(),
|
1939
|
+
newSelection.focus.set(tableNode.getParentOrThrow().getKey(), tableNode.getIndexWithinParent(), 'element');
|
1912
1940
|
} else {
|
1913
1941
|
newSelection.anchor.set(tableNode.getParentOrThrow().getKey(), isBackward ? tableNode.getIndexWithinParent() + 1 : tableNode.getIndexWithinParent(), 'element');
|
1914
1942
|
}
|
@@ -2232,6 +2260,9 @@ function $findTableNode(node) {
|
|
2232
2260
|
return $isTableNode(tableNode) ? tableNode : null;
|
2233
2261
|
}
|
2234
2262
|
function $handleArrowKey(editor, event, direction, tableNode, tableObserver) {
|
2263
|
+
if ((direction === 'up' || direction === 'down') && isTypeaheadMenuInView(editor)) {
|
2264
|
+
return false;
|
2265
|
+
}
|
2235
2266
|
const selection = $getSelection();
|
2236
2267
|
if (!$isSelectionInTable(selection, tableNode)) {
|
2237
2268
|
if (direction === 'backward' && $isRangeSelection(selection) && selection.isCollapsed()) {
|
@@ -2283,6 +2314,10 @@ function $handleArrowKey(editor, event, direction, tableNode, tableObserver) {
|
|
2283
2314
|
if (!anchorNode) {
|
2284
2315
|
return false;
|
2285
2316
|
}
|
2317
|
+
const selectedNodes = selection.getNodes();
|
2318
|
+
if (selectedNodes.length === 1 && $isDecoratorNode(selectedNodes[0])) {
|
2319
|
+
return false;
|
2320
|
+
}
|
2286
2321
|
if (isExitingTableAnchor(anchorType, anchorOffset, anchorNode, direction)) {
|
2287
2322
|
return $handleTableExit(event, anchorNode, tableNode, direction);
|
2288
2323
|
}
|
@@ -2359,13 +2394,22 @@ function stopEvent(event) {
|
|
2359
2394
|
event.stopImmediatePropagation();
|
2360
2395
|
event.stopPropagation();
|
2361
2396
|
}
|
2397
|
+
function isTypeaheadMenuInView(editor) {
|
2398
|
+
// There is no inbuilt way to check if the component picker is in view
|
2399
|
+
// but we can check if the root DOM element has the aria-controls attribute "typeahead-menu".
|
2400
|
+
const root = editor.getRootElement();
|
2401
|
+
if (!root) {
|
2402
|
+
return false;
|
2403
|
+
}
|
2404
|
+
return root.hasAttribute('aria-controls') && root.getAttribute('aria-controls') === 'typeahead-menu';
|
2405
|
+
}
|
2362
2406
|
function isExitingTableAnchor(type, offset, anchorNode, direction) {
|
2363
|
-
return isExitingTableElementAnchor(type, anchorNode, direction) || isExitingTableTextAnchor(type, offset, anchorNode, direction);
|
2407
|
+
return isExitingTableElementAnchor(type, anchorNode, direction) || $isExitingTableTextAnchor(type, offset, anchorNode, direction);
|
2364
2408
|
}
|
2365
2409
|
function isExitingTableElementAnchor(type, anchorNode, direction) {
|
2366
2410
|
return type === 'element' && (direction === 'backward' ? anchorNode.getPreviousSibling() === null : anchorNode.getNextSibling() === null);
|
2367
2411
|
}
|
2368
|
-
function isExitingTableTextAnchor(type, offset, anchorNode, direction) {
|
2412
|
+
function $isExitingTableTextAnchor(type, offset, anchorNode, direction) {
|
2369
2413
|
const parentNode = $findMatchingParent(anchorNode, n => $isElementNode(n) && !n.isInline());
|
2370
2414
|
if (!parentNode) {
|
2371
2415
|
return false;
|
@@ -2382,7 +2426,7 @@ function $handleTableExit(event, anchorNode, tableNode, direction) {
|
|
2382
2426
|
if (!isExitingCell(tableMap, cellValue, direction)) {
|
2383
2427
|
return false;
|
2384
2428
|
}
|
2385
|
-
const toNode = getExitingToNode(anchorNode, direction, tableNode);
|
2429
|
+
const toNode = $getExitingToNode(anchorNode, direction, tableNode);
|
2386
2430
|
if (!toNode || $isTableNode(toNode)) {
|
2387
2431
|
return false;
|
2388
2432
|
}
|
@@ -2403,7 +2447,7 @@ function isExitingCell(tableMap, cellValue, direction) {
|
|
2403
2447
|
} = cellValue;
|
2404
2448
|
return direction === 'backward' ? startColumn === firstCell.startColumn && startRow === firstCell.startRow : startColumn === lastCell.startColumn && startRow === lastCell.startRow;
|
2405
2449
|
}
|
2406
|
-
function getExitingToNode(anchorNode, direction, tableNode) {
|
2450
|
+
function $getExitingToNode(anchorNode, direction, tableNode) {
|
2407
2451
|
const parentNode = $findMatchingParent(anchorNode, n => $isElementNode(n) && !n.isInline());
|
2408
2452
|
if (!parentNode) {
|
2409
2453
|
return undefined;
|
@@ -2422,9 +2466,18 @@ function $insertParagraphAtTableEdge(edgePosition, tableNode, children) {
|
|
2422
2466
|
paragraphNode.selectEnd();
|
2423
2467
|
}
|
2424
2468
|
function $getTableEdgeCursorPosition(editor, selection, tableNode) {
|
2469
|
+
const tableNodeParent = tableNode.getParent();
|
2470
|
+
if (!tableNodeParent) {
|
2471
|
+
return undefined;
|
2472
|
+
}
|
2473
|
+
const tableNodeParentDOM = editor.getElementByKey(tableNodeParent.getKey());
|
2474
|
+
if (!tableNodeParentDOM) {
|
2475
|
+
return undefined;
|
2476
|
+
}
|
2477
|
+
|
2425
2478
|
// TODO: Add support for nested tables
|
2426
2479
|
const domSelection = window.getSelection();
|
2427
|
-
if (!domSelection || domSelection.anchorNode !==
|
2480
|
+
if (!domSelection || domSelection.anchorNode !== tableNodeParentDOM) {
|
2428
2481
|
return undefined;
|
2429
2482
|
}
|
2430
2483
|
const anchorCellNode = $findMatchingParent(selection.anchor.getNode(), n => $isTableCellNode(n));
|
@@ -2460,6 +2513,7 @@ function $getTableEdgeCursorPosition(editor, selection, tableNode) {
|
|
2460
2513
|
* LICENSE file in the root directory of this source tree.
|
2461
2514
|
*
|
2462
2515
|
*/
|
2516
|
+
|
2463
2517
|
/** @noInheritDoc */
|
2464
2518
|
class TableNode extends ElementNode {
|
2465
2519
|
static getType() {
|
@@ -2471,7 +2525,7 @@ class TableNode extends ElementNode {
|
|
2471
2525
|
static importDOM() {
|
2472
2526
|
return {
|
2473
2527
|
table: _node => ({
|
2474
|
-
conversion: convertTableElement,
|
2528
|
+
conversion: $convertTableElement,
|
2475
2529
|
priority: 1
|
2476
2530
|
})
|
2477
2531
|
};
|
@@ -2611,7 +2665,7 @@ function $getElementForTableNode(editor, tableNode) {
|
|
2611
2665
|
}
|
2612
2666
|
return getTable(tableElement);
|
2613
2667
|
}
|
2614
|
-
function convertTableElement(_domNode) {
|
2668
|
+
function $convertTableElement(_domNode) {
|
2615
2669
|
return {
|
2616
2670
|
node: $createTableNode()
|
2617
2671
|
};
|
@@ -2623,4 +2677,4 @@ function $isTableNode(node) {
|
|
2623
2677
|
return node instanceof TableNode;
|
2624
2678
|
}
|
2625
2679
|
|
2626
|
-
export { $computeTableMap, $createTableCellNode, $createTableNode, $createTableNodeWithDimensions, $createTableRowNode, $createTableSelection, $deleteTableColumn, $deleteTableColumn__EXPERIMENTAL, $deleteTableRow__EXPERIMENTAL, $getElementForTableNode, $getNodeTriplet, $getTableCellNodeFromLexicalNode, $getTableCellNodeRect, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $getTableRowNodeFromTableCellNodeOrThrow, $insertTableColumn, $insertTableColumn__EXPERIMENTAL, $insertTableRow, $insertTableRow__EXPERIMENTAL, $isTableCellNode, $isTableNode, $isTableRowNode, $isTableSelection, $removeTableRowAtIndex, $unmergeCell, INSERT_TABLE_COMMAND, TableCellHeaderStates, TableCellNode, TableNode, TableObserver, TableRowNode, applyTableHandlers, getDOMCellFromTarget, getTableObserverFromTableElement };
|
2680
|
+
export { $computeTableMap, $computeTableMapSkipCellCheck, $createTableCellNode, $createTableNode, $createTableNodeWithDimensions, $createTableRowNode, $createTableSelection, $deleteTableColumn, $deleteTableColumn__EXPERIMENTAL, $deleteTableRow__EXPERIMENTAL, $getElementForTableNode, $getNodeTriplet, $getTableCellNodeFromLexicalNode, $getTableCellNodeRect, $getTableColumnIndexFromTableCellNode, $getTableNodeFromLexicalNodeOrThrow, $getTableRowIndexFromTableCellNode, $getTableRowNodeFromTableCellNodeOrThrow, $insertTableColumn, $insertTableColumn__EXPERIMENTAL, $insertTableRow, $insertTableRow__EXPERIMENTAL, $isTableCellNode, $isTableNode, $isTableRowNode, $isTableSelection, $removeTableRowAtIndex, $unmergeCell, INSERT_TABLE_COMMAND, TableCellHeaderStates, TableCellNode, TableNode, TableObserver, TableRowNode, applyTableHandlers, getDOMCellFromTarget, getTableObserverFromTableElement };
|
package/LexicalTable.js
CHANGED
@@ -3,7 +3,9 @@
|
|
3
3
|
*
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
6
7
|
*/
|
8
|
+
|
7
9
|
'use strict'
|
8
10
|
const LexicalTable = process.env.NODE_ENV === 'development' ? require('./LexicalTable.dev.js') : require('./LexicalTable.prod.js');
|
9
11
|
module.exports = LexicalTable;
|
package/LexicalTable.mjs
CHANGED
@@ -3,11 +3,14 @@
|
|
3
3
|
*
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
6
7
|
*/
|
8
|
+
|
7
9
|
import * as modDev from './LexicalTable.dev.mjs';
|
8
10
|
import * as modProd from './LexicalTable.prod.mjs';
|
9
11
|
const mod = process.env.NODE_ENV === 'development' ? modDev : modProd;
|
10
12
|
export const $computeTableMap = mod.$computeTableMap;
|
13
|
+
export const $computeTableMapSkipCellCheck = mod.$computeTableMapSkipCellCheck;
|
11
14
|
export const $createTableCellNode = mod.$createTableCellNode;
|
12
15
|
export const $createTableNode = mod.$createTableNode;
|
13
16
|
export const $createTableNodeWithDimensions = mod.$createTableNodeWithDimensions;
|
package/LexicalTable.node.mjs
CHANGED
@@ -3,9 +3,12 @@
|
|
3
3
|
*
|
4
4
|
* This source code is licensed under the MIT license found in the
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
6
|
+
*
|
6
7
|
*/
|
8
|
+
|
7
9
|
const mod = await (process.env.NODE_ENV === 'development' ? import('./LexicalTable.dev.mjs') : import('./LexicalTable.prod.mjs'));
|
8
10
|
export const $computeTableMap = mod.$computeTableMap;
|
11
|
+
export const $computeTableMapSkipCellCheck = mod.$computeTableMapSkipCellCheck;
|
9
12
|
export const $createTableCellNode = mod.$createTableCellNode;
|
10
13
|
export const $createTableNode = mod.$createTableNode;
|
11
14
|
export const $createTableNodeWithDimensions = mod.$createTableNodeWithDimensions;
|