Sha256: f242ed9e4622fad13fdd297cf56f80efb870d53cc170e43d1b58244d4a2aeb4b

Contents?: true

Size: 911 Bytes

Versions: 12

Compression:

Stored size: 911 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: ->
    _.extend { language: window.locale }, window.Locomotive.tinyMCE.defaultSettings

  refresh: ->
    # do nothing

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

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
locomotive_cms-2.1.4 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.1.3 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.1.2 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.1.1 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.1.0 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.0.3 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.0.2 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.0.1 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.0.0 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
tribeca_cms-0.1.1 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
tribeca_cms-2.0.0.rc12 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee
locomotive_cms-2.0.0.rc12 app/assets/javascripts/locomotive/views/editable_elements/long_text_view.js.coffee