diff --git a/index.html b/index.html index 5769ebc..72d09d8 100644 --- a/index.html +++ b/index.html @@ -9,6 +9,8 @@ + + diff --git a/src/lib/NoteDetail.svelte b/src/lib/NoteDetail.svelte index 1c053fd..ad16b16 100644 --- a/src/lib/NoteDetail.svelte +++ b/src/lib/NoteDetail.svelte @@ -3,7 +3,7 @@ import { onMount } from 'svelte'; import { RxDBUpdatePlugin } from 'rxdb/plugins/update'; - import { selectedNote, bodyText } from './store'; + import { db, selectedNote, bodyText } from './store'; import { debounce } from '../utils/debounce'; import { isEmptyObject } from '../utils/isEmptyObject'; @@ -11,10 +11,12 @@ import Settings from './Settings.svelte'; let innerHeight; + let db$; - onMount(() => { + onMount(async () => { addRxPlugin(RxDBUpdatePlugin); - if ($selectedNote.body) $bodyText = $selectedNote.body; + db$ = await db(); + db$.notes.findOne($selectedNote.guid).exec(); }); const handleDebounceSave = debounce(() => !isEmptyObject($selectedNote) && updateNote(), 500); @@ -31,7 +33,7 @@ -
...waiting