Fix hotkeys breaking newline handling

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2023-07-04 23:39:39 +02:00
parent 5161b3cba9
commit eedd894ba8

View file

@ -474,7 +474,10 @@ const AutosuggestPlugin = ({
} }
}, [resolution, suggestionsHidden, suggestions.isEmpty()]); }, [resolution, suggestionsHidden, suggestions.isEmpty()]);
useEffect(() => mergeRegister( useEffect(() => {
if (resolution === null) return;
return mergeRegister(
editor.registerCommand<KeyboardEvent>( editor.registerCommand<KeyboardEvent>(
KEY_ARROW_UP_COMMAND, KEY_ARROW_UP_COMMAND,
(payload) => { (payload) => {
@ -542,7 +545,8 @@ const AutosuggestPlugin = ({
}, },
COMMAND_PRIORITY_LOW, COMMAND_PRIORITY_LOW,
), ),
), [editor, selectedSuggestion]); );
}, [editor, selectedSuggestion, resolution]);
return resolution === null || editor === null ? null : ( return resolution === null || editor === null ? null : (
<LexicalPopoverMenu <LexicalPopoverMenu