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" > @@ -288,15 +293,15 @@ class="wp-lightbox-overlay zoom" tabindex="-1" > diff --git a/src/wp-includes/blocks/image/block.json b/src/wp-includes/blocks/image/block.json index 1076aad0f1798..6417879164a22 100644 --- a/src/wp-includes/blocks/image/block.json +++ b/src/wp-includes/blocks/image/block.json @@ -9,6 +9,10 @@ "keywords": [ "img", "photo", "picture" ], "textdomain": "default", "attributes": { + "blob": { + "type": "string", + "__experimentalRole": "local" + }, "url": { "type": "string", "source": "attribute", @@ -102,6 +106,9 @@ "filter": { "duotone": true }, + "spacing": { + "margin": true + }, "__experimentalBorder": { "color": true, "radius": true, diff --git a/src/wp-includes/blocks/latest-comments/block.json b/src/wp-includes/blocks/latest-comments/block.json index aee42f1d15b48..543512ddf3ce7 100644 --- a/src/wp-includes/blocks/latest-comments/block.json +++ b/src/wp-includes/blocks/latest-comments/block.json @@ -29,6 +29,15 @@ }, "supports": { "align": true, + "color": { + "gradients": true, + "link": true, + "__experimentalDefaultControls": { + "background": true, + "text": true, + "link": true + } + }, "html": false, "spacing": { "margin": true, diff --git a/src/wp-includes/blocks/list-item/block.json b/src/wp-includes/blocks/list-item/block.json index 92822c993589d..a4bf2351d9750 100644 --- a/src/wp-includes/blocks/list-item/block.json +++ b/src/wp-includes/blocks/list-item/block.json @@ -6,7 +6,7 @@ "category": "text", "parent": [ "core/list" ], "allowedBlocks": [ "core/list" ], - "description": "Create a list item.", + "description": "An individual item within a list.", "textdomain": "default", "attributes": { "placeholder": { @@ -20,9 +20,23 @@ } }, "supports": { + "anchor": true, "className": false, - "__experimentalSelector": ".wp-block-list > li", "splitting": true, + "__experimentalBorder": { + "color": true, + "radius": true, + "style": true, + "width": true + }, + "color": { + "gradients": true, + "link": true, + "background": true, + "__experimentalDefaultControls": { + "text": true + } + }, "spacing": { "margin": true, "padding": true, @@ -47,5 +61,9 @@ "interactivity": { "clientNavigation": true } + }, + "selectors": { + "root": ".wp-block-list > li", + "border": ".wp-block-list:not(.wp-block-list .wp-block-list) > li" } } diff --git a/src/wp-includes/blocks/list/block.json b/src/wp-includes/blocks/list/block.json index 157aaf7c0cf63..ea07a0eb542df 100644 --- a/src/wp-includes/blocks/list/block.json +++ b/src/wp-includes/blocks/list/block.json @@ -5,7 +5,7 @@ "title": "List", "category": "text", "allowedBlocks": [ "core/list-item" ], - "description": "Create a bulleted or numbered list.", + "description": "An organized collection of items displayed in a specific order.", "keywords": [ "bullet list", "ordered list", "numbered list" ], "textdomain": "default", "attributes": { @@ -39,6 +39,12 @@ "supports": { "anchor": true, "html": false, + "__experimentalBorder": { + "color": true, + "radius": true, + "style": true, + "width": true + }, "typography": { "fontSize": true, "lineHeight": true, @@ -75,6 +81,9 @@ "clientNavigation": true } }, + "selectors": { + "border": ".wp-block-list:not(.wp-block-list .wp-block-list)" + }, "editorStyle": "wp-block-list-editor", "style": "wp-block-list" } diff --git a/src/wp-includes/blocks/loginout/block.json b/src/wp-includes/blocks/loginout/block.json index 8663300343253..f2aaafd60fde0 100644 --- a/src/wp-includes/blocks/loginout/block.json +++ b/src/wp-includes/blocks/loginout/block.json @@ -17,8 +17,17 @@ "default": true } }, + "example": { + "viewportWidth": 350 + }, "supports": { "className": true, + "color": { + "background": true, + "text": false, + "gradients": true, + "link": true + }, "spacing": { "margin": true, "padding": true, @@ -40,8 +49,15 @@ "fontSize": true } }, + "__experimentalBorder": { + "radius": true, + "color": true, + "width": true, + "style": true + }, "interactivity": { "clientNavigation": true } - } + }, + "style": "wp-block-loginout" } diff --git a/src/wp-includes/blocks/media-text.php b/src/wp-includes/blocks/media-text.php index 87be164a04bb9..b65137b150ba5 100644 --- a/src/wp-includes/blocks/media-text.php +++ b/src/wp-includes/blocks/media-text.php @@ -29,15 +29,32 @@ function render_block_core_media_text( $attributes, $content ) { return $content; } + $has_media_on_right = isset( $attributes['mediaPosition'] ) && 'right' === $attributes['mediaPosition']; + $image_fill = isset( $attributes['imageFill'] ) && $attributes['imageFill']; + $focal_point = isset( $attributes['focalPoint'] ) ? round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%' : '50% 50%'; + $unique_id = 'wp-block-media-text__media-' . wp_unique_id(); + + $block_tag_processor = new WP_HTML_Tag_Processor( $content ); + $block_query = array( + 'tag_name' => 'div', + 'class_name' => 'wp-block-media-text', + ); + + while ( $block_tag_processor->next_tag( $block_query ) ) { + if ( $image_fill ) { + // The markup below does not work with the deprecated `is-image-fill` class. + $block_tag_processor->remove_class( 'is-image-fill' ); + $block_tag_processor->add_class( 'is-image-fill-element' ); + } + } + + $content = $block_tag_processor->get_updated_html(); + $media_tag_processor = new WP_HTML_Tag_Processor( $content ); $wrapping_figure_query = array( 'tag_name' => 'figure', 'class_name' => 'wp-block-media-text__media', ); - $has_media_on_right = isset( $attributes['mediaPosition'] ) && 'right' === $attributes['mediaPosition']; - $image_fill = isset( $attributes['imageFill'] ) && $attributes['imageFill']; - $focal_point = isset( $attributes['focalPoint'] ) ? round( $attributes['focalPoint']['x'] * 100 ) . '% ' . round( $attributes['focalPoint']['y'] * 100 ) . '%' : '50% 50%'; - $unique_id = 'wp-block-media-text__media-' . wp_unique_id(); if ( $has_media_on_right ) { // Loop through all the figure tags and set a bookmark on the last figure tag. @@ -46,59 +63,52 @@ function render_block_core_media_text( $attributes, $content ) { } if ( $media_tag_processor->has_bookmark( 'last_figure' ) ) { $media_tag_processor->seek( 'last_figure' ); - if ( $image_fill ) { - $media_tag_processor->set_attribute( 'style', 'background-image:url(' . esc_url( $current_featured_image ) . ');background-position:' . $focal_point . ';' ); - } else { - // Insert a unique ID to identify the figure tag. - $media_tag_processor->set_attribute( 'id', $unique_id ); - } + // Insert a unique ID to identify the figure tag. + $media_tag_processor->set_attribute( 'id', $unique_id ); } } else { if ( $media_tag_processor->next_tag( $wrapping_figure_query ) ) { - if ( $image_fill ) { - $media_tag_processor->set_attribute( 'style', 'background-image:url(' . esc_url( $current_featured_image ) . ');background-position:' . $focal_point . ';' ); - } else { - // Insert a unique ID to identify the figure tag. - $media_tag_processor->set_attribute( 'id', $unique_id ); - } + // Insert a unique ID to identify the figure tag. + $media_tag_processor->set_attribute( 'id', $unique_id ); } } $content = $media_tag_processor->get_updated_html(); - // If the image is not set to fill, add the image tag inside the figure tag, - // and update the image attributes in order to display the featured image. - if ( ! $image_fill ) { - $media_size_slug = isset( $attributes['mediaSizeSlug'] ) ? $attributes['mediaSizeSlug'] : 'full'; - $image_tag = ''; - $content = preg_replace( - '/()/', - '$1' . $image_tag, - $content - ); + // Add the image tag inside the figure tag, and update the image attributes + // in order to display the featured image. + $media_size_slug = isset( $attributes['mediaSizeSlug'] ) ? $attributes['mediaSizeSlug'] : 'full'; + $image_tag = ''; + $content = preg_replace( + '/()/', + '$1' . $image_tag, + $content + ); - $image_tag_processor = new WP_HTML_Tag_Processor( $content ); + $image_tag_processor = new WP_HTML_Tag_Processor( $content ); + if ( $image_tag_processor->next_tag( + array( + 'tag_name' => 'figure', + 'id' => $unique_id, + ) + ) ) { + // The ID is only used to ensure that the correct figure tag is selected, + // and can now be removed. + $image_tag_processor->remove_attribute( 'id' ); if ( $image_tag_processor->next_tag( array( - 'tag_name' => 'figure', - 'id' => $unique_id, + 'tag_name' => 'img', + 'class_name' => 'wp-block-media-text__featured_image', ) ) ) { - // The ID is only used to ensure that the correct figure tag is selected, - // and can now be removed. - $image_tag_processor->remove_attribute( 'id' ); - if ( $image_tag_processor->next_tag( - array( - 'tag_name' => 'img', - 'class_name' => 'wp-block-media-text__featured_image', - ) - ) ) { - $image_tag_processor->set_attribute( 'src', esc_url( $current_featured_image ) ); - $image_tag_processor->set_attribute( 'class', 'wp-image-' . get_post_thumbnail_id() . ' size-' . $media_size_slug ); - $image_tag_processor->set_attribute( 'alt', trim( strip_tags( get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ) ) ) ); - - $content = $image_tag_processor->get_updated_html(); + $image_tag_processor->set_attribute( 'src', esc_url( $current_featured_image ) ); + $image_tag_processor->set_attribute( 'class', 'wp-image-' . get_post_thumbnail_id() . ' size-' . $media_size_slug ); + $image_tag_processor->set_attribute( 'alt', trim( strip_tags( get_post_meta( get_post_thumbnail_id(), '_wp_attachment_image_alt', true ) ) ) ); + if ( $image_fill ) { + $image_tag_processor->set_attribute( 'style', 'object-position:' . $focal_point . ';' ); } + + $content = $image_tag_processor->get_updated_html(); } } diff --git a/src/wp-includes/blocks/media-text/block.json b/src/wp-includes/blocks/media-text/block.json index 0f3519acb5d53..42384c0c4478e 100644 --- a/src/wp-includes/blocks/media-text/block.json +++ b/src/wp-includes/blocks/media-text/block.json @@ -103,6 +103,18 @@ "anchor": true, "align": [ "wide", "full" ], "html": false, + "__experimentalBorder": { + "color": true, + "radius": true, + "style": true, + "width": true, + "__experimentalDefaultControls": { + "color": true, + "radius": true, + "style": true, + "width": true + } + }, "color": { "gradients": true, "heading": true, diff --git a/src/wp-includes/blocks/navigation-submenu/block.json b/src/wp-includes/blocks/navigation-submenu/block.json index 0bcf8a1a47f38..e767b60aec3a6 100644 --- a/src/wp-includes/blocks/navigation-submenu/block.json +++ b/src/wp-includes/blocks/navigation-submenu/block.json @@ -59,6 +59,19 @@ "supports": { "reusable": false, "html": false, + "typography": { + "fontSize": true, + "lineHeight": true, + "__experimentalFontFamily": true, + "__experimentalFontWeight": true, + "__experimentalFontStyle": true, + "__experimentalTextTransform": true, + "__experimentalTextDecoration": true, + "__experimentalLetterSpacing": true, + "__experimentalDefaultControls": { + "fontSize": true + } + }, "interactivity": { "clientNavigation": true } diff --git a/src/wp-includes/blocks/navigation.php b/src/wp-includes/blocks/navigation.php index 99feef98542ed..10fec84ed59d9 100644 --- a/src/wp-includes/blocks/navigation.php +++ b/src/wp-includes/blocks/navigation.php @@ -241,13 +241,11 @@ 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( 'set_ignored_hooked_blocks_metadata' ) ) { - // 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]; + // 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]; - $blocks = isset( $root_nav_block['innerBlocks'] ) ? $root_nav_block['innerBlocks'] : $blocks; - } + $blocks = isset( $root_nav_block['innerBlocks'] ) ? $root_nav_block['innerBlocks'] : $blocks; // TODO - this uses the full navigation block attributes for the // context which could be refined. @@ -483,7 +481,7 @@ private static function get_responsive_container_markup( $attributes, $inner_blo } } $toggle_button_content = $should_display_icon_label ? $toggle_button_icon : __( 'Menu' ); - $toggle_close_button_icon = ''; + $toggle_close_button_icon = ''; $toggle_close_button_content = $should_display_icon_label ? $toggle_close_button_icon : __( 'Close' ); $toggle_aria_label_open = $should_display_icon_label ? 'aria-label="' . __( 'Open menu' ) . '"' : ''; // Open button label. $toggle_aria_label_close = $should_display_icon_label ? 'aria-label="' . __( 'Close menu' ) . '"' : ''; // Close button label. @@ -624,18 +622,7 @@ private static function get_nav_element_directives( $is_interactive ) { */ private static function handle_view_script_module_loading( $attributes, $block, $inner_blocks ) { if ( static::is_interactive( $attributes, $inner_blocks ) ) { - $suffix = wp_scripts_get_suffix(); - if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) { - $module_url = gutenberg_url( '/build/interactivity/navigation.min.js' ); - } - - wp_register_script_module( - '@wordpress/block-library/navigation', - isset( $module_url ) ? $module_url : includes_url( "blocks/navigation/view{$suffix}.js" ), - array( '@wordpress/interactivity' ), - defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' ) - ); - wp_enqueue_script_module( '@wordpress/block-library/navigation' ); + wp_enqueue_script_module( '@wordpress/block-library/navigation/view' ); } } @@ -1083,15 +1070,13 @@ 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( 'set_ignored_hooked_blocks_metadata' ) ) { - // 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 ); - $blocks = parse_blocks( $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 ); + $blocks = parse_blocks( $markup ); - if ( isset( $blocks[0]['innerBlocks'] ) ) { - $fallback_blocks = $blocks[0]['innerBlocks']; - } + if ( isset( $blocks[0]['innerBlocks'] ) ) { + $fallback_blocks = $blocks[0]['innerBlocks']; } } @@ -1621,26 +1606,15 @@ function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) { /* * Do not add the `block_core_navigation_update_ignore_hooked_blocks_meta` filter in the following cases: * - If Core has added the `update_ignored_hooked_blocks_postmeta` filter already (WP >= 6.6); - * - or if the `set_ignored_hooked_blocks_metadata` function is unavailable (which is required for the filter to work. It was introduced by WP 6.5 but is not present in Gutenberg's WP 6.5 compatibility layer); * - or if the `$rest_insert_wp_navigation_core_callback` filter has already been added. */ if ( ! has_filter( 'rest_pre_insert_wp_navigation', 'update_ignored_hooked_blocks_postmeta' ) && - function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_pre_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) { add_filter( 'rest_pre_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta' ); } -/* - * Previous versions of Gutenberg were attaching the block_core_navigation_update_ignore_hooked_blocks_meta - * function to the `rest_insert_wp_navigation` _action_ (rather than the `rest_pre_insert_wp_navigation` _filter_). - * To avoid collisions, we need to remove the filter from that action if it's present. - */ -if ( has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) { - remove_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ); -} - /** * Hooks into the REST API response for the core/navigation block and adds the first and last inner blocks. * @@ -1678,12 +1652,10 @@ function block_core_navigation_insert_hooked_blocks_into_rest_response( $respons /* * Do not add the `block_core_navigation_insert_hooked_blocks_into_rest_response` filter in the following cases: * - If Core has added the `insert_hooked_blocks_into_rest_response` filter already (WP >= 6.6); - * - or if the `set_ignored_hooked_blocks_metadata` function is unavailable (which is required for the filter to work. It was introduced by WP 6.5 but is not present in Gutenberg's WP 6.5 compatibility layer); * - or if the `$rest_prepare_wp_navigation_core_callback` filter has already been added. */ if ( ! has_filter( 'rest_prepare_wp_navigation', 'insert_hooked_blocks_into_rest_response' ) && - function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_prepare_wp_navigation', $rest_prepare_wp_navigation_core_callback ) ) { add_filter( 'rest_prepare_wp_navigation', 'block_core_navigation_insert_hooked_blocks_into_rest_response', 10, 3 ); diff --git a/src/wp-includes/blocks/page-list.php b/src/wp-includes/blocks/page-list.php index 4ff57e1a36a23..a574633d4ddf4 100644 --- a/src/wp-includes/blocks/page-list.php +++ b/src/wp-includes/blocks/page-list.php @@ -192,7 +192,9 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click, $css_class .= ' menu-item-home'; } - $title = wp_kses_post( $page['title'] ); + $title = wp_kses_post( $page['title'] ); + $title = $title ? $title : __( '(no title)' ); + $aria_label = sprintf( /* translators: Accessibility text. %s: Parent page title. */ __( '%s submenu' ), diff --git a/src/wp-includes/blocks/paragraph/block.json b/src/wp-includes/blocks/paragraph/block.json index 6f11baf838a94..f16a7cf041144 100644 --- a/src/wp-includes/blocks/paragraph/block.json +++ b/src/wp-includes/blocks/paragraph/block.json @@ -33,6 +33,12 @@ "splitting": true, "anchor": true, "className": false, + "__experimentalBorder": { + "color": true, + "radius": true, + "style": true, + "width": true + }, "color": { "gradients": true, "link": true, diff --git a/src/wp-includes/blocks/post-author-biography/block.json b/src/wp-includes/blocks/post-author-biography/block.json index 8e0ff61c29dfc..c6e27bc484dfd 100644 --- a/src/wp-includes/blocks/post-author-biography/block.json +++ b/src/wp-includes/blocks/post-author-biography/block.json @@ -12,6 +12,9 @@ } }, "usesContext": [ "postType", "postId" ], + "example": { + "viewportWidth": 350 + }, "supports": { "spacing": { "margin": true, @@ -40,6 +43,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-post-author-biography" } diff --git a/src/wp-includes/blocks/post-author-name/block.json b/src/wp-includes/blocks/post-author-name/block.json index 7889fed37b9d3..68d2c49bd9105 100644 --- a/src/wp-includes/blocks/post-author-name/block.json +++ b/src/wp-includes/blocks/post-author-name/block.json @@ -20,6 +20,9 @@ } }, "usesContext": [ "postType", "postId" ], + "example": { + "viewportWidth": 350 + }, "supports": { "html": false, "spacing": { @@ -50,6 +53,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-post-author-name" } diff --git a/src/wp-includes/blocks/post-author/block.json b/src/wp-includes/blocks/post-author/block.json index 6f814810744c6..d66498c8ee3df 100644 --- a/src/wp-includes/blocks/post-author/block.json +++ b/src/wp-includes/blocks/post-author/block.json @@ -64,7 +64,20 @@ }, "interactivity": { "clientNavigation": true + }, + "__experimentalBorder": { + "radius": true, + "color": true, + "width": true, + "style": true, + "__experimentalDefaultControls": { + "radius": true, + "color": true, + "width": true, + "style": true + } } }, + "editorStyle": "wp-block-post-author-editor", "style": "wp-block-post-author" } diff --git a/src/wp-includes/blocks/post-comments-form/block.json b/src/wp-includes/blocks/post-comments-form/block.json index ff157beb5ced9..af893ccb67a08 100644 --- a/src/wp-includes/blocks/post-comments-form/block.json +++ b/src/wp-includes/blocks/post-comments-form/block.json @@ -37,6 +37,18 @@ "__experimentalDefaultControls": { "fontSize": true } + }, + "__experimentalBorder": { + "radius": true, + "color": true, + "width": true, + "style": true, + "__experimentalDefaultControls": { + "radius": true, + "color": true, + "width": true, + "style": true + } } }, "editorStyle": "wp-block-post-comments-form-editor", diff --git a/src/wp-includes/blocks/post-content/block.json b/src/wp-includes/blocks/post-content/block.json index b0e0487a0b824..1b9de707cb322 100644 --- a/src/wp-includes/blocks/post-content/block.json +++ b/src/wp-includes/blocks/post-content/block.json @@ -7,15 +7,30 @@ "description": "Displays the contents of a post or page.", "textdomain": "default", "usesContext": [ "postId", "postType", "queryId" ], + "example": { + "viewportWidth": 350 + }, "supports": { "align": [ "wide", "full" ], "html": false, "layout": true, + "background": { + "backgroundImage": true, + "backgroundSize": true, + "__experimentalDefaultControls": { + "backgroundImage": true + } + }, "dimensions": { "minHeight": true }, "spacing": { - "blockGap": true + "blockGap": true, + "padding": true, + "__experimentalDefaultControls": { + "margin": false, + "padding": false + } }, "color": { "gradients": true, @@ -39,5 +54,6 @@ } } }, + "style": "wp-block-post-content", "editorStyle": "wp-block-post-content-editor" } diff --git a/src/wp-includes/blocks/post-date.php b/src/wp-includes/blocks/post-date.php index bcfff02fc178d..79aa81e7f9c11 100644 --- a/src/wp-includes/blocks/post-date.php +++ b/src/wp-includes/blocks/post-date.php @@ -20,8 +20,20 @@ function render_block_core_post_date( $attributes, $content, $block ) { return ''; } - $post_ID = $block->context['postId']; - $formatted_date = get_the_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $post_ID ); + $post_ID = $block->context['postId']; + + if ( isset( $attributes['format'] ) && 'human-diff' === $attributes['format'] ) { + $post_timestamp = get_post_timestamp( $post_ID ); + if ( $post_timestamp > time() ) { + // translators: %s: human-readable time difference. + $formatted_date = sprintf( __( '%s from now' ), human_time_diff( $post_timestamp ) ); + } else { + // translators: %s: human-readable time difference. + $formatted_date = sprintf( __( '%s ago' ), human_time_diff( $post_timestamp ) ); + } + } else { + $formatted_date = get_the_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $post_ID ); + } $unformatted_date = esc_attr( get_the_date( 'c', $post_ID ) ); $classes = array(); @@ -38,7 +50,12 @@ function render_block_core_post_date( $attributes, $content, $block ) { */ if ( isset( $attributes['displayType'] ) && 'modified' === $attributes['displayType'] ) { if ( get_the_modified_date( 'Ymdhi', $post_ID ) > get_the_date( 'Ymdhi', $post_ID ) ) { - $formatted_date = get_the_modified_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $post_ID ); + if ( isset( $attributes['format'] ) && 'human-diff' === $attributes['format'] ) { + // translators: %s: human-readable time difference. + $formatted_date = sprintf( __( '%s ago' ), human_time_diff( get_post_timestamp( $post_ID, 'modified' ) ) ); + } else { + $formatted_date = get_the_modified_date( empty( $attributes['format'] ) ? '' : $attributes['format'], $post_ID ); + } $unformatted_date = esc_attr( get_the_modified_date( 'c', $post_ID ) ); $classes[] = 'wp-block-post-date__modified-date'; } else { diff --git a/src/wp-includes/blocks/post-date/block.json b/src/wp-includes/blocks/post-date/block.json index 176e5b6b0ee61..470bddae53bdf 100644 --- a/src/wp-includes/blocks/post-date/block.json +++ b/src/wp-includes/blocks/post-date/block.json @@ -23,6 +23,9 @@ } }, "usesContext": [ "postId", "postType", "queryId" ], + "example": { + "viewportWidth": 350 + }, "supports": { "html": false, "color": { @@ -53,6 +56,18 @@ }, "interactivity": { "clientNavigation": true + }, + "__experimentalBorder": { + "radius": true, + "color": true, + "width": true, + "style": true, + "__experimentalDefaultControls": { + "radius": true, + "color": true, + "width": true, + "style": true + } } } } diff --git a/src/wp-includes/blocks/post-excerpt/block.json b/src/wp-includes/blocks/post-excerpt/block.json index 4bbc962c9838e..61888ced43e67 100644 --- a/src/wp-includes/blocks/post-excerpt/block.json +++ b/src/wp-includes/blocks/post-excerpt/block.json @@ -23,6 +23,9 @@ } }, "usesContext": [ "postId", "postType", "queryId" ], + "example": { + "viewportWidth": 350 + }, "supports": { "html": false, "color": { @@ -53,6 +56,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-post-excerpt-editor", diff --git a/src/wp-includes/blocks/post-featured-image/block.json b/src/wp-includes/blocks/post-featured-image/block.json index 078b7912122ce..8b431ffc62579 100644 --- a/src/wp-includes/blocks/post-featured-image/block.json +++ b/src/wp-includes/blocks/post-featured-image/block.json @@ -58,6 +58,9 @@ } }, "usesContext": [ "postId", "postType", "queryId" ], + "example": { + "viewportWidth": 350 + }, "supports": { "align": [ "left", "right", "center", "wide", "full" ], "color": { diff --git a/src/wp-includes/blocks/post-terms/block.json b/src/wp-includes/blocks/post-terms/block.json index 538768fd7e511..165f50109616e 100644 --- a/src/wp-includes/blocks/post-terms/block.json +++ b/src/wp-includes/blocks/post-terms/block.json @@ -27,6 +27,9 @@ } }, "usesContext": [ "postId", "postType" ], + "example": { + "viewportWidth": 350 + }, "supports": { "html": false, "color": { @@ -57,6 +60,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-post-terms" diff --git a/src/wp-includes/blocks/post-title/block.json b/src/wp-includes/blocks/post-title/block.json index b56adecce52b1..ecb5053d6cd39 100644 --- a/src/wp-includes/blocks/post-title/block.json +++ b/src/wp-includes/blocks/post-title/block.json @@ -15,6 +15,9 @@ "type": "number", "default": 2 }, + "levelOptions": { + "type": "array" + }, "isLink": { "type": "boolean", "default": false @@ -29,6 +32,9 @@ "default": "_self" } }, + "example": { + "viewportWidth": 350 + }, "supports": { "align": [ "wide", "full" ], "html": false, @@ -60,6 +66,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-post-title" diff --git a/src/wp-includes/blocks/preformatted/block.json b/src/wp-includes/blocks/preformatted/block.json index fbec3581bc9d4..a1726ee8b0d43 100644 --- a/src/wp-includes/blocks/preformatted/block.json +++ b/src/wp-includes/blocks/preformatted/block.json @@ -43,6 +43,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-preformatted" diff --git a/src/wp-includes/blocks/pullquote/block.json b/src/wp-includes/blocks/pullquote/block.json index 410b477dd9939..0935f9759668d 100644 --- a/src/wp-includes/blocks/pullquote/block.json +++ b/src/wp-includes/blocks/pullquote/block.json @@ -26,6 +26,13 @@ "supports": { "anchor": true, "align": [ "left", "right", "wide", "full" ], + "background": { + "backgroundImage": true, + "backgroundSize": true, + "__experimentalDefaultControls": { + "backgroundImage": true + } + }, "color": { "gradients": true, "background": true, @@ -35,6 +42,12 @@ "text": true } }, + "dimensions": { + "minHeight": true, + "__experimentalDefaultControls": { + "minHeight": false + } + }, "spacing": { "margin": true, "padding": true diff --git a/src/wp-includes/blocks/query-title/block.json b/src/wp-includes/blocks/query-title/block.json index 674daadee3bb6..de3e60214685c 100644 --- a/src/wp-includes/blocks/query-title/block.json +++ b/src/wp-includes/blocks/query-title/block.json @@ -17,6 +17,9 @@ "type": "number", "default": 1 }, + "levelOptions": { + "type": "array" + }, "showPrefix": { "type": "boolean", "default": true @@ -55,6 +58,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-query-title" diff --git a/src/wp-includes/blocks/query.php b/src/wp-includes/blocks/query.php index 6cc57dc08388c..043f351e11d7f 100644 --- a/src/wp-includes/blocks/query.php +++ b/src/wp-includes/blocks/query.php @@ -24,27 +24,7 @@ function render_block_core_query( $attributes, $content, $block ) { // Enqueue the script module and add the necessary directives if the block is // interactive. if ( $is_interactive ) { - $suffix = wp_scripts_get_suffix(); - if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) { - $module_url = gutenberg_url( '/build/interactivity/query.min.js' ); - } - - wp_register_script_module( - '@wordpress/block-library/query', - isset( $module_url ) ? $module_url : includes_url( "blocks/query/view{$suffix}.js" ), - array( - array( - 'id' => '@wordpress/interactivity', - 'import' => 'static', - ), - array( - 'id' => '@wordpress/interactivity-router', - 'import' => 'dynamic', - ), - ), - defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' ) - ); - wp_enqueue_script_module( '@wordpress/block-library/query' ); + wp_enqueue_script_module( '@wordpress/block-library/query/view' ); $p = new WP_HTML_Tag_Processor( $content ); if ( $p->next_tag() ) { diff --git a/src/wp-includes/blocks/query/block.json b/src/wp-includes/blocks/query/block.json index b602032df3600..9eb8495963823 100644 --- a/src/wp-includes/blocks/query/block.json +++ b/src/wp-includes/blocks/query/block.json @@ -25,7 +25,8 @@ "sticky": "", "inherit": true, "taxQuery": null, - "parents": [] + "parents": [], + "format": [] } }, "tagName": { diff --git a/src/wp-includes/blocks/quote/block.json b/src/wp-includes/blocks/quote/block.json index 7ad713a13373a..0f9ec97422f64 100644 --- a/src/wp-includes/blocks/quote/block.json +++ b/src/wp-includes/blocks/quote/block.json @@ -28,7 +28,33 @@ }, "supports": { "anchor": true, + "align": [ "left", "right", "wide", "full" ], "html": false, + "background": { + "backgroundImage": true, + "backgroundSize": true, + "__experimentalDefaultControls": { + "backgroundImage": true + } + }, + "__experimentalBorder": { + "color": true, + "radius": true, + "style": true, + "width": true, + "__experimentalDefaultControls": { + "color": true, + "radius": true, + "style": true, + "width": true + } + }, + "dimensions": { + "minHeight": true, + "__experimentalDefaultControls": { + "minHeight": false + } + }, "__experimentalOnEnter": true, "__experimentalOnMerge": true, "typography": { @@ -57,7 +83,9 @@ "allowEditing": false }, "spacing": { - "blockGap": true + "blockGap": true, + "padding": true, + "margin": true }, "interactivity": { "clientNavigation": true diff --git a/src/wp-includes/blocks/search.php b/src/wp-includes/blocks/search.php index 39b8591c86600..e4259bb0ce2c7 100644 --- a/src/wp-includes/blocks/search.php +++ b/src/wp-includes/blocks/search.php @@ -80,18 +80,7 @@ function render_block_core_search( $attributes ) { // If it's interactive, enqueue the script module and add the directives. $is_expandable_searchfield = 'button-only' === $button_position; if ( $is_expandable_searchfield ) { - $suffix = wp_scripts_get_suffix(); - if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) { - $module_url = gutenberg_url( '/build/interactivity/search.min.js' ); - } - - wp_register_script_module( - '@wordpress/block-library/search', - isset( $module_url ) ? $module_url : includes_url( "blocks/search/view{$suffix}.js" ), - array( '@wordpress/interactivity' ), - defined( 'GUTENBERG_VERSION' ) ? GUTENBERG_VERSION : get_bloginfo( 'version' ) - ); - wp_enqueue_script_module( '@wordpress/block-library/search' ); + wp_enqueue_script_module( '@wordpress/block-library/search/view' ); $input->set_attribute( 'data-wp-bind--aria-hidden', '!context.isSearchInputVisible' ); $input->set_attribute( 'data-wp-bind--tabindex', 'state.tabindex' ); diff --git a/src/wp-includes/blocks/search/block.json b/src/wp-includes/blocks/search/block.json index 8d5e208045068..dac4c6b488a97 100644 --- a/src/wp-includes/blocks/search/block.json +++ b/src/wp-includes/blocks/search/block.json @@ -85,6 +85,9 @@ "width": true } }, + "spacing": { + "margin": true + }, "html": false }, "editorStyle": "wp-block-search-editor", diff --git a/src/wp-includes/blocks/site-logo.php b/src/wp-includes/blocks/site-logo.php index ea6d9f1f8d97c..915563461e30c 100644 --- a/src/wp-includes/blocks/site-logo.php +++ b/src/wp-includes/blocks/site-logo.php @@ -159,6 +159,8 @@ function _sync_custom_logo_to_site_logo( $value ) { * * @since 5.8.0 * + * @global array $_ignore_site_logo_changes + * * @param array $old_value Previous theme mod settings. * @param array $value Updated theme mod settings. */ @@ -179,6 +181,8 @@ function _delete_site_logo_on_remove_custom_logo( $old_value, $value ) { * Deletes the site logo when all theme mods are being removed. * * @since 5.8.0 + * + * @global array $_ignore_site_logo_changes */ function _delete_site_logo_on_remove_theme_mods() { global $_ignore_site_logo_changes; @@ -211,6 +215,8 @@ function _delete_site_logo_on_remove_custom_logo_on_setup_theme() { * Removes the custom_logo theme-mod when the site_logo option gets deleted. * * @since 5.9.0 + * + * @global array $_ignore_site_logo_changes */ function _delete_custom_logo_on_remove_site_logo() { global $_ignore_site_logo_changes; diff --git a/src/wp-includes/blocks/site-tagline/block.json b/src/wp-includes/blocks/site-tagline/block.json index 01ec727eb9053..d42b7bcd4bed6 100644 --- a/src/wp-includes/blocks/site-tagline/block.json +++ b/src/wp-includes/blocks/site-tagline/block.json @@ -14,9 +14,18 @@ "level": { "type": "number", "default": 0 + }, + "levelOptions": { + "type": "array", + "default": [ 0, 1, 2, 3, 4, 5, 6 ] + } + }, + "example": { + "viewportWidth": 350, + "attributes": { + "textAlign": "center" } }, - "example": {}, "supports": { "align": [ "wide", "full" ], "html": false, @@ -44,13 +53,21 @@ "__experimentalFontStyle": true, "__experimentalFontWeight": true, "__experimentalLetterSpacing": true, + "__experimentalWritingMode": true, "__experimentalDefaultControls": { "fontSize": true } }, "interactivity": { "clientNavigation": true + }, + "__experimentalBorder": { + "radius": true, + "color": true, + "width": true, + "style": true } }, - "editorStyle": "wp-block-site-tagline-editor" + "editorStyle": "wp-block-site-tagline-editor", + "style": "wp-block-site-tagline" } diff --git a/src/wp-includes/blocks/site-title/block.json b/src/wp-includes/blocks/site-title/block.json index 6179452cd15b7..c75b1bc229beb 100644 --- a/src/wp-includes/blocks/site-title/block.json +++ b/src/wp-includes/blocks/site-title/block.json @@ -11,6 +11,10 @@ "type": "number", "default": 1 }, + "levelOptions": { + "type": "array", + "default": [ 0, 1, 2, 3, 4, 5, 6 ] + }, "textAlign": { "type": "string" }, @@ -55,12 +59,19 @@ "__experimentalFontStyle": true, "__experimentalFontWeight": true, "__experimentalLetterSpacing": true, + "__experimentalWritingMode": true, "__experimentalDefaultControls": { "fontSize": true } }, "interactivity": { "clientNavigation": true + }, + "__experimentalBorder": { + "radius": true, + "color": true, + "width": true, + "style": true } }, "editorStyle": "wp-block-site-title-editor", diff --git a/src/wp-includes/blocks/social-links/block.json b/src/wp-includes/blocks/social-links/block.json index 45dbd9d698953..bd750f26b3960 100644 --- a/src/wp-includes/blocks/social-links/block.json +++ b/src/wp-includes/blocks/social-links/block.json @@ -81,6 +81,18 @@ }, "interactivity": { "clientNavigation": true + }, + "__experimentalBorder": { + "radius": true, + "color": true, + "width": true, + "style": true, + "__experimentalDefaultControls": { + "radius": true, + "color": true, + "width": true, + "style": true + } } }, "styles": [ diff --git a/src/wp-includes/blocks/tag-cloud.php b/src/wp-includes/blocks/tag-cloud.php index 69b8c25ec8720..8949dd8e5b11f 100644 --- a/src/wp-includes/blocks/tag-cloud.php +++ b/src/wp-includes/blocks/tag-cloud.php @@ -29,8 +29,13 @@ function render_block_core_tag_cloud( $attributes ) { ); $tag_cloud = wp_tag_cloud( $args ); - if ( ! $tag_cloud ) { - $tag_cloud = __( 'There’s no content to show here yet.' ); + if ( empty( $tag_cloud ) ) { + // Display placeholder content when there are no tags only in editor. + if ( wp_is_serving_rest_request() ) { + $tag_cloud = __( 'There’s no content to show here yet.' ); + } else { + return ''; + } } $wrapper_attributes = get_block_wrapper_attributes(); diff --git a/src/wp-includes/blocks/tag-cloud/block.json b/src/wp-includes/blocks/tag-cloud/block.json index b95e02204faa2..044bc0c533376 100644 --- a/src/wp-includes/blocks/tag-cloud/block.json +++ b/src/wp-includes/blocks/tag-cloud/block.json @@ -4,7 +4,7 @@ "name": "core/tag-cloud", "title": "Tag Cloud", "category": "widgets", - "description": "A cloud of your most used tags.", + "description": "A cloud of popular keywords, each sized by how often it appears.", "textdomain": "default", "attributes": { "numberOfTags": { @@ -51,6 +51,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-tag-cloud-editor" diff --git a/src/wp-includes/blocks/term-description/block.json b/src/wp-includes/blocks/term-description/block.json index 7a3f27c8063ab..dc27fc17df789 100644 --- a/src/wp-includes/blocks/term-description/block.json +++ b/src/wp-includes/blocks/term-description/block.json @@ -40,6 +40,18 @@ }, "interactivity": { "clientNavigation": true + }, + "__experimentalBorder": { + "radius": true, + "color": true, + "width": true, + "style": true, + "__experimentalDefaultControls": { + "radius": true, + "color": true, + "width": true, + "style": true + } } } } diff --git a/src/wp-includes/blocks/verse/block.json b/src/wp-includes/blocks/verse/block.json index 1d6b817c00302..387ff3dfe1712 100644 --- a/src/wp-includes/blocks/verse/block.json +++ b/src/wp-includes/blocks/verse/block.json @@ -21,6 +21,13 @@ }, "supports": { "anchor": true, + "background": { + "backgroundImage": true, + "backgroundSize": true, + "__experimentalDefaultControls": { + "backgroundImage": true + } + }, "color": { "gradients": true, "link": true, @@ -29,6 +36,12 @@ "text": true } }, + "dimensions": { + "minHeight": true, + "__experimentalDefaultControls": { + "minHeight": false + } + }, "typography": { "fontSize": true, "__experimentalFontFamily": true, @@ -38,6 +51,7 @@ "__experimentalLetterSpacing": true, "__experimentalTextTransform": true, "__experimentalTextDecoration": true, + "__experimentalWritingMode": true, "__experimentalDefaultControls": { "fontSize": true } diff --git a/src/wp-includes/blocks/video/block.json b/src/wp-includes/blocks/video/block.json index 2bc153bc1c616..1d3dc75961e8f 100644 --- a/src/wp-includes/blocks/video/block.json +++ b/src/wp-includes/blocks/video/block.json @@ -56,6 +56,10 @@ "attribute": "preload", "default": "metadata" }, + "blob": { + "type": "string", + "__experimentalRole": "local" + }, "src": { "type": "string", "source": "attribute",