CKEditor:如何在文本部分粘贴网址时删除自动嵌入行为(4.7 版本)

问题描述 投票:0回答:2

我使用的是 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 上时显示?

javascript ckeditor ckeditor4.x
2个回答
2
投票

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

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

0
投票

对于 CKEditor 5,使用以下配置来禁用嵌入:

const config = {
    removePlugins: ['MediaEmbed']
};
© www.soinside.com 2019 - 2024. All rights reserved.