Show all existing tags when tag input is empty (#165)

WIP: Previously suggestions only appeared after typing; now all unused tags can be shown immediately when the tag menu opens.
Reviewed-on: https://codeberg.org/ArkHost/HelixNotes/pulls/165
This commit is contained in:
blake
2026-06-25 11:45:53 +02:00
committed by ArkHost
parent 95627cbb5c
commit 313d86df23
+1 -2
View File
@@ -16,11 +16,10 @@
// Existing tags that match what's typed, prefix matches first, already-applied ones excluded.
const suggestions = $derived.by(() => {
const q = query.trim().toLowerCase();
if (!q) return [];
const taken = new Set(existing);
const names = $tags
.map(([name]) => name)
.filter((name) => !taken.has(name) && name.toLowerCase().includes(q));
.filter((name) => !taken.has(name) && (!q || name.toLowerCase().includes(q)));
names.sort((a, b) => {
const ap = a.toLowerCase().startsWith(q) ? 0 : 1;
const bp = b.toLowerCase().startsWith(q) ? 0 : 1;