JiHong88 / suneditor

Pure javascript based WYSIWYG html editor, with no dependencies.
http://suneditor.com
MIT License
1.67k stars 308 forks source link

Error if there is KaTeX code in options.value, but there is no 'math' button in buttonList #1338

Open abvas opened 7 months ago

abvas commented 7 months ago

If from a normally loaded editor with the connected katex plugin, connected katex script and styles, copy content (html) with code including the katex code and try to paste it into the editor in which everything is also connected (plugin, script and styles) from katex, but there is no button in the buttonList ' math', then the plugin does not load and we get the error: Uncaught TypeError: Cannot read properties of undefined (reading 'focusElement')

10

But if you add a 'math' button to the buttonList, everything works without problems.

Here's a live example: https://codepen.io/abvas/pen/xxPBjqK?editors=0010

The problem is that I need to use "readOnly" and buttonList = ["preview", "print"]

Please tell me, is there any way I can get around this? Thank you.