Sha256: 9a0ba3da07f3b5b5ceb6d8ac7bc74c853bc61d517960ad6b2810118801eb4974

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 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, {
        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

5 entries across 3 versions & 2 rubygems

Version Path
bf4-browsercms-3.1.0 public/javascripts/cms/editor.js
bcms_fckeditor-1.0.1 public/bcms/ckeditor/editor.js
bcms_fckeditor-1.0.1 public/javascripts/cms/editor.js
bcms_fckeditor-1.0.0 public/bcms/ckeditor/editor.js
bcms_fckeditor-1.0.0 public/javascripts/cms/editor.js