mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-07-24 07:45:57 +02:00
Fix editor not rendering on every other source mode switch
This commit is contained in:
@@ -4616,6 +4616,11 @@
|
||||
// Only act if we have a loaded note
|
||||
if (!loadedPath) return;
|
||||
|
||||
// untrack: prevent flushSave() (inside destroyEditor) from adding
|
||||
// $editorDirty/$activeNote as effect dependencies, which causes
|
||||
// the effect to re-run and race with tick().then() — resulting in
|
||||
// the editor failing to render on every other source-mode switch.
|
||||
untrack(() => {
|
||||
if (isSource && !lastSourceMode) {
|
||||
// Switching TO source: extract markdown from editor
|
||||
sourceContent = editor ? editorToMarkdown() : ($activeNote?.content ?? '');
|
||||
@@ -4637,16 +4642,12 @@
|
||||
tick().then(() => {
|
||||
if (editorElement && !editor) {
|
||||
createEditor(content);
|
||||
} else if (!editor) {
|
||||
// editorElement not ready yet — retry next frame
|
||||
requestAnimationFrame(() => {
|
||||
if (editorElement && !editor) createEditor(content);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// Tauri drag-drop listener for OS file drops (browser DragEvent doesn't have files in Tauri)
|
||||
let unlistenDragDrop: (() => void) | null = null;
|
||||
|
||||
Reference in New Issue
Block a user