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.

Props azaozz, majhajob, sabernhardt.
Merges [49911] to the 5.6 branch.
Fixes #52046, #51995.
Built from https://develop.svn.wordpress.org/branches/5.6@49996


git-svn-id: http://core.svn.wordpress.org/branches/5.6@49697 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2021-01-21 12:30:55 +00:00
parent afc1e56b2a
commit 54e45457a8
4 changed files with 10 additions and 4 deletions

View File

@ -16,6 +16,8 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
wpTooltips = false; wpTooltips = false;
if ( $ ) { if ( $ ) {
// Runs as soon as TinyMCE has started initializing, while plugins are loading.
// Handlers attached after the `tinymce.init()` call may not get triggered for this instance.
$( document ).triggerHandler( 'tinymce-editor-setup', [ editor ] ); $( document ).triggerHandler( 'tinymce-editor-setup', [ editor ] );
} }
@ -540,7 +542,11 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) {
}); });
if ( $ ) { if ( $ ) {
// Run on DOM ready. Otherwise TinyMCE may initialize earlier and handlers attached
// on DOM ready of after the `tinymce.init()` call may not get triggered.
$( function() {
$( document ).triggerHandler( 'tinymce-editor-init', [editor] ); $( document ).triggerHandler( 'tinymce-editor-init', [editor] );
});
} }
if ( window.tinyMCEPreInit && window.tinyMCEPreInit.dragDropUpload ) { if ( window.tinyMCEPreInit && window.tinyMCEPreInit.dragDropUpload ) {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.6.1-alpha-49995'; $wp_version = '5.6.1-alpha-49996';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.