disable preventAccidentalTabClosure by default

This commit is contained in:
Eugene Pankov
2021-10-22 22:00:32 +02:00
parent 2fc457dd78
commit e3214e38d3
2 changed files with 6 additions and 3 deletions

View File

@@ -4,7 +4,7 @@ import { ConfigProvider } from 'tabby-core'
export class WebConfigProvider extends ConfigProvider { export class WebConfigProvider extends ConfigProvider {
defaults = { defaults = {
web: { web: {
preventAccidentalTabClosure: true, preventAccidentalTabClosure: false,
}, },
} }
} }

View File

@@ -12,12 +12,15 @@ export class WebHostWindow extends HostWindowService {
this.windowShown.next() this.windowShown.next()
this.windowFocused.next() this.windowFocused.next()
window.addEventListener('beforeunload', (event) => { const unloadHandler = (event) => {
if (config.store.web.preventAccidentalTabClosure) { if (config.store.web.preventAccidentalTabClosure) {
event.preventDefault() event.preventDefault()
event.returnValue = 'Are you sure you want to close Tabby? You can disable this prompt in Settings -> Window.' event.returnValue = 'Are you sure you want to close Tabby? You can disable this prompt in Settings -> Window.'
} else {
window.removeEventListener('beforeunload', unloadHandler)
} }
}) }
window.addEventListener('beforeunload', unloadHandler)
} }
reload (): void { reload (): void {