Skip to content

Commit

Permalink
[lexical][lexical-table] Bug fix: TablePlugin: - check is current sel…
Browse files Browse the repository at this point in the history
…ection in target table node (#6979)

Co-authored-by: alazarev <[email protected]>
  • Loading branch information
Ulop and alazarev authored Dec 20, 2024
1 parent 62b3713 commit 23715f5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 0 additions & 3 deletions packages/lexical-table/src/LexicalTableObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import {
$createTextNode,
$getEditor,
$getNodeByKey,
$getRoot,
$getSelection,
$isElementNode,
$isParagraphNode,
Expand Down Expand Up @@ -470,8 +469,6 @@ export class TableObserver {
tableNode.selectPrevious();
// Delete entire table
tableNode.remove();
const rootNode = $getRoot();
rootNode.selectStart();
return;
}

Expand Down
4 changes: 4 additions & 0 deletions packages/lexical-table/src/LexicalTableSelectionHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,10 @@ export function applyTableHandlers(
return false;
}

if (!$isSelectionInTable(selection, tableNode)) {
return false;
}

if ($isTableSelection(selection)) {
if (event) {
event.preventDefault();
Expand Down

0 comments on commit 23715f5

Please sign in to comment.