From 1ba6909495a36c78bcc49d1e8705252af921080a Mon Sep 17 00:00:00 2001 From: Henrik Giesel Date: Fri, 25 Jun 2021 15:44:44 +0200 Subject: [PATCH] Decouple Autocomplete from TagInput: Allows to only have one autocompletion for all tags, rather than every tag having its own --- ts/editor/AddTagBadge.svelte | 35 ++++++++++++--------- ts/editor/TagAutocomplete.svelte | 10 +++--- ts/editor/TagEditor.svelte | 48 ++++++++++++++++------------- ts/editor/TagInput.svelte | 52 ++++++++++++-------------------- 4 files changed, 72 insertions(+), 73 deletions(-) diff --git a/ts/editor/AddTagBadge.svelte b/ts/editor/AddTagBadge.svelte index 66bb992da..48f84166a 100644 --- a/ts/editor/AddTagBadge.svelte +++ b/ts/editor/AddTagBadge.svelte @@ -16,23 +16,30 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html - (theTagIcon = addTagIcon)} - on:mouseleave={() => (theTagIcon = tagIcon)} - on:mount={withSpan(createShortcut)}>{@html theTagIcon} +
+ (theTagIcon = addTagIcon)} + on:mouseleave={() => (theTagIcon = tagIcon)} + on:mount={withSpan(createShortcut)}>{@html theTagIcon} +
diff --git a/ts/editor/TagAutocomplete.svelte b/ts/editor/TagAutocomplete.svelte index 514380d0c..6a541061a 100644 --- a/ts/editor/TagAutocomplete.svelte +++ b/ts/editor/TagAutocomplete.svelte @@ -8,8 +8,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export const suggestions = ["en::idioms", "anki::functionality", "math"]; - const triggerId = "tagLabel" + String(Math.random()).slice(2); - const triggerClass = "dropdown-toggle"; + let className: string = ""; + export { className as class }; let menu: HTMLDivElement; @@ -33,10 +33,10 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html function updateActiveItem(even: FocusEvent): void {} -