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.


Built from https://develop.svn.wordpress.org/branches/5.0@43901


git-svn-id: http://core.svn.wordpress.org/branches/5.0@43733 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2018-11-15 23:53:49 +00:00
parent 1f13d6144d
commit 5ad2582000
3 changed files with 14 additions and 3 deletions

View File

@ -325,6 +325,7 @@ wp_enqueue_media(
'post' => $post->ID,
)
);
wp_tinymce_inline_scripts();
wp_enqueue_editor();
/**

View File

@ -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' );
}
/**

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.0-beta4-43900';
$wp_version = '5.0-beta4-43901';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.