I'm writing a media plugin with tinyMCE hooks that produces some fairly complex HTML. If the HTML is present, I can use onBeforeSetContent to convert it to something the visual editor can work with, and onGetContent to convert it from visual back to HTML.
Unfortunately, the media_send_to_editor function just puts the string back in the active editor. What I need to do is detect WHICH editor is in use (HTML or Visual) and return the correct string. Anyone else done this successfully?