Warm tip: This article is reproduced from serverfault.com, please click

html-密码编辑器5

(html - CKEDITOR 5)

发布于 2020-02-08 16:20:45

CKEditor 5在我的angular 7应用程序中使用。ClassicEditor默认情况下Insert Media,工具栏上的按钮在下图中突出显示。

在此处输入图片说明

在网上研究时,我发现我们可以通过使用下面removePlugins选项来禁用特定的选项editorConfig

editor.component.ts

 editorConfig = {
    removePlugins: ['Image'],
    placeholder: 'Type the content here!'
      };

上面的代码不是要删除该Insert Media选项,而是要删除其他选项Insert Image但这是行不通的。即使使用了上面的代码,我仍然可以在我的CK编辑器中看到“图像插入”选项。

我也无法在网上找到我需要提供的内容,removePlugins以禁用Insert Media尝试至少正常运行选项。任何帮助将不胜感激。

提前致谢

Questioner
rocketpicks
Viewed
0
rocketpicks 2020-02-09 18:39:35

除了删除特定按钮外,还可以将CKEditor的默认配置设置为仅显示我们所需的选项。

将以下代码添加到你的angular component.ts文件中的构造函数中,将创建一个简单的CKEditor,其中仅包含items数组中提到的那些选项mediaEmbed是负责Insert Video在CKEditor中显示选项的项目的名称,我没有在items数组中提及它不会在CKEditor中显示它。

ClassicEditor.defaultConfig = {
      toolbar: {
        items: [
          'heading',
          '|',
          'bold',
          'italic',
          '|',
          'bulletedList',
          'numberedList',
          '|',
          'insertTable',
          '|',
          'imageUpload',
          '|',
          'undo',
          'redo'
        ]
      },
      image: {
        toolbar: [
          'imageStyle:full',
          'imageStyle:side',
          '|',
          'imageTextAlternative'
        ]
      },
      table: {
        contentToolbar: [ 'tableColumn', 'tableRow', 'mergeTableCells' ]
      },
      language: 'en'
    };

添加以上代码后的结果

在此处输入图片说明

希望这会对某人有所帮助!