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

This commit is contained in:
Elian Doran 2024-11-22 23:02:43 +02:00
parent f62e860b61
commit 13a997beb0
No known key found for this signature in database
2 changed files with 9 additions and 6 deletions

View File

@ -88,8 +88,11 @@ export default class Component {
if (fun) { if (fun) {
return this.callMethod(fun, data); 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); return this.parent.triggerCommand(name, data);
} }
} }

View File

@ -94,13 +94,13 @@ export default class DesktopLayout {
const launcherPaneIsHorizontal = true; const launcherPaneIsHorizontal = true;
const launcherPane = this.#buildLauncherPane(launcherPaneIsHorizontal); const launcherPane = this.#buildLauncherPane(launcherPaneIsHorizontal);
const tabBar = new TabRowWidget();
return new RootContainer() return new RootContainer()
.setParent(appContext) .setParent(appContext)
.optChild(launcherPaneIsHorizontal, new FlexContainer('row') .optChild(launcherPaneIsHorizontal, new FlexContainer('row')
.child(tabBar.class("full-width")) .child(new TabRowWidget().class("full-width"))
.css('height', '40px') .css('height', '40px')
.setParent(appContext)
) )
.optChild(launcherPaneIsHorizontal, launcherPane) .optChild(launcherPaneIsHorizontal, launcherPane)
.child(new FlexContainer('row') .child(new FlexContainer('row')
@ -115,7 +115,7 @@ export default class DesktopLayout {
.id('rest-pane') .id('rest-pane')
.css("flex-grow", "1") .css("flex-grow", "1")
.optChild(!launcherPaneIsHorizontal, new FlexContainer('row') .optChild(!launcherPaneIsHorizontal, new FlexContainer('row')
.child(tabBar) .child(new TabRowWidget())
.child(new TitleBarButtonsWidget()) .child(new TitleBarButtonsWidget())
.css('height', '40px') .css('height', '40px')
) )