From 16805c96aa8852800bead0c53e1fb4b419219bbe Mon Sep 17 00:00:00 2001 From: mf Date: Wed, 24 Jun 2026 21:00:33 +0200 Subject: [PATCH] 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 --- src/lib/components/AppLayout.svelte | 7 +++++++ src/lib/components/NoteList.svelte | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/lib/components/AppLayout.svelte b/src/lib/components/AppLayout.svelte index 8a92e4e..7bdfc25 100644 --- a/src/lib/components/AppLayout.svelte +++ b/src/lib/components/AppLayout.svelte @@ -425,6 +425,13 @@ 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); if (action) { e.preventDefault(); diff --git a/src/lib/components/NoteList.svelte b/src/lib/components/NoteList.svelte index e2c8b83..5dbc2a8 100644 --- a/src/lib/components/NoteList.svelte +++ b/src/lib/components/NoteList.svelte @@ -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) { contextMenu = null; try {