Skip to content

Commit

Permalink
Only unload editor window when confirmed
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinsawicki committed Aug 12, 2014
1 parent 16d2e41 commit 97c2fc0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
5 changes: 0 additions & 5 deletions src/atom.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -311,11 +311,6 @@ class Atom extends Model
@requireUserInitScript()
@menu.update()

$(window).on 'beforeunload', =>
$(document.body).css('visibility', 'hidden')
@unloadEditorWindow()
null

@displayWindow()

unloadEditorWindow: ->
Expand Down
14 changes: 8 additions & 6 deletions src/window-event-handler.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,17 @@ class WindowEventHandler
confirmed = atom.workspaceView?.confirmClose()
atom.hide() if confirmed and not @reloadRequested and atom.getCurrentWindow().isWebViewFocused()
@reloadRequested = false
confirmed

@subscribe $(window), 'blur beforeunload', ->
atom.storeDefaultWindowDimensions()
null

@subscribe $(window), 'beforeunload', ->
atom.storeWindowDimensions()
null

if confirmed
$(document.body).css('visibility', 'hidden')
atom.unloadEditorWindow()

confirmed

@subscribe $(window), 'blur', -> atom.storeDefaultWindowDimensions()

@subscribeToCommand $(window), 'window:toggle-full-screen', -> atom.toggleFullScreen()

Expand Down

0 comments on commit 97c2fc0

Please sign in to comment.