Skip to content

Commit 83c5f4d

Browse files
committed
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
1 parent e7dbf1d commit 83c5f4d

File tree

26 files changed

+1018
-923
lines changed

26 files changed

+1018
-923
lines changed

package-lock.json

Lines changed: 741 additions & 646 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 51 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
"devDependencies": {
2727
"@wordpress/custom-templated-path-webpack-plugin": "2.0.4",
2828
"@wordpress/dependency-extraction-webpack-plugin": "3.1.3",
29-
"@wordpress/e2e-test-utils": "5.1.4",
29+
"@wordpress/e2e-test-utils": "5.2.0",
3030
"@wordpress/library-export-default-webpack-plugin": "2.0.4",
31-
"@wordpress/scripts": "16.0.0",
31+
"@wordpress/scripts": "16.1.0",
3232
"autoprefixer": "^9.8.6",
3333
"chalk": "4.1.0",
3434
"check-node-version": "4.1.0",
@@ -77,55 +77,55 @@
7777
},
7878
"dependencies": {
7979
"@babel/polyfill": "7.10.1",
80-
"@wordpress/a11y": "3.0.0",
81-
"@wordpress/annotations": "2.0.0",
82-
"@wordpress/api-fetch": "5.0.0",
83-
"@wordpress/autop": "3.0.0",
84-
"@wordpress/blob": "3.0.0",
85-
"@wordpress/block-directory": "2.0.0",
86-
"@wordpress/block-editor": "6.0.0",
87-
"@wordpress/block-library": "3.0.0",
88-
"@wordpress/block-serialization-default-parser": "4.0.0",
89-
"@wordpress/blocks": "9.0.0",
90-
"@wordpress/components": "14.0.0",
91-
"@wordpress/compose": "4.0.0",
92-
"@wordpress/core-data": "3.0.0",
93-
"@wordpress/data": "5.0.0",
94-
"@wordpress/data-controls": "2.0.0",
95-
"@wordpress/date": "4.0.0",
96-
"@wordpress/deprecated": "3.0.0",
97-
"@wordpress/dom": "3.0.0",
98-
"@wordpress/dom-ready": "3.0.0",
99-
"@wordpress/edit-post": "4.0.0",
100-
"@wordpress/editor": "10.0.0",
101-
"@wordpress/element": "3.0.0",
102-
"@wordpress/escape-html": "2.0.0",
103-
"@wordpress/format-library": "2.0.0",
104-
"@wordpress/hooks": "3.0.0",
105-
"@wordpress/html-entities": "3.0.0",
106-
"@wordpress/i18n": "4.0.0",
107-
"@wordpress/icons": "3.0.0",
108-
"@wordpress/interface": "3.0.0",
109-
"@wordpress/is-shallow-equal": "4.0.0",
110-
"@wordpress/keyboard-shortcuts": "2.0.0",
111-
"@wordpress/keycodes": "3.0.0",
112-
"@wordpress/list-reusable-blocks": "2.0.0",
113-
"@wordpress/media-utils": "2.0.0",
114-
"@wordpress/notices": "3.0.0",
115-
"@wordpress/nux": "4.0.0",
116-
"@wordpress/plugins": "3.0.0",
117-
"@wordpress/primitives": "2.0.0",
118-
"@wordpress/priority-queue": "2.0.0",
119-
"@wordpress/redux-routine": "4.0.0",
120-
"@wordpress/reusable-blocks": "2.0.0",
121-
"@wordpress/rich-text": "4.0.0",
122-
"@wordpress/server-side-render": "2.0.0",
123-
"@wordpress/shortcode": "3.0.0",
124-
"@wordpress/token-list": "2.0.0",
125-
"@wordpress/url": "3.0.0",
126-
"@wordpress/viewport": "3.0.0",
127-
"@wordpress/warning": "2.0.0",
128-
"@wordpress/wordcount": "3.0.0",
80+
"@wordpress/a11y": "3.1.0",
81+
"@wordpress/annotations": "2.1.0",
82+
"@wordpress/api-fetch": "5.1.0",
83+
"@wordpress/autop": "3.1.0",
84+
"@wordpress/blob": "3.1.0",
85+
"@wordpress/block-directory": "2.1.0",
86+
"@wordpress/block-editor": "6.1.0",
87+
"@wordpress/block-library": "3.1.0",
88+
"@wordpress/block-serialization-default-parser": "4.1.0",
89+
"@wordpress/blocks": "9.1.0",
90+
"@wordpress/components": "14.1.0",
91+
"@wordpress/compose": "4.1.0",
92+
"@wordpress/core-data": "3.1.0",
93+
"@wordpress/data": "5.1.0",
94+
"@wordpress/data-controls": "2.1.0",
95+
"@wordpress/date": "4.1.0",
96+
"@wordpress/deprecated": "3.1.0",
97+
"@wordpress/dom": "3.1.0",
98+
"@wordpress/dom-ready": "3.1.0",
99+
"@wordpress/edit-post": "4.1.0",
100+
"@wordpress/editor": "10.1.0",
101+
"@wordpress/element": "3.1.0",
102+
"@wordpress/escape-html": "2.1.0",
103+
"@wordpress/format-library": "2.1.0",
104+
"@wordpress/hooks": "3.1.0",
105+
"@wordpress/html-entities": "3.1.0",
106+
"@wordpress/i18n": "4.1.0",
107+
"@wordpress/icons": "4.0.0",
108+
"@wordpress/interface": "3.1.0",
109+
"@wordpress/is-shallow-equal": "4.1.0",
110+
"@wordpress/keyboard-shortcuts": "2.1.0",
111+
"@wordpress/keycodes": "3.1.0",
112+
"@wordpress/list-reusable-blocks": "2.1.0",
113+
"@wordpress/media-utils": "2.1.0",
114+
"@wordpress/notices": "3.1.0",
115+
"@wordpress/nux": "4.1.0",
116+
"@wordpress/plugins": "3.1.0",
117+
"@wordpress/primitives": "2.1.0",
118+
"@wordpress/priority-queue": "2.1.0",
119+
"@wordpress/redux-routine": "4.1.0",
120+
"@wordpress/reusable-blocks": "2.1.0",
121+
"@wordpress/rich-text": "4.1.0",
122+
"@wordpress/server-side-render": "2.1.0",
123+
"@wordpress/shortcode": "3.1.0",
124+
"@wordpress/token-list": "2.1.0",
125+
"@wordpress/url": "3.1.0",
126+
"@wordpress/viewport": "3.1.0",
127+
"@wordpress/warning": "2.1.0",
128+
"@wordpress/wordcount": "3.1.0",
129129
"backbone": "1.4.0",
130130
"clipboard": "2.0.8",
131131
"core-js-url-browser": "3.6.4",

src/wp-includes/assets/script-loader-packages.php

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

src/wp-includes/block-supports/colors.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ function wp_apply_colors_support( $block_type, $block_attributes ) {
8383

8484
$has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) );
8585
$has_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) );
86-
$has_link_colors_support = _wp_array_get( $color_support, array( 'link' ), false );
8786
$has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false );
8887
$classes = array();
8988
$styles = array();
@@ -106,24 +105,6 @@ function wp_apply_colors_support( $block_type, $block_attributes ) {
106105
}
107106
}
108107

109-
// Link colors.
110-
if ( $has_link_colors_support ) {
111-
$has_link_color = isset( $block_attributes['style']['color']['link'] );
112-
// Apply required class and style.
113-
if ( $has_link_color ) {
114-
$classes[] = 'has-link-color';
115-
// If link is a named color.
116-
if ( strpos( $block_attributes['style']['color']['link'], 'var:preset|color|' ) !== false ) {
117-
// Get the name from the string and add proper styles.
118-
$index_to_splice = strrpos( $block_attributes['style']['color']['link'], '|' ) + 1;
119-
$link_color_name = substr( $block_attributes['style']['color']['link'], $index_to_splice );
120-
$styles[] = sprintf( '--wp--style--color--link: var(--wp--preset--color--%s);', $link_color_name );
121-
} else {
122-
$styles[] = sprintf( '--wp--style--color--link: %s;', $block_attributes['style']['color']['link'] );
123-
}
124-
}
125-
}
126-
127108
// Background colors.
128109
if ( $has_background_colors_support ) {
129110
$has_named_background_color = array_key_exists( 'backgroundColor', $block_attributes );
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
<?php
2+
/**
3+
* Elements styles block support.
4+
*
5+
* @package WordPress
6+
* @since 5.8.0
7+
*/
8+
9+
/**
10+
* Render the elements stylesheet.
11+
*
12+
* @since 5.8.0
13+
* @access private
14+
*
15+
* @param string $block_content Rendered block content.
16+
* @param array $block Block object.
17+
* @return string Filtered block content.
18+
*/
19+
function wp_render_elements_support( $block_content, $block ) {
20+
$link_color = _wp_array_get( $block['attrs'], array( 'style', 'elements', 'link', 'color', 'text' ), null );
21+
22+
/*
23+
* For now we only care about link color.
24+
* This code in the future when we have a public API
25+
* should take advantage of WP_Theme_JSON::compute_style_properties
26+
* and work for any element and style.
27+
*/
28+
if ( null === $link_color ) {
29+
return $block_content;
30+
}
31+
32+
$class_name = 'wp-elements-' . uniqid();
33+
34+
if ( strpos( $link_color, 'var:preset|color|' ) !== false ) {
35+
// Get the name from the string and add proper styles.
36+
$index_to_splice = strrpos( $link_color, '|' ) + 1;
37+
$link_color_name = substr( $link_color, $index_to_splice );
38+
$link_color = "var(--wp--preset--color--$link_color_name)";
39+
}
40+
$link_color_declaration = esc_html( safecss_filter_attr( "color: $link_color" ) );
41+
42+
$style = "<style>.$class_name a{" . $link_color_declaration . " !important;}</style>\n";
43+
44+
// Like the layout hook this assumes the hook only applies to blocks with a single wrapper.
45+
// Retrieve the opening tag of the first HTML element.
46+
$html_element_matches = array();
47+
preg_match( '/<[^>]+>/', $block_content, $html_element_matches, PREG_OFFSET_CAPTURE );
48+
$first_element = $html_element_matches[0][0];
49+
// If the first HTML element has a class attribute just add the new class
50+
// as we do on layout and duotone.
51+
if ( strpos( $first_element, 'class="' ) !== false ) {
52+
$content = preg_replace(
53+
'/' . preg_quote( 'class="', '/' ) . '/',
54+
'class="' . $class_name . ' ',
55+
$block_content,
56+
1
57+
);
58+
} else {
59+
// If the first HTML element has no class attribute we should inject the attribute before the attribute at the end.
60+
$first_element_offset = $html_element_matches[0][1];
61+
$content = substr_replace( $block_content, ' class="' . $class_name . '"', $first_element_offset + strlen( $first_element ) - 1, 0 );
62+
}
63+
64+
return $content . $style;
65+
66+
}
67+
68+
add_filter( 'render_block', 'wp_render_elements_support', 10, 2 );

src/wp-includes/block-supports/padding.php

Lines changed: 0 additions & 66 deletions
This file was deleted.
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
<?php
2+
/**
3+
* Spacing block support flag.
4+
*
5+
* @package WordPress
6+
* @since 5.8.0
7+
*/
8+
9+
/**
10+
* Registers the style block attribute for block types that support it.
11+
*
12+
* @since 5.8.0
13+
* @access private
14+
*
15+
* @param WP_Block_Type $block_type Block Type.
16+
*/
17+
function wp_register_spacing_support( $block_type ) {
18+
$has_spacing_support = block_has_support( $block_type, array( 'spacing' ), false );
19+
20+
// Setup attributes and styles within that if needed.
21+
if ( ! $block_type->attributes ) {
22+
$block_type->attributes = array();
23+
}
24+
25+
if ( $has_spacing_support && ! array_key_exists( 'style', $block_type->attributes ) ) {
26+
$block_type->attributes['style'] = array(
27+
'type' => 'object',
28+
);
29+
}
30+
}
31+
32+
/**
33+
* Add CSS classes for block spacing to the incoming attributes array.
34+
* This will be applied to the block markup in the front-end.
35+
*
36+
* @since 5.8.0
37+
* @access private
38+
*
39+
* @param WP_Block_Type $block_type Block Type.
40+
* @param array $block_attributes Block attributes.
41+
*
42+
* @return array Block spacing CSS classes and inline styles.
43+
*/
44+
function wp_apply_spacing_support( $block_type, $block_attributes ) {
45+
$has_padding_support = wp_has_spacing_feature_support( $block_type, 'padding' );
46+
$has_margin_support = wp_has_spacing_feature_support( $block_type, 'margin' );
47+
$styles = array();
48+
49+
if ( $has_padding_support ) {
50+
$padding_value = _wp_array_get( $block_attributes, array( 'style', 'spacing', 'padding' ), null );
51+
if ( null !== $padding_value ) {
52+
foreach ( $padding_value as $key => $value ) {
53+
$styles[] = sprintf( 'padding-%s: %s;', $key, $value );
54+
}
55+
}
56+
}
57+
58+
if ( $has_margin_support ) {
59+
$margin_value = _wp_array_get( $block_attributes, array( 'style', 'spacing', 'margin' ), null );
60+
if ( null !== $margin_value ) {
61+
foreach ( $margin_value as $key => $value ) {
62+
$styles[] = sprintf( 'margin-%s: %s;', $key, $value );
63+
}
64+
}
65+
}
66+
67+
return empty( $styles ) ? array() : array( 'style' => implode( ' ', $styles ) );
68+
}
69+
70+
/**
71+
* Checks whether the current block type supports the spacing feature requested.
72+
*
73+
* @since 5.8.0
74+
* @access private
75+
*
76+
* @param WP_Block_Type $block_type Block type to check for support.
77+
* @param string $feature Name of the feature to check support for.
78+
* @param mixed $default Fallback value for feature support, defaults to false.
79+
*
80+
* @return boolean Whether or not the feature is supported.
81+
*/
82+
function wp_has_spacing_feature_support( $block_type, $feature, $default = false ) {
83+
// Check if the specific feature has been opted into individually
84+
// via nested flag under `spacing`.
85+
return block_has_support( $block_type, array( 'spacing', $feature ), $default );
86+
}
87+
88+
// Register the block support.
89+
WP_Block_Supports::get_instance()->register(
90+
'spacing',
91+
array(
92+
'register_attribute' => 'wp_register_spacing_support',
93+
'apply' => 'wp_apply_spacing_support',
94+
)
95+
);

0 commit comments

Comments
 (0)