Fix editor focus after autocomplete (#2233)

* upgrade slatejs

* collapse autocomplete on escape

* make FN_KEYS_REGEX const in module scope
This commit is contained in:
Ajay Bura 2025-02-26 21:42:42 +11:00 committed by GitHub
parent 2c7038cd1f
commit ccfe30cd68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 84 additions and 49 deletions

View file

@ -353,10 +353,14 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
}
if (isKeyHotkey('escape', evt)) {
evt.preventDefault();
if (autocompleteQuery) {
setAutocompleteQuery(undefined);
return;
}
setReplyDraft(undefined);
}
},
[submit, setReplyDraft, enterForNewline]
[submit, setReplyDraft, enterForNewline, autocompleteQuery]
);
const handleKeyUp: KeyboardEventHandler = useCallback(