Sha256: 95dc86475dec06e53d21646a7b7f9117f7dc36fa72f627eb3055386e4bd698e1

Contents?: true

Size: 1.34 KB

Versions: 18

Compression:

Stored size: 1.34 KB

Contents

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

18 entries across 18 versions & 5 rubygems

Version Path
browsercms-3.3.4 public/bcms/ckeditor/editor.js
browsercms-3.3.3 public/bcms/ckeditor/editor.js
browsercms-3.1.5 public/bcms/ckeditor/editor.js
browsercms-3.1.4 public/bcms/ckeditor/editor.js
browsercms-3.3.2 public/bcms/ckeditor/editor.js
browsercms-3.3.1 public/bcms/ckeditor/editor.js
browsercms-3.3.0 public/bcms/ckeditor/editor.js
browsercms-3.1.3 public/bcms/ckeditor/editor.js
browsercms-3.3.0.beta public/bcms/ckeditor/editor.js
bcms_content_syncing-1.0.0 public/bcms/ckeditor/editor.js
drujensen-browsercms-3.2.0 public/bcms/ckeditor/editor.js
browsercmsi-3.1.2 public/bcms/ckeditor/editor.js
browsercms-3.1.2 public/bcms/ckeditor/editor.js
browsercms-3.1.1 public/bcms/ckeditor/editor.js
browsercmsi-3.1.1 public/bcms/ckeditor/editor.js
browsercmsi-3.1.0 public/bcms/ckeditor/editor.js
browsercms-3.1.0 public/bcms/ckeditor/editor.js
we5-browsercms-3.1.0 public/bcms/ckeditor/editor.js