From 8e0f392aabe73a2f9f30f27d9f3a1c693d10bede Mon Sep 17 00:00:00 2001 From: Laila Los <44241786+ElectronicBlueberry@users.noreply.github.com> Date: Wed, 14 Feb 2024 13:33:55 +0100 Subject: [PATCH 1/5] persist up to 500 tags in client database --- client/package.json | 1 + .../TagsMultiselect/HeadlessMultiselect.vue | 3 + .../TagsMultiselect/StatelessTags.vue | 11 +- client/src/stores/userTagsStore.ts | 129 ++++++++++++++++-- client/yarn.lock | 12 ++ 5 files changed, 138 insertions(+), 18 deletions(-) diff --git a/client/package.json b/client/package.json index 07df904d9eea..74a927ee93f8 100644 --- a/client/package.json +++ b/client/package.json @@ -55,6 +55,7 @@ "d3v3": "npm:d3@3", "date-fns": "^2.30.0", "decode-uri-component": "^0.2.1", + "dexie": "^3.2.5", "dom-to-image": "^2.6.0", "dompurify": "^3.0.6", "dumpmeta-webpack-plugin": "^0.2.0", diff --git a/client/src/components/TagsMultiselect/HeadlessMultiselect.vue b/client/src/components/TagsMultiselect/HeadlessMultiselect.vue index 8a3fc5dd5fb3..0a5528697839 100644 --- a/client/src/components/TagsMultiselect/HeadlessMultiselect.vue +++ b/client/src/components/TagsMultiselect/HeadlessMultiselect.vue @@ -41,6 +41,8 @@ const emit = defineEmits<{ (e: "input", selected: string[]): void; /** emitted when a new option is selected, which wasn't part of the options prop */ (e: "addOption", newOption: string): void; + /** emitted when a option is added */ + (e: "selected", option: string): void; }>(); const inputField = ref(null); @@ -154,6 +156,7 @@ function onOptionSelected(option: string) { set.delete(option); } else { set.add(option); + emit("selected", option); } emit("input", Array.from(set)); diff --git a/client/src/components/TagsMultiselect/StatelessTags.vue b/client/src/components/TagsMultiselect/StatelessTags.vue index 3bd10cf7de69..6fd2db1e1b0f 100644 --- a/client/src/components/TagsMultiselect/StatelessTags.vue +++ b/client/src/components/TagsMultiselect/StatelessTags.vue @@ -1,7 +1,7 @@