1
1
mirror of https://github.com/Eugeny/tabby.git synced 2024-11-26 13:10:36 +03:00

disable preventAccidentalTabClosure by default

This commit is contained in:
Eugene Pankov 2021-10-22 22:00:32 +02:00
parent 2fc457dd78
commit e3214e38d3
No known key found for this signature in database
GPG Key ID: 5896FCBBDD1CF4F4
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 {
defaults = {
web: {
preventAccidentalTabClosure: true,
preventAccidentalTabClosure: false,
},
}
}

View File

@ -12,12 +12,15 @@ export class WebHostWindow extends HostWindowService {
this.windowShown.next()
this.windowFocused.next()
window.addEventListener('beforeunload', (event) => {
const unloadHandler = (event) => {
if (config.store.web.preventAccidentalTabClosure) {
event.preventDefault()
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 {