diff --git a/ts/editor/Tag.svelte b/ts/editor/Tag.svelte
index f2ec6c4b3..09e790c8c 100644
--- a/ts/editor/Tag.svelte
+++ b/ts/editor/Tag.svelte
@@ -38,7 +38,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
bind:name
bind:input
on:focusout={() => (active = false)}
- on:update={updateTag}
+ on:tagupdate={updateTag}
on:mount={(event) => event.detail.input.focus()}
/>
{:else}
diff --git a/ts/editor/TagEditor.svelte b/ts/editor/TagEditor.svelte
index 52fafff12..a06dddab8 100644
--- a/ts/editor/TagEditor.svelte
+++ b/ts/editor/TagEditor.svelte
@@ -21,6 +21,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
tags.splice(tags.indexOf(detail.name), 1);
tags = tags;
}
+
+ function addTag({ detail }: CustomEvent) {
+ if (!tags.includes(detail.name) && detail.name.length > 0) {
+ tags.push(detail.name);
+ }
+ tags = tags;
+ }
@@ -31,7 +38,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
{/each}
-
+
diff --git a/ts/editor/TagInput.svelte b/ts/editor/TagInput.svelte
index d8a263eb4..d624e1afa 100644
--- a/ts/editor/TagInput.svelte
+++ b/ts/editor/TagInput.svelte
@@ -20,7 +20,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
}
function onAccept(event: Event): void {
- dispatch("update", { tagname: normalizeTagname(name) });
+ dispatch("tagupdate", { name: normalizeTagname(name) });
+ input.value = "";
}
function dropdownBlur(event: Event, dropdown: Dropdown): void {
@@ -46,9 +47,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
const splitted = pasted.split(" ");
const last = splitted.pop();
for (const token of splitted) {
- const tagname = normalizeTagname(token);
- if (tagname) {
- dispatch("add", { tagname });
+ const name = normalizeTagname(token);
+ if (name) {
+ dispatch("tagadd", { name });
}
}
name = last!;
@@ -73,6 +74,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
onFocus(event, dropdown)}