diff --git a/src/wp-includes/class-wp-editor.php b/src/wp-includes/class-wp-editor.php index 10d83fac50..004ec9159e 100644 --- a/src/wp-includes/class-wp-editor.php +++ b/src/wp-includes/class-wp-editor.php @@ -800,12 +800,6 @@ final class _WP_Editors { var init, edId, qtId, firstInit, override, loadMCE = typeof getUserSetting !== 'undefined' ? getUserSetting( 'editor' ) === 'tinymce' : true; - if ( typeof quicktags !== 'undefined' ) { - for ( qtId in tinyMCEPreInit.qtInit ) { - try { quicktags( tinyMCEPreInit.qtInit[qtId] ); } catch(e){}; - } - } - if ( typeof tinymce !== 'undefined' ) { for ( edId in tinyMCEPreInit.mceInit ) { if ( firstInit ) { @@ -818,11 +812,29 @@ final class _WP_Editors { override = override || ! tinyMCEPreInit.qtInit.hasOwnProperty( edId ); if ( ( loadMCE || override ) && ! init.wp_skip_init ) { - try { tinymce.init( init ); } catch(e){} + try { + tinymce.init( init ); + + if ( ! window.wpActiveEditor ) { + window.wpActiveEditor = edId; + } + } catch(e){} } } } + if ( typeof quicktags !== 'undefined' ) { + for ( qtId in tinyMCEPreInit.qtInit ) { + try { + quicktags( tinyMCEPreInit.qtInit[qtId] ); + + if ( ! window.wpActiveEditor ) { + window.wpActiveEditor = qtId; + } + } catch(e){}; + } + } + if ( typeof jQuery !== 'undefined' ) { jQuery('.wp-editor-wrap').on( 'click.wp-editor', function() { if ( this.id ) {