Sha256: 48122bf3c08d4031196b9b231b6fc0e5503802e05064915cf22b8c856566ca1f

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

//
//  Manifest file for loading the CKeditor JS. Loads it from ckeditor-rails gem.
//  See /assets/ckeditor/config.js for default configuration.
//
//= require ckeditor-jquery

jQuery(function($){
  $('textarea.editor').each(function(e){
    if(editorEnabled()) {
      loadEditor(this.id)
    }
  });
});

function editorEnabled() {
  return $.cookie('editorEnabled') ? $.cookie('editorEnabled') == "true" : true
}

function disableEditor(id) {
  if(typeof(CKEDITOR) != "undefined" && CKEDITOR.instances[id] != null) {
    $('#'+id).val(CKEDITOR.instances[id].getData()).show()
    CKEDITOR.instances[id].destroy();
    $.cookie('editorEnabled', false, { expires: 90, path: '/' })
  }
}

function enableEditor(id) {
  if(typeof(CKEDITOR) != "undefined" && CKEDITOR.instances[id] != null) {
    CKEDITOR.instances[id].setData($('#'+id).val())
    $('#'+id).hide()
    $.cookie('editorEnabled', true, { expires: 90, path: '/' })
  }
}

function toggleEditor(id, status) {
  loadEditor(id)
  if(status == 'Simple Text' || status.value == 'disabled'){
    disableEditor(id)
  } else {
    enableEditor(id)
  }
}

function loadEditor(id) {
  if(typeof(CKEDITOR) != "undefined") {
    if (CKEDITOR.instances[id] == null) {
      CKEDITOR.replace(id, {
//  Commented out as do not have image search available
//        filebrowserImageBrowseUrl : '/ckfinder/ckfinder.html?Type=Image&Connector=/cms/sections/file_browser.xml'
      });
    }
    $.cookie('editorEnabled', true, { expires: 90, path: '/' })
    return true
  } else {
    return false
  }
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
browsercms-3.5.1 app/assets/javascripts/bcms/ckeditor.js
browsercms-3.5.0 app/assets/javascripts/bcms/ckeditor.js
browsercms-3.5.0.rc3 app/assets/javascripts/bcms/ckeditor.js
browsercms-3.5.0.rc2 app/assets/javascripts/bcms/ckeditor.js
browsercms-3.5.0.rc1 app/assets/javascripts/bcms/ckeditor.js
browsercms-3.4.2 app/assets/javascripts/bcms/ckeditor.js
browsercms-3.4.2.rc1 app/assets/javascripts/bcms/ckeditor.js
browsercms-3.4.1 app/assets/javascripts/bcms/ckeditor.js
browsercms-3.4.0 app/assets/javascripts/bcms/ckeditor.js