Skip to content
Permalink
Browse files

Block Editor: Fix the WordPress packages and vendor script registration.

The version is set properly and the scripts are automatically loaded in the footer.
This patch also includes a revert for the reusable blocks enqueue script.

Props pento, swissspidy.
Fixes #45402.
See #45396.


git-svn-id: https://develop.svn.wordpress.org/branches/5.0@43942 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information...
youknowriad committed Nov 23, 2018
1 parent da6b20d commit 94b478183f4afe4b71e6b9eeff6c92a5370cf931
Showing with 3 additions and 6 deletions.
  1. +1 −3 src/wp-admin/edit.php
  2. +2 −3 src/wp-includes/script-loader.php
@@ -183,10 +183,8 @@
wp_enqueue_script('heartbeat');
if ( 'wp_block' === $post_type ) {
wp_enqueue_script( 'wp-list-reusable-blocks' );
wp_enqueue_style( 'wp-list-reusable-blocks' );
// wp-list-reusable-blocks enhances the page's DOM and so needs to be loaded in the footer.
wp_enqueue_script( 'wp-list-reusable-blocks', '', array(), false, true );
}
$title = $post_type_object->labels->name;
@@ -111,7 +111,7 @@ function wp_default_packages_vendor( &$scripts ) {
$path = "/wp-includes/js/dist/vendor/$handle$dev_suffix.js";
$version = $vendor_scripts_versions[ $handle ];
$scripts->add( $handle, $path, $dependencies, false, $version );
$scripts->add( $handle, $path, $dependencies, $version, 1 );
}
$scripts->add( 'wp-polyfill', null, array( 'wp-polyfill' ) );
@@ -210,7 +210,6 @@ function wp_default_packages_scripts( &$scripts ) {
'api-fetch' => '2.2.5',
'a11y' => '2.0.2',
'annotations' => '1.0.3',
'api-fetch' => '2.2.5',
'autop' => '2.0.2',
'blob' => '2.1.0',
'block-library' => '2.2.7',
@@ -468,7 +467,7 @@ function wp_default_packages_scripts( &$scripts ) {
$path = "/wp-includes/js/dist/$package$suffix.js";
$version = $packages_versions[ $package ];
$scripts->add( $handle, $path, $dependencies, false, $version );
$scripts->add( $handle, $path, $dependencies, $version, 1 );
if ( isset( $package_translations[ $package ] ) ) {
$scripts->set_translations( $handle, $package_translations[ $package ] );

0 comments on commit 94b4781

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