Skip to content

Commit

Permalink
Editor: 2nd update of npm packages for 6.4 RC3.
Browse files Browse the repository at this point in the history
This second update for RC3 includes the following fixes:

* [WordPress/gutenberg#55724 Update label for lightbox editor UI] - string change.
* [WordPress/gutenberg#55720 Query: Require queryId for enhanced pagination to prevent PHP notices] and warnings.
* [WordPress/gutenberg#55714 Query block enhanced pagination: Detect inner plugin blocks during render] - which avoids turning off enhanced pagination in TT4, includes string changes.
* [WordPress/gutenberg#55309 Query Loop block: Reuse existing screen-reader-text CSS class for the enhanced pagination aria-live region].

Follow up to [57034], [56987], [56961], [56849], [56818], [56816].

Props afercia, aristath, artemiosans, czapla, darerodz, glendaviesnz, hellofromTonya, jameskoster, joen, luisherranz, mikachan, ocean90, peterwilsoncc, ramonopoly, rajinsharwar, swissspidy.
Fixes #59411.

git-svn-id: https://develop.svn.wordpress.org/trunk@57048 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
hellofromtonya committed Nov 1, 2023
1 parent 5333ea1 commit 126d780
Show file tree
Hide file tree
Showing 8 changed files with 1,659 additions and 1,570 deletions.
2,974 changes: 1,487 additions & 1,487 deletions package-lock.json

Large diffs are not rendered by default.

138 changes: 69 additions & 69 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
"@lodder/grunt-postcss": "^3.1.1",
"@playwright/test": "1.32.0",
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
"@wordpress/babel-preset-default": "7.26.10",
"@wordpress/dependency-extraction-webpack-plugin": "4.25.10",
"@wordpress/e2e-test-utils": "10.13.10",
"@wordpress/e2e-test-utils-playwright": "0.10.10",
"@wordpress/scripts": "26.13.10",
"@wordpress/babel-preset-default": "7.26.11",
"@wordpress/dependency-extraction-webpack-plugin": "4.25.11",
"@wordpress/e2e-test-utils": "10.13.11",
"@wordpress/e2e-test-utils-playwright": "0.10.11",
"@wordpress/scripts": "26.13.11",
"autoprefixer": "10.4.16",
"chalk": "5.3.0",
"check-node-version": "4.2.1",
Expand Down Expand Up @@ -79,70 +79,70 @@
"dependencies": {
"@emotion/is-prop-valid": "0.8.8",
"@emotion/memoize": "0.7.4",
"@wordpress/a11y": "3.42.10",
"@wordpress/annotations": "2.42.10",
"@wordpress/api-fetch": "6.39.10",
"@wordpress/autop": "3.42.10",
"@wordpress/blob": "3.42.10",
"@wordpress/block-directory": "4.19.10",
"@wordpress/block-editor": "12.10.10",
"@wordpress/block-library": "8.19.10",
"@wordpress/block-serialization-default-parser": "4.42.10",
"@wordpress/blocks": "12.19.10",
"@wordpress/commands": "0.13.10",
"@wordpress/components": "25.8.10",
"@wordpress/compose": "6.19.10",
"@wordpress/core-commands": "0.11.10",
"@wordpress/core-data": "6.19.10",
"@wordpress/customize-widgets": "4.19.10",
"@wordpress/data": "9.12.10",
"@wordpress/data-controls": "3.11.10",
"@wordpress/date": "4.42.10",
"@wordpress/deprecated": "3.42.10",
"@wordpress/dom": "3.42.10",
"@wordpress/dom-ready": "3.42.10",
"@wordpress/edit-post": "7.19.10",
"@wordpress/edit-site": "5.19.10",
"@wordpress/edit-widgets": "5.19.10",
"@wordpress/editor": "13.19.10",
"@wordpress/element": "5.19.10",
"@wordpress/escape-html": "2.42.10",
"@wordpress/format-library": "4.19.10",
"@wordpress/hooks": "3.42.10",
"@wordpress/html-entities": "3.42.10",
"@wordpress/i18n": "4.42.10",
"@wordpress/icons": "9.33.10",
"@wordpress/interactivity": "2.3.10",
"@wordpress/interface": "5.19.10",
"@wordpress/is-shallow-equal": "4.42.10",
"@wordpress/keyboard-shortcuts": "4.19.10",
"@wordpress/keycodes": "3.42.10",
"@wordpress/list-reusable-blocks": "4.19.10",
"@wordpress/media-utils": "4.33.10",
"@wordpress/notices": "4.10.10",
"@wordpress/nux": "8.4.10",
"@wordpress/patterns": "1.3.10",
"@wordpress/plugins": "6.10.10",
"@wordpress/preferences": "3.19.10",
"@wordpress/preferences-persistence": "1.34.10",
"@wordpress/primitives": "3.40.10",
"@wordpress/priority-queue": "2.42.10",
"@wordpress/private-apis": "0.24.10",
"@wordpress/redux-routine": "4.42.10",
"@wordpress/reusable-blocks": "4.19.10",
"@wordpress/rich-text": "6.19.10",
"@wordpress/router": "0.11.10",
"@wordpress/server-side-render": "4.19.10",
"@wordpress/shortcode": "3.42.10",
"@wordpress/style-engine": "1.25.10",
"@wordpress/sync": "0.4.10",
"@wordpress/token-list": "2.42.10",
"@wordpress/undo-manager": "0.2.10",
"@wordpress/url": "3.43.10",
"@wordpress/viewport": "5.19.10",
"@wordpress/warning": "2.42.10",
"@wordpress/widgets": "3.19.10",
"@wordpress/wordcount": "3.42.10",
"@wordpress/a11y": "3.42.11",
"@wordpress/annotations": "2.42.11",
"@wordpress/api-fetch": "6.39.11",
"@wordpress/autop": "3.42.11",
"@wordpress/blob": "3.42.11",
"@wordpress/block-directory": "4.19.11",
"@wordpress/block-editor": "12.10.11",
"@wordpress/block-library": "8.19.11",
"@wordpress/block-serialization-default-parser": "4.42.11",
"@wordpress/blocks": "12.19.11",
"@wordpress/commands": "0.13.11",
"@wordpress/components": "25.8.11",
"@wordpress/compose": "6.19.11",
"@wordpress/core-commands": "0.11.11",
"@wordpress/core-data": "6.19.11",
"@wordpress/customize-widgets": "4.19.11",
"@wordpress/data": "9.12.11",
"@wordpress/data-controls": "3.11.11",
"@wordpress/date": "4.42.11",
"@wordpress/deprecated": "3.42.11",
"@wordpress/dom": "3.42.11",
"@wordpress/dom-ready": "3.42.11",
"@wordpress/edit-post": "7.19.11",
"@wordpress/edit-site": "5.19.11",
"@wordpress/edit-widgets": "5.19.11",
"@wordpress/editor": "13.19.11",
"@wordpress/element": "5.19.11",
"@wordpress/escape-html": "2.42.11",
"@wordpress/format-library": "4.19.11",
"@wordpress/hooks": "3.42.11",
"@wordpress/html-entities": "3.42.11",
"@wordpress/i18n": "4.42.11",
"@wordpress/icons": "9.33.11",
"@wordpress/interactivity": "2.3.11",
"@wordpress/interface": "5.19.11",
"@wordpress/is-shallow-equal": "4.42.11",
"@wordpress/keyboard-shortcuts": "4.19.11",
"@wordpress/keycodes": "3.42.11",
"@wordpress/list-reusable-blocks": "4.19.11",
"@wordpress/media-utils": "4.33.11",
"@wordpress/notices": "4.10.11",
"@wordpress/nux": "8.4.11",
"@wordpress/patterns": "1.3.11",
"@wordpress/plugins": "6.10.11",
"@wordpress/preferences": "3.19.11",
"@wordpress/preferences-persistence": "1.34.11",
"@wordpress/primitives": "3.40.11",
"@wordpress/priority-queue": "2.42.11",
"@wordpress/private-apis": "0.24.11",
"@wordpress/redux-routine": "4.42.11",
"@wordpress/reusable-blocks": "4.19.11",
"@wordpress/rich-text": "6.19.11",
"@wordpress/router": "0.11.11",
"@wordpress/server-side-render": "4.19.11",
"@wordpress/shortcode": "3.42.11",
"@wordpress/style-engine": "1.25.11",
"@wordpress/sync": "0.4.11",
"@wordpress/token-list": "2.42.11",
"@wordpress/undo-manager": "0.2.11",
"@wordpress/url": "3.43.11",
"@wordpress/viewport": "5.19.11",
"@wordpress/warning": "2.42.11",
"@wordpress/widgets": "3.19.11",
"@wordpress/wordcount": "3.42.11",
"backbone": "1.5.0",
"clipboard": "2.0.11",
"core-js-url-browser": "3.6.4",
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/assets/script-loader-packages.min.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/wp-includes/blocks/query-pagination-next.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function render_block_core_query_pagination_next( $attributes, $content, $block
wp_reset_postdata(); // Restore original Post Data.
}

if ( $enhanced_pagination ) {
if ( $enhanced_pagination && isset( $content ) ) {
$p = new WP_HTML_Tag_Processor( $content );
if ( $p->next_tag(
array(
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/query-pagination-previous.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function render_block_core_query_pagination_previous( $attributes, $content, $bl
);
}

if ( $enhanced_pagination ) {
if ( $enhanced_pagination && isset( $content ) ) {
$p = new WP_HTML_Tag_Processor( $content );
if ( $p->next_tag(
array(
Expand Down
107 changes: 98 additions & 9 deletions src/wp-includes/blocks/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
*
* @since 6.4.0
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param string $block Block instance.
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block The block instance.
*
* @return string Returns the modified output of the query block.
*/
function render_block_core_query( $attributes, $content, $block ) {
if ( $attributes['enhancedPagination'] ) {
if ( $attributes['enhancedPagination'] && isset( $attributes['queryId'] ) ) {
$p = new WP_HTML_Tag_Processor( $content );
if ( $p->next_tag() ) {
// Add the necessary directives.
Expand Down Expand Up @@ -48,7 +48,7 @@ function render_block_core_query( $attributes, $content, $block ) {
$content = substr_replace(
$content,
'<div
class="wp-block-query__enhanced-pagination-navigation-announce"
class="wp-block-query__enhanced-pagination-navigation-announce screen-reader-text"
aria-live="polite"
data-wp-text="context.core.query.message"
></div>
Expand All @@ -67,11 +67,14 @@ class="wp-block-query__enhanced-pagination-animation"
if ( ! wp_script_is( $view_asset ) ) {
$script_handles = $block->block_type->view_script_handles;
// If the script is not needed, and it is still in the `view_script_handles`, remove it.
if ( ! $attributes['enhancedPagination'] && in_array( $view_asset, $script_handles, true ) ) {
if (
( ! $attributes['enhancedPagination'] || ! isset( $attributes['queryId'] ) )
&& in_array( $view_asset, $script_handles, true )
) {
$block->block_type->view_script_handles = array_diff( $script_handles, array( $view_asset ) );
}
// If the script is needed, but it was previously removed, add it again.
if ( $attributes['enhancedPagination'] && ! in_array( $view_asset, $script_handles, true ) ) {
if ( $attributes['enhancedPagination'] && isset( $attributes['queryId'] ) && ! in_array( $view_asset, $script_handles, true ) ) {
$block->block_type->view_script_handles = array_merge( $script_handles, array( $view_asset ) );
}
}
Expand All @@ -80,11 +83,14 @@ class="wp-block-query__enhanced-pagination-animation"
if ( ! wp_style_is( $style_asset ) ) {
$style_handles = $block->block_type->style_handles;
// If the styles are not needed, and they are still in the `style_handles`, remove them.
if ( ! $attributes['enhancedPagination'] && in_array( $style_asset, $style_handles, true ) ) {
if (
( ! $attributes['enhancedPagination'] || ! isset( $attributes['queryId'] ) )
&& in_array( $style_asset, $style_handles, true )
) {
$block->block_type->style_handles = array_diff( $style_handles, array( $style_asset ) );
}
// If the styles are needed, but they were previously removed, add them again.
if ( $attributes['enhancedPagination'] && ! in_array( $style_asset, $style_handles, true ) ) {
if ( $attributes['enhancedPagination'] && isset( $attributes['queryId'] ) && ! in_array( $style_asset, $style_handles, true ) ) {
$block->block_type->style_handles = array_merge( $style_handles, array( $style_asset ) );
}
}
Expand Down Expand Up @@ -123,3 +129,86 @@ function register_block_core_query() {
);
}
add_action( 'init', 'register_block_core_query' );

/**
* Traverse the tree of blocks looking for any plugin block (i.e., a block from
* an installed plugin) inside a Query block with the enhanced pagination
* enabled. If at least one is found, the enhanced pagination is effectively
* disabled to prevent any potential incompatibilities.
*
* @since 6.4.0
*
* @param array $parsed_block The block being rendered.
* @return string Returns the parsed block, unmodified.
*/
function block_core_query_disable_enhanced_pagination( $parsed_block ) {
static $enhanced_query_stack = array();
static $dirty_enhanced_queries = array();
static $render_query_callback = null;

$block_name = $parsed_block['blockName'];

if (
'core/query' === $block_name &&
isset( $parsed_block['attrs']['enhancedPagination'] ) &&
true === $parsed_block['attrs']['enhancedPagination'] &&
isset( $parsed_block['attrs']['queryId'] )
) {
$enhanced_query_stack[] = $parsed_block['attrs']['queryId'];

if ( ! isset( $render_query_callback ) ) {
/**
* Filter that disables the enhanced pagination feature during block
* rendering when a plugin block has been found inside. It does so
* by adding an attribute called `data-wp-navigation-disabled` which
* is later handled by the front-end logic.
*
* @param string $content The block content.
* @param array $block The full block, including name and attributes.
* @return string Returns the modified output of the query block.
*/
$render_query_callback = static function ( $content, $block ) use ( &$enhanced_query_stack, &$dirty_enhanced_queries, &$render_query_callback ) {
$has_enhanced_pagination =
isset( $block['attrs']['enhancedPagination'] ) &&
true === $block['attrs']['enhancedPagination'] &&
isset( $block['attrs']['queryId'] );

if ( ! $has_enhanced_pagination ) {
return $content;
}

if ( isset( $dirty_enhanced_queries[ $block['attrs']['queryId'] ] ) ) {
$p = new WP_HTML_Tag_Processor( $content );
if ( $p->next_tag() ) {
$p->set_attribute( 'data-wp-navigation-disabled', 'true' );
}
$content = $p->get_updated_html();
$dirty_enhanced_queries[ $block['attrs']['queryId'] ] = null;
}

array_pop( $enhanced_query_stack );

if ( empty( $enhanced_query_stack ) ) {
remove_filter( 'render_block_core/query', $render_query_callback );
$render_query_callback = null;
}

return $content;
};

add_filter( 'render_block_core/query', $render_query_callback, 10, 2 );
}
} elseif (
! empty( $enhanced_query_stack ) &&
isset( $block_name ) &&
( ! str_starts_with( $block_name, 'core/' ) || 'core/post-content' === $block_name )
) {
foreach ( $enhanced_query_stack as $query_id ) {
$dirty_enhanced_queries[ $query_id ] = true;
}
}

return $parsed_block;
}

add_filter( 'render_block_data', 'block_core_query_disable_enhanced_pagination', 10, 1 );
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/query/view.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '804d398ca1813f0f63e9');
<?php return array('dependencies' => array(), 'version' => 'c623c4990d8a2d98c8d0');
2 changes: 1 addition & 1 deletion src/wp-includes/blocks/query/view.min.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '3dd5dbc0a377c7b7336f');
<?php return array('dependencies' => array(), 'version' => 'ecab5647d5d9321e0101');

0 comments on commit 126d780

Please sign in to comment.