WordPress.org

Make WordPress Core


Ignore:
Timestamp:
12/30/2013 07:16:49 PM (8 years ago)
Author:
azaozz
Message:

Set wpActiveEditor as soon as any editor associated button is clicked, including Add Media, switching Text to Visual, etc. Fixes #26747.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-editor.php

    r26876 r26881  
    812812                }
    813813            }
     814
     815            if ( typeof jQuery !== 'undefined' ) {
     816                jQuery('.wp-editor-wrap').on( 'click.wp-editor', function() {
     817                    if ( this.id ) {
     818                        window.wpActiveEditor = this.id.slice( 3, -5 );
     819                    }
     820                });
     821            } else {
     822                for ( qtId in tinyMCEPreInit.qtInit ) {
     823                    document.getElementById( 'wp-' + qtId + '-wrap' ).onclick = function() {
     824                        window.wpActiveEditor = this.id.slice( 3, -5 );
     825                    }
     826                }
     827            }
    814828        }());
    815 
    816829        </script>
    817830        <?php
    818831
    819         if ( in_array('wplink', self::$plugins, true) || in_array('link', self::$qt_buttons, true) )
     832        if ( in_array( 'wplink', self::$plugins, true ) || in_array( 'link', self::$qt_buttons, true ) )
    820833            self::wp_link_dialog();
    821834
    822         if ( in_array('wpfullscreen', self::$plugins, true) || in_array('fullscreen', self::$qt_buttons, true) )
     835        if ( in_array( 'wpfullscreen', self::$plugins, true ) || in_array( 'fullscreen', self::$qt_buttons, true ) )
    823836            self::wp_fullscreen_html();
    824837
Note: See TracChangeset for help on using the changeset viewer.