@lexical/table 0.48.0 → 0.48.1-nightly.20260720.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/dist/LexicalTable.dev.js +311 -113
- package/dist/LexicalTable.dev.mjs +311 -115
- package/dist/LexicalTable.js.flow +5 -6
- package/dist/LexicalTable.mjs +2 -0
- package/dist/LexicalTable.node.mjs +2 -0
- package/dist/LexicalTable.prod.js +1 -1
- package/dist/LexicalTable.prod.mjs +1 -1
- package/dist/LexicalTableCellNode.d.ts +28 -5
- package/dist/LexicalTableExtension.d.ts +13 -0
- package/dist/LexicalTableNode.d.ts +30 -7
- package/dist/LexicalTableRowNode.d.ts +21 -6
- package/dist/LexicalTableSelection.d.ts +12 -0
- package/dist/LexicalTableUtils.d.ts +4 -0
- package/dist/index.d.ts +3 -2
- package/package.json +7 -7
- package/src/LexicalTableCellNode.ts +14 -29
- package/src/LexicalTableExtension.ts +100 -0
- package/src/LexicalTableNode.ts +234 -43
- package/src/LexicalTableRowNode.ts +13 -21
- package/src/LexicalTableSelection.ts +17 -7
- package/src/LexicalTableSelectionHelpers.ts +2 -62
- package/src/LexicalTableUtils.ts +4 -0
- package/src/index.ts +3 -0
|
@@ -72,7 +72,6 @@ import {
|
|
|
72
72
|
KEY_DELETE_COMMAND,
|
|
73
73
|
KEY_ESCAPE_COMMAND,
|
|
74
74
|
KEY_TAB_COMMAND,
|
|
75
|
-
type LexicalCommand,
|
|
76
75
|
type LexicalEditor,
|
|
77
76
|
type LexicalNode,
|
|
78
77
|
type NodeKey,
|
|
@@ -673,7 +672,7 @@ export function applyTableHandlers(
|
|
|
673
672
|
),
|
|
674
673
|
);
|
|
675
674
|
|
|
676
|
-
const deleteTextHandler = (
|
|
675
|
+
const $deleteTextHandler = () => {
|
|
677
676
|
const selection = $getSelection();
|
|
678
677
|
|
|
679
678
|
if (!$isSelectionInTable(selection, tableNode)) {
|
|
@@ -684,56 +683,6 @@ export function applyTableHandlers(
|
|
|
684
683
|
tableObserver.$clearText();
|
|
685
684
|
|
|
686
685
|
return true;
|
|
687
|
-
} else if ($isRangeSelection(selection)) {
|
|
688
|
-
const tableCellNode = $findParentTableCellNodeInTable(
|
|
689
|
-
tableNode,
|
|
690
|
-
selection.anchor.getNode(),
|
|
691
|
-
);
|
|
692
|
-
|
|
693
|
-
if (!$isTableCellNode(tableCellNode)) {
|
|
694
|
-
return false;
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
const anchorNode = selection.anchor.getNode();
|
|
698
|
-
const focusNode = selection.focus.getNode();
|
|
699
|
-
const isAnchorInside = tableNode.isParentOf(anchorNode);
|
|
700
|
-
const isFocusInside = tableNode.isParentOf(focusNode);
|
|
701
|
-
|
|
702
|
-
const selectionContainsPartialTable =
|
|
703
|
-
(isAnchorInside && !isFocusInside) ||
|
|
704
|
-
(isFocusInside && !isAnchorInside);
|
|
705
|
-
|
|
706
|
-
if (selectionContainsPartialTable) {
|
|
707
|
-
tableObserver.$clearText();
|
|
708
|
-
return true;
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
const nearestElementNode = $findMatchingParent(
|
|
712
|
-
selection.anchor.getNode(),
|
|
713
|
-
n => $isElementNode(n),
|
|
714
|
-
);
|
|
715
|
-
|
|
716
|
-
const topLevelCellElementNode =
|
|
717
|
-
nearestElementNode &&
|
|
718
|
-
$findMatchingParent(
|
|
719
|
-
nearestElementNode,
|
|
720
|
-
n => $isElementNode(n) && $isTableCellNode(n.getParent()),
|
|
721
|
-
);
|
|
722
|
-
|
|
723
|
-
if (
|
|
724
|
-
!$isElementNode(topLevelCellElementNode) ||
|
|
725
|
-
!$isElementNode(nearestElementNode)
|
|
726
|
-
) {
|
|
727
|
-
return false;
|
|
728
|
-
}
|
|
729
|
-
|
|
730
|
-
if (
|
|
731
|
-
command === DELETE_LINE_COMMAND &&
|
|
732
|
-
topLevelCellElementNode.getPreviousSibling() === null
|
|
733
|
-
) {
|
|
734
|
-
// TODO: Fix Delete Line in Table Cells.
|
|
735
|
-
return true;
|
|
736
|
-
}
|
|
737
686
|
}
|
|
738
687
|
|
|
739
688
|
return false;
|
|
@@ -743,7 +692,7 @@ export function applyTableHandlers(
|
|
|
743
692
|
tableObserver.listenersToRemove.add(
|
|
744
693
|
editor.registerCommand(
|
|
745
694
|
command,
|
|
746
|
-
deleteTextHandler
|
|
695
|
+
$deleteTextHandler,
|
|
747
696
|
COMMAND_PRIORITY_HIGH,
|
|
748
697
|
),
|
|
749
698
|
);
|
|
@@ -907,15 +856,6 @@ export function applyTableHandlers(
|
|
|
907
856
|
tableObserver.$formatCells(payload);
|
|
908
857
|
|
|
909
858
|
return true;
|
|
910
|
-
} else if ($isRangeSelection(selection)) {
|
|
911
|
-
const tableCellNode = $findMatchingParent(
|
|
912
|
-
selection.anchor.getNode(),
|
|
913
|
-
n => $isTableCellNode(n),
|
|
914
|
-
);
|
|
915
|
-
|
|
916
|
-
if (!$isTableCellNode(tableCellNode)) {
|
|
917
|
-
return false;
|
|
918
|
-
}
|
|
919
859
|
}
|
|
920
860
|
|
|
921
861
|
return false;
|
package/src/LexicalTableUtils.ts
CHANGED
|
@@ -1197,6 +1197,10 @@ export function $computeTableCellRectSpans(
|
|
|
1197
1197
|
return {bottomSpan, leftSpan, rightSpan, topSpan};
|
|
1198
1198
|
}
|
|
1199
1199
|
|
|
1200
|
+
/**
|
|
1201
|
+
* Compute the bounding rectangle of two table cells in a table map,
|
|
1202
|
+
* expanding iteratively to include any merged cells that overlap the boundary.
|
|
1203
|
+
*/
|
|
1200
1204
|
export function $computeTableCellRectBoundary(
|
|
1201
1205
|
map: TableMapType,
|
|
1202
1206
|
cellAMap: TableMapValueType,
|
package/src/index.ts
CHANGED
|
@@ -28,6 +28,7 @@ export {
|
|
|
28
28
|
$createTableNode,
|
|
29
29
|
$getElementForTableNode,
|
|
30
30
|
$isScrollableTablesActive,
|
|
31
|
+
$isStickyScrollbarActive,
|
|
31
32
|
$isTableNode,
|
|
32
33
|
setScrollableTablesActive,
|
|
33
34
|
TableNode,
|
|
@@ -65,7 +66,9 @@ export {
|
|
|
65
66
|
getTableElement,
|
|
66
67
|
getTableObserverFromTableElement,
|
|
67
68
|
} from './LexicalTableSelectionHelpers';
|
|
69
|
+
export type {TableCellRectBoundary} from './LexicalTableUtils';
|
|
68
70
|
export {
|
|
71
|
+
$computeTableCellRectBoundary,
|
|
69
72
|
$computeTableMap,
|
|
70
73
|
$computeTableMapSkipCellCheck,
|
|
71
74
|
$createTableNodeWithDimensions,
|