Reputation: 5363
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
Upvotes: 5
Views: 3902
Reputation: 5267
Extending @codehitman's answer, you can manage the plugin via bower with at least two approaches:
Via CLI:
bower install panelbutton=https://download.ckeditor.com/panelbutton/releases/panelbutton_4.7.2.zip --save
The previous line will download the "panelbutton" addon and rename the downloaded addon to "panelbutton" (specified before the =
) and the --save
will write the command to bower.json (totally optional).
Via bower.json:
"dependencies": {
"panelbutton": "https://download.ckeditor.com/panelbutton/releases/panelbutton_4.7.2.zip",
"colorbutton": "https://download.ckeditor.com/colorbutton/releases/colorbutton_4.7.2.zip"
}
Just add the name you want to save the downloaded addon and the download url.
EXTRA: since you might want to store the downloaded addons into a ckeditor path, you can accomplish creating .bowerrc and pasting the following:
{
"directory" : "my/path/to/ckeditor/addons"
}
WARNING: If there is only a js on the package, bower renames it to index.js. I solved it running a postinstall script like this (adapt to your needs).
mv ./web/libraries/panelbutton/index.js ./web/libraries/panelbutton/plugin.js
Upvotes: 0
Reputation: 387
You could try adding the following line to your bower.json file:
"ckeditor": "#full/4.4.7"
This should install all plugins for you!
Upvotes: -2
Reputation: 7436
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
Upvotes: 7
Reputation: 1188
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
Upvotes: 3