diff --git a/wp-includes/js/tinymce/plugins/wordpress/plugin.js b/wp-includes/js/tinymce/plugins/wordpress/plugin.js index cbb320b146..3f95448266 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/plugin.js +++ b/wp-includes/js/tinymce/plugins/wordpress/plugin.js @@ -16,6 +16,8 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { wpTooltips = false; 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 ] ); } @@ -540,7 +542,11 @@ tinymce.PluginManager.add( 'wordpress', function( editor ) { }); if ( $ ) { - $( document ).triggerHandler( 'tinymce-editor-init', [editor] ); + // 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] ); + }); } if ( window.tinyMCEPreInit && window.tinyMCEPreInit.dragDropUpload ) { diff --git a/wp-includes/js/tinymce/plugins/wordpress/plugin.min.js b/wp-includes/js/tinymce/plugins/wordpress/plugin.min.js index ea2c03d911..5396bbd873 100644 --- a/wp-includes/js/tinymce/plugins/wordpress/plugin.min.js +++ b/wp-includes/js/tinymce/plugins/wordpress/plugin.min.js @@ -1 +1 @@ -!function(z){(!z.ui.FloatPanel.zIndex||z.ui.FloatPanel.zIndex<100100)&&(z.ui.FloatPanel.zIndex=100100),z.PluginManager.add("wordpress",function(g){var r,t,W=z.DOM,h=z.each,f=g.editorManager.i18n.translate,i=window.jQuery,o=window.wp,a=o&&o.editor&&o.editor.autop&&g.getParam("wpautop",!0),s=!1;function e(n){var e,t,o,i=0,a=z.$(".block-library-classic__toolbar");"hide"===n?e=!0:a.length&&!a.hasClass("has-advanced-toolbar")&&(a.addClass("has-advanced-toolbar"),n="show"),g.theme.panel&&(t=g.theme.panel.find(".toolbar:not(.menubar)")),t&&1/g,function(e,t){return''})),-1!==e.content.indexOf("\x3c!--nextpage--\x3e")&&(n=f("Page break"),e.content=e.content.replace(//g,'')),e.load&&"raw"!==e.format&&(e.content=a?o.editor.autop(e.content):e.content.replace(/-->\s+\s*/g,function(e,t){return''})),-1!==e.content.indexOf("\x3c!--nextpage--\x3e")&&(n=f("Page break"),e.content=e.content.replace(//g,'')),e.load&&"raw"!==e.format&&(e.content=a?o.editor.autop(e.content):e.content.replace(/-->\s+\s*/g,function(e,t){return''})),-1!==e.content.indexOf("\x3c!--nextpage--\x3e")&&(n=f("Page break"),e.content=e.content.replace(//g,'')),e.load&&"raw"!==e.format&&(e.content=a?o.editor.autop(e.content):e.content.replace(/-->\s+\s*/g,function(e,t){return''})),-1!==e.content.indexOf("\x3c!--nextpage--\x3e")&&(n=f("Page break"),e.content=e.content.replace(//g,'')),e.load&&"raw"!==e.format&&(e.content=a?o.editor.autop(e.content):e.content.replace(/-->\s+\s*