mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-24 07:45:57 +02:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user