mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-22 00:19:24 +03:00
Use atom.showSaveDialog
when closing a previously-unsaved buffer
This commit is contained in:
parent
8b5b7de6e0
commit
3b2b829419
@ -18,7 +18,7 @@ atom.sendMessageToBrowserProcess = (name, data, callbacks) ->
|
||||
atom.receiveMessageFromBrowserProcess = (name, data) ->
|
||||
if name is 'reply'
|
||||
[messageId, callbackIndex] = data.shift()
|
||||
@pendingBrowserProcessCallbacks[messageId]?[callbackIndex]?(data)
|
||||
@pendingBrowserProcessCallbacks[messageId]?[callbackIndex]?(data...)
|
||||
|
||||
atom.open = (args...) ->
|
||||
@sendMessageToBrowserProcess('open', args)
|
||||
|
@ -516,14 +516,15 @@ class Editor extends View
|
||||
@removeClass 'soft-wrap'
|
||||
$(window).off 'resize', @_setSoftWrapColumn
|
||||
|
||||
save: ->
|
||||
save: (onSuccess) ->
|
||||
if not @getPath()
|
||||
path = Native.saveDialog()
|
||||
return false if not path
|
||||
@getBuffer().saveAs(path)
|
||||
atom.showSaveDialog (path) =>
|
||||
if path
|
||||
@getBuffer().saveAs(path)
|
||||
onSuccess()
|
||||
else
|
||||
@getBuffer().save()
|
||||
true
|
||||
onSuccess()
|
||||
|
||||
subscribeToFontSize: ->
|
||||
return unless rootView = @rootView()
|
||||
@ -565,7 +566,7 @@ class Editor extends View
|
||||
atom.confirm(
|
||||
"'#{filename}' has changes, do you want to save them?"
|
||||
"Your changes will be lost if you don't save them"
|
||||
"Save", (=> @save() and @destroyActiveEditSession())
|
||||
"Save", (=> @save(=> @destroyActiveEditSession())),
|
||||
"Cancel", null
|
||||
"Don't save", (=> @destroyActiveEditSession())
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user