From 05e012c93e11dc9145fd8e4f0a72072eb40aecc8 Mon Sep 17 00:00:00 2001 From: Guilhem Date: Wed, 12 Nov 2025 17:00:16 +0100 Subject: [PATCH] improve note select --- frontend/src/lib/components/graph/FlowGraphV2.svelte | 11 +---------- .../src/lib/components/graph/noteManager.svelte.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/frontend/src/lib/components/graph/FlowGraphV2.svelte b/frontend/src/lib/components/graph/FlowGraphV2.svelte index 700925cc2c..93901cff0e 100644 --- a/frontend/src/lib/components/graph/FlowGraphV2.svelte +++ b/frontend/src/lib/components/graph/FlowGraphV2.svelte @@ -480,10 +480,7 @@ // Keyboard event handling function handleKeyDown(event: KeyboardEvent) { selectionManager.handleKeyDown(event, nodes) - } - - function handleKeyUp(_event: KeyboardEvent) { - // Keep for potential future use + noteManager.handleKeyDown(event) } async function updateStores() { @@ -666,16 +663,10 @@ } } - function globalKeyUpHandler(event: KeyboardEvent) { - handleKeyUp(event) - } - document.addEventListener('keydown', globalKeyDownHandler) - document.addEventListener('keyup', globalKeyUpHandler) return () => { document.removeEventListener('keydown', globalKeyDownHandler) - document.removeEventListener('keyup', globalKeyUpHandler) } }) diff --git a/frontend/src/lib/components/graph/noteManager.svelte.ts b/frontend/src/lib/components/graph/noteManager.svelte.ts index fe36244425..9b7225885d 100644 --- a/frontend/src/lib/components/graph/noteManager.svelte.ts +++ b/frontend/src/lib/components/graph/noteManager.svelte.ts @@ -334,4 +334,12 @@ export class NoteManager { isNoteSelected(noteId: string): boolean { return this.selectedNoteId === noteId } + + // Handle keyboard shortcuts + handleKeyDown(event: KeyboardEvent) { + if (event.key === 'Escape') { + // Escape key clears selection regardless of mode + this.clearNoteSelection() + } + } }