【发布时间】:2022-11-04 18:03:29
【问题描述】:
我使用 ckeditor5 documentation 来导入 ckeditor5 react 组件。这是我的代码:
<CKEditor
editor={ClassicEditor}
data=""
config={custom_config}
onReady={editor => {
// You can store the "editor" and use when it is needed.
// console.log('Editor is ready to use!', editor);
}}
onChange={(event, editor) => {
const data = editor.getData();
console.log({ event, editor, data });
this.setState({ content: data })
}}
onBlur={(event, editor) => {
// console.log('Blur.', editor);
}}
onFocus={(event, editor) => {
// console.log('Focus.', editor);
}}
/>
这是我的 custom_config :
const custom_config = {
extraPlugins: [MyCustomUploadAdapterPlugin],
toolbar: {
items: [
'heading',
'|',
'bold',
'italic',
'link',
'bulletedList',
'numberedList',
'|',
'blockQuote',
'insertTable',
'|',
'imageUpload',
'undo',
'redo'
]
},
image: {
toolbar: [
'imageStyle:inline',
'imageStyle:block',
'imageStyle:side',
'|',
'toggleImageCaption',
'imageTextAlternative'
]
},
table: {
contentToolbar: ['tableColumn', 'tableRow', 'mergeTableCells']
}
}
我想添加 ImageResize 插件,但在文档中它没有显示如何为 React 导入。您可以在here 中找到文档
我尝试像这样导入extraPlugins:
extraPlugins: [MyCustomUploadAdapterPlugin, ImageResize],
我在文档中找不到如何正确处理 React 组件。
【问题讨论】:
标签: reactjs ckeditor ckeditor5