Rename to getSaveDialogOptions and document in TextEditor

This commit is contained in:
Jesse Grosjean
2015-06-08 16:20:53 -04:00
parent 656c91beb4
commit 1dbfd0b5ac
2 changed files with 11 additions and 1 deletions

View File

@@ -492,7 +492,7 @@ class Pane extends Model
saveItemAs: (item, nextAction) ->
return unless item?.saveAs?
saveOptions = item.getSaveOptions?() or {}
saveOptions = item.getSaveDialogOptions?() ? {}
saveOptions.defaultPath ?= item.getPath()
newItemPath = atom.showSaveDialogSync(saveOptions)
if newItemPath

View File

@@ -593,6 +593,16 @@ class TextEditor extends Model
# Essential: Returns the {String} path of this editor's text buffer.
getPath: -> @buffer.getPath()
# Private: Return [save options](http://electron.atom.io/docs/v0.27.0/api/di
# alog/#dialog.showsavedialog(%5Bbrowserwindow%5D,-%5Boptions%5D,-%5Bcallbac
# k%5D)) to be used when displaying the save dialog.
#
# Default empty options are returned now. In the future this would be the
# place to start implementing things like: https://discuss.atom.io/t
# /request-saving- file-with-correct-extension/17521
getSaveDialogOptions: ->
{}
# Extended: Returns the {String} character set encoding of this editor's text
# buffer.
getEncoding: -> @buffer.getEncoding()