Prompt split editors to save on close

Previously an editor that was split into multiple panes would not
prompt to save correctly when the window was unloading.

This adds a new `windowCloseRequested` option passed through from the
beforeunload handler to the editor so that it can specially handle this
case.

Closes #5257
This commit is contained in:
Kevin Sawicki
2015-02-04 17:14:46 -08:00
parent c5b6b90c88
commit fd1d872840
6 changed files with 34 additions and 9 deletions

View File

@@ -641,7 +641,11 @@ class TextEditor extends Model
# Determine whether the user should be prompted to save before closing
# this editor.
shouldPromptToSave: -> @isModified() and not @buffer.hasMultipleEditors()
shouldPromptToSave: ({windowCloseRequested}={})->
if windowCloseRequested
@isModified()
else
@isModified() and not @buffer.hasMultipleEditors()
###
Section: Reading Text