WordPress.org

Make WordPress Core

Changeset 49911


Ignore:
Timestamp:
12/29/2020 01:19:14 PM (9 months ago)
Author:
azaozz
Message:

Editor: Trigger the tinymce-editor-init custom jQuery event on DOM ready. Otherwise TinyMCE may initialize earlier and handlers attached on DOM ready may not get triggered. Fixes making the editor menu "sticky" and setting/resetting some screen options on the old Edit Post screen.

Fixes 52046, 51995.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/vendor/tinymce/plugins/wordpress/plugin.js

    r47122 r49911  
    1717
    1818    if ( $ ) {
     19        // Runs as soon as TinyMCE has started initializing, while plugins are loading.
     20        // Handlers attached after the `tinymce.init()` call may not get triggered for this instance.
    1921        $( document ).triggerHandler( 'tinymce-editor-setup', [ editor ] );
    2022    }
     
    541543
    542544        if ( $ ) {
    543             $( document ).triggerHandler( 'tinymce-editor-init', [editor] );
     545            // Run on DOM ready. Otherwise TinyMCE may initialize earlier and handlers attached
     546            // on DOM ready of after the `tinymce.init()` call may not get triggered.
     547            $( function() {
     548                $( document ).triggerHandler( 'tinymce-editor-init', [editor] );
     549            });
    544550        }
    545551
Note: See TracChangeset for help on using the changeset viewer.