From 1295db8283c825e08c38729d8ecf14b24eb76108 Mon Sep 17 00:00:00 2001 From: Joscha Date: Fri, 7 Feb 2025 21:43:15 +0100 Subject: [PATCH] Refactor child note editor I plan on using the same editor component when editing a note itself, in which case the plus symbol and padding is unnecessary. The editor is meant to be used in-place of note text. --- gdn-app/src/components/CNote.vue | 27 ++++++++++++------- .../{CNoteCreator.vue => CNoteEditor.vue} | 27 +++++++------------ 2 files changed, 28 insertions(+), 26 deletions(-) rename gdn-app/src/components/{CNoteCreator.vue => CNoteEditor.vue} (67%) diff --git a/gdn-app/src/components/CNote.vue b/gdn-app/src/components/CNote.vue index 8f90605..3836719 100644 --- a/gdn-app/src/components/CNote.vue +++ b/gdn-app/src/components/CNote.vue @@ -3,13 +3,14 @@ import { useNotesStore } from "@/stores/notes"; import { useUiStore } from "@/stores/ui"; import { pathAppend } from "@/util"; import { + RiAddLine, RiArrowDownSLine, RiArrowRightSLine, RiStickyNoteAddLine, } from "@remixicon/vue"; import { computed, ref, watchEffect } from "vue"; import CNoteButton from "./CNoteButton.vue"; -import CNoteCreator from "./CNoteCreator.vue"; +import CNoteEditor from "./CNoteEditor.vue"; const notes = useNotesStore(); const ui = useUiStore(); @@ -76,14 +77,14 @@ function onClick() { toggleOpen(); } -function onCreatorClose() { +function onChildEditorClose() { creating.value = false; } -function onCreatorFinish(text: string) { +function onChildEditorFinish(text: string) { notes.appendNewChildNote(props.noteId, text); ui.focusPath = pathAppend(props.path, children.value.length - 1); - onCreatorClose(); + onChildEditorClose(); } @@ -128,11 +129,19 @@ function onCreatorFinish(text: string) { /> -
- +
+ +
+
+ +
+
+ +
diff --git a/gdn-app/src/components/CNoteCreator.vue b/gdn-app/src/components/CNoteEditor.vue similarity index 67% rename from gdn-app/src/components/CNoteCreator.vue rename to gdn-app/src/components/CNoteEditor.vue index cd0f116..d9a1c5e 100644 --- a/gdn-app/src/components/CNoteCreator.vue +++ b/gdn-app/src/components/CNoteEditor.vue @@ -1,5 +1,5 @@