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!

有帮助吗?

解决方案

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'
} );
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top