Skip to content

Commit

Permalink
TablePlugin: - check is current selection in target table node
Browse files Browse the repository at this point in the history
  • Loading branch information
alazarev committed Dec 19, 2024
1 parent 62b3713 commit 8fb7683
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 8fb7683

Please sign in to comment.