首页 > 解决方案 > CKEditor:如何在文本部分粘贴 url 时删除自动嵌入行为(4.7 版)

问题描述

我正在使用 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 时,我看到了自动嵌入行为。我需要禁用它,如果只有当我单击选项卡上的特定图标时才会有这种行为会更好。只有当我单击该图标而不是当我简单地将链接 url 粘贴到 CKEditor 时,才会出现嵌入 iframe 的方法?

标签: javascriptckeditorckeditor4.x

解决方案


好的,我找到了解决方案,每个组件都有属性 removePlugins 执行此操作,在这种情况下,我删除了 embedbase 和 embed 插件,如下所示:

CKEDITOR.replace('text1', {
       allowedContent : true,
       autoParagraph: false,
       removePlugins: 'embedbase, embed',
       toolbar : [ ['Source'], ['Bold','Italic','Underline'], [ 'NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', '-', 'Blockquote' ], [ 'Styles', 'Format' ], ]});

推荐阅读