Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add extra plugins to CKEditor using bower

I use bower to manage my js packages. I installed CKEditor into bower directory and it worked fine.

The question is: how should I add external plugins to ckeditor? I read here http://ckeditor.com/blog/CKEditor-Supports-Bower-and-Composer that this is possible by using extraPlugins property. But obviously I should somehow download plugin and add it to ckeditor/plugins folder. I'm quite new to bower but as I understand I shouldn't manually add any files or folders into bower directory. Instead I should use bower install plugin_name or something like that.

So, if I simple write it like:

    CKEDITOR.replace('pageContent', {
        extraPlugins: 'Syntaxhighlighter Interface'
    });

I got an error that the plugins is not found

like image 375
Victor Avatar asked Aug 19 '14 13:08

Victor


2 Answers

As far as I can see you can't just use Bower to care about the CKEditor plugins but at least you can add plugins from an external folder with this command:

CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/' );

/myplugins/sample/ is a path to the folder where the plugin.js file is relative to the web root. sample is the name of the plugin.

Check out the docs on this:

http://docs.ckeditor.com/#!/api/CKEDITOR.resourceManager-method-addExternal

like image 140
Gherman Avatar answered Oct 03 '22 22:10

Gherman


With the page you linked mentions that Ckeditor iteself can be downloaded with bower but not the plugins. After you download the plugins you need to enable them with the extraPlugins option. To download the actual plugin I would use the plugin's download link like so:

bower install http://mydomain/somefile.zip

like image 21
codehitman Avatar answered Oct 03 '22 22:10

codehitman