mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@51402 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e618a5b859
commit
2ebdfc16eb
@ -1663,7 +1663,8 @@ final class _WP_Editors {
|
||||
?>
|
||||
|
||||
( function() {
|
||||
var initialize = function() {
|
||||
var initialized = [];
|
||||
var initialize = function() {
|
||||
var init, id, inPostbox, $wrap;
|
||||
var readyState = document.readyState;
|
||||
|
||||
@ -1672,6 +1673,10 @@ final class _WP_Editors {
|
||||
}
|
||||
|
||||
for ( id in tinyMCEPreInit.mceInit ) {
|
||||
if ( initialized.indexOf( id ) > -1 ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
init = tinyMCEPreInit.mceInit[id];
|
||||
$wrap = tinymce.$( '#wp-' + id + '-wrap' );
|
||||
inPostbox = $wrap.parents( '.postbox' ).length > 0;
|
||||
@ -1679,9 +1684,10 @@ final class _WP_Editors {
|
||||
if (
|
||||
! init.wp_skip_init &&
|
||||
( $wrap.hasClass( 'tmce-active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) &&
|
||||
( ( inPostbox && readyState === 'complete' ) || ( ! inPostbox && readyState === 'interactive' ) )
|
||||
( readyState === 'complete' || ( ! inPostbox && readyState === 'interactive' ) )
|
||||
) {
|
||||
tinymce.init( init );
|
||||
initialized.push( id );
|
||||
|
||||
if ( ! window.wpActiveEditor ) {
|
||||
window.wpActiveEditor = id;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user