mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-24 07:45:57 +02:00
Delete active note on shortcut (#156)
Press `ctrl+shift+del` to move the active note to the trash. Reviewed-on: https://codeberg.org/ArkHost/HelixNotes/pulls/156
This commit is contained in:
@@ -425,6 +425,13 @@
|
|||||||
editor?.addLinkFromToolbar();
|
editor?.addLinkFromToolbar();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ctrl/Cmd+Shift+Delete: move the open note to the trash.
|
||||||
|
if (mod && e.shiftKey && code === 'Delete' && $activeNotePath) {
|
||||||
|
e.preventDefault();
|
||||||
|
noteList?.trashActiveNote();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const action = matchAction(e, $keybindings);
|
const action = matchAction(e, $keybindings);
|
||||||
if (action) {
|
if (action) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
@@ -473,6 +473,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Move the currently open note to the trash (keyboard shortcut from the editor).
|
||||||
|
export async function trashActiveNote() {
|
||||||
|
if ($viewMode === 'trash' || !$activeNotePath) return;
|
||||||
|
const note = $notes.find(n => n.path === $activeNotePath);
|
||||||
|
if (note) await handleDelete(note);
|
||||||
|
}
|
||||||
|
|
||||||
async function handleRestore(note: NoteEntry) {
|
async function handleRestore(note: NoteEntry) {
|
||||||
contextMenu = null;
|
contextMenu = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user