From 88eebf6944d0fbdbc3d9e272fa768c2e7774984d Mon Sep 17 00:00:00 2001 From: Anders Holck Date: Fri, 22 May 2026 20:08:09 +0200 Subject: [PATCH] Drag and drop files between folders --- frontend/src/App.vue | 18 ++++++++++-- frontend/src/components/FileTree.vue | 42 ++++++++++++++++++++++++---- internal/api/handlers.go | 18 ++++++++++++ internal/api/router.go | 1 + internal/files/files.go | 13 +++++++++ 5 files changed, 85 insertions(+), 7 deletions(-) diff --git a/frontend/src/App.vue b/frontend/src/App.vue index 2e625bf..76ab0ce 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -18,8 +18,8 @@ - - + +
@@ -361,6 +361,20 @@ async function deleteItem(item) { await loadFiles() } +async function moveFile({ from, to }) { + const filename = from.split('/').pop() + const newPath = to + '/' + filename + try { + await api('/api/files/move', { from, to: newPath }) + if (currentFile.value === from) { + currentFile.value = newPath + } + await loadFiles() + } catch (e) { + alert('Move failed') + } +} + // ─── Shared ────────────────────────────────────────────────────────────────── async function loadShared() { diff --git a/frontend/src/components/FileTree.vue b/frontend/src/components/FileTree.vue index aff2688..5e0ba07 100644 --- a/frontend/src/components/FileTree.vue +++ b/frontend/src/components/FileTree.vue @@ -3,36 +3,67 @@
{{ item.isDir ? (expanded[item.path] ? '📂' : '📁') : '📄' }} {{ item.name }}
- +