Sha256: 91dc1726b1c0062923fbfd45e883acbb2194edf6a4c87c2b6de1221bb14de6bb

Contents?: true

Size: 1.17 KB

Versions: 27

Compression:

Stored size: 1.17 KB

Contents

# This is depricated. We will keep this around until we have moved everything over to the new
#  plain data form editor.

$(document).ready ->
  $('.ace_yaml_editor').each ->
    editor_area = document.createElement('div')
    this.appendChild(editor_area)

    # Initialize Ace Editor
    editor = ace.edit(editor_area)
    editor.getSession().setMode("ace/mode/yaml")
    editor.getSession().setTabSize(2)
    editor.setPrintMarginColumn(800)
    editor.setOptions({
      minLines: 8,
      maxLines: Infinity
    });

    textarea = $(this).children('textarea').hide()
    editor.getSession().setValue textarea.val()
    editor.getSession().on "change", ->
      textarea.val editor.getSession().getValue()


    # Setup drag-drop image upload
    editor.container.addEventListener 'dragover', (e) =>
      e.preventDefault()
      e.stopPropagation()

    editor.container.addEventListener 'dragleave', (e) =>
      e.preventDefault()
      e.stopPropagation()

    editor.container.addEventListener 'drop', (e) =>
      e.preventDefault()
      e.stopPropagation()
      fileUploader.sendFileToServer e.dataTransfer.files[0], 'embedded_image', (url) ->
        editor.insert('"' + url + '"')

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
biola_wcms_components-0.19.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.18.1 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.18.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.17.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.16.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.15.3 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.15.2 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.15.1 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.15.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.14.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.13.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.12.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.11.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.10.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.9.1 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.9.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.8.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.7.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.6.1 app/assets/javascripts/components/forms/yaml_editor.js.coffee
biola_wcms_components-0.6.0 app/assets/javascripts/components/forms/yaml_editor.js.coffee