问题
I followed the steps on the CDN Guidelines page for CKEditior, but I can't make it work. The plugin that I'm trying to install is "autoembed" (or any plugin that lets me insert a video from YouTube, a Tweet and all of those different content types), but even when I tried different ways, I can't get it to work.
I was also reading the documentation on using a custom config file, where apparently they let you create a custom config config.js file, but it too doesn't work, or I'm not qualified to make it work.
回答1:
There's a method in CKEDITOR.resourceManager called addExternal. You can use it like
// Loads a plugin from '/myplugin/samples/plugin.js'.
CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/' );
Then simply add autoembed to config.extraPlugins = 'autoembed' like
CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/' );
CKEDITOR.replace( 'element', {
extraPlugins: 'sample'
} );
or in config.js:
CKEDITOR.plugins.addExternal( 'sample', '/myplugins/sample/' );
CKEDITOR.editorConfig = function( config ) {
config.plugins =
'sample,' +
...
};
来源:https://stackoverflow.com/questions/33024196/how-do-i-set-a-plugin-on-ckeditor-when-is-used-from-the-cdn