[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 22:02:45 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  |     Focuses:
-----------------------------------------+-----------------------
Changes (by azaozz):

 * keywords:  reporter-feedback has-patch needs-testing => reporter-feedback
     has-patch


Comment:

 @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.

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


More information about the wp-trac mailing list