Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(client): report a code note load only from a hidden editor
Elian Dorancf71bf1613d0
diff --git a/apps/client/src/widgets/type_widgets/code/Code.tsx b/apps/client/src/widgets/type_widgets/code/Code.tsxindex 9ac613d4ee..b457b06c4b 100644--- a/apps/client/src/widgets/type_widgets/code/Code.tsx+++ b/apps/client/src/widgets/type_widgets/code/Code.tsx@@ -115,7 +115,10 @@ export function EditableCode({ note, ntxId, noteContext, debounceUpdate, parentCconst codeEditor = editorRef.current;if (!codeEditor) return;codeEditor.setText(content ?? "");- onContentChanged?.(content ?? "");+ // `setText()` loads a hidden editor without an update, so its listener reports nothing.+ if (codeEditor.dom.offsetParent === null) {+ onContentChanged?.(content ?? "");+ }codeEditor.setMimeType(note.mime);codeEditor.clearHistory();