ITADN

页面中有两个编辑器实例,当删除第一个编辑器后,第二个实例点击公式报错

#1111Openpkwdzc 创建于 2025-07-17
type:bug
P
pkwdzccommented
## Description 当页面中有两个ck5实例并且都加载了wiris插件,因为业务需求,删除了第一个ck5实例,然后你会发现第二个ck5编辑器的wiris打不开了,点击报错 ## Environment ckdeditor : 46.0.0 vue2: 2.7.16 @ckeditor/ckeditor5-vue2: 3.0.1 mathtype-ckeditor5: 8.13.3 ## Steps to reproduce 1、页面中创建两个带wiris公式的ck5编辑器 2、删除第一个编辑器 ## Expected result 第二个编辑器功能正常 ## Actual result 第二个编辑器的公式点击报错 ``` index.js:1110 Uncaught CKEditorError: unexpected-error Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-unexpected-error Original error: TypeError: Cannot read properties of null (reading 'editing') at CKEditor5Integration.openNewFormulaEditor (index.js:164:63) at ChemTypeCommand.openEditor (index.js:368:24) at ChemTypeCommand.execute (index.js:348:10) at ChemTypeCommand.eval (index.js:1955:37) at ChemTypeCommand.fire (index.js:1485:16) at <computed> [as execute] (index.js:1958:21) at CommandCollection.execute (index.js:542:20) at ClassicEditor.execute (index.js:2555:28) at ButtonView.eval (index.js:547:18) at ButtonView.fire (index.js:1485:16) ``` ## Other details ``` <template> <div class="home"> <ckeditor v-if="ckShow" :editor="editor" v-model="text1" :config="editorConfig"></ckeditor> <ckeditor :editor="editor" v-model="text2" :config="editorConfig"></ckeditor> <button @click="ckShow = false">删除第一个</button> </div> </template> <script> import CKEditor from '@ckeditor/ckeditor5-vue2' import { ClassicEditor, Paragraph } from 'ckeditor5'; import MathType from '@wiris/mathtype-ckeditor5/dist/index.js'; import 'ckeditor5/ckeditor5.css'; export default { name: 'HomeView', components: { ckeditor: CKEditor.component, }, data() { return { editor: ClassicEditor, editorConfig: { licenseKey: 'GPL', // Or 'GPL'. plugins: [ MathType, Paragraph ], toolbar: [ 'MathType', 'ChemType', ], }, text1: '1111111', text2: '22222222', ckShow: true } } } </script> ```
1 条评论