fix-ignore-editor-hotkeys-in-inputs
This commit is contained in:
parent
b252a80a8e
commit
3ea6aa8fb3
@ -21,15 +21,16 @@ export function bindEditorHotkeys(getShift: () => boolean, dispatch: (a: EditorA
|
|||||||
const onKeyDown = (e: KeyboardEvent) => {
|
const onKeyDown = (e: KeyboardEvent) => {
|
||||||
const ctrl = e.ctrlKey || e.metaKey;
|
const ctrl = e.ctrlKey || e.metaKey;
|
||||||
|
|
||||||
|
// Do not steal common hotkeys while typing in an input/editor.
|
||||||
|
// (Including Escape: inputs often use it to revert/blur.)
|
||||||
|
if (isEditableTarget(e.target)) return;
|
||||||
|
|
||||||
// Esc: clear selection (and closes context menu via selection parity effect).
|
// Esc: clear selection (and closes context menu via selection parity effect).
|
||||||
if (e.key === 'Escape') {
|
if (e.key === 'Escape') {
|
||||||
dispatch({ type: 'selectSingle', id: undefined });
|
dispatch({ type: 'selectSingle', id: undefined });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not steal common hotkeys while typing in an input/editor.
|
|
||||||
if (isEditableTarget(e.target)) return;
|
|
||||||
|
|
||||||
// Undo/redo
|
// Undo/redo
|
||||||
if (ctrl && e.key.toLowerCase() === 'z') {
|
if (ctrl && e.key.toLowerCase() === 'z') {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user