javascript - 如何在反应中删除ckeditor5工具栏上的图像插件
问题描述
如何在反应时删除ckeditor5工具栏上的图像插件?
import React, { Component, Fragment } from 'react';
import CKEditor from '@ckeditor/ckeditor5-react';
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
const Editor = ({onEditorStateChange, defaultValue}) => {
const onChange = (event, editor ) => {
const data = editor.getData();
console.log( data );
onEditorStateChange(data)
};
const onBlur = (event, editor) => {
console.log( 'Blur.', editor );
};
const onFocus = (event, editor) => {
console.log( 'Focus.', editor );
};
const onInit = (editor) => {
// editor
// You can store the "editor" and use when it is needed.
console.log( 'Editor is ready to use!', editor );
};
return (
<div className="editor">
{/* <h2>Using CKEditor 5 build in React</h2> */}
<CKEditor
editor={ClassicEditor}
data={defaultValue}
onInit={onInit}
onChange={onChange}
onBlur={onBlur}
onFocus={onFocus}
/>
</div>
);
}
export default Editor;
解决方案
您可以为组件提供config
属性CKEditor
并将字符串数组传递给removePlugins
道具。
<CKEditor
editor={ClassicEditor}
config={{
removePlugins: ['Image', 'ImageCaption', 'ImageStyle', 'ImageToolbar', 'ImageUpload', 'MediaEmbed']
}}
data={defaultValue}
onChange={onChange}
>
</CKEditor>
以下是有关 CKEditor React 组件的更多信息: https ://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/frameworks/react.html#component-properties
这是配置选项的链接 https://ckeditor.com/docs/ckeditor5/latest/builds/guides/integration/configuration.html
下面是 ClassicEditor 的默认插件列表:
- 要点
- CKFinderUploadAdapter
- 自动格式化
- 大胆的
- 斜体
- 块报价
- CKFinder
- 易图
- 标题
- 图片
- 图片说明
- 图像样式
- 图像工具栏
- 图片上传
- 缩进
- 关联
- 列表
- 媒体嵌入
- 段落
- PasteFromOffice
- 桌子
- 表格工具栏
- 文本转换
推荐阅读
- kubernetes - 评估亲和性规则
- sql - 我不确定这个查询
- swift - 2 个 NSTableViews 1 个视图控制器。第二个表格视图中的单元格未将数据附加到行
- php - 为什么作曲家要更新所有内容?
- mysql - 我如何混合列数据
- php - 如何在 Laravel Nova 中的创建/更新表单上添加按钮以创建新的相关资源?
- c++ - 具有完美哈希函数的哈希表是否比数组更好?
- logstash - 使用 logstash 文件配置将数据从 mysql 移动到 elasticsearch
- node.js - 为 SSO 实施 oAuth 好不好?
- java - 可以在主要 java 代码上放置测试双重实现吗