making close work

This commit is contained in:
Corey Johnson
2011-11-10 17:13:36 -08:00
parent 5fef3f1aff
commit 930a5ff5c7
3 changed files with 10 additions and 9 deletions

View File

@@ -12,8 +12,8 @@ class Browser extends Document
$ "<iframe src='#{@path}' style='width:100%;height:100%'></iframe>"
constructor: (@path) ->
@html.html @iframe()
@html.html @iframe().bind 'load', (e) =>
window.setTitle e.target.contentWindow.document.title
@show()
atom.trigger 'browser:load', this
super()

View File

@@ -26,5 +26,6 @@ class Document extends Pane
@constructor is Document.handler path
close: ->
window.close()
save: ->

View File

@@ -95,15 +95,15 @@ class Editor extends Document
else
"An untitled file has changes."
canceled = atom.native.alert "Do you want to save your changes?",
close = atom.native.alert "Do you want to save your changes?",
detailedMessage,
"Save": =>
# if save modal fails/cancels, consider it cancelled
not @save()
"Cancel": => true
"Don't Save": => false
"Save": => @save()
"Cancel": => false
"Don't Save": => true
return if canceled
return if not close
super
save: ->
return @saveAs() if not @path