From 4f324ad68288a8390ae8c28f87e19668c4e3bf70 Mon Sep 17 00:00:00 2001 From: Yuri Karamian Date: Fri, 19 Jun 2026 11:31:49 +0200 Subject: [PATCH] Fix pasted images disappearing when switching to source mode (#87) --- src/lib/components/Editor.svelte | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/lib/components/Editor.svelte b/src/lib/components/Editor.svelte index 5fbebb5..ce8ecc2 100644 --- a/src/lib/components/Editor.svelte +++ b/src/lib/components/Editor.svelte @@ -4620,17 +4620,15 @@ // Switching TO source: fix blob images first, then extract markdown if (hasPendingBlobs) { hasPendingBlobs = false; - fixingBlobsPromise = fixBlobImages(); - } - const doSwap = () => { + fixBlobImages().then(() => { + sourceContent = editor ? editorToMarkdown() : ($activeNote?.content ?? ''); + resetSourceHistory(sourceContent); + lastSourceMode = true; + }); + } else { sourceContent = editor ? editorToMarkdown() : ($activeNote?.content ?? ''); resetSourceHistory(sourceContent); lastSourceMode = true; - }; - if (fixingBlobsPromise) { - fixingBlobsPromise.then(doSwap); - } else { - doSwap(); } } else if (!isSource && lastSourceMode) { lastSourceMode = false;