Sha256: 50d28b79da51a98f9d08df0217c48857fe33a19b28d06cfdf8d9778f9e1b6bd3

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

decko.addEditor(
  '.tinymce-textarea',
  ->
    decko.initTinyMCE @[0].id
  ->
    tinyMCE.get(@[0].id).getContent()
)

$.extend decko,
  setTinyMCEConfig: (string) ->
    setter = ->
      try
        $.parseJSON string
      catch
        {}
    decko.tinyMCEConfig = setter()

  initTinyMCE: (el_id) ->
    # verify_html: false -- note: this option needed for empty
    #                             paragraphs to add space.
    conf = {
      theme: "silver"
      plugins: 'autoresize'
      autoresize_max_height: 500
      mobile: { theme: 'mobile' }
    }
    user_conf = if decko.tinyMCEConfig? then decko.tinyMCEConfig else {}
    hard_conf = {
      selector: "##{el_id}"
      branding: false
      extended_valid_elements: "card-nest[id]"
      # CSS could be made optional, but it may involve migrating old legacy
      # *tinyMCE settings to get rid of stale stuff.
      content_css: decko.cssPath
      entity_encoding: 'raw'
    }
    $.extend conf, user_conf, hard_conf
    tinyMCE.baseURL = decko.path('assets/tinymce_editor/tinymce')
    tinyMCE.suffix = '.min'
    tinyMCE.remove("##{el_id}") if tinyMCE.get(el_id)?
    tinyMCE.init conf

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
card-1.97.0 mod/tinymce_editor/lib/javascript/script_tinymce_config.js.coffee