mirror of
https://github.com/atom/atom.git
synced 2026-01-25 06:48:28 -05:00
Meta+s triggers save on Editor.
Still can't save buffers that don't have a url.
This commit is contained in:
committed by
Corey Johnson & Nathan Sobo
parent
79fbc0118c
commit
c75c3555bb
@@ -7,21 +7,30 @@ module.exports =
|
||||
class Editor
|
||||
aceEditor: null
|
||||
buffer: null
|
||||
editorElement: null
|
||||
|
||||
constructor: (url) ->
|
||||
@buffer = new Buffer(url)
|
||||
@buildAceEditor()
|
||||
$(document).keydown (event) =>
|
||||
if String.fromCharCode(event.which) == 'S' and event.metaKey
|
||||
@save()
|
||||
|
||||
|
||||
destroy: ->
|
||||
@aceEditor.destroy()
|
||||
|
||||
buildAceEditor: ->
|
||||
editorElement = $("<div class='editor'>")
|
||||
$('#main').append(editorElement)
|
||||
@aceEditor = ace.edit editorElement[0]
|
||||
@editorElement = $("<div class='editor'>")
|
||||
$('#main').append(@editorElement)
|
||||
@aceEditor = ace.edit @editorElement[0]
|
||||
@aceEditor.setSession(new EditSession(@buffer.aceDocument))
|
||||
@aceEditor.setTheme(require "ace/theme/twilight")
|
||||
|
||||
getAceSession: ->
|
||||
@aceEditor.getSession()
|
||||
|
||||
|
||||
save: ->
|
||||
@buffer.save()
|
||||
|
||||
|
||||
@@ -24,9 +24,6 @@ windowAdditions =
|
||||
onerror: ->
|
||||
@showConsole true
|
||||
|
||||
handleKeyEvent: ->
|
||||
null
|
||||
|
||||
triggerEvent: ->
|
||||
null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user