我使用的是 CKEditor 版本 4.7。
在 config.js 文件中,我集成了一些用于在外部网站(例如 youtube、twitter、facebook 等)上自动嵌入链接的插件。
CKEDITOR.editorConfig = function( config ) {
config.extra_plugins = 'widgetselection,notificationaggregator,notification,clipboard,lineutils,widget,dialogui,dialog,embedbase,embed';
};
但是,对于某些页面,当我在 ckeditor 的文本部分复制 url 时,我发现存在自动嵌入行为。我需要禁用它,如果仅当我单击选项卡上的特定图标时才具有此行为,那就更好了。有一种方法可以仅在我单击该图标时显示嵌入的 iframely,而不是在我简单地将链接 url 粘贴到 CKEditor 上时显示?
好的,我找到了解决方案,有属性removePlugins可以为每个组件执行此操作,在这种情况下,我删除了嵌入库和嵌入插件,如下所示:
CKEDITOR.replace('text1', {
allowedContent : true,
autoParagraph: false,
removePlugins: 'embedbase, embed',
toolbar : [ ['Source'], ['Bold','Italic','Underline'], [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote' ], [ 'Styles', 'Format' ], ]});
对于 CKEditor 5,使用以下配置来禁用嵌入:
const config = {
removePlugins: ['MediaEmbed']
};