diff --git a/ts/editor/Tag.svelte b/ts/editor/Tag.svelte index ded03e9f9..bea495d9e 100644 --- a/ts/editor/Tag.svelte +++ b/ts/editor/Tag.svelte @@ -13,6 +13,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html export { className as class }; export let name: string; + export let tooltip: string | undefined = undefined; export let selected: boolean = false; const dispatch = createEventDispatcher(); @@ -61,6 +62,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html class:btn-day={!nightMode} class:btn-night={nightMode} tabindex="-1" + title={tooltip} on:mousemove={setDeleteIcon} on:click={onClick} > diff --git a/ts/editor/TagEditor.svelte b/ts/editor/TagEditor.svelte index 9aa77667f..7cb746315 100644 --- a/ts/editor/TagEditor.svelte +++ b/ts/editor/TagEditor.svelte @@ -364,6 +364,25 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } let height: number; + let badgeHeight: number; + + // typically correct for rows < 7 + $: assumedRows = Math.floor(height / badgeHeight); + $: shortenTags = shortenTags || assumedRows > 2; + + function processTagName(name: string): string { + const parts = name.split("::"); + + if (parts.length === 1) { + return name; + } + + return "…::" + parts[parts.length - 1]; + } + + function hasMultipleParts(name: string): boolean { + return name.split("::").length > 1; + } @@ -374,7 +393,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {size} on:focusout={deselectIfLeave} > -
+
{#if tags.some((tag) => tag.selected)} {