Commit 1a19d44d authored by Andrew Ozz's avatar Andrew Ozz
Browse files

Set wpActiveEditor to the id of the first instance on init, props kovshenin, fixes #27210.

Built from https://develop.svn.wordpress.org/trunk@27270


git-svn-id: https://core.svn.wordpress.org/trunk@27126 1a063a9b-81f0-0310-95a4-ce76da25c4cd
parent 943498ae
Loading
Loading
Loading
Loading
+19 −7
Original line number Diff line number Diff line
@@ -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,8 +812,26 @@ 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){};
				}
			}