I'm using TinyMCE with WordPress. I need it as a part of my custom WordPress plugin. So there is a page containing multiple TinyMCE editors, each with different ID. Each of them was created with wp_editor() function. When user performs an action like clicking the button I want to set content of the particular editor using tinymce.get("exampleID").setContent(). That works fine as long as TinyMCE was loaded in Visual Mode. Like there are 2 modes: visual and text.
When user changes to the text mode, leaves the page and come back later these TinyMCE editors will try to load in the text mode instead of visual one. But here is my problem: if these editors are loaded in text mode these are not in the tinymce.editors array and using tinymce.get() will result with javascript error saying it's null. If user switches back to visual mode, that particular editor will appear in the tinymce.editors array. So user needs to switch each of editors back to visual mode so these will be pushed to tinymce.editors array.
Currently I just hide the toggle mode buttons but I would know if there is any solution for that.