feat: parse hashtags from content instead of dedicated tag input

Tags are now automatically extracted from #hashtags in content text.
Removed TagInput from entry editing, keeping it only in FilterBar.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Thomas Richter
2026-02-01 21:59:04 +01:00
parent 21a11bbb22
commit ce07d79652
5 changed files with 54 additions and 34 deletions

View File

@@ -8,6 +8,7 @@ import {
deleteImage as deleteImageFile
} from '$lib/server/images/storage';
import { generateThumbnail } from '$lib/server/images/thumbnails';
import { parseHashtags } from '$lib/utils/parseHashtags';
export const load: PageServerLoad = async ({ url }) => {
const showCompleted = url.searchParams.get('showCompleted') === 'true';
@@ -53,6 +54,12 @@ export const actions: Actions = {
type: type || 'thought'
});
// Parse hashtags from content and save them
const hashtags = parseHashtags(content);
if (hashtags.length > 0) {
tagRepository.updateEntryTags(entry.id, hashtags);
}
return { success: true, entryId: entry.id };
},
@@ -77,6 +84,7 @@ export const actions: Actions = {
updates.title = title.toString().trim() || null;
}
let contentChanged = false;
const content = formData.get('content');
if (content !== null) {
const contentStr = content.toString().trim();
@@ -84,6 +92,7 @@ export const actions: Actions = {
return fail(400, { error: 'Content cannot be empty' });
}
updates.content = contentStr;
contentChanged = true;
}
const type = formData.get('type');
@@ -106,6 +115,12 @@ export const actions: Actions = {
entryRepository.update(id, updates);
// Re-parse hashtags if content changed
if (contentChanged && updates.content) {
const hashtags = parseHashtags(updates.content as string);
tagRepository.updateEntryTags(id, hashtags);
}
return { success: true };
},