mirror of
https://github.com/Eugeny/tabby.git
synced 2025-04-06 16:00:28 +08:00
Merge pull request #1293 from ehwarren/bugfix/1271
Ensure tabs can be closed before executing window closure
This commit is contained in:
commit
b6aa1f764b
@ -128,9 +128,8 @@ export class AppRootComponent {
|
||||
})
|
||||
|
||||
this.hostApp.windowCloseRequest$.subscribe(async () => {
|
||||
await this.app.closeAllTabs()
|
||||
this.hostApp.closeWindow()
|
||||
})
|
||||
await this.app.closeAllTabs() && this.hostApp.closeWindow();
|
||||
});
|
||||
|
||||
if (window['safeModeReason']) {
|
||||
ngbModal.open(SafeModeModalComponent)
|
||||
|
@ -12,7 +12,6 @@ export class WindowControlsComponent {
|
||||
constructor (public hostApp: HostAppService, public app: AppService) { }
|
||||
|
||||
async closeWindow () {
|
||||
await this.app.closeAllTabs()
|
||||
this.hostApp.closeWindow()
|
||||
await this.app.closeAllTabs() && this.hostApp.closeWindow()
|
||||
}
|
||||
}
|
||||
|
@ -206,15 +206,19 @@ export class AppService {
|
||||
}
|
||||
}
|
||||
|
||||
async closeAllTabs () {
|
||||
/**
|
||||
* Attempts to close all tabs, returns false if one of the tabs blocked closure
|
||||
*/
|
||||
async closeAllTabs () : Promise<boolean> {
|
||||
for (const tab of this.tabs) {
|
||||
if (!await tab.canClose()) {
|
||||
return
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (const tab of this.tabs) {
|
||||
tab.destroy()
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @hidden */
|
||||
|
Loading…
x
Reference in New Issue
Block a user