There is a getEditor() function that can be used to invoke against a jQuery object, but if a CKEditor object related to the textarea doesn't exist, it throws an exception. To get around this issue, we can implement our own version:
function disableCKEditor(textarea) {
// We cannot use getEditor() since it will throw an exception.
// http://ckeditor.com/blog/CKEditor_for_jQuery
var ck = textarea.eq(0).data('ckeditorInstance');
if (ck) {
ck.destroy();
ck = false;
}
}
To create a ckeditor object, we can invoke ckeditor() against the text area jQuery object.
// NOTE: If the django-filebrowser app is not used, then remove the filebrowserBrowseUrl.
// Using ckeditor() to replace a textarea does not call ckeditor/config.js, so we must
// specify the config explicitly.
content_field.ckeditor(function() { }, {width: '100%',
filebrowserBrowseUrl: '/admin/filebrowser/browse?pop=3'
});
Hi,
ReplyDeleteCud u plz lemme know how to toggle between plain text editor and ckeditor?