diff --git a/gdn-app/src/components/CNote.vue b/gdn-app/src/components/CNote.vue
index 9ec7f79..0c5a649 100644
--- a/gdn-app/src/components/CNote.vue
+++ b/gdn-app/src/components/CNote.vue
@@ -12,6 +12,7 @@ import {
RiCornerUpRightLine,
RiDeleteBinLine,
RiEditLine,
+ RiLinkUnlinkM,
RiPushpinFill,
RiPushpinLine,
} from "@remixicon/vue";
@@ -83,6 +84,15 @@ function onClick(): void {
ui.toggleOpen(path);
}
+function onDeleteButtonClick(): void {
+ notes.deleteNote(segment.id);
+}
+
+function onUnlinkButtonClick(): void {
+ if (parentId === undefined) return;
+ notes.removeChild(parentId, segment);
+}
+
function onEditButtonClick(): void {
if (!note.value) return;
ui.edit(path);
@@ -208,9 +218,12 @@ function onInsertEditorCopy(): void {
-
+
+
+
+
diff --git a/gdn-app/src/stores/notes.ts b/gdn-app/src/stores/notes.ts
index 61a3d02..d556fc0 100644
--- a/gdn-app/src/stores/notes.ts
+++ b/gdn-app/src/stores/notes.ts
@@ -38,8 +38,12 @@ export const useNotesStore = defineStore("notes", () => {
return notes.value.get(id)!; // Re-getting so returned Note is reactive
}
- function clearNotes(): void {
- notes.value.clear();
+ function deleteNote(id: string): void {
+ for (const note of notes.value.values()) {
+ note.children = note.children.filter((it) => it !== id);
+ }
+
+ notes.value.delete(id);
}
function addChild(id: string, childId: string, index: number): void {
@@ -83,13 +87,18 @@ export const useNotesStore = defineStore("notes", () => {
to.children.splice(toIndex, 0, segment.id);
}
+ function clearNotes(): void {
+ notes.value.clear();
+ }
+
return {
getNote,
getParents,
createNote,
- clearNotes,
+ deleteNote,
addChild,
removeChild,
moveChild,
+ clearNotes,
};
});