Block Editor: Updated the WordPress packages from Gutenberg 10.7.0 RC.

This also includes:

 - The removal of the Post Author block.
 - Renaming build_query_vars_from_query_block function.
 - Update the block supports.

Props gziolo.
See #52991. 
-This line, and those below, will be ignored--

M    package-lock.json
M    package.json
M    src/wp-includes/assets/script-loader-packages.php
M    src/wp-includes/block-supports/colors.php
AM   src/wp-includes/block-supports/elements.php
D    src/wp-includes/block-supports/padding.php
AM   src/wp-includes/block-supports/spacing.php
M    src/wp-includes/block-supports/typography.php
M    src/wp-includes/blocks/column/block.json
M    src/wp-includes/blocks/index.php
D    src/wp-includes/blocks/post-author
D    src/wp-includes/blocks/post-author.php
M    src/wp-includes/blocks/post-content.php
M    src/wp-includes/blocks/post-featured-image.php
M    src/wp-includes/blocks/query/block.json
M    src/wp-includes/blocks/query-loop/block.json
M    src/wp-includes/blocks/query-loop.php
M    src/wp-includes/blocks/query-pagination/block.json
M    src/wp-includes/blocks/query-pagination-next.php
M    src/wp-includes/blocks/query-pagination-numbers.php
M    src/wp-includes/blocks/site-tagline/block.json
M    src/wp-includes/blocks/site-title/block.json
M    src/wp-includes/blocks.php
M    src/wp-settings.php
M    tests/phpunit/tests/blocks/block.php
M    tools/webpack/packages.js


git-svn-id: https://develop.svn.wordpress.org/trunk@50945 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Riad Benguella
2021-05-21 10:12:42 +00:00
parent e7dbf1d5f1
commit 83c5f4d23b
26 changed files with 1017 additions and 922 deletions

1385
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -26,9 +26,9 @@
"devDependencies": {
"@wordpress/custom-templated-path-webpack-plugin": "2.0.4",
"@wordpress/dependency-extraction-webpack-plugin": "3.1.3",
"@wordpress/e2e-test-utils": "5.1.4",
"@wordpress/e2e-test-utils": "5.2.0",
"@wordpress/library-export-default-webpack-plugin": "2.0.4",
"@wordpress/scripts": "16.0.0",
"@wordpress/scripts": "16.1.0",
"autoprefixer": "^9.8.6",
"chalk": "4.1.0",
"check-node-version": "4.1.0",
@@ -77,55 +77,55 @@
},
"dependencies": {
"@babel/polyfill": "7.10.1",
"@wordpress/a11y": "3.0.0",
"@wordpress/annotations": "2.0.0",
"@wordpress/api-fetch": "5.0.0",
"@wordpress/autop": "3.0.0",
"@wordpress/blob": "3.0.0",
"@wordpress/block-directory": "2.0.0",
"@wordpress/block-editor": "6.0.0",
"@wordpress/block-library": "3.0.0",
"@wordpress/block-serialization-default-parser": "4.0.0",
"@wordpress/blocks": "9.0.0",
"@wordpress/components": "14.0.0",
"@wordpress/compose": "4.0.0",
"@wordpress/core-data": "3.0.0",
"@wordpress/data": "5.0.0",
"@wordpress/data-controls": "2.0.0",
"@wordpress/date": "4.0.0",
"@wordpress/deprecated": "3.0.0",
"@wordpress/dom": "3.0.0",
"@wordpress/dom-ready": "3.0.0",
"@wordpress/edit-post": "4.0.0",
"@wordpress/editor": "10.0.0",
"@wordpress/element": "3.0.0",
"@wordpress/escape-html": "2.0.0",
"@wordpress/format-library": "2.0.0",
"@wordpress/hooks": "3.0.0",
"@wordpress/html-entities": "3.0.0",
"@wordpress/i18n": "4.0.0",
"@wordpress/icons": "3.0.0",
"@wordpress/interface": "3.0.0",
"@wordpress/is-shallow-equal": "4.0.0",
"@wordpress/keyboard-shortcuts": "2.0.0",
"@wordpress/keycodes": "3.0.0",
"@wordpress/list-reusable-blocks": "2.0.0",
"@wordpress/media-utils": "2.0.0",
"@wordpress/notices": "3.0.0",
"@wordpress/nux": "4.0.0",
"@wordpress/plugins": "3.0.0",
"@wordpress/primitives": "2.0.0",
"@wordpress/priority-queue": "2.0.0",
"@wordpress/redux-routine": "4.0.0",
"@wordpress/reusable-blocks": "2.0.0",
"@wordpress/rich-text": "4.0.0",
"@wordpress/server-side-render": "2.0.0",
"@wordpress/shortcode": "3.0.0",
"@wordpress/token-list": "2.0.0",
"@wordpress/url": "3.0.0",
"@wordpress/viewport": "3.0.0",
"@wordpress/warning": "2.0.0",
"@wordpress/wordcount": "3.0.0",
"@wordpress/a11y": "3.1.0",
"@wordpress/annotations": "2.1.0",
"@wordpress/api-fetch": "5.1.0",
"@wordpress/autop": "3.1.0",
"@wordpress/blob": "3.1.0",
"@wordpress/block-directory": "2.1.0",
"@wordpress/block-editor": "6.1.0",
"@wordpress/block-library": "3.1.0",
"@wordpress/block-serialization-default-parser": "4.1.0",
"@wordpress/blocks": "9.1.0",
"@wordpress/components": "14.1.0",
"@wordpress/compose": "4.1.0",
"@wordpress/core-data": "3.1.0",
"@wordpress/data": "5.1.0",
"@wordpress/data-controls": "2.1.0",
"@wordpress/date": "4.1.0",
"@wordpress/deprecated": "3.1.0",
"@wordpress/dom": "3.1.0",
"@wordpress/dom-ready": "3.1.0",
"@wordpress/edit-post": "4.1.0",
"@wordpress/editor": "10.1.0",
"@wordpress/element": "3.1.0",
"@wordpress/escape-html": "2.1.0",
"@wordpress/format-library": "2.1.0",
"@wordpress/hooks": "3.1.0",
"@wordpress/html-entities": "3.1.0",
"@wordpress/i18n": "4.1.0",
"@wordpress/icons": "4.0.0",
"@wordpress/interface": "3.1.0",
"@wordpress/is-shallow-equal": "4.1.0",
"@wordpress/keyboard-shortcuts": "2.1.0",
"@wordpress/keycodes": "3.1.0",
"@wordpress/list-reusable-blocks": "2.1.0",
"@wordpress/media-utils": "2.1.0",
"@wordpress/notices": "3.1.0",
"@wordpress/nux": "4.1.0",
"@wordpress/plugins": "3.1.0",
"@wordpress/primitives": "2.1.0",
"@wordpress/priority-queue": "2.1.0",
"@wordpress/redux-routine": "4.1.0",
"@wordpress/reusable-blocks": "2.1.0",
"@wordpress/rich-text": "4.1.0",
"@wordpress/server-side-render": "2.1.0",
"@wordpress/shortcode": "3.1.0",
"@wordpress/token-list": "2.1.0",
"@wordpress/url": "3.1.0",
"@wordpress/viewport": "3.1.0",
"@wordpress/warning": "2.1.0",
"@wordpress/wordcount": "3.1.0",
"backbone": "1.4.0",
"clipboard": "2.0.8",
"core-js-url-browser": "3.6.4",

File diff suppressed because one or more lines are too long

View File

@@ -83,7 +83,6 @@ function wp_apply_colors_support( $block_type, $block_attributes ) {
$has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) );
$has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) );
$has_link_colors_support = _wp_array_get( $color_support, array( 'link' ), false );
$has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false );
$classes = array();
$styles = array();
@@ -106,24 +105,6 @@ function wp_apply_colors_support( $block_type, $block_attributes ) {
}
}
// Link colors.
if ( $has_link_colors_support ) {
$has_link_color = isset( $block_attributes['style']['color']['link'] );
// Apply required class and style.
if ( $has_link_color ) {
$classes[] = 'has-link-color';
// If link is a named color.
if ( strpos( $block_attributes['style']['color']['link'], 'var:preset|color|' ) !== false ) {
// Get the name from the string and add proper styles.
$index_to_splice = strrpos( $block_attributes['style']['color']['link'], '|' ) + 1;
$link_color_name = substr( $block_attributes['style']['color']['link'], $index_to_splice );
$styles[] = sprintf( '--wp--style--color--link: var(--wp--preset--color--%s);', $link_color_name );
} else {
$styles[] = sprintf( '--wp--style--color--link: %s;', $block_attributes['style']['color']['link'] );
}
}
}
// Background colors.
if ( $has_background_colors_support ) {
$has_named_background_color = array_key_exists( 'backgroundColor', $block_attributes );

View File

@@ -0,0 +1,68 @@
<?php
/**
* Elements styles block support.
*
* @package WordPress
* @since 5.8.0
*/
/**
* Render the elements stylesheet.
*
* @since 5.8.0
* @access private
*
* @param string $block_content Rendered block content.
* @param array $block Block object.
* @return string Filtered block content.
*/
function wp_render_elements_support( $block_content, $block ) {
$link_color = _wp_array_get( $block['attrs'], array( 'style', 'elements', 'link', 'color', 'text' ), null );
/*
* For now we only care about link color.
* This code in the future when we have a public API
* should take advantage of WP_Theme_JSON::compute_style_properties
* and work for any element and style.
*/
if ( null === $link_color ) {
return $block_content;
}
$class_name = 'wp-elements-' . uniqid();
if ( strpos( $link_color, 'var:preset|color|' ) !== false ) {
// Get the name from the string and add proper styles.
$index_to_splice = strrpos( $link_color, '|' ) + 1;
$link_color_name = substr( $link_color, $index_to_splice );
$link_color = "var(--wp--preset--color--$link_color_name)";
}
$link_color_declaration = esc_html( safecss_filter_attr( "color: $link_color" ) );
$style = "<style>.$class_name a{" . $link_color_declaration . " !important;}</style>\n";
// Like the layout hook this assumes the hook only applies to blocks with a single wrapper.
// Retrieve the opening tag of the first HTML element.
$html_element_matches = array();
preg_match( '/<[^>]+>/', $block_content, $html_element_matches, PREG_OFFSET_CAPTURE );
$first_element = $html_element_matches[0][0];
// If the first HTML element has a class attribute just add the new class
// as we do on layout and duotone.
if ( strpos( $first_element, 'class="' ) !== false ) {
$content = preg_replace(
'/' . preg_quote( 'class="', '/' ) . '/',
'class="' . $class_name . ' ',
$block_content,
1
);
} else {
// If the first HTML element has no class attribute we should inject the attribute before the attribute at the end.
$first_element_offset = $html_element_matches[0][1];
$content = substr_replace( $block_content, ' class="' . $class_name . '"', $first_element_offset + strlen( $first_element ) - 1, 0 );
}
return $content . $style;
}
add_filter( 'render_block', 'wp_render_elements_support', 10, 2 );

View File

@@ -1,66 +0,0 @@
<?php
/**
* Padding block support flag.
*
* @package WordPress
* @since 5.8.0
*/
/**
* Registers the style block attribute for block types that support it.
*
* @since 5.8.0
* @access private
*
* @param WP_Block_Type $block_type Block Type.
*/
function wp_register_padding_support( $block_type ) {
$has_padding_support = block_has_support( $block_type, array( 'spacing', 'padding' ), false );
// Setup attributes and styles within that if needed.
if ( ! $block_type->attributes ) {
$block_type->attributes = array();
}
if ( $has_padding_support && ! array_key_exists( 'style', $block_type->attributes ) ) {
$block_type->attributes['style'] = array(
'type' => 'object',
);
}
}
/**
* Add CSS classes for block padding to the incoming attributes array.
* This will be applied to the block markup in the front-end.
*
* @since 5.8.0
* @access private
*
* @param WP_Block_Type $block_type Block Type.
* @param array $block_attributes Block attributes.
*
* @return array Block padding CSS classes and inline styles.
*/
function wp_apply_padding_support( $block_type, $block_attributes ) {
$has_padding_support = block_has_support( $block_type, array( 'spacing', 'padding' ), false );
$styles = array();
if ( $has_padding_support ) {
$padding_value = _wp_array_get( $block_attributes, array( 'style', 'spacing', 'padding' ), null );
if ( null !== $padding_value ) {
foreach ( $padding_value as $key => $value ) {
$styles[] = sprintf( 'padding-%s: %s;', $key, $value );
}
}
}
return empty( $styles ) ? array() : array( 'style' => implode( ' ', $styles ) );
}
// Register the block support.
WP_Block_Supports::get_instance()->register(
'padding',
array(
'register_attribute' => 'wp_register_padding_support',
'apply' => 'wp_apply_padding_support',
)
);

View File

@@ -0,0 +1,95 @@
<?php
/**
* Spacing block support flag.
*
* @package WordPress
* @since 5.8.0
*/
/**
* Registers the style block attribute for block types that support it.
*
* @since 5.8.0
* @access private
*
* @param WP_Block_Type $block_type Block Type.
*/
function wp_register_spacing_support( $block_type ) {
$has_spacing_support = block_has_support( $block_type, array( 'spacing' ), false );
// Setup attributes and styles within that if needed.
if ( ! $block_type->attributes ) {
$block_type->attributes = array();
}
if ( $has_spacing_support && ! array_key_exists( 'style', $block_type->attributes ) ) {
$block_type->attributes['style'] = array(
'type' => 'object',
);
}
}
/**
* Add CSS classes for block spacing to the incoming attributes array.
* This will be applied to the block markup in the front-end.
*
* @since 5.8.0
* @access private
*
* @param WP_Block_Type $block_type Block Type.
* @param array $block_attributes Block attributes.
*
* @return array Block spacing CSS classes and inline styles.
*/
function wp_apply_spacing_support( $block_type, $block_attributes ) {
$has_padding_support = wp_has_spacing_feature_support( $block_type, 'padding' );
$has_margin_support = wp_has_spacing_feature_support( $block_type, 'margin' );
$styles = array();
if ( $has_padding_support ) {
$padding_value = _wp_array_get( $block_attributes, array( 'style', 'spacing', 'padding' ), null );
if ( null !== $padding_value ) {
foreach ( $padding_value as $key => $value ) {
$styles[] = sprintf( 'padding-%s: %s;', $key, $value );
}
}
}
if ( $has_margin_support ) {
$margin_value = _wp_array_get( $block_attributes, array( 'style', 'spacing', 'margin' ), null );
if ( null !== $margin_value ) {
foreach ( $margin_value as $key => $value ) {
$styles[] = sprintf( 'margin-%s: %s;', $key, $value );
}
}
}
return empty( $styles ) ? array() : array( 'style' => implode( ' ', $styles ) );
}
/**
* Checks whether the current block type supports the spacing feature requested.
*
* @since 5.8.0
* @access private
*
* @param WP_Block_Type $block_type Block type to check for support.
* @param string $feature Name of the feature to check support for.
* @param mixed $default Fallback value for feature support, defaults to false.
*
* @return boolean Whether or not the feature is supported.
*/
function wp_has_spacing_feature_support( $block_type, $feature, $default = false ) {
// Check if the specific feature has been opted into individually
// via nested flag under `spacing`.
return block_has_support( $block_type, array( 'spacing', $feature ), $default );
}
// Register the block support.
WP_Block_Supports::get_instance()->register(
'spacing',
array(
'register_attribute' => 'wp_register_spacing_support',
'apply' => 'wp_apply_spacing_support',
)
);

View File

@@ -68,8 +68,9 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
return array();
}
$classes = array();
$styles = array();
$attributes = array();
$classes = array();
$styles = array();
$has_font_family_support = _wp_array_get( $block_type->supports, array( '__experimentalFontFamily' ), false );
$has_font_style_support = _wp_array_get( $block_type->supports, array( '__experimentalFontStyle' ), false );
@@ -81,6 +82,9 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
$skip_font_size_support_serialization = _wp_array_get( $block_type->supports, array( '__experimentalSkipFontSizeSerialization' ), false );
// Covers all typography features _except_ font size.
$skip_typography_serialization = _wp_array_get( $block_type->supports, array( '__experimentalSkipTypographySerialization' ), false );
// Font Size.
if ( $has_font_size_support && ! $skip_font_size_support_serialization ) {
$has_named_font_size = array_key_exists( 'fontSize', $block_attributes );
@@ -95,7 +99,7 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
}
// Font Family.
if ( $has_font_family_support ) {
if ( $has_font_family_support && ! $skip_typography_serialization ) {
$has_font_family = isset( $block_attributes['style']['typography']['fontFamily'] );
// Apply required class and style.
if ( $has_font_family ) {
@@ -106,13 +110,13 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
$font_family_name = substr( $font_family, $index_to_splice );
$styles[] = sprintf( 'font-family: var(--wp--preset--font-family--%s);', $font_family_name );
} else {
$styles[] = sprintf( 'font-family: %s;', $block_attributes['style']['color']['fontFamily'] );
$styles[] = sprintf( 'font-family: %s;', $block_attributes['style']['typography']['fontFamily'] );
}
}
}
// Font style.
if ( $has_font_style_support ) {
if ( $has_font_style_support && ! $skip_typography_serialization ) {
// Apply font style.
$font_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'fontStyle', 'font-style' );
if ( $font_style ) {
@@ -121,7 +125,7 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
}
// Font weight.
if ( $has_font_weight_support ) {
if ( $has_font_weight_support && ! $skip_typography_serialization ) {
// Apply font weight.
$font_weight = wp_typography_get_css_variable_inline_style( $block_attributes, 'fontWeight', 'font-weight' );
if ( $font_weight ) {
@@ -130,7 +134,7 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
}
// Line Height.
if ( $has_line_height_support ) {
if ( $has_line_height_support && ! $skip_typography_serialization ) {
$has_line_height = isset( $block_attributes['style']['typography']['lineHeight'] );
// Add the style (no classes for line-height).
if ( $has_line_height ) {
@@ -139,7 +143,7 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
}
// Text Decoration.
if ( $has_text_decoration_support ) {
if ( $has_text_decoration_support && ! $skip_typography_serialization ) {
$text_decoration_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'textDecoration', 'text-decoration' );
if ( $text_decoration_style ) {
$styles[] = $text_decoration_style;
@@ -147,14 +151,13 @@ function wp_apply_typography_support( $block_type, $block_attributes ) {
}
// Text Transform.
if ( $has_text_transform_support ) {
if ( $has_text_transform_support && ! $skip_typography_serialization ) {
$text_transform_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'textTransform', 'text-transform' );
if ( $text_transform_style ) {
$styles[] = $text_transform_style;
}
}
$attributes = array();
if ( ! empty( $classes ) ) {
$attributes['class'] = implode( ' ', $classes );
}

View File

@@ -975,7 +975,7 @@ function block_has_support( $block_type, $feature, $default = false ) {
*
* @return array Returns the constructed WP_Query arguments.
*/
function construct_wp_query_args( $block, $page ) {
function build_query_vars_from_query_block( $block, $page ) {
$query = array(
'post_type' => 'post',
'order' => 'DESC',

View File

@@ -20,6 +20,13 @@
"supports": {
"anchor": true,
"reusable": false,
"html": false
"html": false,
"color": {
"gradients": true,
"link": true
},
"spacing": {
"padding": true
}
}
}

View File

@@ -14,7 +14,6 @@ require ABSPATH . WPINC . '/blocks/file.php';
require ABSPATH . WPINC . '/blocks/latest-comments.php';
require ABSPATH . WPINC . '/blocks/latest-posts.php';
require ABSPATH . WPINC . '/blocks/loginout.php';
require ABSPATH . WPINC . '/blocks/post-author.php';
require ABSPATH . WPINC . '/blocks/post-content.php';
require ABSPATH . WPINC . '/blocks/post-date.php';
require ABSPATH . WPINC . '/blocks/post-excerpt.php';

View File

@@ -1,61 +0,0 @@
<?php
/**
* Server-side rendering of the `core/post-author` block.
*
* @package WordPress
*/
/**
* Renders the `core/post-author` block on the server.
*
* @param array $attributes Block attributes.
* @param string $content Block default content.
* @param WP_Block $block Block instance.
* @return string Returns the rendered author block.
*/
function render_block_core_post_author( $attributes, $content, $block ) {
if ( ! isset( $block->context['postId'] ) ) {
return '';
}
$author_id = get_post_field( 'post_author', $block->context['postId'] );
if ( empty( $author_id ) ) {
return '';
}
$avatar = ! empty( $attributes['avatarSize'] ) ? get_avatar(
$author_id,
$attributes['avatarSize']
) : null;
$byline = ! empty( $attributes['byline'] ) ? $attributes['byline'] : false;
$classes = array_merge(
isset( $attributes['className'] ) ? array( $attributes['className'] ) : array(),
isset( $attributes['itemsJustification'] ) ? array( 'items-justified-' . $attributes['itemsJustification'] ) : array(),
isset( $attributes['textAlign'] ) ? array( 'has-text-align-' . $attributes['textAlign'] ) : array()
);
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );
return sprintf( '<div %1$s>', $wrapper_attributes ) .
( ! empty( $attributes['showAvatar'] ) ? '<div class="wp-block-post-author__avatar">' . $avatar . '</div>' : '' ) .
'<div class="wp-block-post-author__content">' .
( ! empty( $byline ) ? '<p class="wp-block-post-author__byline">' . $byline . '</p>' : '' ) .
'<p class="wp-block-post-author__name">' . get_the_author_meta( 'display_name', $author_id ) . '</p>' .
( ! empty( $attributes['showBio'] ) ? '<p class="wp-block-post-author__bio">' . get_the_author_meta( 'user_description', $author_id ) . '</p>' : '' ) .
'</div>' .
'</div>';
}
/**
* Registers the `core/post-author` block on the server.
*/
function register_block_core_post_author() {
register_block_type_from_metadata(
__DIR__ . '/post-author',
array(
'render_callback' => 'render_block_core_post_author',
)
);
}
add_action( 'init', 'register_block_core_post_author' );

View File

@@ -1,39 +0,0 @@
{
"apiVersion": 2,
"name": "core/post-author",
"title": "Post Author",
"category": "design",
"description": "Add the author of this post.",
"textdomain": "default",
"attributes": {
"textAlign": {
"type": "string"
},
"avatarSize": {
"type": "number",
"default": 48
},
"showAvatar": {
"type": "boolean",
"default": true
},
"showBio": {
"type": "boolean"
},
"byline": {
"type": "string"
}
},
"usesContext": [ "postType", "postId" ],
"supports": {
"html": false,
"fontSize": true,
"color": {
"gradients": true,
"link": true
},
"lineHeight": true
},
"editorStyle": "wp-block-post-author-editor",
"style": "wp-block-post-author"
}

View File

@@ -49,16 +49,15 @@ function render_block_core_post_content( $attributes, $content, $block ) {
}
$content = get_the_content( null, false, $post_id );
/** This filter is documented in wp-includes/post-template.php */
$content = apply_filters( 'the_content', str_replace( ']]>', ']]&gt;', $content ) );
unset( $seen_ids[ $post_id ] );
if ( empty( $content ) ) {
unset( $seen_ids[ $post_id ] );
return '';
}
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => 'entry-content' ) );
/** This filter is documented in wp-includes/post-template.php */
$content = apply_filters( 'the_content', str_replace( ']]>', ']]&gt;', $content ) );
unset( $seen_ids[ $post_id ] );
return (
'<div ' . $wrapper_attributes . '>' .

View File

@@ -30,7 +30,7 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
$wrapper_attributes = get_block_wrapper_attributes();
return '<p ' . $wrapper_attributes . '>' . $featured_image . '</p>';
return '<figure ' . $wrapper_attributes . '>' . $featured_image . '</figure>';
}
/**

View File

@@ -18,7 +18,7 @@ function render_block_core_query_loop( $attributes, $content, $block ) {
$page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
$page = empty( $_GET[ $page_key ] ) ? 1 : filter_var( $_GET[ $page_key ], FILTER_VALIDATE_INT );
$query_args = construct_wp_query_args( $block, $page );
$query_args = build_query_vars_from_query_block( $block, $page );
// Override the custom query with the global query if needed.
$use_global_query = ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] );
if ( $use_global_query ) {
@@ -41,9 +41,9 @@ function render_block_core_query_loop( $attributes, $content, $block ) {
}
$classnames = '';
if ( isset( $block->context['layout'] ) && isset( $block->context['query'] ) ) {
if ( isset( $block->context['layout']['type'] ) && 'flex' === $block->context['layout']['type'] ) {
$classnames = "is-flex-container columns-{$block->context['layout']['columns']}";
if ( isset( $block->context['displayLayout'] ) && isset( $block->context['query'] ) ) {
if ( isset( $block->context['displayLayout']['type'] ) && 'flex' === $block->context['displayLayout']['type'] ) {
$classnames = "is-flex-container columns-{$block->context['displayLayout']['columns']}";
}
}

View File

@@ -10,12 +10,13 @@
"queryId",
"query",
"queryContext",
"layout",
"displayLayout",
"templateSlug"
],
"supports": {
"reusable": false,
"html": false
"html": false,
"align": true
},
"style": "wp-block-query-loop",
"editorStyle": "wp-block-query-loop-editor"

View File

@@ -39,7 +39,7 @@ function render_block_core_query_pagination_next( $attributes, $content, $block
$content = get_next_posts_link( $label, $max_page );
remove_filter( 'next_posts_link_attributes', $filter_link_attributes );
} elseif ( ! $max_page || $max_page > $page ) {
$custom_query = new WP_Query( construct_wp_query_args( $block, $page ) );
$custom_query = new WP_Query( build_query_vars_from_query_block( $block, $page ) );
if ( (int) $custom_query->max_num_pages !== $page ) {
$content = sprintf(
'<a href="%1$s" %2$s>%3$s</a>',

View File

@@ -32,7 +32,7 @@ function render_block_core_query_pagination_numbers( $attributes, $content, $blo
);
$content = paginate_links( $paginate_args );
} else {
$block_query = new WP_Query( construct_wp_query_args( $block, $page ) );
$block_query = new WP_Query( build_query_vars_from_query_block( $block, $page ) );
// `paginate_links` works with the global $wp_query, so we have to
// temporarily switch it with our custom query.
$prev_wp_query = $wp_query;

View File

@@ -10,7 +10,11 @@
"supports": {
"align": true,
"reusable": false,
"html": false
"html": false,
"color": {
"gradients": true,
"link": true
}
},
"editorStyle": "wp-block-query-pagination-editor",
"style": "wp-block-query-pagination"

View File

@@ -31,7 +31,7 @@
"type": "string",
"default": "div"
},
"layout": {
"displayLayout": {
"type": "object",
"default": {
"type": "list"
@@ -41,11 +41,16 @@
"providesContext": {
"queryId": "queryId",
"query": "query",
"layout": "layout"
"displayLayout": "displayLayout"
},
"supports": {
"align": [ "wide", "full" ],
"html": false
"html": false,
"color": {
"gradients": true,
"link": true
},
"__experimentalLayout": true
},
"editorStyle": "wp-block-query-editor"
}

View File

@@ -3,7 +3,7 @@
"name": "core/site-tagline",
"title": "Site Tagline",
"category": "design",
"description": "In a few words, what this site is about.",
"description": "Describe in a few words what the website is about. The tagline can be used in search results or when sharing on social networks even if it's not displayed in the theme design.",
"keywords": [ "description" ],
"textdomain": "default",
"attributes": {
@@ -17,6 +17,7 @@
"gradients": true
},
"spacing": {
"margin": true,
"padding": true
},
"fontSize": true,

View File

@@ -23,11 +23,14 @@
"link": true
},
"spacing": {
"padding": true
"padding": true,
"margin": true
},
"fontSize": true,
"lineHeight": true,
"__experimentalFontFamily": true,
"__experimentalTextTransform": true
"__experimentalTextTransform": true,
"__experimentalFontStyle": true,
"__experimentalFontWeight": true
}
}

View File

@@ -302,9 +302,10 @@ require ABSPATH . WPINC . '/block-supports/border.php';
require ABSPATH . WPINC . '/block-supports/colors.php';
require ABSPATH . WPINC . '/block-supports/custom-classname.php';
require ABSPATH . WPINC . '/block-supports/duotone.php';
require ABSPATH . WPINC . '/block-supports/elements.php';
require ABSPATH . WPINC . '/block-supports/generated-classname.php';
require ABSPATH . WPINC . '/block-supports/layout.php';
require ABSPATH . WPINC . '/block-supports/padding.php';
require ABSPATH . WPINC . '/block-supports/spacing.php';
require ABSPATH . WPINC . '/block-supports/typography.php';
$GLOBALS['wp_embed'] = new WP_Embed();

View File

@@ -434,7 +434,7 @@ class WP_Block_Test extends WP_UnitTestCase {
),
);
$block = new WP_Block( $parsed_block, $context, $this->registry );
$query = construct_wp_query_args( $block, 1 );
$query = build_query_vars_from_query_block( $block, 1 );
$this->assertSame(
$query,
@@ -458,7 +458,7 @@ class WP_Block_Test extends WP_UnitTestCase {
$parsed_blocks = parse_blocks( '<!-- wp:example {"ok":true} -->a<!-- wp:example /-->b<!-- /wp:example -->' );
$parsed_block = $parsed_blocks[0];
$block_no_context = new WP_Block( $parsed_block, array(), $this->registry );
$query = construct_wp_query_args( $block_no_context, 1 );
$query = build_query_vars_from_query_block( $block_no_context, 1 );
$this->assertSame(
$query,
@@ -489,7 +489,7 @@ class WP_Block_Test extends WP_UnitTestCase {
),
);
$block = new WP_Block( $parsed_block, $context, $this->registry );
$query = construct_wp_query_args( $block, 1 );
$query = build_query_vars_from_query_block( $block, 1 );
$this->assertSame(
$query,
@@ -522,7 +522,7 @@ class WP_Block_Test extends WP_UnitTestCase {
),
);
$block = new WP_Block( $parsed_block, $context, $this->registry );
$query = construct_wp_query_args( $block, 3 );
$query = build_query_vars_from_query_block( $block, 3 );
$this->assertSame(
$query,
array(
@@ -554,7 +554,7 @@ class WP_Block_Test extends WP_UnitTestCase {
),
);
$block = new WP_Block( $parsed_block, $context, $this->registry );
$query = construct_wp_query_args( $block, 3 );
$query = build_query_vars_from_query_block( $block, 3 );
$this->assertSame(
$query,
array(

View File

@@ -113,7 +113,6 @@ module.exports = function( env = { environment: 'production', watch: false, buil
'latest-comments',
'latest-posts',
'loginout',
'post-author',
'post-content',
'post-date',
'post-excerpt',