mirror of
https://github.com/Eugeny/tabby.git
synced 2025-06-29 07:49:53 +00: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 () => {
|
this.hostApp.windowCloseRequest$.subscribe(async () => {
|
||||||
await this.app.closeAllTabs()
|
await this.app.closeAllTabs() && this.hostApp.closeWindow();
|
||||||
this.hostApp.closeWindow()
|
});
|
||||||
})
|
|
||||||
|
|
||||||
if (window['safeModeReason']) {
|
if (window['safeModeReason']) {
|
||||||
ngbModal.open(SafeModeModalComponent)
|
ngbModal.open(SafeModeModalComponent)
|
||||||
|
@ -12,7 +12,6 @@ export class WindowControlsComponent {
|
|||||||
constructor (public hostApp: HostAppService, public app: AppService) { }
|
constructor (public hostApp: HostAppService, public app: AppService) { }
|
||||||
|
|
||||||
async closeWindow () {
|
async closeWindow () {
|
||||||
await this.app.closeAllTabs()
|
await this.app.closeAllTabs() && this.hostApp.closeWindow()
|
||||||
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) {
|
for (const tab of this.tabs) {
|
||||||
if (!await tab.canClose()) {
|
if (!await tab.canClose()) {
|
||||||
return
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const tab of this.tabs) {
|
for (const tab of this.tabs) {
|
||||||
tab.destroy()
|
tab.destroy()
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @hidden */
|
/** @hidden */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user