我已经完成了这项工作并将其发布到npm,您可以使用以下命令进行安装: npm install ckeditor5-classic-with-mathtype 下面是将它与react结合使用的示例: 从'@ ckeditor/ckeditor5-react'导入CKEditor;从'ckeditor5-classic-with-mathtype'导入ClassicEditor;...使成为() {返回 (< CKEditor编辑器= {ClassicEditor}config = {{工具栏:{项目: ['heading','MathType','ChemType','|','大胆的',斜体",'关联','项目符号列表','numberedList','imageUpload','mediaEmbed',"insertTable",'blockQuote',撤消",'重做']},}}来自CKEditor 5的带有MathType的data =< p>你好!</p>"onInit = {编辑器=>{//您可以存储编辑器"并在需要时使用.//console.log('Editor is ready to use!',editor);}}/>);} I have installed three packages:@ckeditor/ckeditor5-react@ckeditor/ckeditor5-build-classic@wiris/mathtype-ckeditor5/src/pluginI'm able to setup simple ckeditor5 but don't know how to use MathType plugin in this editor.Here is my sample code:<CKEditor data={input.value} editor={ClassicEditor} onChange={(event, editor) => { return input.onChange(editor.getData()); }}/>;Can anyone explain how i can use this?Thanks. 解决方案 Here's a link you should see to understand how to add a plugin to ckeditor.TL;DR: You should create a new build containing your plugin (in your case MathType plugin), the easiest way to do it is using their online builder, then you can use that build that you generated instead of @ckeditor/ckeditor5-build-classic for example.I have already done this work and published it to npm, you can install it with:npm install ckeditor5-classic-with-mathtypeHere's an example of using it with react:import CKEditor from '@ckeditor/ckeditor5-react';import ClassicEditor from 'ckeditor5-classic-with-mathtype';...render() { return ( <CKEditor editor={ClassicEditor} config={{ toolbar: { items: [ 'heading', 'MathType', 'ChemType', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'imageUpload', 'mediaEmbed', 'insertTable', 'blockQuote', 'undo', 'redo' ] }, }} data="<p>Hello from CKEditor 5 with MathType!</p>" onInit={editor => { // You can store the "editor" and use when it is needed. // console.log( 'Editor is ready to use!', editor ); }} /> ); } 这篇关于如何使用ReactJS在CKEditor 5中使用MathType插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-09 13:43