WordPress.org

Make WordPress Core

Changeset 51402


Ignore:
Timestamp:
07/10/2021 11:57:43 PM (2 months ago)
Author:
azaozz
Message:

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.

File:
1 edited

Legend:

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

    r51085 r51402  
    16641664
    16651665        ( function() {
    1666             var initialize = function() {
     1666            var initialized = [];
     1667            var initialize  = function() {
    16671668                var init, id, inPostbox, $wrap;
    16681669                var readyState = document.readyState;
     
    16731674
    16741675                for ( id in tinyMCEPreInit.mceInit ) {
     1676                    if ( initialized.indexOf( id ) > -1 ) {
     1677                        continue;
     1678                    }
     1679
    16751680                    init      = tinyMCEPreInit.mceInit[id];
    16761681                    $wrap     = tinymce.$( '#wp-' + id + '-wrap' );
     
    16801685                        ! init.wp_skip_init &&
    16811686                        ( $wrap.hasClass( 'tmce-active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) &&
    1682                         ( ( inPostbox && readyState === 'complete' ) || ( ! inPostbox && readyState === 'interactive' ) )
     1687                        ( readyState === 'complete' || ( ! inPostbox && readyState === 'interactive' ) )
    16831688                    ) {
    16841689                        tinymce.init( init );
     1690                        initialized.push( id );
    16851691
    16861692                        if ( ! window.wpActiveEditor ) {
Note: See TracChangeset for help on using the changeset viewer.