TinyMCE in IonModal fails to start when initialised a second time
See original GitHub issueWhat is the current behavior? I have an Editor on an IonModal if I open the modal twice the Editor crashes and fails to render.
Please provide the steps to reproduce and if possible a minimal demo of the problem via codesandbox.io or similar. You can find a minimal example of this here: https://codesandbox.io/s/jolly-fire-d7l52?file=/src/App.js If you press “Show Modal” twice it crashes with
tinymce.min.js:2 Uncaught TypeError: Cannot read property 'open' of undefined
What is the expected behavior?
The Editor should show up.
Which versions of TinyMCE, and which browser / OS are affected by this issue? Did this work in previous versions of TinyMCE or tinymce-react
?
Google Chrome | 87.0.4280.141
@tinymce/tinymce-react 3.9.0 @ionic/react 5.5.2 @ionic/react-hooks 0.0.8 @ionic/react-route 5.3.4
I figure it’s a problem with the IonModal and my current workaround to use the Material-UI Modal works. I just thought I should let someone know.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:20 (9 by maintainers)
Top GitHub Comments
Thanks for the reply @Marruixu. Yes I eventually also tried using tinymce directly with a
textarea
(no react wrapper) but bumped into other problems (missing themes, icons) and even though I tried importing them, the current project’s gulp setup is not ready for this approach… I put a pin on it because of the time that this adaptation might take.Still, it seems that the solution is simply not using the library, which is a pitty …
I’m suffering from the same issue. Although the editor is not inside a modal, it’s an element that either gets added or removed from the DOM. As soon as it’s added a second time, I’m faced with the “Cannot read property ‘open’ of undefined” error. @Marruixu I’ve tried sending a different
id
on each mount but without any luck…