Sha256: f22e486a9945589df7ada1f3216ee0b84f75b6815bc2d76f2184c8532d62c369

Contents?: true

Size: 869 Bytes

Versions: 7

Compression:

Stored size: 869 Bytes

Contents

#= require ./short_text_view

Locomotive.Views.EditableElements ||= {}

class Locomotive.Views.EditableElements.LongTextView extends Backbone.View

  tagName: 'li'

  className: 'text input html'

  render: ->
    $(@el).html(ich.editable_text_input(@model.toJSON()))

    return @

  after_render: ->
    settings = _.extend {}, @tinymce_settings(),
      oninit: ((editor) =>
        $.cmd 'S', (() =>
          @model.set(content: editor.getBody().innerHTML)
          $(@el).parents('form').trigger('submit')
        ), [], ignoreCase: true, document: editor.dom.doc),
      onchange_callback: (editor) =>
        @model.set(content: editor.getBody().innerHTML)

    @$('textarea').tinymce(settings)

  tinymce_settings: ->
    window.Locomotive.tinyMCE.defaultSettings

  refresh: ->
    # do nothing

  remove: ->
    @$('textarea').tinymce().destroy()
    super

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc11 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.0.0.rc10 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.0.0.rc9 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.0.0.rc8 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.0.0.rc7 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.0.0.rc6 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.0.0.rc5 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee