TinyMCE: ensure initialization runs in all cases on 'interactive' and 'complete' readyState. Fixes a rare bug when the init code is inserted in the DOM after the page has finished loading.
Props Collizo4sky, azaozz. Fixes #53632. Built from https://develop.svn.wordpress.org/trunk@51402 git-svn-id: http://core.svn.wordpress.org/trunk@51013 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f45d515ff8
commit
8a8c4796db
|
@ -1663,7 +1663,8 @@ final class _WP_Editors {
|
||||||
?>
|
?>
|
||||||
|
|
||||||
( function() {
|
( function() {
|
||||||
var initialize = function() {
|
var initialized = [];
|
||||||
|
var initialize = function() {
|
||||||
var init, id, inPostbox, $wrap;
|
var init, id, inPostbox, $wrap;
|
||||||
var readyState = document.readyState;
|
var readyState = document.readyState;
|
||||||
|
|
||||||
|
@ -1672,6 +1673,10 @@ final class _WP_Editors {
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( id in tinyMCEPreInit.mceInit ) {
|
for ( id in tinyMCEPreInit.mceInit ) {
|
||||||
|
if ( initialized.indexOf( id ) > -1 ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
init = tinyMCEPreInit.mceInit[id];
|
init = tinyMCEPreInit.mceInit[id];
|
||||||
$wrap = tinymce.$( '#wp-' + id + '-wrap' );
|
$wrap = tinymce.$( '#wp-' + id + '-wrap' );
|
||||||
inPostbox = $wrap.parents( '.postbox' ).length > 0;
|
inPostbox = $wrap.parents( '.postbox' ).length > 0;
|
||||||
|
@ -1679,9 +1684,10 @@ final class _WP_Editors {
|
||||||
if (
|
if (
|
||||||
! init.wp_skip_init &&
|
! init.wp_skip_init &&
|
||||||
( $wrap.hasClass( 'tmce-active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) &&
|
( $wrap.hasClass( 'tmce-active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) &&
|
||||||
( ( inPostbox && readyState === 'complete' ) || ( ! inPostbox && readyState === 'interactive' ) )
|
( readyState === 'complete' || ( ! inPostbox && readyState === 'interactive' ) )
|
||||||
) {
|
) {
|
||||||
tinymce.init( init );
|
tinymce.init( init );
|
||||||
|
initialized.push( id );
|
||||||
|
|
||||||
if ( ! window.wpActiveEditor ) {
|
if ( ! window.wpActiveEditor ) {
|
||||||
window.wpActiveEditor = id;
|
window.wpActiveEditor = id;
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.9-alpha-51401';
|
$wp_version = '5.9-alpha-51402';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue