mirror of
https://github.com/wassname/nvatom.git
synced 2026-06-27 16:10:36 +08:00
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:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user