[wp-trac] [WordPress Trac] #52133: TinyMCE editor doesn't load properly when initializing on Visual Tab (Firefox)

WordPress Trac noreply at wordpress.org
Sat Jun 12 09:17:56 UTC 2021


#52133: TinyMCE editor doesn't load properly when initializing on Visual Tab
(Firefox)
-----------------------------------------+---------------------
 Reporter:  metalandcoffee               |       Owner:  azaozz
     Type:  defect (bug)                 |      Status:  closed
 Priority:  normal                       |   Milestone:  5.8
Component:  TinyMCE                      |     Version:  5.6
 Severity:  normal                       |  Resolution:  fixed
 Keywords:  reporter-feedback has-patch  |     Focuses:
-----------------------------------------+---------------------

Comment (by patkemper):

 Replying to [comment:32 azaozz]:
 > @metalandcoffee thanks for testing, glad to hear the patch is working :)
 >
 > @patkemper that line of code is just a short-circuit to avoid running
 the loop when the document is still loading (small speed up). If
 `readyState !== 'interactive'` is removed it means the loop will run only
 after the document has fully loaded, i.e. initialization of all TinyMCE
 instances will wait for images to finish loading.
 >
 > That's not a good idea especially for the main editor on the old Edit
 Post screen (when using Classic Editor plugin, etc.). It can add a visible
 slowdown, even flicker when the page seems "ready" but the editor is still
 not initialized.
 >
 > Perhaps what you're seeing is caused by the TinyMCE instance not being
 in a postbox? For plugins there is a way to prevent initializing a
 particular TinyMCE instance and initialize it later. Example:
 >
 > {{{#!php
 > $args = array(
 >       'quicktags' => false,
 >       'tinymce' => array( 'wp_skip_init' => true ),
 > );
 > wp_editor(  'Welcome to WP'  , 'test-editor', $args );
 > }}}
 >
 > Then the plugin can decide when to initialize, could be onclick, etc.
 The js for the above example would be:
 >
 > {{{#!js
 > tinymce.init( tinyMCEPreInit.mceInit['test-editor'] );
 > }}}
 >
 > Thinking 52133.diff is ready for commit as it seems to fix
 initialization of TinyMCE in postboxes.


 Many thanks for your hints. After some expriements, I can confirm, this is
 completly fixed.

 I'm very glad, this bug has been fixed. Many thank to @metalandcoffee for
 this ticket and many thanks @azaozz for fixing this issue.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/52133#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list