Skip to content

Commit d83bde3

Browse files
authored
Support backward selection in rows deletion (#6680)
1 parent 7717ee7 commit d83bde3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/lexical-table/src/LexicalTableUtils.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,9 @@ export function $deleteTableRow__EXPERIMENTAL(): void {
510510
$isRangeSelection(selection) || $isTableSelection(selection),
511511
'Expected a RangeSelection or TableSelection',
512512
);
513-
const anchor = selection.anchor.getNode();
514-
const focus = selection.focus.getNode();
513+
const [anchor, focus] = selection.isBackward()
514+
? [selection.focus.getNode(), selection.anchor.getNode()]
515+
: [selection.anchor.getNode(), selection.focus.getNode()];
515516
const [anchorCell, , grid] = $getNodeTriplet(anchor);
516517
const [focusCell] = $getNodeTriplet(focus);
517518
const [gridMap, anchorCellMap, focusCellMap] = $computeTableMap(

0 commit comments

Comments
 (0)