-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editor: Update the WordPress Packages to Gutenberg 17.6 RC3 #5984
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,7 +55,6 @@ | |
} | ||
}, | ||
"dimensions": { | ||
"aspectRatio": true, | ||
"minHeight": true | ||
}, | ||
"__experimentalBorder": { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,7 +192,7 @@ private static function get_inner_blocks_from_navigation_post( $attributes ) { | |
// it encounters whitespace. This code strips it. | ||
$blocks = block_core_navigation_filter_out_empty_blocks( $parsed_blocks ); | ||
|
||
if ( function_exists( 'get_hooked_blocks' ) ) { | ||
if ( function_exists( 'get_hooked_block_markup' ) ) { | ||
// Run Block Hooks algorithm to inject hooked blocks. | ||
$markup = block_core_navigation_insert_hooked_blocks( $blocks, $navigation_post ); | ||
$root_nav_block = parse_blocks( $markup )[0]; | ||
|
@@ -992,7 +992,7 @@ function block_core_navigation_get_fallback_blocks() { | |
// In this case default to the (Page List) fallback. | ||
$fallback_blocks = ! empty( $maybe_fallback ) ? $maybe_fallback : $fallback_blocks; | ||
|
||
if ( function_exists( 'get_hooked_blocks' ) ) { | ||
if ( function_exists( 'get_hooked_block_markup' ) ) { | ||
// Run Block Hooks algorithm to inject hooked blocks. | ||
// We have to run it here because we need the post ID of the Navigation block to track ignored hooked blocks. | ||
$markup = block_core_navigation_insert_hooked_blocks( $fallback_blocks, $navigation_post ); | ||
|
@@ -1358,7 +1358,7 @@ function block_core_navigation_get_most_recently_published_navigation() { | |
* @param WP_Post $post `wp_navigation` post object corresponding to the block. | ||
* @return string Serialized inner blocks in mock Navigation block wrapper, with hooked blocks inserted, if any. | ||
*/ | ||
function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post = null ) { | ||
function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) { | ||
$before_block_visitor = null; | ||
$after_block_visitor = null; | ||
$hooked_blocks = get_hooked_blocks(); | ||
|
@@ -1397,10 +1397,6 @@ function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post = null | |
* @param WP_Post $post Post object. | ||
*/ | ||
function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) { | ||
if ( ! isset( $post->ID ) ) { | ||
return; | ||
} | ||
|
||
// We run the Block Hooks mechanism so it will return the list of ignored hooked blocks | ||
// in the mock root Navigation block's metadata attribute. | ||
// We ignore the rest of the returned `$markup`; `$post->post_content` already has the hooked | ||
|
@@ -1422,9 +1418,9 @@ function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) { | |
} | ||
} | ||
|
||
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.4 | ||
// that are not present in Gutenberg's WP 6.4 compatibility layer. | ||
if ( function_exists( 'get_hooked_blocks' ) ) { | ||
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5 | ||
// that are not present in Gutenberg's WP 6.5 compatibility layer. | ||
if ( function_exists( 'get_hooked_block_markup' ) ) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ockham, should it be moved to WordPress Core instead? It looks like it will never get executed in the Gutenberg plugin with the guard call included. |
||
add_action( 'rest_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10, 3 ); | ||
} | ||
|
||
|
@@ -1454,8 +1450,8 @@ function block_core_navigation_insert_hooked_blocks_into_rest_response( $respons | |
return $response; | ||
} | ||
|
||
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.4 | ||
// that are not present in Gutenberg's WP 6.4 compatibility layer. | ||
if ( function_exists( 'get_hooked_blocks' ) ) { | ||
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5 | ||
// that are not present in Gutenberg's WP 6.5 compatibility layer. | ||
if ( function_exists( 'get_hooked_block_markup' ) ) { | ||
add_filter( 'rest_prepare_wp_navigation', 'block_core_navigation_insert_hooked_blocks_into_rest_response', 10, 3 ); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
/** | ||
* Interactivity API: Functions and hooks | ||
* | ||
* @package WordPress | ||
* @subpackage Interactivity API | ||
*/ | ||
|
||
/** | ||
* Registers the interactivity modules. | ||
*/ | ||
function wp_interactivity_register_script_modules() { | ||
wp_register_script_module( | ||
'@wordpress/interactivity', | ||
includes_url( '/js/dist/interactivity.min.js' ), | ||
array() | ||
); | ||
|
||
wp_register_script_module( | ||
'@wordpress/interactivity-router', | ||
includes_url( '/js/dist/interactivity-router.min.js' ), | ||
array( '@wordpress/interactivity' ) | ||
); | ||
} | ||
|
||
add_action( 'init', 'wp_interactivity_register_script_modules' ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we introduce a new action similar to Inside add_action( 'wp_default_script_modules', 'wp_default_script_modules_packages' ); There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That makes sense, I believe this is meant as a start though. @luisherranz is planning a follow-up for this PR to bring the full interactivity API. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. Once this is committed, my plan is to delete it in #5953, which already includes these filters. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In #5953, it is no longer part of the |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,32 +53,11 @@ module.exports = function ( | |
}, | ||
environment: { module: true }, | ||
}, | ||
module: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that the modules are built automatically, there's no need to use babel anymore. |
||
rules: [ | ||
{ | ||
test: /\.(j|t)sx?$/, | ||
use: [ | ||
{ | ||
loader: require.resolve( 'babel-loader' ), | ||
options: { | ||
cacheDirectory: | ||
process.env.BABEL_CACHE_DIRECTORY || true, | ||
babelrc: false, | ||
configFile: false, | ||
presets: [ | ||
[ | ||
'@babel/preset-react', | ||
{ | ||
runtime: 'automatic', | ||
importSource: 'preact', | ||
}, | ||
], | ||
], | ||
}, | ||
}, | ||
], | ||
}, | ||
], | ||
externalsType: 'module', | ||
externals: { | ||
'@wordpress/interactivity': '@wordpress/interactivity', | ||
'@wordpress/interactivity-router': | ||
'import @wordpress/interactivity-router', | ||
}, | ||
plugins: [ | ||
...baseConfig.plugins, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would making
$post
now to be required could causeFatal error: Uncaught ArgumentCountError: Too few arguments to function
if someone is using it without it? Was this function introduced before 6.5?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this has been discussed. See WordPress/gutenberg#58379 (comment) cc @ockham