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() });
        CKEDITOR.loadFullCore();
    } else {
        fn();
    }
}

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! 

SUJEET's picture
Joined: 17/07/2014
Posts: 2
call ckeditor plugin while loading page

I want to load a ckeditor plugin automatically without any click on button of ckeditor plugin. is there any method for this issue? so that i load ckeditor plugin on loading the page.

n2lose's picture
Joined: 30/04/2010
Posts: 15
I created this tutorial long

I created this tutorial long time ago. For now, i move to do another things and don't work with CKeditot anymore.

 

smsabbir480's picture
Joined: 15/07/2014
Posts: 2
Tutorial link

Have you made a video for this tutorial?.If you did please submit the video on any video submission site and give me the link.That will be helpful for me.Thank's for the tropic.