From fb82331db801b7ddc35d0e7857530d77307a1d1f Mon Sep 17 00:00:00 2001 From: Ivaylo Pavlov Date: Thu, 22 Aug 2024 20:01:39 +0300 Subject: [PATCH] [lexical-table] Stop selecting the whole table after pasting cells (#6539) --- .../src/LexicalTableSelectionHelpers.ts | 22 +------------------ 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/packages/lexical-table/src/LexicalTableSelectionHelpers.ts b/packages/lexical-table/src/LexicalTableSelectionHelpers.ts index 0edd2747b30..53ee28115b8 100644 --- a/packages/lexical-table/src/LexicalTableSelectionHelpers.ts +++ b/packages/lexical-table/src/LexicalTableSelectionHelpers.ts @@ -69,10 +69,7 @@ import {$isTableCellNode} from './LexicalTableCellNode'; import {$isTableNode} from './LexicalTableNode'; import {TableDOMTable, TableObserver} from './LexicalTableObserver'; import {$isTableRowNode} from './LexicalTableRowNode'; -import { - $createTableSelection, - $isTableSelection, -} from './LexicalTableSelection'; +import {$isTableSelection} from './LexicalTableSelection'; import {$computeTableMap, $getNodeTriplet} from './LexicalTableUtils'; const LEXICAL_ELEMENT_KEY = '__lexicalTableSelection'; @@ -672,8 +669,6 @@ export function applyTableHandlers( const toY = Math.max(startY, stopY); const gridRowNodes = gridNode.getChildren(); let newRowIdx = 0; - let newAnchorCellKey; - let newFocusCellKey; for (let r = fromY; r <= toY; r++) { const currentGridRowNode = gridRowNodes[r]; @@ -705,12 +700,6 @@ export function applyTableHandlers( return false; } - if (r === fromY && c === fromX) { - newAnchorCellKey = currentGridCellNode.getKey(); - } else if (r === toY && c === toX) { - newFocusCellKey = currentGridCellNode.getKey(); - } - const originalChildren = currentGridCellNode.getChildren(); newGridCellNode.getChildren().forEach((child) => { if ($isTextNode(child)) { @@ -727,15 +716,6 @@ export function applyTableHandlers( newRowIdx++; } - if (newAnchorCellKey && newFocusCellKey) { - const newTableSelection = $createTableSelection(); - newTableSelection.set( - nodes[0].getKey(), - newAnchorCellKey, - newFocusCellKey, - ); - $setSelection(newTableSelection); - } return true; }, COMMAND_PRIORITY_CRITICAL,