Fix 'Open in New Window' cursor jumping to the top when pausing (ignore the file-watcher echo of the window's own save)

This commit is contained in:
Yuri Karamian
2026-06-25 16:08:25 +02:00
parent 2c774c51c6
commit 7e63d721bc
2 changed files with 10 additions and 2 deletions
+5
View File
@@ -2660,6 +2660,11 @@
} }
} }
// The markdown body the editor would currently save; used to ignore the file-watcher echo of our own save.
export function getCurrentBody(): string {
return $sourceMode ? restoreTitleH1(sourceContent) : editorToMarkdown();
}
// ── Tag editing (active note) ── // ── Tag editing (active note) ──
function toggleTagMenu(e: MouseEvent) { function toggleTagMenu(e: MouseEvent) {
if (tagMenu) { tagMenu = null; return; } if (tagMenu) { tagMenu = null; return; }
+5 -2
View File
@@ -103,8 +103,11 @@
if (!$editorDirty) { if (!$editorDirty) {
try { try {
const content = await readNote(notePath); const content = await readNote(notePath);
$activeNote = content; // Ignore the file-watcher echo of our own save; only reload genuine external edits.
editor?.loadNote(notePath, content.content); if (content.content.trim() !== (editor?.getCurrentBody() ?? '').trim()) {
$activeNote = content;
editor?.loadNote(notePath, content.content);
}
} catch (_) {} } catch (_) {}
} }
} }