Make WordPress Core

Changeset 51407 for branches/5.8


Ignore:
Timestamp:
07/12/2021 01:27:44 PM (3 years ago)
Author:
desrosj
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.
Merges [51402] to the 5.8 branch.
Fixes #53632.

Location:
branches/5.8
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/5.8

  • branches/5.8/src/wp-includes/class-wp-editor.php

    r51085 r51407  
    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.