mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-22 00:19:24 +03:00
Ask for close confirmation in beforeunload handler.
This commit is contained in:
parent
bdbec54f24
commit
45ce8e1d63
@ -83,7 +83,9 @@ class PaneContainer extends View
|
||||
saved = true
|
||||
for pane in @getPanes()
|
||||
for item in pane.getItems() when item.isModified?()
|
||||
saved = false if not pane.promptToSaveItem item
|
||||
if not @paneAtIndex(0).promptToSaveItem item
|
||||
saved = false
|
||||
break
|
||||
saved
|
||||
|
||||
getPanes: ->
|
||||
|
@ -14,13 +14,10 @@ class WindowEventHandler
|
||||
@subscribe $(window), 'blur', -> $("body").addClass('is-blurred')
|
||||
@subscribe $(window), 'window:open-path', (event, pathToOpen) ->
|
||||
rootView?.open(pathToOpen) unless fsUtils.isDirectorySync(pathToOpen)
|
||||
@subscribe $(window), 'beforeunload', -> rootView?.confirmClose()
|
||||
|
||||
@subscribeToCommand $(window), 'window:toggle-full-screen', => atom.toggleFullScreen()
|
||||
@subscribeToCommand $(window), 'window:close', =>
|
||||
if rootView?
|
||||
closeWithoutConfirm() if rootView.confirmClose()
|
||||
else
|
||||
closeWithoutConfirm()
|
||||
@subscribeToCommand $(window), 'window:close', => window.close()
|
||||
@subscribeToCommand $(window), 'window:reload', => atom.reload()
|
||||
|
||||
@subscribeToCommand $(document), 'core:focus-next', @focusNext
|
||||
|
@ -210,10 +210,6 @@ window.restoreDimensions = ->
|
||||
window.setDimensions(dimensions)
|
||||
$(window).on 'unload', -> atom.setWindowState('dimensions', window.getDimensions())
|
||||
|
||||
window.closeWithoutConfirm = ->
|
||||
atom.hide()
|
||||
ipc.sendChannel 'close-without-confirm'
|
||||
|
||||
window.onerror = ->
|
||||
atom.openDevTools()
|
||||
|
||||
|
@ -175,11 +175,6 @@ class AtomApplication
|
||||
@installUpdate = quitAndUpdate
|
||||
@buildApplicationMenu version, quitAndUpdate
|
||||
|
||||
ipc.on 'close-without-confirm', (processId, routingId) ->
|
||||
window = BrowserWindow.fromProcessIdAndRoutingId processId, routingId
|
||||
window.removeAllListeners 'close'
|
||||
window.close()
|
||||
|
||||
ipc.on 'open-config', =>
|
||||
@openConfig()
|
||||
|
||||
|
@ -89,11 +89,6 @@ class AtomWindow
|
||||
# Spec window's web view should always have focus
|
||||
@browserWindow.on 'blur', =>
|
||||
@browserWindow.focusOnWebView()
|
||||
else
|
||||
@browserWindow.on 'close', (event) =>
|
||||
unless @browserWindow.isCrashed()
|
||||
event.preventDefault()
|
||||
@sendCommand 'window:close'
|
||||
|
||||
openPath: (pathToOpen) ->
|
||||
if @loaded
|
||||
|
Loading…
Reference in New Issue
Block a user