Fix pasted images disappearing when switching to source mode (#87)

This commit is contained in:
Yuri Karamian
2026-06-19 11:18:06 +02:00
parent 4f4e2854a6
commit a1913558b9
+12 -1
View File
@@ -4617,10 +4617,21 @@
if (!loadedPath) return; if (!loadedPath) return;
if (isSource && !lastSourceMode) { if (isSource && !lastSourceMode) {
// Switching TO source: extract markdown from editor // Switching TO source: fix blob images first, then extract markdown
if (hasPendingBlobs) {
hasPendingBlobs = false;
fixingBlobsPromise = fixBlobImages();
}
const doSwap = () => {
sourceContent = editor ? editorToMarkdown() : ($activeNote?.content ?? ''); sourceContent = editor ? editorToMarkdown() : ($activeNote?.content ?? '');
resetSourceHistory(sourceContent); resetSourceHistory(sourceContent);
lastSourceMode = true; lastSourceMode = true;
};
if (fixingBlobsPromise) {
fixingBlobsPromise.then(doSwap);
} else {
doSwap();
}
} else if (!isSource && lastSourceMode) { } else if (!isSource && lastSourceMode) {
lastSourceMode = false; lastSourceMode = false;
if (isMobile) { if (isMobile) {