[wp-trac] [WordPress Trac] #52133: TinyMCE editor doesn't load properly when initializing on Visual Tab (Firefox)
WordPress Trac
noreply at wordpress.org
Mon Jun 7 09:40:44 UTC 2021
#52133: TinyMCE editor doesn't load properly when initializing on Visual Tab
(Firefox)
-------------------------------------------------+-------------------------
Reporter: metalandcoffee | Owner: (none)
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 5.8
Component: TinyMCE | Version: 5.6
Severity: normal | Resolution:
Keywords: reporter-feedback has-patch needs- | Focuses:
testing |
-------------------------------------------------+-------------------------
Comment (by patkemper):
Replying to [comment:29 azaozz]:
> Related #52050. 52133.diff should fix it.
I just tried your new patch. It still does not solve the issue.
However, removing "&& readyState !== 'interactive'" on line 1670 does the
trick.
Here's the full patch.
{{{
Index: src/wp-includes/class-wp-editor.php
===================================================================
--- src/wp-includes/class-wp-editor.php (revision 51078)
+++ src/wp-includes/class-wp-editor.php (working copy)
@@ -1663,19 +1663,27 @@
?>
( function() {
- var init, id, $wrap;
+ var initialize = function() {
+ var init, id, inPostbox, $wrap;
+ var readyState = document.readyState;
- if ( typeof tinymce !== 'undefined' ) {
- if ( tinymce.Env.ie && tinymce.Env.ie < 11
) {
- tinymce.$( '.wp-editor-wrap '
).removeClass( 'tmce-active' ).addClass( 'html-active' );
+ if ( readyState !== 'complete' ) {
return;
}
for ( id in tinyMCEPreInit.mceInit ) {
- init = tinyMCEPreInit.mceInit[id];
- $wrap = tinymce.$( '#wp-' + id +
'-wrap' );
+ init =
tinyMCEPreInit.mceInit[id];
+ $wrap = tinymce.$( '#wp-' + id
+ '-wrap' );
+ inPostbox = $wrap.parents(
'.postbox' ).length > 0;
- if ( ( $wrap.hasClass( 'tmce-
active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) && !
init.wp_skip_init ) {
+ if (
+ ! init.wp_skip_init &&
+ ( $wrap.hasClass( 'tmce-
active' ) || ! tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) &&
+ (
+ ( ! inPostbox && (
readyState === 'interactive' || readyState === 'complete' ) ) ||
+ ( inPostbox &&
readyState === 'complete' )
+ )
+ ) {
tinymce.init( init );
if ( !
window.wpActiveEditor ) {
@@ -1685,6 +1693,18 @@
}
}
+ if ( typeof tinymce !== 'undefined' ) {
+ if ( tinymce.Env.ie && tinymce.Env.ie < 11
) {
+ tinymce.$( '.wp-editor-wrap '
).removeClass( 'tmce-active' ).addClass( 'html-active' );
+ } else {
+ if ( document.readyState ===
'complete' ) {
+ initialize();
+ } else {
+ document.addEventListener(
'readystatechange', initialize );
+ }
+ }
+ }
+
if ( typeof quicktags !== 'undefined' ) {
for ( id in tinyMCEPreInit.qtInit ) {
quicktags(
tinyMCEPreInit.qtInit[id] );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/52133#comment:31>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list