diff --git a/apps/mana/apps/web/src/lib/modules/notes/ListView.svelte b/apps/mana/apps/web/src/lib/modules/notes/ListView.svelte index 0ce30c223..d848b4d5c 100644 --- a/apps/mana/apps/web/src/lib/modules/notes/ListView.svelte +++ b/apps/mana/apps/web/src/lib/modules/notes/ListView.svelte @@ -9,6 +9,7 @@ import type { ViewProps } from '$lib/app-registry'; import { ContextMenu, type ContextMenuItem } from '@mana/shared-ui'; import { PencilSimple, Trash, PushPin } from '@mana/shared-icons'; + import VoiceCaptureBar from '$lib/components/voice/VoiceCaptureBar.svelte'; let { navigate, goBack, params }: ViewProps = $props(); @@ -31,6 +32,11 @@ startEdit(note); } + async function handleVoiceComplete(blob: Blob, durationMs: number) { + const note = await notesStore.createFromVoice(blob, durationMs, 'de'); + startEdit(note); + } + function startEdit(note: Note) { if (editingId && editingId !== note.id) saveEdit(); editingId = note.id; @@ -38,6 +44,21 @@ editContent = note.content; } + // When a voice note's transcript arrives asynchronously while the + // inline editor is open, the underlying Dexie row updates but the + // editor's local copy stays on the "…" placeholder. Sync it back in + // — but ONLY while the editor still shows the placeholder, so we + // never overwrite content the user has already typed. + $effect(() => { + if (!editingId) return; + const live = notes.find((n) => n.id === editingId); + if (!live) return; + if (editContent === '…' && live.content !== '…') { + editTitle = live.title; + editContent = live.content; + } + }); + async function saveEdit() { if (!editingId) return; await notesStore.updateNote(editingId, { @@ -105,6 +126,14 @@