mirror of
https://github.com/arduino/arduino-ide.git
synced 2025-07-24 11:46:32 +00:00
changed the default ref behavior.
instead of opening the widget next to current, open it after the last. Signed-off-by: Akos Kitta <kittaakos@typefox.io>
This commit is contained in:
parent
9ee5fc097c
commit
eb2161cc6e
@ -34,6 +34,27 @@ export class ApplicationShell extends TheiaApplicationShell {
|
||||
}
|
||||
}
|
||||
|
||||
async addWidget(widget: Widget, options: Readonly<TheiaApplicationShell.WidgetOptions> = {}): Promise<void> {
|
||||
// By default, Theia open a widget **next** to the currently active in the target area.
|
||||
// Instead of this logic, we want to open the new widget after the last of the target area.
|
||||
if (!widget.id) {
|
||||
console.error('Widgets added to the application shell must have a unique id property.');
|
||||
return;
|
||||
}
|
||||
let ref: Widget | undefined = options.ref;
|
||||
let area: TheiaApplicationShell.Area = options.area || 'main';
|
||||
if (!ref && (area === 'main' || area === 'bottom')) {
|
||||
const tabBar = this.getTabBarFor(area);
|
||||
if (tabBar) {
|
||||
const last = tabBar.titles[tabBar.titles.length - 1];
|
||||
if (last) {
|
||||
ref = last.owner;
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.addWidget(widget, { ...options, ref });
|
||||
}
|
||||
|
||||
async saveAll(): Promise<void> {
|
||||
await super.saveAll();
|
||||
const options = { execOnlyIfTemp: true, openAfterMove: true };
|
||||
|
Loading…
x
Reference in New Issue
Block a user