Pregunta

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!

¿Fue útil?

Solución

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'
} );
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top