From 44b270e2c2fb7e6cae33462314d720a0c68aa050 Mon Sep 17 00:00:00 2001 From: vcoppe Date: Tue, 21 May 2024 13:22:14 +0200 Subject: [PATCH] working file tree --- website/src/lib/components/App.svelte | 5 +- .../{FileList2.svelte => FileList.svelte} | 8 +- .../components/file-list/FileListNode.svelte | 21 +-- .../file-list/FileListNodeContent.svelte | 129 ++++++++++++++---- .../file-list/FileListNodeLabel.svelte | 35 +++++ 5 files changed, 156 insertions(+), 42 deletions(-) rename website/src/lib/components/file-list/{FileList2.svelte => FileList.svelte} (60%) create mode 100644 website/src/lib/components/file-list/FileListNodeLabel.svelte diff --git a/website/src/lib/components/App.svelte b/website/src/lib/components/App.svelte index a88486a4..23c5e40c 100644 --- a/website/src/lib/components/App.svelte +++ b/website/src/lib/components/App.svelte @@ -1,14 +1,13 @@
@@ -26,7 +25,7 @@
- + diff --git a/website/src/lib/components/file-list/FileListNodeLabel.svelte b/website/src/lib/components/file-list/FileListNodeLabel.svelte new file mode 100644 index 00000000..2e1d1d3f --- /dev/null +++ b/website/src/lib/components/file-list/FileListNodeLabel.svelte @@ -0,0 +1,35 @@ + + + + + { + e.stopPropagation(); // Avoid toggling the collapsible element + }} + on:contextmenu={(e) => { + if (e.ctrlKey) { + // Add to selection instead of opening context menu + e.preventDefault(); + e.stopPropagation(); + selected.update((value) => { + if (value.has(id)) { + value.delete(id); + } else { + value.add(id); + } + return value; + }); + } + }} +> + {label} +