Forums

[resolved] detect tinymce editor type (2 posts)

  1. gdf55
    Member
    Posted 7 months ago #

    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?

  2. gdf55
    Member
    Posted 7 months ago #

    Realized (middle of the night, I hate it when that happens) that it must be a WP setting, not a tinyMCE setting, that determines the editor. Found a function wp_default_editor() that returns "html" or "tinymce" depending on a stored cookie or user default setting.

Reply

You must log in to post.

About this Topic