Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a tab switching theme that lets the user choose 3 editing modes when adding new pages (HTML and Visual- these are WP defaults and the new Syntax mode using Code Mirror).

I have issues when switching from Syntax back to HTML and Visual. It seems that the tab switching is unstable and the editor is not restored back to its normal WP default behaviour.

I plan to use the default switchEditors.switchto function by WP but I don't know what parameters I would like to feed to it. Can someone please show me an example how to use this function in a custom JS function (like inside a theme?) Thanks.

share|improve this question
add comment

1 Answer 1

switchEditors is written only to handle request between html, tmce, tinymce options. It's no luck to extend it functionality. Better use of jQuery events like $(el).on('click, ... )

// WP 3.8 build

You can extend standard Wordpress function in order to make some custom functionality like this:

(function ( $ ) {
    "use strict";

    $(function () {

        window.switchEditors.go = function( id, mode ) {

            return false;
        };

    });
}(jQuery));
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.