mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 07:15:51 +01:00
fix lazy initialization of the sidebar
This commit is contained in:
@@ -34,7 +34,7 @@ import utils from "./utils.js";
|
||||
import treeService from "./tree.js";
|
||||
import SidePaneContainer from "../widgets/side_pane_container.js";
|
||||
import ZoomService from "./zoom.js";
|
||||
import SidepaneToggles from "../widgets/sidebar_toggle.js";
|
||||
import SidePaneToggles from "../widgets/side_pane_toggles.js";
|
||||
|
||||
class AppContext {
|
||||
constructor() {
|
||||
@@ -188,9 +188,9 @@ class AppContext {
|
||||
|
||||
$centerPane.after(rightPaneContainer.render());
|
||||
|
||||
const sidebarToggleWidget = new SidepaneToggles(this);
|
||||
const sidePaneTogglesWidget = new SidePaneToggles(this);
|
||||
|
||||
$centerPane.after(sidebarToggleWidget.render());
|
||||
$centerPane.after(sidePaneTogglesWidget.render());
|
||||
|
||||
this.components = [
|
||||
new Entrypoints(),
|
||||
@@ -199,7 +199,7 @@ class AppContext {
|
||||
leftPaneContainer,
|
||||
...centerPaneWidgets,
|
||||
rightPaneContainer,
|
||||
sidebarToggleWidget
|
||||
sidePaneTogglesWidget
|
||||
];
|
||||
|
||||
if (utils.isElectron()) {
|
||||
|
||||
@@ -28,7 +28,7 @@ const TPL = `
|
||||
</div>
|
||||
`;
|
||||
|
||||
export default class SidepaneToggles extends BasicWidget {
|
||||
export default class SidePaneToggles extends BasicWidget {
|
||||
constructor(appContext) {
|
||||
super(appContext);
|
||||
|
||||
@@ -78,6 +78,10 @@ export default class TabAwareWidget extends BasicWidget {
|
||||
}
|
||||
|
||||
lazyLoadedListener() {
|
||||
if (!this.tabContext) { // has not been loaded yet
|
||||
this.tabContext = this.appContext.getActiveTabContext();
|
||||
}
|
||||
|
||||
this.refresh();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user