<commit_before>window.Editor = CKEDITOR

Editor.active = ->
  target = $('.editable-long-text')
  target.attr('contenteditable',true)
  target.effect('highlight', duration: 5000)
  for div in target
    CKEDITOR.inline(div)

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

Editor.commitAll = ->
  $.each(CKEDITOR.instances, (key, editor) ->
    dataset = editor.container.$.dataset
    model = FrontendEditor.getCurrentModel(dataset.object)
    model.id = dataset.id
    model.set(dataset.attribute, editor.getData())
  )

Editor.on('instanceCreated', ( event ) ->
  editor = event.editor
  element = editor.element
  editor.on('configLoaded', () ->
    editor.config.toolbarGroups = [
      { name: 'editing',    groups: [ 'basicstyles', 'links' ] }
      { name: 'styles' }
      '/'
      { name: 'undo' }
      { name: 'clipboard',  groups: [ 'selection', 'clipboard' ] }<commit_msg>send the element of the editor<commit_after>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.getCurrentModel(dataset.object)
    model.id = dataset.id
    model.set(dataset.attribute, editor.getData())
  )

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

Editor.on('instanceCreated', ( event ) ->
  editor = event.editor
  element = editor.element
  editor.on('configLoaded', () ->
    editor.config.toolbarGroups = [
      { name: 'editing',    groups: [ 'basicstyles', 'links' ] }
      { name: 'styles' }
      '/'
      { name: 'undo' }
      { name: 'clipboard',  groups: [ 'selection', 'clipboard' ] }
{'fraction_non_alphanumeric': 0.17406659939455096, 'fraction_numerical': 0.004036326942482341, 'mean_word_length': 3.3582417582417583, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4151450', 'n_tokens_mistral': 663, 'n_tokens_neox': 651, 'n_words': 115}