Sha256: a42744c6ac4a3d41943d2830beef9532c7a0c112d380233c97311a25f21b1e68

Contents?: true

Size: 1.6 KB

Versions: 14

Compression:

Stored size: 1.6 KB

Contents

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) ->
    mode = textarea.attr "data-ace-mode"
    unless mode
      textarea.autosize()
      return
    editDiv = $("<div>",
      position: "absolute"
      width: "auto"
      height: textarea.height()
    ).insertBefore(textarea)
    textarea.css "visibility", "hidden"
    textarea.css "height", "0px"
    ace.config.set('basePath','/assets/ace')
    editor = ace.edit(editDiv[0])
    editor.getSession().setValue textarea.val()
    decko.configAceEditor(editor, mode)
    return

aceEditorContent = (element) ->
  ace_div = $(element).siblings(".ace_editor")
  editor = ace.edit(ace_div[0])
  editor.getSession().getValue()




$.extend decko,


  initProseMirror: (el_id) ->
    conf = {
      menuBar: true,
      tooltipMenu: false
    }
    hard_conf = { docFormat: "html" }
    user_conf = if decko.proseMirrorConfig? then decko.proseMirrorConfig else {}
    $.extend conf, user_conf, hard_conf
    createProseMirror(el_id, conf)

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
card-1.93.9 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.93.8 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.93.7 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.93.6 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.93.5 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.93.4 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.93.3 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.93.2 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.93.1 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.93.0 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.92.2 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.92.1 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.92 mod/ace_editor/lib/javascript/script_ace_config.js.coffee
card-1.91 mod/ace_editor/lib/javascript/script_ace_config.js.coffee