mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-09 16:50:28 +03:00
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:
parent
2c7038cd1f
commit
ccfe30cd68
4 changed files with 84 additions and 49 deletions
|
|
@ -20,6 +20,7 @@ import { useKeyDown } from '../../hooks/useKeyDown';
|
|||
import { editableActiveElement } from '../../utils/dom';
|
||||
import navigation from '../../../client/state/navigation';
|
||||
|
||||
const FN_KEYS_REGEX = /^F\d+$/;
|
||||
const shouldFocusMessageField = (evt: KeyboardEvent): boolean => {
|
||||
const { code } = evt;
|
||||
if (evt.metaKey || evt.altKey || evt.ctrlKey) {
|
||||
|
|
@ -27,7 +28,7 @@ const shouldFocusMessageField = (evt: KeyboardEvent): boolean => {
|
|||
}
|
||||
|
||||
// do not focus on F keys
|
||||
if (/^F\d+$/.test(code)) return false;
|
||||
if (FN_KEYS_REGEX.test(code)) return false;
|
||||
|
||||
// do not focus on numlock/scroll lock
|
||||
if (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue