fix: disable delete note shortcut for inputs
This commit is contained in:
@@ -28,6 +28,7 @@ type KeyboardObserver = {
|
|||||||
elements?: HTMLElement[];
|
elements?: HTMLElement[];
|
||||||
notElement?: HTMLElement;
|
notElement?: HTMLElement;
|
||||||
notElementIds?: string[];
|
notElementIds?: string[];
|
||||||
|
notTags?: string[];
|
||||||
};
|
};
|
||||||
|
|
||||||
export class IOService {
|
export class IOService {
|
||||||
@@ -175,6 +176,10 @@ export class IOService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (observer.notTags && observer.notTags.includes(target.tagName)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
this.eventMatchesKeyAndModifiers(
|
this.eventMatchesKeyAndModifiers(
|
||||||
event,
|
event,
|
||||||
|
|||||||
@@ -863,7 +863,7 @@ class EditorViewCtrl extends PureViewCtrl<unknown, EditorState> {
|
|||||||
.io
|
.io
|
||||||
.addKeyObserver({
|
.addKeyObserver({
|
||||||
key: KeyboardKey.Backspace,
|
key: KeyboardKey.Backspace,
|
||||||
notElementIds: [ElementIds.NoteTextEditor, ElementIds.NoteTitleEditor],
|
notTags: ['INPUT', 'TEXTAREA'],
|
||||||
modifiers: [KeyboardModifier.Meta],
|
modifiers: [KeyboardModifier.Meta],
|
||||||
onKeyDown: () => {
|
onKeyDown: () => {
|
||||||
this.deleteNote(false);
|
this.deleteNote(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user