Skip to content

Commit

Permalink
Dont lose table selection when focus changes (facebook#1766)
Browse files Browse the repository at this point in the history
* Add tests for special Table selection behavior

* Dont lose table selection when focus changes

* Update packages/lexical-table/src/LexicalTableSelectionHelpers.js

Co-authored-by: Strek <harish.sethuraman@freshworks.com>

Co-authored-by: Strek <harish.sethuraman@freshworks.com>
  • Loading branch information
tylerjbainbridge and Strek authored Apr 15, 2022
1 parent 7aa228d commit 69997ae
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions packages/lexical-table/src/LexicalTableSelectionHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
$isRangeSelection,
$setSelection,
DELETE_CHARACTER_COMMAND,
FOCUS_COMMAND,
FORMAT_TEXT_COMMAND,
INSERT_TEXT_COMMAND,
KEY_ARROW_DOWN_COMMAND,
Expand Down Expand Up @@ -778,6 +779,16 @@ export function applyTableHandlers(
),
);

tableSelection.listenersToRemove.add(
editor.registerCommand(
FOCUS_COMMAND,
(payload) => {
return tableNode.isSelected();
},
CriticalPriority,
),
);

tableSelection.listenersToRemove.add(
editor.registerCommand(
SELECTION_CHANGE_COMMAND,
Expand Down

0 comments on commit 69997ae

Please sign in to comment.