ITADN

CKEditor 5 integration doesn't fully support multiple editors on the same page

#1047Closedjonscheiding 创建于 2024-11-26
type:bug
J
jonscheidingcommented
## Description The CKE5 plugin doesn't correctly handle the `IntegrationModel` object when there are multiple editors on the same page. It has the following undesirable behaviors: * `window.WirisPlugin.currentInstance` will always be the last one to be initialized * If an editor is destroyed, it will destroy the last-initialized integration model instead of its own ## Environment _Which version of MathType does this happen in?_ `@wiris/mathtype-ckeditor5@8.11.1` _What is the relevant software and their versions?_ - _Editor (CKEditor, Froala, TinyMCE, etc.)_ CKEditor 5 40.1.0 - _Framework (Angular, React, etc.)_ n/a (React 17.0.2) - _Browser (Chrome, Firefox, etc.)_ n/a - _Operating System (Windows, macOS, Ubuntu, etc.)_ n/a ## Steps to reproduce Run an app with the following React component: ``` const Sample: React.FC = () => { const [showFirstEditor, setShowFirstEditor] = useState(true); return ( <div> {showFirstEditor && ( <CKEditor key="1" editor={ClassicEditor} config={{ plugins: [Paragraph, Essentials, MathType], toolbar: ["MathType"], }} onReady={(editor) => { editor.on<EditorDestroyEvent>("destroy", () => { console.log("Editor 1 destroyed"); }); }} /> )} <CKEditor key="2" editor={ClassicEditor} config={{ plugins: [Paragraph, Essentials, MathType], toolbar: ["MathType"], }} /> <button onClick={() => setShowFirstEditor(false)}> Remove First Editor </button> </div> ); }; ``` 1. Enter an equation in the second editor 2. Click "Remove First Editor" 3. Double-click the equation in the second editor ## Expected result * The MathType equation editor opens with the selected equation filled in ## Actual result * The MathType equation editor does not open * An error `Cannot read properties of null (reading 'isReadOnly')` is logged to the console
关闭于 2024-12-10 3 条评论