diff --git a/ka-note/client/src/lib/components/HistoryItem.svelte b/ka-note/client/src/lib/components/HistoryItem.svelte
index 9231380..35facb9 100644
--- a/ka-note/client/src/lib/components/HistoryItem.svelte
+++ b/ka-note/client/src/lib/components/HistoryItem.svelte
@@ -5,20 +5,22 @@
interface Props {
entry: HistoryEntry;
- onedit?: (id: string, text: string) => void;
+ onedit?: (id: string, text: string, date: string) => void;
}
let { entry, onedit }: Props = $props();
let editing = $state(false);
let editText = $state('');
+ let editDate = $state('');
function startEdit() {
editText = entry.text;
+ editDate = entry.date;
editing = true;
}
function saveEdit() {
- onedit?.(entry.id, editText);
+ onedit?.(entry.id, editText, editDate);
editing = false;
}
@@ -50,9 +52,17 @@
onsave={saveEdit}
minHeight="100px"
/>
-
-
-
+
+
+
+
+
+
{:else}
diff --git a/ka-note/client/src/lib/components/JournalView.svelte b/ka-note/client/src/lib/components/JournalView.svelte
index 67a541b..1ac91d8 100644
--- a/ka-note/client/src/lib/components/JournalView.svelte
+++ b/ka-note/client/src/lib/components/JournalView.svelte
@@ -129,13 +129,15 @@
let editTitle = $state('');
let editBody = $state('');
let editIsPrivate = $state(false);
+ let editDate = $state('');
- function startEdit(entry: { id: string; text: string; isPrivate?: boolean }) {
+ function startEdit(entry: { id: string; text: string; date: string; isPrivate?: boolean }) {
const lines = entry.text.split('\n');
editingId = entry.id;
editTitle = lines[0].replace(/^#{1,6}\s+/, '');
editBody = lines.slice(1).join('\n').trim();
editIsPrivate = !!entry.isPrivate;
+ editDate = entry.date;
}
function cancelEdit() {
@@ -145,7 +147,7 @@
async function saveEdit() {
if (!editingId || !editTitle.trim()) return;
const text = editBody.trim() ? `${editTitle.trim()}\n${editBody.trim()}` : editTitle.trim();
- await updateHistoryEntry(editingId, text, editIsPrivate);
+ await updateHistoryEntry(editingId, text, editIsPrivate, editDate || undefined);
editingId = null;
}
@@ -332,6 +334,12 @@
class="rounded bg-[#444] px-3 py-1 text-sm text-white hover:bg-[#555]"
onclick={cancelEdit}
>Abbrechen
+