-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Labels
type:bugSomething isn't workingSomething isn't working
Description
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.currentInstancewill 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>
);
};
- Enter an equation in the second editor
- Click "Remove First Editor"
- 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
Metadata
Metadata
Assignees
Labels
type:bugSomething isn't workingSomething isn't working