diff --git a/ka-note/VERSION b/ka-note/VERSION index cb13578..7e29bda 100644 --- a/ka-note/VERSION +++ b/ka-note/VERSION @@ -1 +1 @@ -1.1.27 \ No newline at end of file +1.1.30 \ No newline at end of file diff --git a/ka-note/client/src/lib/components/JournalView.svelte b/ka-note/client/src/lib/components/JournalView.svelte index 6985350..67a541b 100644 --- a/ka-note/client/src/lib/components/JournalView.svelte +++ b/ka-note/client/src/lib/components/JournalView.svelte @@ -10,7 +10,9 @@ import ConfirmDialog from './ConfirmDialog.svelte'; import WiedervorlageSection from './WiedervorlageSection.svelte'; import LinkTitle from './LinkTitle.svelte'; + import { get } from 'svelte/store'; import { currentScope, scopeSettings } from '$lib/stores/scopeContext'; + import { normalizeTitleAndBody } from '$lib/utils/titleUtils'; import { useUnsavedGuard } from '$lib/utils/unsavedGuard.svelte'; interface Props { @@ -96,12 +98,14 @@ const isPrivate = journalScope === 'private'; if (selectedLinkedContextId) { - const topic = await createTopic(selectedLinkedContextId, title); + const topic = await createTopic(selectedLinkedContextId, title, isPrivate); if (body) { await createHistoryEntry(topic.id, selectedDate, body, null, false, isPrivate); } } else { - const text = body ? `${title}\n${body}` : title; + const { maxTitleLength } = get(scopeSettings); + const { title: shortTitle, body: fullBody } = normalizeTitleAndBody(title, body, maxTitleLength); + const text = fullBody ? `${shortTitle}\n\n${fullBody}` : shortTitle; await getOrCreateJournalTopic(); await createHistoryEntry(JOURNAL_TOPIC_ID, selectedDate, text, null, wiedervorlageChecked, isPrivate); } @@ -129,7 +133,7 @@ function startEdit(entry: { id: string; text: string; isPrivate?: boolean }) { const lines = entry.text.split('\n'); editingId = entry.id; - editTitle = lines[0]; + editTitle = lines[0].replace(/^#{1,6}\s+/, ''); editBody = lines.slice(1).join('\n').trim(); editIsPrivate = !!entry.isPrivate; } @@ -343,7 +347,7 @@ {:else} {@const lines = entry.text.split('\n')} - {@const title = lines[0]} + {@const title = lines[0].replace(/^#{1,6}\s+/, '')} {@const body = lines.slice(1).join('\n').trim()}