Sha256: cc1a469aebb3c74dc5b997f4c7bbd125461cd8f684e2d770ee1013e02bdfd1b5

Contents?: true

Size: 1.21 KB

Versions: 1

Compression:

Stored size: 1.21 KB

Contents

window.Editor = CKEDITOR

Editor.active = ->
  @el().attr('contenteditable',true)
  @el().effect('highlight', duration: 5000)
  for div in @el()
    CKEDITOR.inline(div)

Editor.deactive = ->
  @el().attr('contenteditable', false)
  $.each(CKEDITOR.instances, (key, editor) ->
    editor.destroy()
  )

Editor.commitAll = ->
  $.each(CKEDITOR.instances, (key, editor) ->
    dataset = editor.container.$.dataset
    model = FrontendEditor.findCurrentOrCreateModel(dataset.object)

    values = id: dataset.id
    values[dataset.attribute] = editor.getData()

    attributes =
      values: values
      prefix: dataset.prefix
      objectName: dataset.object
    model.setAttributes(attributes)
  )

Editor.el = ->
  $('.editable-long-text')

Editor.on('instanceCreated', ( event ) ->
  editor = event.editor
  element = editor.element
  editor.on('configLoaded', () ->
    editor.config.extraPlugins = 'sourcedialog'
    editor.config.toolbarGroups = [
      { name: 'source',    groups: [ 'sourcedialog' ] }
      { name: 'editing',    groups: [ 'basicstyles', 'links' ] }
      { name: 'styles' }
      '/'
      { name: 'undo' }
      { name: 'clipboard',  groups: [ 'selection', 'clipboard' ] }
      { name: 'insert' }
    ]
  )
)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
frontendeditor_ckeditor-0.0.10 vendor/assets/javascripts/ckeditor/ckeditor_actions.coffee