mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Only unload editor window when confirmed
This commit is contained in:
@@ -311,11 +311,6 @@ class Atom extends Model
|
||||
@requireUserInitScript()
|
||||
@menu.update()
|
||||
|
||||
$(window).on 'beforeunload', =>
|
||||
$(document.body).css('visibility', 'hidden')
|
||||
@unloadEditorWindow()
|
||||
null
|
||||
|
||||
@displayWindow()
|
||||
|
||||
unloadEditorWindow: ->
|
||||
|
||||
@@ -35,15 +35,17 @@ class WindowEventHandler
|
||||
confirmed = atom.workspaceView?.confirmClose()
|
||||
atom.hide() if confirmed and not @reloadRequested and atom.getCurrentWindow().isWebViewFocused()
|
||||
@reloadRequested = false
|
||||
|
||||
atom.storeDefaultWindowDimensions()
|
||||
atom.storeWindowDimensions()
|
||||
|
||||
if confirmed
|
||||
$(document.body).css('visibility', 'hidden')
|
||||
atom.unloadEditorWindow()
|
||||
|
||||
confirmed
|
||||
|
||||
@subscribe $(window), 'blur beforeunload', ->
|
||||
atom.storeDefaultWindowDimensions()
|
||||
null
|
||||
|
||||
@subscribe $(window), 'beforeunload', ->
|
||||
atom.storeWindowDimensions()
|
||||
null
|
||||
@subscribe $(window), 'blur', -> atom.storeDefaultWindowDimensions()
|
||||
|
||||
@subscribeToCommand $(window), 'window:toggle-full-screen', -> atom.toggleFullScreen()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user