Skip to content

Build your personal knowledge base with Trilium Notes

client: Fix center issue at startup

Elian Doranb32f3ffd8461
diff --git a/src/public/app/widgets/type_widgets/mind_map.js b/src/public/app/widgets/type_widgets/mind_map.js
index b5bc767c54..5b143a3c69 100644
--- a/src/public/app/widgets/type_widgets/mind_map.js
+++ b/src/public/app/widgets/type_widgets/mind_map.js
@@ -26,7 +26,7 @@ export default class MindMapWidget extends TypeWidget {
this.$widget = $(TPL);
this.$content = this.$widget.find(".mind-map-container");
- super.doRender();
+ super.doRender();
}
async doRefresh(note) {
@@ -69,6 +69,12 @@ export default class MindMapWidget extends TypeWidget {
this.spacedUpdate.scheduleUpdate();
}
});
+
+ // If the note is displayed directly after a refresh, the scroll ends up at (0,0), making it difficult for the user to see.
+ // Adding an arbitrary wait until the element is attached to the DOM seems to do the trick for now.
+ setTimeout(() => {
+ mind.toCenter();
+ }, 200);
}
async getData() {