<commit_before>initialize = ->
  $inputs = $('textarea.effective_ckeditor_text_area:not(.initialized)')
  setupCkeditor($inputs)

  $inputs.each (i, element) ->
    element = $(element)
    element.addClass('initialized')
    initCkeditor(element)

# This is a one-time initialization that is done to check that all the scripts are properly set up
setupCkeditor = ($inputs) ->
  return unless $inputs.length > 0

  input_js_options = $inputs.first().data('input-js-options') || {}

  ckeditor_present = ((try CKEDITOR.version) || '').length > 0
  use_effective_assets = input_js_options['effective_assets'] == true
  $head = $('head')

  unless ckeditor_present
    $head.append("<link href='#{input_js_options['effective_ckeditor_css_path']}' type='text/css', media='screen' rel='stylesheet' />")
    jQuery.ajax({url: input_js_options['effective_ckeditor_js_path'], dataType: 'script', cache: true, async: false})

  if use_effective_assets
    $head.append("
      <script>
        try {
          CKEDITOR.config['effective_regions'] = {
            'snippets': {
              'effective_asset': {
                'dialog_url':'/assets/effective/snippets/effective_asset.js',
                'label':'Effective asset',
                'description':'Insert Effective asset',
                'inline':true,
                'editables':false,
                'tag':'span'
              }
            }
          };
        } catch(e) {};
      </script>
    ");

initCkeditor = (textarea) ->
  options =
    toolbar: 'full'
    effectiveRegionType: 'full'
    customConfig: ''
    enterMode: CKEDITOR.ENTER_P
    shiftEnterMode: CKEDITOR.ENTER_BR
    startupOutlineBlocks: false
    startupShowBorders: true
    disableNativeTableHandles: true
    disableNativeSpellChecker: false
    extraPlugins: 'effective_regions,effective_assets'
    removePlugins: 'elementspath'
    format_tags: 'p;h1;h2;h3;h4;h5;h6;pre;div'
    templates: 'effective_regions'
    templates_files: []
    templates_replaceContent: false
    filebrowserWindowHeight: 600
    filebrowserWindowWidth: 800
    filebrowserBrowseUrl: '/effective/assets?only=images'<commit_msg>startup outline blocks = true for ckeditor<commit_after>initialize = ->
  $inputs = $('textarea.effective_ckeditor_text_area:not(.initialized)')
  setupCkeditor($inputs)

  $inputs.each (i, element) ->
    element = $(element)
    element.addClass('initialized')
    initCkeditor(element)

# This is a one-time initialization that is done to check that all the scripts are properly set up
setupCkeditor = ($inputs) ->
  return unless $inputs.length > 0

  input_js_options = $inputs.first().data('input-js-options') || {}

  ckeditor_present = ((try CKEDITOR.version) || '').length > 0
  use_effective_assets = input_js_options['effective_assets'] == true
  $head = $('head')

  unless ckeditor_present
    $head.append("<link href='#{input_js_options['effective_ckeditor_css_path']}' type='text/css', media='screen' rel='stylesheet' />")
    jQuery.ajax({url: input_js_options['effective_ckeditor_js_path'], dataType: 'script', cache: true, async: false})

  if use_effective_assets
    $head.append("
      <script>
        try {
          CKEDITOR.config['effective_regions'] = {
            'snippets': {
              'effective_asset': {
                'dialog_url':'/assets/effective/snippets/effective_asset.js',
                'label':'Effective asset',
                'description':'Insert Effective asset',
                'inline':true,
                'editables':false,
                'tag':'span'
              }
            }
          };
        } catch(e) {};
      </script>
    ");

initCkeditor = (textarea) ->
  options =
    toolbar: 'full'
    effectiveRegionType: 'full'
    customConfig: ''
    enterMode: CKEDITOR.ENTER_P
    shiftEnterMode: CKEDITOR.ENTER_BR
    startupOutlineBlocks: true
    startupShowBorders: true
    disableNativeTableHandles: true
    disableNativeSpellChecker: false
    extraPlugins: 'effective_regions,effective_assets'
    removePlugins: 'elementspath'
    format_tags: 'p;h1;h2;h3;h4;h5;h6;pre;div'
    templates: 'effective_regions'
    templates_files: []
    templates_replaceContent: false
    filebrowserWindowHeight: 600
    filebrowserWindowWidth: 800
    filebrowserBrowseUrl: '/effective/assets?only=images'
{'fraction_non_alphanumeric': 0.12552011095700416, 'fraction_numerical': 0.006472491909385114, 'mean_word_length': 3.2214634146341465, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 21, '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': '1220653', 'n_tokens_mistral': 1350, 'n_tokens_neox': 1283, 'n_words': 240}