Open andrewhl opened 6 years ago
I have a similar issue working with react-tinymce (0.6.0) and redux-form (7.1.1) while loading my data asynchronously. @andrewhl, have you found a work-around in the mean-time?
Just upgraded to react-tinymce 0.7.0 and I get the same error.
@gvautour Unfortunately, I have not. The only solution that seems to accomplish anything is setting a manual setTimeout of 2-3 seconds before rendering the editor. This is, obviously, not ideal. Please let me know if you find anything. I'll post this to Stack Overflow and see if I get any hits.
@gvautour Here's my StackOverflow post
@gvautour I found a viable workaround. The one I posted above doesn't actually work. Upgrade to React 16, and use an error boundary component. See this article.
You wrap your TinyMCE component in <PotentialError></PotentialError>
, and React will re-render the component if it throws the onload error. It'll still error in the console, but the wysiwyg editor will rerender and be usable.
For others stumbling across this: It looks like this is fixed in version 4.7.7 of TinyMCE: https://github.com/tinymce/tinymce/blob/6b0075fdac4d190614de7d815d067b93300f029d/changelog.txt#L140
I'm using react-tinymce with create-react-app.
I'm getting the following error when the editor component mounts:
The section in question is in
tinymce.js
:b.getBody()
is returning null. This only happens intermittently. Sometimes the editor loads correctly. I should note that I am integrating the editor into react-redux-form, as a customControl
component.I am initializing the value of the form from a reducer that
react-redux-form
connects to myredux
state. The reducer has the following structure:Sometimes the editor loads just fine, prepopulating with the description of article from the reducer. This suggests to me that the issue is asynchronous, and is happening when the TinyMCE component attempts to mount before it has received the data from the
react-redux-form
reducer. I am setting default values in the reducer, however, so I'm not sure if something else is causing this issue.This is my implementation of TinyMCECustom: