Save in editor.onDidStopChanging

Temporarily disables whitespace package so that you can create
newlines without getting them removed on autosave.
This commit is contained in:
Jonathan Hoyt
2015-05-09 13:49:42 -07:00
parent 49c081ed6e
commit e94430630c
+12 -4
View File
@@ -87,16 +87,24 @@ class NotationalVelocityView extends SelectListView
confirmSelection: ->
item = @getSelectedItem()
filePath = null
if item?
atom.workspace.open(item.getFilePath())
@cancel()
filePath = item.getFilePath()
else
sanitizedQuery = @getFilterQuery().replace(/\s+$/, '')
if sanitizedQuery.length > 0
filePath = path.join(@rootDirectory, sanitizedQuery + '.md')
fs.writeFileSync(filePath, '')
atom.workspace.open(filePath)
@cancel()
if filePath
atom.workspace.open(filePath).then (editor) ->
editor.onDidStopChanging () ->
if editor.isModified()
atom.packages.deactivatePackage("whitespace");
editor.save()
atom.packages.activatePackage("whitespace");
@cancel()
destroy: ->
@cancel()