mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Add config.editor.autosave
This commit is contained in:
@@ -1939,9 +1939,9 @@ describe "Editor", ->
|
||||
|
||||
describe "when autosave is enabled", ->
|
||||
it "autosaves the current buffer when the editor loses focus or switches edit sessions", ->
|
||||
config.update("editor.autosave", true)
|
||||
rootView.attachToDom()
|
||||
editor2 = editor.splitRight()
|
||||
rootView.autosave = true
|
||||
spyOn(editor2.activeEditSession, 'save')
|
||||
|
||||
editor.focus()
|
||||
|
||||
@@ -18,6 +18,7 @@ class Editor extends View
|
||||
@configDefaults:
|
||||
fontSize: 20
|
||||
showInvisibles: false
|
||||
autosave: false
|
||||
|
||||
@content: (params) ->
|
||||
@div class: @classes(params), tabindex: -1, =>
|
||||
@@ -323,7 +324,7 @@ class Editor extends View
|
||||
@hiddenInput.on 'focusout', =>
|
||||
@isFocused = false
|
||||
@removeClass 'focused'
|
||||
@autosave() if @rootView()?.autosave
|
||||
@autosave() if config.editor.autosave
|
||||
|
||||
@overlayer.on 'mousedown', (e) =>
|
||||
@overlayer.hide()
|
||||
@@ -449,7 +450,7 @@ class Editor extends View
|
||||
throw new Error("Edit session not found") unless @editSessions[index]
|
||||
|
||||
if @activeEditSession
|
||||
@autosave() if @rootView()?.autosave
|
||||
@autosave() if config.editor.autosave
|
||||
@saveScrollPositionForActiveEditSession()
|
||||
@activeEditSession.off(".editor")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user