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:
mf
2026-06-24 21:00:33 +02:00
committed by ArkHost
parent 9f2e0ba8b6
commit 16805c96aa
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -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();
+7
View File
@@ -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 {