From c7452166e089f35f5c9babf8b1f8ef5f68ffbbdd Mon Sep 17 00:00:00 2001 From: Joscha Date: Wed, 12 Feb 2025 12:54:45 +0100 Subject: [PATCH] Implement node movement and copying --- gdn-app/src/components/CNote.vue | 29 +++ gdn-app/src/components/CNoteChildEditor.vue | 9 +- gdn-app/src/components/CNoteEditor.vue | 19 +- gdn-app/src/stores/notes.ts | 23 +++ gdn-app/src/stores/pinned.ts | 188 ++++++++++++++++++++ gdn-app/src/stores/ui.ts | 1 - 6 files changed, 260 insertions(+), 9 deletions(-) create mode 100644 gdn-app/src/stores/pinned.ts diff --git a/gdn-app/src/components/CNote.vue b/gdn-app/src/components/CNote.vue index 434f296..ca28302 100644 --- a/gdn-app/src/components/CNote.vue +++ b/gdn-app/src/components/CNote.vue @@ -137,6 +137,29 @@ function onInsertEditorFinish(text: string): void { onInsertEditorClose(); } + +function onInsertEditorMove(): void { + if (!ui.pinned) return; + if (insertIndex.value === undefined) return; + + if (ui.pinned.parentId) { + notes.removeChild(ui.pinned.parentId, ui.pinned.segment); + } + + notes.addChild(segment.id, ui.pinned.segment.id, insertIndex.value); + + onInsertEditorClose(); + ui.unsetPinned(); +} + +function onInsertEditorCopy(): void { + if (!ui.pinned) return; + if (insertIndex.value === undefined) return; + + notes.addChild(segment.id, ui.pinned.segment.id, insertIndex.value); + + onInsertEditorClose(); +} diff --git a/gdn-app/src/components/CNoteEditor.vue b/gdn-app/src/components/CNoteEditor.vue index 908504a..8974f77 100644 --- a/gdn-app/src/components/CNoteEditor.vue +++ b/gdn-app/src/components/CNoteEditor.vue @@ -1,14 +1,15 @@