[CKEditor5] MathType plugin throws error when editor.sourceElement
is not defined
#829
Labels
type:bug
Something isn't working
editor.sourceElement
is not defined
#829
Description
When using an editor that doesn't have the
sourceElement
property, theMathType
plugin throws an error during the destroy process.We utilize various versions of editors, such as the headless editor in our internal features or the Multi-root editor, which do not include the
sourceElement
property. This results in error since the thecurrentInstance
variable in the theMathType
plugin is not defined (the plugin attempts to destroycurrentInstance
, which isundefined
).Reference: https://github.com/wiris/html-integrations/blob/stable/packages/ckeditor5/src/plugin.js#L68C5-L68C20
It could be simply fixed by adding the
if
statement:Environment
Which version of MathType does this happen in?
Latest
What is the relevant software and their versions?
CKEditor5
Steps to reproduce
MathType
to the editor plugins.editor.destroy()
.Expected result
The editor should be destroyed without errors.
Actual result
The error is thrown.
TypeError: Cannot read properties of undefined (reading 'removeEvents') at MathType.destroy
The text was updated successfully, but these errors were encountered: