diff --git a/src/wp-includes/blocks/audio/block.json b/src/wp-includes/blocks/audio/block.json
index 14b44704fb7e8..bee2ff6d534a7 100644
--- a/src/wp-includes/blocks/audio/block.json
+++ b/src/wp-includes/blocks/audio/block.json
@@ -8,6 +8,10 @@
"keywords": [ "music", "sound", "podcast", "recording" ],
"textdomain": "default",
"attributes": {
+ "blob": {
+ "type": "string",
+ "__experimentalRole": "local"
+ },
"src": {
"type": "string",
"source": "attribute",
diff --git a/src/wp-includes/blocks/button/block.json b/src/wp-includes/blocks/button/block.json
index 740f3e50f84ee..d0f90b93467c9 100644
--- a/src/wp-includes/blocks/button/block.json
+++ b/src/wp-includes/blocks/button/block.json
@@ -93,6 +93,7 @@
"__experimentalTextTransform": true,
"__experimentalTextDecoration": true,
"__experimentalLetterSpacing": true,
+ "__experimentalWritingMode": true,
"__experimentalDefaultControls": {
"fontSize": true
}
diff --git a/src/wp-includes/blocks/buttons/block.json b/src/wp-includes/blocks/buttons/block.json
index 015290a4c7cc5..bb4c370158ad5 100644
--- a/src/wp-includes/blocks/buttons/block.json
+++ b/src/wp-includes/blocks/buttons/block.json
@@ -13,8 +13,16 @@
"align": [ "wide", "full" ],
"html": false,
"__experimentalExposeControlsToChildren": true,
+ "color": {
+ "gradients": true,
+ "text": false,
+ "__experimentalDefaultControls": {
+ "background": true
+ }
+ },
"spacing": {
- "blockGap": true,
+ "blockGap": [ "horizontal", "vertical" ],
+ "padding": true,
"margin": [ "top", "bottom" ],
"__experimentalDefaultControls": {
"blockGap": true
@@ -33,6 +41,18 @@
"fontSize": true
}
},
+ "__experimentalBorder": {
+ "color": true,
+ "radius": true,
+ "style": true,
+ "width": true,
+ "__experimentalDefaultControls": {
+ "color": true,
+ "radius": true,
+ "style": true,
+ "width": true
+ }
+ },
"layout": {
"allowSwitching": false,
"allowInheriting": false,
diff --git a/src/wp-includes/blocks/categories.php b/src/wp-includes/blocks/categories.php
index 1a6e6f43b1d93..e15f662bdfbb9 100644
--- a/src/wp-includes/blocks/categories.php
+++ b/src/wp-includes/blocks/categories.php
@@ -9,20 +9,26 @@
* Renders the `core/categories` block on server.
*
* @since 5.0.0
+ * @since 6.7.0 Enable client-side rendering if enhancedPagination context is true.
*
- * @param array $attributes The block attributes.
+ * @param array $attributes The block attributes.
+ * @param string $content Block default content.
+ * @param WP_Block $block Block instance.
*
* @return string Returns the categories list/dropdown markup.
*/
-function render_block_core_categories( $attributes ) {
+function render_block_core_categories( $attributes, $content, $block ) {
static $block_id = 0;
++$block_id;
+ $taxonomy = get_taxonomy( $attributes['taxonomy'] );
+
$args = array(
'echo' => false,
'hierarchical' => ! empty( $attributes['showHierarchy'] ),
'orderby' => 'name',
'show_count' => ! empty( $attributes['showPostCounts'] ),
+ 'taxonomy' => $attributes['taxonomy'],
'title_li' => '',
'hide_empty' => empty( $attributes['showEmpty'] ),
);
@@ -33,10 +39,20 @@ function render_block_core_categories( $attributes ) {
if ( ! empty( $attributes['displayAsDropdown'] ) ) {
$id = 'wp-block-categories-' . $block_id;
$args['id'] = $id;
- $args['show_option_none'] = __( 'Select Category' );
- $wrapper_markup = '
%2$s
';
- $items_markup = wp_dropdown_categories( $args );
- $type = 'dropdown';
+ $args['name'] = $taxonomy->query_var;
+ $args['value_field'] = 'slug';
+ $args['show_option_none'] = sprintf(
+ /* translators: %s: taxonomy's singular name */
+ __( 'Select %s' ),
+ $taxonomy->labels->singular_name
+ );
+
+ $show_label = empty( $attributes['showLabel'] ) ? ' screen-reader-text' : '';
+ $default_label = $taxonomy->label;
+ $label_text = ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
+ $wrapper_markup = '%2$s
';
+ $items_markup = wp_dropdown_categories( $args );
+ $type = 'dropdown';
if ( ! is_admin() ) {
// Inject the dropdown script immediately after the select dropdown.
@@ -48,9 +64,19 @@ function render_block_core_categories( $attributes ) {
);
}
} else {
+ $args['show_option_none'] = $taxonomy->labels->no_terms;
+
$wrapper_markup = '';
$items_markup = wp_list_categories( $args );
$type = 'list';
+
+ if ( ! empty( $block->context['enhancedPagination'] ) ) {
+ $p = new WP_HTML_Tag_Processor( $items_markup );
+ while ( $p->next_tag( 'a' ) ) {
+ $p->set_attribute( 'data-wp-on--click', 'core/query::actions.navigate' );
+ }
+ $items_markup = $p->get_updated_html();
+ }
}
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => "wp-block-categories-{$type}" ) );
@@ -78,8 +104,8 @@ function build_dropdown_script_block_core_categories( $dropdown_id ) {
( function() {
var dropdown = document.getElementById( '' );
function onCatChange() {
- if ( dropdown.options[ dropdown.selectedIndex ].value > 0 ) {
- location.href = "/?cat=" + dropdown.options[ dropdown.selectedIndex ].value;
+ if ( dropdown.options[ dropdown.selectedIndex ].value !== -1 ) {
+ location.href = "/?" + dropdown.name + '=' + dropdown.options[ dropdown.selectedIndex ].value;
}
}
dropdown.onchange = onCatChange;
diff --git a/src/wp-includes/blocks/categories/block.json b/src/wp-includes/blocks/categories/block.json
index 820ac8945f50f..bfd8461f8eda4 100644
--- a/src/wp-includes/blocks/categories/block.json
+++ b/src/wp-includes/blocks/categories/block.json
@@ -2,11 +2,16 @@
"$schema": "https://schemas.wp.org/trunk/block.json",
"apiVersion": 3,
"name": "core/categories",
- "title": "Categories List",
+ "title": "Terms List",
"category": "widgets",
- "description": "Display a list of all categories.",
+ "description": "Display a list of all terms of a given taxonomy.",
+ "keywords": [ "categories" ],
"textdomain": "default",
"attributes": {
+ "taxonomy": {
+ "type": "string",
+ "default": "category"
+ },
"displayAsDropdown": {
"type": "boolean",
"default": false
@@ -26,8 +31,17 @@
"showEmpty": {
"type": "boolean",
"default": false
+ },
+ "label": {
+ "type": "string",
+ "__experimentalRole": "content"
+ },
+ "showLabel": {
+ "type": "boolean",
+ "default": true
}
},
+ "usesContext": [ "enhancedPagination" ],
"supports": {
"align": true,
"html": false,
@@ -54,6 +68,18 @@
},
"interactivity": {
"clientNavigation": true
+ },
+ "__experimentalBorder": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true,
+ "__experimentalDefaultControls": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true
+ }
}
},
"editorStyle": "wp-block-categories-editor",
diff --git a/src/wp-includes/blocks/column/block.json b/src/wp-includes/blocks/column/block.json
index 0857abb47ffdc..33bd528b35688 100644
--- a/src/wp-includes/blocks/column/block.json
+++ b/src/wp-includes/blocks/column/block.json
@@ -48,10 +48,12 @@
},
"__experimentalBorder": {
"color": true,
+ "radius": true,
"style": true,
"width": true,
"__experimentalDefaultControls": {
"color": true,
+ "radius": true,
"style": true,
"width": true
}
diff --git a/src/wp-includes/blocks/comment-author-name/block.json b/src/wp-includes/blocks/comment-author-name/block.json
index f3422faf0264d..1889d054c940e 100644
--- a/src/wp-includes/blocks/comment-author-name/block.json
+++ b/src/wp-includes/blocks/comment-author-name/block.json
@@ -51,6 +51,19 @@
},
"interactivity": {
"clientNavigation": true
+ },
+ "__experimentalBorder": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true,
+ "__experimentalDefaultControls": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true
+ }
}
- }
+ },
+ "style": "wp-block-comment-author-name"
}
diff --git a/src/wp-includes/blocks/comment-content/block.json b/src/wp-includes/blocks/comment-content/block.json
index 9ac4b5453365b..0e812299a45e8 100644
--- a/src/wp-includes/blocks/comment-content/block.json
+++ b/src/wp-includes/blocks/comment-content/block.json
@@ -35,6 +35,18 @@
"fontSize": true
}
},
+ "__experimentalBorder": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true,
+ "__experimentalDefaultControls": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true
+ }
+ },
"spacing": {
"padding": [ "horizontal", "vertical" ],
"__experimentalDefaultControls": {
@@ -42,5 +54,6 @@
}
},
"html": false
- }
+ },
+ "style": "wp-block-comment-content"
}
diff --git a/src/wp-includes/blocks/comment-date.php b/src/wp-includes/blocks/comment-date.php
index f5876bb237b67..bdb6fd5ba42ae 100644
--- a/src/wp-includes/blocks/comment-date.php
+++ b/src/wp-includes/blocks/comment-date.php
@@ -28,11 +28,13 @@ function render_block_core_comment_date( $attributes, $content, $block ) {
$classes = ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) ? 'has-link-color' : '';
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
- $formatted_date = get_comment_date(
- isset( $attributes['format'] ) ? $attributes['format'] : '',
- $comment
- );
- $link = get_comment_link( $comment );
+ if ( isset( $attributes['format'] ) && 'human-diff' === $attributes['format'] ) {
+ // translators: %s: human-readable time difference.
+ $formatted_date = sprintf( __( '%s ago' ), human_time_diff( get_comment_date( 'U', $comment ) ) );
+ } else {
+ $formatted_date = get_comment_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $comment );
+ }
+ $link = get_comment_link( $comment );
if ( ! empty( $attributes['isLink'] ) ) {
$formatted_date = sprintf( '%2s', esc_url( $link ), $formatted_date );
diff --git a/src/wp-includes/blocks/comment-date/block.json b/src/wp-includes/blocks/comment-date/block.json
index ddc0281e6c668..1e8110f836d93 100644
--- a/src/wp-includes/blocks/comment-date/block.json
+++ b/src/wp-includes/blocks/comment-date/block.json
@@ -47,6 +47,19 @@
},
"interactivity": {
"clientNavigation": true
+ },
+ "__experimentalBorder": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true,
+ "__experimentalDefaultControls": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true
+ }
}
- }
+ },
+ "style": "wp-block-comment-date"
}
diff --git a/src/wp-includes/blocks/comment-edit-link/block.json b/src/wp-includes/blocks/comment-edit-link/block.json
index a49f9a23161b8..578b284715c2a 100644
--- a/src/wp-includes/blocks/comment-edit-link/block.json
+++ b/src/wp-includes/blocks/comment-edit-link/block.json
@@ -30,7 +30,11 @@
},
"spacing": {
"margin": true,
- "padding": true
+ "padding": true,
+ "__experimentalDefaultControls": {
+ "margin": false,
+ "padding": false
+ }
},
"typography": {
"fontSize": true,
@@ -47,6 +51,13 @@
},
"interactivity": {
"clientNavigation": true
+ },
+ "__experimentalBorder": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true
}
- }
+ },
+ "style": "wp-block-comment-edit-link"
}
diff --git a/src/wp-includes/blocks/comment-reply-link/block.json b/src/wp-includes/blocks/comment-reply-link/block.json
index c10129412145c..68aa93c3c1526 100644
--- a/src/wp-includes/blocks/comment-reply-link/block.json
+++ b/src/wp-includes/blocks/comment-reply-link/block.json
@@ -25,7 +25,11 @@
},
"spacing": {
"margin": true,
- "padding": true
+ "padding": true,
+ "__experimentalDefaultControls": {
+ "margin": false,
+ "padding": false
+ }
},
"typography": {
"fontSize": true,
@@ -40,6 +44,13 @@
"fontSize": true
}
},
+ "__experimentalBorder": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true
+ },
"html": false
- }
+ },
+ "style": "wp-block-comment-reply-link"
}
diff --git a/src/wp-includes/blocks/comment-template/block.json b/src/wp-includes/blocks/comment-template/block.json
index 70238c45a3d92..08fd591b42409 100644
--- a/src/wp-includes/blocks/comment-template/block.json
+++ b/src/wp-includes/blocks/comment-template/block.json
@@ -31,6 +31,18 @@
},
"interactivity": {
"clientNavigation": true
+ },
+ "__experimentalBorder": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true,
+ "__experimentalDefaultControls": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true
+ }
}
},
"style": "wp-block-comment-template"
diff --git a/src/wp-includes/blocks/comments-pagination-next.php b/src/wp-includes/blocks/comments-pagination-next.php
index cb8350e561b6e..0fd9519a56d30 100644
--- a/src/wp-includes/blocks/comments-pagination-next.php
+++ b/src/wp-includes/blocks/comments-pagination-next.php
@@ -37,7 +37,7 @@ function render_block_core_comments_pagination_next( $attributes, $content, $blo
$label .= $pagination_arrow;
}
- $next_comments_link = get_next_comments_link( $label, $max_page );
+ $next_comments_link = get_next_comments_link( $label, $max_page, $comment_vars['paged'] ?? null );
remove_filter( 'next_posts_link_attributes', $filter_link_attributes );
diff --git a/src/wp-includes/blocks/comments-pagination-previous.php b/src/wp-includes/blocks/comments-pagination-previous.php
index 092a28da67792..ba9bef97ad34d 100644
--- a/src/wp-includes/blocks/comments-pagination-previous.php
+++ b/src/wp-includes/blocks/comments-pagination-previous.php
@@ -29,7 +29,8 @@ function render_block_core_comments_pagination_previous( $attributes, $content,
};
add_filter( 'previous_comments_link_attributes', $filter_link_attributes );
- $previous_comments_link = get_previous_comments_link( $label );
+ $comment_vars = build_comment_query_vars_from_block( $block );
+ $previous_comments_link = get_previous_comments_link( $label, $comment_vars['paged'] ?? null );
remove_filter( 'previous_comments_link_attributes', $filter_link_attributes );
diff --git a/src/wp-includes/blocks/comments-title/block.json b/src/wp-includes/blocks/comments-title/block.json
index f8a02f2e5089b..b66b741e1916a 100644
--- a/src/wp-includes/blocks/comments-title/block.json
+++ b/src/wp-includes/blocks/comments-title/block.json
@@ -23,6 +23,9 @@
"level": {
"type": "number",
"default": 2
+ },
+ "levelOptions": {
+ "type": "array"
}
},
"supports": {
diff --git a/src/wp-includes/blocks/file.php b/src/wp-includes/blocks/file.php
index 87910f0e66a0c..8ea668d56d854 100644
--- a/src/wp-includes/blocks/file.php
+++ b/src/wp-includes/blocks/file.php
@@ -19,18 +19,7 @@
function render_block_core_file( $attributes, $content ) {
// If it's interactive, enqueue the script module and add the directives.
if ( ! empty( $attributes['displayPreview'] ) ) {
- $suffix = wp_scripts_get_suffix();
- if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
- $module_url = gutenberg_url( '/build/interactivity/file.min.js' );
- }
-
- wp_register_script_module(
- '@wordpress/block-library/file',
- isset( $module_url ) ? $module_url : includes_url( "blocks/file/view{$suffix}.js" ),
- array( '@wordpress/interactivity' ),
- defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
- );
- wp_enqueue_script_module( '@wordpress/block-library/file' );
+ wp_enqueue_script_module( '@wordpress/block-library/file/view' );
$processor = new WP_HTML_Tag_Processor( $content );
$processor->next_tag();
diff --git a/src/wp-includes/blocks/file/block.json b/src/wp-includes/blocks/file/block.json
index fd5da67d284f4..0526120c4dfc1 100644
--- a/src/wp-includes/blocks/file/block.json
+++ b/src/wp-includes/blocks/file/block.json
@@ -11,6 +11,10 @@
"id": {
"type": "number"
},
+ "blob": {
+ "type": "string",
+ "__experimentalRole": "local"
+ },
"href": {
"type": "string"
},
@@ -70,6 +74,18 @@
"link": true
}
},
+ "__experimentalBorder": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true,
+ "__experimentalDefaultControls": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true
+ }
+ },
"interactivity": true
},
"editorStyle": "wp-block-file-editor",
diff --git a/src/wp-includes/blocks/gallery/block.json b/src/wp-includes/blocks/gallery/block.json
index e9018704bf6bf..6a2129ec1e056 100644
--- a/src/wp-includes/blocks/gallery/block.json
+++ b/src/wp-includes/blocks/gallery/block.json
@@ -112,6 +112,16 @@
"supports": {
"anchor": true,
"align": true,
+ "__experimentalBorder": {
+ "radius": true,
+ "color": true,
+ "width": true,
+ "style": true,
+ "__experimentalDefaultControls": {
+ "color": true,
+ "radius": true
+ }
+ },
"html": false,
"units": [ "px", "em", "rem", "vh", "vw" ],
"spacing": {
diff --git a/src/wp-includes/blocks/group/block.json b/src/wp-includes/blocks/group/block.json
index db7d09c55d2c0..3c7d8d3ce1310 100644
--- a/src/wp-includes/blocks/group/block.json
+++ b/src/wp-includes/blocks/group/block.json
@@ -45,6 +45,7 @@
"text": true
}
},
+ "shadow": true,
"spacing": {
"margin": [ "top", "bottom" ],
"padding": true,
diff --git a/src/wp-includes/blocks/heading/block.json b/src/wp-includes/blocks/heading/block.json
index 39e985038c323..6e43a18cfba45 100644
--- a/src/wp-includes/blocks/heading/block.json
+++ b/src/wp-includes/blocks/heading/block.json
@@ -21,6 +21,9 @@
"type": "number",
"default": 2
},
+ "levelOptions": {
+ "type": "array"
+ },
"placeholder": {
"type": "string"
}
@@ -30,6 +33,18 @@
"anchor": true,
"className": true,
"splitting": true,
+ "__experimentalBorder": {
+ "color": true,
+ "radius": true,
+ "style": true,
+ "width": true,
+ "__experimentalDefaultControls": {
+ "color": true,
+ "radius": true,
+ "style": true,
+ "width": true
+ }
+ },
"color": {
"gradients": true,
"link": true,
diff --git a/src/wp-includes/blocks/image.php b/src/wp-includes/blocks/image.php
index 584318b51d196..5d7815a1f2f3f 100644
--- a/src/wp-includes/blocks/image.php
+++ b/src/wp-includes/blocks/image.php
@@ -70,19 +70,7 @@ function render_block_core_image( $attributes, $content, $block ) {
isset( $lightbox_settings['enabled'] ) &&
true === $lightbox_settings['enabled']
) {
- $suffix = wp_scripts_get_suffix();
- if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
- $module_url = gutenberg_url( '/build/interactivity/image.min.js' );
- }
-
- wp_register_script_module(
- '@wordpress/block-library/image',
- isset( $module_url ) ? $module_url : includes_url( "blocks/image/view{$suffix}.js" ),
- array( '@wordpress/interactivity' ),
- defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' )
- );
-
- wp_enqueue_script_module( '@wordpress/block-library/image' );
+ wp_enqueue_script_module( '@wordpress/block-library/image/view' );
/*
* This render needs to happen in a filter with priority 15 to ensure that
@@ -185,22 +173,37 @@ function block_core_image_render_lightbox( $block_content, $block ) {
$p->seek( 'figure' );
$figure_class_names = $p->get_attribute( 'class' );
$figure_styles = $p->get_attribute( 'style' );
+
+ // Create unique id and set the image metadata in the state.
+ $unique_image_id = uniqid();
+
+ wp_interactivity_state(
+ 'core/image',
+ array(
+ 'metadata' => array(
+ $unique_image_id => array(
+ 'uploadedSrc' => $img_uploaded_src,
+ 'figureClassNames' => $figure_class_names,
+ 'figureStyles' => $figure_styles,
+ 'imgClassNames' => $img_class_names,
+ 'imgStyles' => $img_styles,
+ 'targetWidth' => $img_width,
+ 'targetHeight' => $img_height,
+ 'scaleAttr' => $block['attrs']['scale'] ?? false,
+ 'ariaLabel' => $aria_label,
+ 'alt' => $alt,
+ ),
+ ),
+ )
+ );
+
$p->add_class( 'wp-lightbox-container' );
$p->set_attribute( 'data-wp-interactive', 'core/image' );
$p->set_attribute(
'data-wp-context',
wp_json_encode(
array(
- 'uploadedSrc' => $img_uploaded_src,
- 'figureClassNames' => $figure_class_names,
- 'figureStyles' => $figure_styles,
- 'imgClassNames' => $img_class_names,
- 'imgStyles' => $img_styles,
- 'targetWidth' => $img_width,
- 'targetHeight' => $img_height,
- 'scaleAttr' => $block['attrs']['scale'] ?? false,
- 'ariaLabel' => $aria_label,
- 'alt' => $alt,
+ 'imageId' => $unique_image_id,
),
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP
)
@@ -215,6 +218,8 @@ function block_core_image_render_lightbox( $block_content, $block ) {
// contain a caption, and we don't want to trigger the lightbox when the
// caption is clicked.
$p->set_attribute( 'data-wp-on-async--click', 'actions.showLightbox' );
+ $p->set_attribute( 'data-wp-class--hide', 'state.isContentHidden' );
+ $p->set_attribute( 'data-wp-class--show', 'state.isContentVisible' );
$body_content = $p->get_updated_html();
@@ -231,8 +236,8 @@ class="lightbox-trigger"
aria-label="' . esc_attr( $aria_label ) . '"
data-wp-init="callbacks.initTriggerButton"
data-wp-on-async--click="actions.showLightbox"
- data-wp-style--right="context.imageButtonRight"
- data-wp-style--top="context.imageButtonTop"
+ data-wp-style--right="state.imageButtonRight"
+ data-wp-style--top="state.imageButtonTop"
>