From a19e51b6b9bca25db7fa61305cddd6a6445b9eef Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Sun, 1 Feb 2026 22:35:32 +0100 Subject: [PATCH] fix: parse hashtags only when collapsing entry card Move tag parsing from textarea blur to entry collapse action. This prevents incomplete tags from being created while editing. Co-Authored-By: Claude Opus 4.5 --- src/lib/components/EntryCard.svelte | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lib/components/EntryCard.svelte b/src/lib/components/EntryCard.svelte index 6c098b1..61ddf1d 100644 --- a/src/lib/components/EntryCard.svelte +++ b/src/lib/components/EntryCard.svelte @@ -128,9 +128,11 @@ debouncedSave(); } - function toggleExpand() { + async function toggleExpand() { if (expanded) { - // Collapsing - reset edit state to current entry values + // Collapsing - parse hashtags from content + await handleParseTags(); + // Reset edit state to current entry values editTitle = entry.title || ''; editContent = entry.content; editType = entry.type; @@ -207,8 +209,8 @@ input.value = ''; } - async function handleContentBlur() { - // Parse hashtags from content when focus leaves the textarea + async function handleParseTags() { + // Parse hashtags from content const formData = new FormData(); formData.append('id', entry.id); @@ -426,7 +428,6 @@ id="edit-content-{entry.id}" bind:value={editContent} oninput={handleInput} - onblur={handleContentBlur} rows="4" class="w-full px-3 py-2 border border-gray-200 rounded-lg text-base resize-y focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent" >