diff --git a/src/lib/components/EntryCard.svelte b/src/lib/components/EntryCard.svelte
index 61ddf1d..7b5dd42 100644
--- a/src/lib/components/EntryCard.svelte
+++ b/src/lib/components/EntryCard.svelte
@@ -128,11 +128,9 @@
debouncedSave();
}
- async function toggleExpand() {
+ function toggleExpand() {
if (expanded) {
- // Collapsing - parse hashtags from content
- await handleParseTags();
- // Reset edit state to current entry values
+ // Collapsing - reset edit state to current entry values
editTitle = entry.title || '';
editContent = entry.content;
editType = entry.type;
@@ -210,9 +208,10 @@
}
async function handleParseTags() {
- // Parse hashtags from content
+ // Parse hashtags from current content in textarea
const formData = new FormData();
formData.append('id', entry.id);
+ formData.append('content', editContent);
await fetch('?/parseTags', {
method: 'POST',
@@ -520,9 +519,18 @@
- {#if entry.tags?.length > 0}
-
-
+
+
+
+
+
+ {#if entry.tags?.length > 0}
{#each entry.tags as tag}
@@ -540,8 +548,10 @@
{/each}
-
- {/if}
+ {:else}
+
No tags. Use #hashtags in content and click "Scan for #tags".
+ {/if}
+
diff --git a/src/routes/+page.server.ts b/src/routes/+page.server.ts
index 3417243..4539bb9 100644
--- a/src/routes/+page.server.ts
+++ b/src/routes/+page.server.ts
@@ -296,6 +296,7 @@ export const actions: Actions = {
parseTags: async ({ request }) => {
const formData = await request.formData();
const id = formData.get('id')?.toString();
+ const content = formData.get('content')?.toString();
if (!id) {
return fail(400, { error: 'Entry ID is required' });
@@ -306,8 +307,9 @@ export const actions: Actions = {
return fail(404, { error: 'Entry not found' });
}
- // Parse hashtags from current content and merge with existing tags
- const newTags = parseHashtags(existing.content);
+ // Parse hashtags from provided content (or fall back to database content)
+ const textToParse = content ?? existing.content;
+ const newTags = parseHashtags(textToParse);
const existingTags = tagRepository.getByEntryId(id).map((t) => t.name.toLowerCase());
const allTags = [...new Set([...existingTags, ...newTags])];
tagRepository.updateEntryTags(id, allTags);