mirror of
https://github.com/ankitects/anki.git
synced 2026-01-07 02:53:54 -05:00
Added: Delete current note
This commit is contained in:
parent
5523482121
commit
d549112a6b
3 changed files with 11 additions and 1 deletions
|
|
@ -765,6 +765,7 @@ exposed_backend_list = [
|
|||
# NotesService
|
||||
"get_field_names",
|
||||
"get_note",
|
||||
"remove_notes",
|
||||
# NotetypesService
|
||||
"get_notetype_names",
|
||||
"get_change_notetype_info",
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
{
|
||||
name: tr.studyingDeleteNote(),
|
||||
shortcut: /* isMac ? "Ctrl+Backspace" :*/ "Ctrl+Delete",
|
||||
onClick: todo,
|
||||
onClick: state.deleteCurrentNote.bind(state),
|
||||
},
|
||||
|
||||
"hr",
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
openReviewerMenu,
|
||||
playAvtags,
|
||||
redo,
|
||||
removeNotes,
|
||||
setConfigJson,
|
||||
undo,
|
||||
} from "@generated/backend";
|
||||
|
|
@ -150,6 +151,14 @@ export class ReviewerState {
|
|||
}
|
||||
}
|
||||
|
||||
public async deleteCurrentNote() {
|
||||
if (this.currentCard?.card?.noteId) {
|
||||
const op = await removeNotes({ noteIds: [this.currentCard.card.noteId], cardIds: [] });
|
||||
this.showTooltip(tr.browsingCardsDeleted({ count: op.count }));
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
async handleKeyPress(key: string, ctrl: boolean, shift: boolean) {
|
||||
key = key.toLowerCase();
|
||||
switch (key) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue