Skip to content

Build your personal knowledge base with Trilium Notes

fix(client): add new tab not working in horizontal layout

Elian Doran13a997beb065
diff --git a/src/public/app/components/component.js b/src/public/app/components/component.js
index 0f614bcbf7..490b70b35d 100644
--- a/src/public/app/components/component.js
+++ b/src/public/app/components/component.js
@@ -88,8 +88,11 @@ export default class Component {
if (fun) {
return this.callMethod(fun, data);
- }
- else {
+ } else {
+ if (!this.parent) {
+ throw new Error(`Component "${this.componentId}" does not have a parent attached to propagate a command.`);
+ }
+
return this.parent.triggerCommand(name, data);
}
}
diff --git a/src/public/app/layouts/desktop_layout.js b/src/public/app/layouts/desktop_layout.js
index bc6ccf3c95..6273e8e4a1 100644
--- a/src/public/app/layouts/desktop_layout.js
+++ b/src/public/app/layouts/desktop_layout.js
@@ -94,13 +94,13 @@ export default class DesktopLayout {
const launcherPaneIsHorizontal = true;
const launcherPane = this.#buildLauncherPane(launcherPaneIsHorizontal);
- const tabBar = new TabRowWidget();
return new RootContainer()
.setParent(appContext)
- .optChild(launcherPaneIsHorizontal, new FlexContainer('row')
- .child(tabBar.class("full-width"))
+ .optChild(launcherPaneIsHorizontal, new FlexContainer('row')
+ .child(new TabRowWidget().class("full-width"))
.css('height', '40px')
+ .setParent(appContext)
)
.optChild(launcherPaneIsHorizontal, launcherPane)
.child(new FlexContainer('row')
@@ -115,7 +115,7 @@ export default class DesktopLayout {
.id('rest-pane')
.css("flex-grow", "1")
.optChild(!launcherPaneIsHorizontal, new FlexContainer('row')
- .child(tabBar)
+ .child(new TabRowWidget())
.child(new TitleBarButtonsWidget())
.css('height', '40px')
)