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 <noreply@anthropic.com>
This commit is contained in:
Thomas Richter
2026-02-01 22:35:32 +01:00
parent 79c9b12702
commit a19e51b6b9

View File

@@ -128,9 +128,11 @@
debouncedSave(); debouncedSave();
} }
function toggleExpand() { async function toggleExpand() {
if (expanded) { 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 || ''; editTitle = entry.title || '';
editContent = entry.content; editContent = entry.content;
editType = entry.type; editType = entry.type;
@@ -207,8 +209,8 @@
input.value = ''; input.value = '';
} }
async function handleContentBlur() { async function handleParseTags() {
// Parse hashtags from content when focus leaves the textarea // Parse hashtags from content
const formData = new FormData(); const formData = new FormData();
formData.append('id', entry.id); formData.append('id', entry.id);
@@ -426,7 +428,6 @@
id="edit-content-{entry.id}" id="edit-content-{entry.id}"
bind:value={editContent} bind:value={editContent}
oninput={handleInput} oninput={handleInput}
onblur={handleContentBlur}
rows="4" 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" 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"
></textarea> ></textarea>