Editor: 2nd update of npm packages for 6.4 RC3.

This second update for RC3 includes the following fixes:

* [https://github.com/WordPress/gutenberg/pull/55724 Update label for lightbox editor UI] - string change.
* [https://github.com/WordPress/gutenberg/pull/55720 Query: Require queryId for enhanced pagination to prevent PHP notices] and warnings.
* [https://github.com/WordPress/gutenberg/pull/55714 Query block enhanced pagination: Detect inner plugin blocks during render] - which avoids turning off enhanced pagination in TT4, includes string changes.
* [https://github.com/WordPress/gutenberg/pull/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.
Built from https://develop.svn.wordpress.org/trunk@57048


git-svn-id: http://core.svn.wordpress.org/trunk@56559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
hellofromTonya 2023-11-01 17:49:17 +00:00
parent af66c304f8
commit 8dfcdc8088
18 changed files with 184 additions and 83 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -63,7 +63,7 @@ function render_block_core_query_pagination_next( $attributes, $content, $block
wp_reset_postdata(); // Restore original Post Data. wp_reset_postdata(); // Restore original Post Data.
} }
if ( $enhanced_pagination ) { if ( $enhanced_pagination && isset( $content ) ) {
$p = new WP_HTML_Tag_Processor( $content ); $p = new WP_HTML_Tag_Processor( $content );
if ( $p->next_tag( if ( $p->next_tag(
array( array(

View File

@ -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 ); $p = new WP_HTML_Tag_Processor( $content );
if ( $p->next_tag( if ( $p->next_tag(
array( array(

View File

@ -10,14 +10,14 @@
* *
* @since 6.4.0 * @since 6.4.0
* *
* @param array $attributes Block attributes. * @param array $attributes Block attributes.
* @param string $content Block default content. * @param string $content Block default content.
* @param string $block Block instance. * @param WP_Block $block The block instance.
* *
* @return string Returns the modified output of the query block. * @return string Returns the modified output of the query block.
*/ */
function render_block_core_query( $attributes, $content, $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 ); $p = new WP_HTML_Tag_Processor( $content );
if ( $p->next_tag() ) { if ( $p->next_tag() ) {
// Add the necessary directives. // Add the necessary directives.
@ -48,7 +48,7 @@ function render_block_core_query( $attributes, $content, $block ) {
$content = substr_replace( $content = substr_replace(
$content, $content,
'<div '<div
class="wp-block-query__enhanced-pagination-navigation-announce" class="wp-block-query__enhanced-pagination-navigation-announce screen-reader-text"
aria-live="polite" aria-live="polite"
data-wp-text="context.core.query.message" data-wp-text="context.core.query.message"
></div> ></div>
@ -67,11 +67,14 @@ function render_block_core_query( $attributes, $content, $block ) {
if ( ! wp_script_is( $view_asset ) ) { if ( ! wp_script_is( $view_asset ) ) {
$script_handles = $block->block_type->view_script_handles; $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 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 ) ); $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 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 ) ); $block->block_type->view_script_handles = array_merge( $script_handles, array( $view_asset ) );
} }
} }
@ -80,11 +83,14 @@ function render_block_core_query( $attributes, $content, $block ) {
if ( ! wp_style_is( $style_asset ) ) { if ( ! wp_style_is( $style_asset ) ) {
$style_handles = $block->block_type->style_handles; $style_handles = $block->block_type->style_handles;
// If the styles are not needed, and they are still in the `style_handles`, remove them. // 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 ) ); $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 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 ) ); $block->block_type->style_handles = array_merge( $style_handles, array( $style_asset ) );
} }
} }
@ -123,3 +129,86 @@ function register_block_core_query() {
); );
} }
add_action( 'init', '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 );

View File

@ -39,14 +39,4 @@
to{ to{
opacity:0; opacity:0;
} }
}
.wp-block-query__enhanced-pagination-navigation-announce{
clip:rect(0, 0, 0, 0);
border:0;
height:1px;
margin:-1px;
overflow:hidden;
padding:0;
position:absolute;
width:1px;
} }

View File

@ -1 +1 @@
.wp-block-query__enhanced-pagination-animation{background-color:var(--wp--preset--color--primary,#000);height:4px;margin:0;max-width:100vw!important;opacity:0;padding:0;position:fixed;right:0;top:0;width:100vw}.wp-block-query__enhanced-pagination-animation.start-animation{animation:wp-block-query__enhanced-pagination-start-animation 30s cubic-bezier(.03,.5,0,1) forwards}.wp-block-query__enhanced-pagination-animation.finish-animation{animation:wp-block-query__enhanced-pagination-finish-animation .3s ease-in}@keyframes wp-block-query__enhanced-pagination-start-animation{0%{opacity:1;transform:scaleX(0);transform-origin:100% 0}to{opacity:1;transform:scaleX(1);transform-origin:100% 0}}@keyframes wp-block-query__enhanced-pagination-finish-animation{0%{opacity:1}50%{opacity:1}to{opacity:0}}.wp-block-query__enhanced-pagination-navigation-announce{clip:rect(0,0,0,0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px} .wp-block-query__enhanced-pagination-animation{background-color:var(--wp--preset--color--primary,#000);height:4px;margin:0;max-width:100vw!important;opacity:0;padding:0;position:fixed;right:0;top:0;width:100vw}.wp-block-query__enhanced-pagination-animation.start-animation{animation:wp-block-query__enhanced-pagination-start-animation 30s cubic-bezier(.03,.5,0,1) forwards}.wp-block-query__enhanced-pagination-animation.finish-animation{animation:wp-block-query__enhanced-pagination-finish-animation .3s ease-in}@keyframes wp-block-query__enhanced-pagination-start-animation{0%{opacity:1;transform:scaleX(0);transform-origin:100% 0}to{opacity:1;transform:scaleX(1);transform-origin:100% 0}}@keyframes wp-block-query__enhanced-pagination-finish-animation{0%{opacity:1}50%{opacity:1}to{opacity:0}}

View File

@ -39,14 +39,4 @@
to{ to{
opacity:0; opacity:0;
} }
}
.wp-block-query__enhanced-pagination-navigation-announce{
clip:rect(0, 0, 0, 0);
border:0;
height:1px;
margin:-1px;
overflow:hidden;
padding:0;
position:absolute;
width:1px;
} }

View File

@ -1 +1 @@
.wp-block-query__enhanced-pagination-animation{background-color:var(--wp--preset--color--primary,#000);height:4px;left:0;margin:0;max-width:100vw!important;opacity:0;padding:0;position:fixed;top:0;width:100vw}.wp-block-query__enhanced-pagination-animation.start-animation{animation:wp-block-query__enhanced-pagination-start-animation 30s cubic-bezier(.03,.5,0,1) forwards}.wp-block-query__enhanced-pagination-animation.finish-animation{animation:wp-block-query__enhanced-pagination-finish-animation .3s ease-in}@keyframes wp-block-query__enhanced-pagination-start-animation{0%{opacity:1;transform:scaleX(0);transform-origin:0 0}to{opacity:1;transform:scaleX(1);transform-origin:0 0}}@keyframes wp-block-query__enhanced-pagination-finish-animation{0%{opacity:1}50%{opacity:1}to{opacity:0}}.wp-block-query__enhanced-pagination-navigation-announce{clip:rect(0,0,0,0);border:0;height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px} .wp-block-query__enhanced-pagination-animation{background-color:var(--wp--preset--color--primary,#000);height:4px;left:0;margin:0;max-width:100vw!important;opacity:0;padding:0;position:fixed;top:0;width:100vw}.wp-block-query__enhanced-pagination-animation.start-animation{animation:wp-block-query__enhanced-pagination-start-animation 30s cubic-bezier(.03,.5,0,1) forwards}.wp-block-query__enhanced-pagination-animation.finish-animation{animation:wp-block-query__enhanced-pagination-finish-animation .3s ease-in}@keyframes wp-block-query__enhanced-pagination-start-animation{0%{opacity:1;transform:scaleX(0);transform-origin:0 0}to{opacity:1;transform:scaleX(1);transform-origin:0 0}}@keyframes wp-block-query__enhanced-pagination-finish-animation{0%{opacity:1}50%{opacity:1}to{opacity:0}}

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '19b95fd73ecd65d97c60'); <?php return array('dependencies' => array(), 'version' => 'f932eea8999458215fe1');

View File

@ -40,7 +40,8 @@ const isValidEvent = event => event.button === 0 &&
ref, ref,
context context
}) => { }) => {
if (isValidLink(ref) && isValidEvent(event)) { const isDisabled = ref.closest('[data-wp-navigation-id]')?.dataset.wpNavigationDisabled;
if (isValidLink(ref) && isValidEvent(event) && !isDisabled) {
event.preventDefault(); event.preventDefault();
const id = ref.closest('[data-wp-navigation-id]').dataset.wpNavigationId; const id = ref.closest('[data-wp-navigation-id]').dataset.wpNavigationId;
@ -69,7 +70,8 @@ const isValidEvent = event => event.button === 0 &&
prefetch: async ({ prefetch: async ({
ref ref
}) => { }) => {
if (isValidLink(ref)) { const isDisabled = ref.closest('[data-wp-navigation-id]')?.dataset.wpNavigationDisabled;
if (isValidLink(ref) && !isDisabled) {
await (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__/* .prefetch */ .tL)(ref.href); await (0,_wordpress_interactivity__WEBPACK_IMPORTED_MODULE_0__/* .prefetch */ .tL)(ref.href);
} }
} }

View File

@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '3dd5dbc0a377c7b7336f'); <?php return array('dependencies' => array(), 'version' => 'ecab5647d5d9321e0101');

View File

@ -1 +1 @@
"use strict";(self.__WordPressPrivateInteractivityAPI__=self.__WordPressPrivateInteractivityAPI__||[]).push([[155],{890:function(e,t,r){var a=r(754);const o=e=>e&&e instanceof window.HTMLAnchorElement&&e.href&&(!e.target||"_self"===e.target)&&e.origin===window.location.origin;(0,a.h)({selectors:{core:{query:{startAnimation:({context:e})=>"start"===e.core.query.animation,finishAnimation:({context:e})=>"finish"===e.core.query.animation}}},actions:{core:{query:{navigate:async({event:e,ref:t,context:r})=>{if(o(t)&&(e=>!(0!==e.button||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.defaultPrevented))(e)){e.preventDefault();const o=t.closest("[data-wp-navigation-id]").dataset.wpNavigationId,i=setTimeout((()=>{r.core.query.message=r.core.query.loadingText,r.core.query.animation="start"}),400);await(0,a.c4)(t.href),clearTimeout(i),r.core.query.message=r.core.query.loadedText+(r.core.query.message===r.core.query.loadedText?" ":""),r.core.query.animation="finish",r.core.query.url=t.href;const n=`[data-wp-navigation-id=${o}] .wp-block-post-template a[href]`;document.querySelector(n)?.focus()}},prefetch:async({ref:e})=>{o(e)&&await(0,a.tL)(e.href)}}}},effects:{core:{query:{prefetch:async({ref:e,context:t})=>{t.core.query.url&&o(e)&&await(0,a.tL)(e.href)}}}}})}},function(e){var t;t=890,e(e.s=t)}]); "use strict";(self.__WordPressPrivateInteractivityAPI__=self.__WordPressPrivateInteractivityAPI__||[]).push([[155],{890:function(e,t,a){var r=a(754);const i=e=>e&&e instanceof window.HTMLAnchorElement&&e.href&&(!e.target||"_self"===e.target)&&e.origin===window.location.origin;(0,r.h)({selectors:{core:{query:{startAnimation:({context:e})=>"start"===e.core.query.animation,finishAnimation:({context:e})=>"finish"===e.core.query.animation}}},actions:{core:{query:{navigate:async({event:e,ref:t,context:a})=>{const o=t.closest("[data-wp-navigation-id]")?.dataset.wpNavigationDisabled;if(i(t)&&(e=>!(0!==e.button||e.metaKey||e.ctrlKey||e.altKey||e.shiftKey||e.defaultPrevented))(e)&&!o){e.preventDefault();const i=t.closest("[data-wp-navigation-id]").dataset.wpNavigationId,o=setTimeout((()=>{a.core.query.message=a.core.query.loadingText,a.core.query.animation="start"}),400);await(0,r.c4)(t.href),clearTimeout(o),a.core.query.message=a.core.query.loadedText+(a.core.query.message===a.core.query.loadedText?" ":""),a.core.query.animation="finish",a.core.query.url=t.href;const n=`[data-wp-navigation-id=${i}] .wp-block-post-template a[href]`;document.querySelector(n)?.focus()}},prefetch:async({ref:e})=>{const t=e.closest("[data-wp-navigation-id]")?.dataset.wpNavigationDisabled;i(e)&&!t&&await(0,r.tL)(e.href)}}}},effects:{core:{query:{prefetch:async({ref:e,context:t})=>{t.core.query.url&&i(e)&&await(0,r.tL)(e.href)}}}}})}},function(e){var t;t=890,e(e.s=t)}]);

View File

@ -62741,12 +62741,12 @@ function ImageSettingsPanel({
// Global Styles. // Global Styles.
, { , {
hasValue: () => !!value?.lightbox, hasValue: () => !!value?.lightbox,
label: (0,external_wp_i18n_namespaceObject.__)('Expand on Click'), label: (0,external_wp_i18n_namespaceObject.__)('Expand on click'),
onDeselect: resetLightbox, onDeselect: resetLightbox,
isShownByDefault: true, isShownByDefault: true,
panelId: panelId panelId: panelId
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Expand on Click'), label: (0,external_wp_i18n_namespaceObject.__)('Expand on click'),
checked: lightboxChecked, checked: lightboxChecked,
onChange: onChangeLightbox onChange: onChangeLightbox
})))); }))));

File diff suppressed because one or more lines are too long

View File

@ -24244,7 +24244,7 @@ function image_Image({
options: imageSizeOptions options: imageSizeOptions
}), showLightboxToggle && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, { }), showLightboxToggle && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalToolsPanelItem, {
hasValue: () => !!lightbox, hasValue: () => !!lightbox,
label: (0,external_wp_i18n_namespaceObject.__)('Expand on Click'), label: (0,external_wp_i18n_namespaceObject.__)('Expand on click'),
onDeselect: () => { onDeselect: () => {
setAttributes({ setAttributes({
lightbox: undefined lightbox: undefined
@ -24252,7 +24252,7 @@ function image_Image({
}, },
isShownByDefault: true isShownByDefault: true
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Expand on Click'), label: (0,external_wp_i18n_namespaceObject.__)('Expand on click'),
checked: lightboxChecked, checked: lightboxChecked,
onChange: newValue => { onChange: newValue => {
setAttributes({ setAttributes({
@ -42521,22 +42521,41 @@ const usePatterns = (clientId, name) => {
}; };
/** /**
* Hook that returns a list of unsupported blocks inside the Query Loop with the * The object returned by useUnsupportedBlocks with info about the type of
* given `clientId`. * unsupported blocks present inside the Query block.
*
* @typedef {Object} UnsupportedBlocksInfo
* @property {boolean} hasBlocksFromPlugins True if blocks from plugins are present.
* @property {boolean} hasPostContentBlock True if a 'core/post-content' block is present.
* @property {boolean} hasUnsupportedBlocks True if there are any unsupported blocks.
*/
/**
* Hook that returns an object with information about the unsupported blocks
* present inside a Query Loop with the given `clientId`. The returned object
* contains props that are true when a certain type of unsupported block is
* present.
* *
* @param {string} clientId The block's client ID. * @param {string} clientId The block's client ID.
* @return {string[]} List of block titles. * @return {UnsupportedBlocksInfo} The object containing the information.
*/ */
const useUnsupportedBlockList = clientId => { const useUnsupportedBlocks = clientId => {
return (0,external_wp_data_namespaceObject.useSelect)(select => { return (0,external_wp_data_namespaceObject.useSelect)(select => {
const { const {
getClientIdsOfDescendants, getClientIdsOfDescendants,
getBlockName getBlockName
} = select(external_wp_blockEditor_namespaceObject.store); } = select(external_wp_blockEditor_namespaceObject.store);
return getClientIdsOfDescendants(clientId).filter(descendantClientId => { const blocks = {};
getClientIdsOfDescendants(clientId).forEach(descendantClientId => {
const blockName = getBlockName(descendantClientId); const blockName = getBlockName(descendantClientId);
return !blockName.startsWith('core/') || blockName === 'core/post-content' || blockName === 'core/template-part' || blockName === 'core/block'; if (!blockName.startsWith('core/')) {
blocks.hasBlocksFromPlugins = true;
} else if (blockName === 'core/post-content') {
blocks.hasPostContentBlock = true;
}
}); });
blocks.hasUnsupportedBlocks = blocks.hasBlocksFromPlugins || blocks.hasPostContentBlock;
return blocks;
}, [clientId]); }, [clientId]);
}; };
@ -43099,7 +43118,6 @@ function StickyControl({
/** /**
* Internal dependencies * Internal dependencies
*/ */
@ -43109,26 +43127,26 @@ function EnhancedPaginationControl({
setAttributes, setAttributes,
clientId clientId
}) { }) {
const unsupported = useUnsupportedBlockList(clientId); const {
hasUnsupportedBlocks
} = useUnsupportedBlocks(clientId);
let help = (0,external_wp_i18n_namespaceObject.__)('Browsing between pages requires a full page reload.');
if (enhancedPagination) {
help = (0,external_wp_i18n_namespaceObject.__)("Browsing between pages won't require a full page reload, unless non-compatible blocks are detected.");
} else if (hasUnsupportedBlocks) {
help = (0,external_wp_i18n_namespaceObject.__)("Force page reload can't be disabled because there are non-compatible blocks inside the Query block.");
}
return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, { return (0,external_wp_element_namespaceObject.createElement)(external_wp_element_namespaceObject.Fragment, null, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.ToggleControl, {
label: (0,external_wp_i18n_namespaceObject.__)('Enhanced pagination'), label: (0,external_wp_i18n_namespaceObject.__)('Force page reload'),
help: (0,external_wp_i18n_namespaceObject.__)('Browsing between pages wont require a full page reload.'), help: help,
checked: !!enhancedPagination, checked: !enhancedPagination,
disabled: unsupported.length, disabled: hasUnsupportedBlocks,
onChange: value => { onChange: value => {
setAttributes({ setAttributes({
enhancedPagination: !!value enhancedPagination: !value
}); });
} }
}), !!unsupported.length && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Notice, { }));
status: "warning",
isDismissible: false,
className: "wp-block-query__enhanced-pagination-notice"
}, (0,external_wp_i18n_namespaceObject.__)("Enhanced pagination doesn't support the following blocks:"), (0,external_wp_element_namespaceObject.createElement)("ul", null, unsupported.map(id => (0,external_wp_element_namespaceObject.createElement)("li", {
key: id
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_blockEditor_namespaceObject.BlockTitle, {
clientId: id
})))), (0,external_wp_i18n_namespaceObject.__)('If you want to enable it, you have to remove all unsupported blocks first.')));
} }
;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/create-new-post-link.js ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/query/edit/inspector-controls/create-new-post-link.js
@ -43375,7 +43393,6 @@ function QueryInspectorControls(props) {
* Internal dependencies * Internal dependencies
*/ */
const disableEnhancedPaginationDescription = (0,external_wp_i18n_namespaceObject.__)('You have added unsupported blocks. For the enhanced pagination to work, remove them, then re-enable "Enhanced pagination" in the Query Block settings.');
const modalDescriptionId = 'wp-block-query-enhanced-pagination-modal__description'; const modalDescriptionId = 'wp-block-query-enhanced-pagination-modal__description';
function EnhancedPaginationModal({ function EnhancedPaginationModal({
clientId, clientId,
@ -43385,31 +43402,44 @@ function EnhancedPaginationModal({
setAttributes setAttributes
}) { }) {
const [isOpen, setOpen] = (0,external_wp_element_namespaceObject.useState)(false); const [isOpen, setOpen] = (0,external_wp_element_namespaceObject.useState)(false);
const unsupported = useUnsupportedBlockList(clientId); const {
hasBlocksFromPlugins,
hasPostContentBlock,
hasUnsupportedBlocks
} = useUnsupportedBlocks(clientId);
(0,external_wp_element_namespaceObject.useEffect)(() => { (0,external_wp_element_namespaceObject.useEffect)(() => {
setOpen(!!unsupported.length && enhancedPagination); if (enhancedPagination && hasUnsupportedBlocks) {
}, [unsupported.length, enhancedPagination, setOpen]); setAttributes({
enhancedPagination: false
});
setOpen(true);
}
}, [enhancedPagination, hasUnsupportedBlocks, setAttributes]);
const closeModal = () => {
setOpen(false);
};
let notice = (0,external_wp_i18n_namespaceObject.__)('If you still want to prevent full page reloads, remove that block, then disable "Force page reload" again in the Query Block settings.');
if (hasBlocksFromPlugins) {
notice = (0,external_wp_i18n_namespaceObject.__)('Currently, avoiding full page reloads is not possible when blocks from plugins are present inside the Query block.') + ' ' + notice;
} else if (hasPostContentBlock) {
notice = (0,external_wp_i18n_namespaceObject.__)('Currently, avoiding full page reloads is not possible when a Content block is present inside the Query block.') + ' ' + notice;
}
return isOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, { return isOpen && (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Modal, {
title: (0,external_wp_i18n_namespaceObject.__)('Enhanced pagination will be disabled'), title: (0,external_wp_i18n_namespaceObject.__)('Query block: Force page reload enabled'),
className: "wp-block-query__enhanced-pagination-modal", className: "wp-block-query__enhanced-pagination-modal",
aria: { aria: {
describedby: modalDescriptionId describedby: modalDescriptionId
}, },
isDismissible: false, isDismissible: false,
shouldCloseOnEsc: false, onRequestClose: closeModal
shouldCloseOnClickOutside: false
}, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, { }, (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.__experimentalVStack, {
alignment: "right", alignment: "right",
spacing: 5 spacing: 5
}, (0,external_wp_element_namespaceObject.createElement)("span", { }, (0,external_wp_element_namespaceObject.createElement)("span", {
id: modalDescriptionId id: modalDescriptionId
}, disableEnhancedPaginationDescription), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, { }, notice), (0,external_wp_element_namespaceObject.createElement)(external_wp_components_namespaceObject.Button, {
variant: "primary", variant: "primary",
onClick: () => { onClick: closeModal
setAttributes({
enhancedPagination: false
});
}
}, (0,external_wp_i18n_namespaceObject.__)('OK')))); }, (0,external_wp_i18n_namespaceObject.__)('OK'))));
} }

File diff suppressed because one or more lines are too long

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.5-alpha-57046'; $wp_version = '6.5-alpha-57048';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.