fix: disable delete note shortcut for inputs

This commit is contained in:
Antonella Sgarlatta
2021-07-05 14:43:09 -03:00
parent 3f94636615
commit 1be87cbef8
2 changed files with 6 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ type KeyboardObserver = {
elements?: HTMLElement[];
notElement?: HTMLElement;
notElementIds?: string[];
notTags?: string[];
};
export class IOService {
@@ -175,6 +176,10 @@ export class IOService {
continue;
}
if (observer.notTags && observer.notTags.includes(target.tagName)) {
continue;
}
if (
this.eventMatchesKeyAndModifiers(
event,

View File

@@ -863,7 +863,7 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
.io
.addKeyObserver({
key: KeyboardKey.Backspace,
notElementIds: [ElementIds.NoteTextEditor, ElementIds.NoteTitleEditor],
notTags: ['INPUT', 'TEXTAREA'],
modifiers: [KeyboardModifier.Meta],
onKeyDown: () => {
this.deleteNote(false);