2

I have made custom plugin for ckeditor in drupal ckeditor module. The page where I am displaying CKEDITOR is loaded through AJAX and I am doing a replace div to show the CKEDITOR. the code for replaceDiv is:

function replaceDiv( div )
{
    if ( editor )
        editor.destroy();

    editor = CKEDITOR.replace( div ,
    {
        toolbar : 'Basic'/*'Basic'*/
    }); 
}

But, the problem is that in this way I am not getting my custom plugin displayed, I tried adding my control name in the toolbar definition in the array but it seems that I am not doing in the right way since it is not working!

1

In ckeditor.config.js you need something like this:

CKEDITOR.editorConfig = function(config) {
  config.extraPlugins = 'vicheck';
  CKEDITOR.plugins.addExternal('vicheck', '/sites/all/plugins/ckeditor/vicheck/');
  config.toolbar_DrupalBasic = [ [ 'Bold', 'Italic', '-', 'vicheck' ] ];
}

where vicheck is a plugin.

This works for me using an old CKEditor module. I don't know if the latest versions have any change.

| improve this answer | |
  • using this syntax do i need to modify the replaceDiv() code? – Firdous Dec 20 '11 at 11:51
  • b/c apparently its not working.. – Firdous Dec 20 '11 at 13:12
  • You have two separate question: add plugins into CKEditor, and use CKEditor on an Ajax page. Try do answer each first. My solution could solve the first problem, for the second I don't know, and I don't know the replaceDiv function. But it looks like you do not give the full config variable to your instanciation. – jcisio Dec 20 '11 at 13:29
  • yeah thats the actual problem, that i have no idea about instantiation of the config variable, otherwise there is no problem in opening ckeditor through ajax, but my plugin wont show up – Firdous Dec 20 '11 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.