Log in or register to post comments
Last post
sabr's picture
Joined: 09/01/2010
Posts: 65
Re: Tutorial create external plugin for CKEDITOR
Great writeup. Here are two gotchas that I tripped over yesterday.

The addExternal docs describe a bunch of different ways of specifying plugins (including addExternal('plugina,pluginb', path)), none of which work. In fact, all but one of the examples they show don't work! The call to addExternal that you show here is the only form that works. Just hoping to save somebody some time!

Also, if you're using ckeditor_basic to prevent loading ckeditor code until it's needed, you can't just start adding external resources. The problem is that CKEDITOR.plugin still doesn't exist when loadFullCore returns. If you want to add some resources right after calling loadFullCore, you must wait for the loaded event:

function after_loaded(fn) {
    if(CKEDITOR.loadFullCore) {
        CKEDITOR.on('loaded', function () { fn() });
    } else {

function start_editor(editor_id) {
    CKEDITOR.replaceByClassEnabled = false;
    var mydir = location.pathname.substring(0, location.pathname.lastIndexOf('/'));
// the following call dies with "CKEDITOR.plugins undefined" if we don't wait for the loaded event.
    CKEDITOR.plugins.addExternal('autogrow', mydir + '/plugins/autogrow/', 'plugin.js');
    editor = CKEDITOR.replace(editor_id, { contentsCss: mydir + '/content.css' } );

$('#editor1').click(function (evt) { after_loaded(start_editor) });
virginia511's picture
Joined: 04/11/2011
Posts: 1
Re: Tutorial create external plugin for CKEDITOR
Hi, guys, registered to thank you for the great tutorial provided in here. You've saved tones of my nerves and time
TomGreen's picture
Joined: 06/09/2013
Posts: 1
One thing to note about your directories passed to addExternal.

Be sure to have a trailing slash at the end of the directories or the getUrl() method used to generate the request URL will include the timestamp. We ran into this at first when trying to use this api.

gursahibsahni's picture
Joined: 19/11/2013
Posts: 1
unable to add an external plugin

Sir am unable to add an external plugin, i followed all the steps but am unsucessful. 
kindly help ! thanks!