Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CKEditor 4: Can I define multiple plugin directories?

Is it possible for me to configure CKEditor to "search" for plugins in more than one directory?

I'm including the base CKEditor files using Bower and would like to keep my custom config and additional plugins outside of the bower_components folder.

From the docs I can see that it's possible to enable extra plugins easily enough but I think it assumes that the plugins are all contained within the main plugins folder - hopefully I'm wrong!

like image 224
HelloPablo Avatar asked Mar 19 '23 17:03

HelloPablo


1 Answers

CKEDITOR.plugins.addExternal is what you're looking for:

// Loads a plugin from '/myplugin/samples/plugin.js'.
CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/' );

// Loads a plugin from '/myplugin/samples/my_plugin.js'.
CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/', 'my_plugin.js' );

// Loads a plugin from '/myplugin/samples/my_plugin.js'.
CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/my_plugin.js', '' );

Once the plugin is defined, you can use it, i.e. via config.extraPlugins:

CKEDITOR.replace( 'editor1', {
    extraPlugins: 'sample'
} );
like image 97
oleq Avatar answered Apr 02 '23 15:04

oleq