decko.addEditor( '.ace-editor-textarea', -> decko.initAce $(this), -> aceEditorContent this[0] ) $.extend decko, setAceConfig: (string) -> setter = -> try $.parseJSON string catch {} decko.aceConfig = setter() configAceEditor: (editor, mode) -> conf = { showGutter: true, theme: "ace/theme/github", printMargin: false, tabSize: 2, useSoftTabs: true, maxLines: 30 } hard_conf = { mode: "ace/mode/" + mode } user_conf = if decko.aceConfig? then decko.aceConfig else {} $.extend conf, user_conf['default'], user_conf[mode], hard_conf editor.setOptions conf initAce: (textarea) -> return if textarea.data('aceInited') textarea.data('aceInited', true) # prevents double initialization mode = textarea.attr "data-ace-mode" unless mode textarea.autosize() return editDiv = $("