Closed AlexKvazos closed 4 years ago
I had this same problem. I tracked down the problem and internally an init
handler was getting triggered and would set the contents to ""
after it had the correct value.
So, in my consuming code I ended up adding a setup
method inside of the config
that is passed to TinyMCE
. In the setup I listen to the init
event and manually set the editor's contents.
Something like this... (pseudo-code)
<TinyMCE
content={ content }
config={ {
setup( editor ) {
editor.on( "init", () => editor.setContent( content ) )
}
} }
/>
So the component that renders the editor has the onChange handler and updates the state with the new value each time an input changes, however, the editor disappears when this happens. Looks like the render function is making the editor disappear. Any ideas?