Skip to content
Permalink
Browse files

Block Editor: Load TinyMCE inline scripts later.

Previously, the TinyMCE inline scripts were added on the `init` action in the block editor. In the classic editor, however, these scripts are loaded when the TinyMCE window is printed, and some plugins rely on them being loaded later, so they can attach to the appropriate filters.

See #45338.



git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43901 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
pento committed Nov 15, 2018
1 parent 5ca028c commit 0fc49bfb894e541c328b479ff40a97fbd2c13aec
Showing with 13 additions and 2 deletions.
  1. +1 −0 src/wp-admin/edit-form-blocks.php
  2. +12 −2 src/wp-includes/script-loader.php
@@ -325,6 +325,7 @@
'post' => $post->ID,
)
);
wp_tinymce_inline_scripts();
wp_enqueue_editor();
/**
@@ -484,8 +484,18 @@ function wp_default_packages_inline_scripts( &$scripts ) {
'window.wp.oldEditor = window.wp.editor;',
'after'
);
}
/**
* Adds inline scripts required for the TinyMCE in the block editor.
*
* @since 5.0.0
*
* @global WP_Scripts $wp_scripts
*/
function wp_tinymce_inline_scripts() {
global $wp_scripts;
// TinyMCE init.
$tinymce_plugins = array(
'charmap',
'colorpicker',
@@ -596,7 +606,7 @@ function wp_default_packages_inline_scripts( &$scripts ) {
}
}';
$scripts->add_inline_script( 'wp-block-library', $script, 'before' );
$wp_scripts->add_inline_script( 'wp-block-library', $script, 'before' );
}
/**

0 comments on commit 0fc49bf

Please sign in to comment.
You can’t perform that action at this time.