admin管理员组文章数量:1332361
how to remove the image plugin on ckeditor5 toolbar on react?
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;
how to remove the image plugin on ckeditor5 toolbar on react?
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;
Share
Improve this question
asked Jun 27, 2020 at 17:29
phongyewtongphongyewtong
5,31915 gold badges59 silver badges87 bronze badges
3 Answers
Reset to default 5You can provide a config
property to the CKEditor
ponent and pass in an array of strings to the removePlugins
prop.
<CKEditor
editor={ClassicEditor}
config={{
removePlugins: ['Image', 'ImageCaption', 'ImageStyle', 'ImageToolbar', 'ImageUpload', 'MediaEmbed']
}}
data={defaultValue}
onChange={onChange}
>
</CKEditor>
Here is more information on the CKEditor React ponent: https://ckeditor./docs/ckeditor5/latest/builds/guides/integration/frameworks/react.html#ponent-properties
Here is a link to the configuration options https://ckeditor./docs/ckeditor5/latest/builds/guides/integration/configuration.html
Here is a list of the default plugins with the ClassicEditor:
- Essentials
- CKFinderUploadAdapter
- Autoformat
- Bold
- Italic
- BlockQuote
- CKFinder
- EasyImage
- Heading
- Image
- ImageCaption
- ImageStyle
- ImageToolbar
- ImageUpload
- Indent
- Link
- List
- MediaEmbed
- Paragraph
- PasteFromOffice
- Table
- TableToolbar
- TextTransformation
My React solution
In my React ponent below only worked to remove Image and Media icons
<CKEditor
editor={ClassicEditor}
config={{
removePlugins: ["EasyImage","ImageUpload","MediaEmbed"]
}}
data={form.description}
onChange={(event, editor) => {
const data = editor.getData();
setForm((prev) => ({ ...prev, description: data }))
// console.log({ event, editor, data });
}}
/>
you can remove the image plugin with this config :
{
removePlugins: ['ImageInsert', 'ImageUpload'],
}
本文标签: javascripthow to remove the image plugin on ckeditor5 toolbar on reactStack Overflow
版权声明:本文标题:javascript - how to remove the image plugin on ckeditor5 toolbar on react - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742319327a2452462.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论