feat: remove tag on backspace press

This commit is contained in:
Antonella Sgarlatta
2021-05-26 17:49:09 -03:00
parent d6f1cc3730
commit 69c9247cd9
3 changed files with 25 additions and 3 deletions

View File

@@ -158,7 +158,7 @@ export class NotesState {
reloadActiveNoteTags(): void {
const { activeNote } = this;
if (activeNote) {
this.activeNoteTags = this.application.getSortedTagsForNote(activeNote)
this.activeNoteTags = this.application.getSortedTagsForNote(activeNote);
}
}
@@ -379,6 +379,18 @@ export class NotesState {
}
}
async removeTagFromActiveNote(tag: SNTag): Promise<void> {
const { activeNote } = this;
if (activeNote) {
await this.application.changeItem(tag.uuid, (mutator) => {
mutator.removeItemAsRelationship(activeNote);
});
this.application.sync();
this.reloadActiveNoteTags();
}
}
setShowProtectedWarning(show: boolean): void {
this.showProtectedWarning = show;
}