Sha256: bf1e2798542153884a609ff6fce11b13b4321e108dbdc5408f6a8ecff2451ab0

Contents?: true

Size: 839 Bytes

Versions: 1

Compression:

Stored size: 839 Bytes

Contents

Locomotive.Views.EditableElements ||= {}

class Locomotive.Views.EditableElements.ShortTextView 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.minimalSettings

  refresh: ->
    # do nothing

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
locomotive_cms-2.0.0.rc4 app/assets/javascripts/locomotive/views/editable_elements/short_text_view.js.coffee