How do I set a plugin on CKEditor when is used from the CDN?

纵然是瞬间 提交于 2019-12-19 19:40:04

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!