Skip to content

Commit

Permalink
Block Editor: Update packages and backport the latest Gutenberg fixes.
Browse files Browse the repository at this point in the history
This includes the following fixes:

- Generate babel polyfill dynamically WordPress/gutenberg#31279
- Improve the List View component WordPress/gutenberg#31290 WordPress/gutenberg#32063
- Template mode:
    - Fix embed dimensions WordPress/gutenberg#32057
    - Update the welcome guide WordPress/gutenberg#32055 WordPress/gutenberg#32026
    - Don’t display the notice at the same time as the welcome guide WordPress/gutenberg#32076
    - Remove MetaBoxes WordPress/gutenberg#32315
    - Update the title area WordPress/gutenberg#32037 
- Widgets Screen:
    - Fix unsaved changes WordPress/gutenberg#31757
    - Fix toolbar alignment WordPress/gutenberg#31991
    - Fix block toolbar position after scroll WordPress/gutenberg#32212
    - Fix the visible widget area header WordPress/gutenberg#32262
    - Fix legacy widgets preview WordPress/gutenberg#32260
    - 
- Block Widgets in the customizer: 
    - Fix customizer title overlapping block toolbar WordPress/gutenberg#32140
    - Fix styling issues WordPress/gutenberg#32072
    - Fix escape key events WordPress/gutenberg#32175
    - Add preferences menu group label WordPress/gutenberg#32259
    - Fix creating and replacing legacy widgets WordPress/gutenberg#32005
    - Fix the welcome guide’s image WordPress/gutenberg#32264 WordPress/gutenberg#32302 
- Fix Cover to Image transform duotone error WordPress/gutenberg#32006
- Remove filter_var usage from blocks WordPress/gutenberg#32046 
- Fix image width for aligned Post Featured Image block WordPress/gutenberg#32070
- Prevent excessive Image block re-rendering WordPress/gutenberg#32102
- Remove gutenberg domain from core blocks WordPress/gutenberg#32152
- Use the block editor context class for the the different settings filters WordPress/gutenberg#32159
- Fix Latest Posts block grid view WordPress/gutenberg#32160
- Fix preset classes generation per block WordPress/gutenberg#32190
- Fix logic to enable custom colors and gradients WordPress/gutenberg#32200
- Update the Site Logo logic to use a dedicated site option WordPress/gutenberg#32229
- Limit the Latest Posts block’s featured image width WordPress/gutenberg#32245
- Remove opacity animation in the canvas. WordPress/gutenberg#32266
- Make the focus style valid CSS WordPress/gutenberg#32305
- Fix theme.json styles for the core/list block WordPress/gutenberg#32343
- Fix PHP notice when calling render_block WordPress/gutenberg#32135

Props nosolosw, noisysocks.
See #52991.

Built from https://develop.svn.wordpress.org/trunk@51051


git-svn-id: http://core.svn.wordpress.org/trunk@50660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
youknowriad authored and F-Wilke committed Jul 31, 2021
1 parent b0356ae commit e724b3d
Show file tree
Hide file tree
Showing 54 changed files with 2,320 additions and 1,818 deletions.
2 changes: 1 addition & 1 deletion wp-includes/assets/script-loader-packages.php

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion wp-includes/block-supports/elements.php
Expand Up @@ -17,7 +17,10 @@
* @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 );
$link_color = null;
if ( ! empty( $block['attrs'] ) ) {
$link_color = _wp_array_get( $block['attrs'], array( 'style', 'elements', 'link', 'color', 'text' ), null );
}

/*
* For now we only care about link color.
Expand Down
1 change: 1 addition & 0 deletions wp-includes/blocks/latest-posts/style-rtl.css
Expand Up @@ -140,6 +140,7 @@
.wp-block-latest-posts__featured-image img {
height: auto;
width: auto;
max-width: 100%;
}
.wp-block-latest-posts__featured-image.alignleft {
margin-right: 1em;
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/latest-posts/style-rtl.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions wp-includes/blocks/latest-posts/style.css
Expand Up @@ -142,6 +142,7 @@
.wp-block-latest-posts__featured-image img {
height: auto;
width: auto;
max-width: 100%;
}
.wp-block-latest-posts__featured-image.alignleft {
/*rtl:ignore*/
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/latest-posts/style.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion wp-includes/blocks/list/block.json
Expand Up @@ -41,7 +41,8 @@
"color": {
"gradients": true
},
"__unstablePasteTextInline": true
"__unstablePasteTextInline": true,
"__experimentalSelector": "ol,ul"
},
"editorStyle": "wp-block-list-editor",
"style": "wp-block-list"
Expand Down
3 changes: 3 additions & 0 deletions wp-includes/blocks/post-featured-image/style-rtl.css
Expand Up @@ -78,4 +78,7 @@
.wp-block-post-featured-image img {
max-width: 100%;
height: auto;
}
.wp-block-post-featured-image.alignwide img, .wp-block-post-featured-image.alignfull img {
width: 100%;
}
2 changes: 1 addition & 1 deletion wp-includes/blocks/post-featured-image/style-rtl.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions wp-includes/blocks/post-featured-image/style.css
Expand Up @@ -78,4 +78,7 @@
.wp-block-post-featured-image img {
max-width: 100%;
height: auto;
}
.wp-block-post-featured-image.alignwide img, .wp-block-post-featured-image.alignfull img {
width: 100%;
}
2 changes: 1 addition & 1 deletion wp-includes/blocks/post-featured-image/style.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion wp-includes/blocks/query-loop.php
Expand Up @@ -16,7 +16,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 );
$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];

$query_args = build_query_vars_from_query_block( $block, $page );
// Override the custom query with the global query if needed.
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/blocks/query-pagination-next.php
Expand Up @@ -16,11 +16,11 @@
*/
function render_block_core_query_pagination_next( $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 );
$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
$max_page = isset( $block->context['query']['pages'] ) ? (int) $block->context['query']['pages'] : 0;

$wrapper_attributes = get_block_wrapper_attributes();
$default_label = __( 'Next Page »', 'gutenberg' );
$default_label = __( 'Next Page »' );
$label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
$content = '';

Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/query-pagination-numbers.php
Expand Up @@ -16,7 +16,7 @@
*/
function render_block_core_query_pagination_numbers( $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 );
$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
$max_page = isset( $block->context['query']['pages'] ) ? (int) $block->context['query']['pages'] : 0;

$wrapper_attributes = get_block_wrapper_attributes();
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/blocks/query-pagination-previous.php
Expand Up @@ -16,10 +16,10 @@
*/
function render_block_core_query_pagination_previous( $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 );
$page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];

$wrapper_attributes = get_block_wrapper_attributes();
$default_label = __( '« Previous Page', 'gutenberg' );
$default_label = __( '« Previous Page' );
$label = isset( $attributes['label'] ) && ! empty( $attributes['label'] ) ? $attributes['label'] : $default_label;
$content = '';
// Check if the pagination is for Query that inherits the global context
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/social-link.php
Expand Up @@ -21,7 +21,7 @@ function render_block_core_social_link( $attributes, $content, $block ) {
$url = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false;
$label = ( isset( $attributes['label'] ) ) ? $attributes['label'] : sprintf(
/* translators: %1$s: Social-network name. %2$s: URL. */
__( '%1$s: %2$s', 'gutenberg' ),
__( '%1$s: %2$s' ),
block_core_social_link_get_name( $service ),
$url
);
Expand Down
24 changes: 23 additions & 1 deletion wp-includes/class-wp-theme-json.php
Expand Up @@ -609,6 +609,28 @@ function ( $carry, $element ) {
return $selector . '{' . $declaration_block . '}';
}

/**
* Function that appends a sub-selector to a existing one.
*
* Given the compounded $selector "h1, h2, h3"
* and the $to_append selector ".some-class" the result will be
* "h1.some-class, h2.some-class, h3.some-class".
*
* @param string $selector Original selector.
* @param string $to_append Selector to append.
*
* @return string
*/
private static function append_to_selector( $selector, $to_append ) {
$new_selectors = array();
$selectors = explode( ',', $selector );
foreach ( $selectors as $sel ) {
$new_selectors[] = $sel . $to_append;
}

return implode( ',', $new_selectors );
}

/**
* Given a settings array, it returns the generated rulesets
* for the preset classes.
Expand All @@ -633,7 +655,7 @@ private static function compute_preset_classes( $settings, $selector ) {
foreach ( $values as $value ) {
foreach ( $preset['classes'] as $class ) {
$stylesheet .= self::to_ruleset(
$selector . '.has-' . $value['slug'] . '-' . $class['class_suffix'],
self::append_to_selector( $selector, '.has-' . $value['slug'] . '-' . $class['class_suffix'] ),
array(
array(
'name' => $class['property_name'],
Expand Down
44 changes: 40 additions & 4 deletions wp-includes/css/dist/block-editor/style-rtl.css
Expand Up @@ -1356,9 +1356,44 @@
display: flex;
}

.block-editor-block-navigator-indentation {
flex-shrink: 0;
width: 28px;
.block-editor-block-navigation-leaf[aria-level] .block-editor-block-icon {
margin-right: 224px;
}

.block-editor-block-navigation-leaf[aria-level="1"] .block-editor-block-icon {
margin-right: 0px;
}

.block-editor-block-navigation-leaf[aria-level="2"] .block-editor-block-icon {
margin-right: 28px;
}

.block-editor-block-navigation-leaf[aria-level="3"] .block-editor-block-icon {
margin-right: 56px;
}

.block-editor-block-navigation-leaf[aria-level="4"] .block-editor-block-icon {
margin-right: 84px;
}

.block-editor-block-navigation-leaf[aria-level="5"] .block-editor-block-icon {
margin-right: 112px;
}

.block-editor-block-navigation-leaf[aria-level="6"] .block-editor-block-icon {
margin-right: 140px;
}

.block-editor-block-navigation-leaf[aria-level="7"] .block-editor-block-icon {
margin-right: 168px;
}

.block-editor-block-navigation-leaf[aria-level="8"] .block-editor-block-icon {
margin-right: 196px;
}

.block-editor-block-navigation-leaf[aria-level="9"] .block-editor-block-icon {
margin-right: 224px;
}

.block-editor-block-parent-selector {
Expand Down Expand Up @@ -1889,7 +1924,7 @@
}
.block-editor-block-variation-transforms .components-dropdown-menu__toggle:focus:not(:disabled) {
border-color: var(--wp-admin-theme-color);
box-shadow: 0 0 0 var(--wp-admin-border-width-focus)-1px var(--wp-admin-theme-color);
box-shadow: 0 0 0 calc(var(--wp-admin-border-width-focus) - 1px) var(--wp-admin-theme-color);
}
.block-editor-block-variation-transforms .components-dropdown-menu__toggle svg {
height: 100%;
Expand Down Expand Up @@ -2039,6 +2074,7 @@
.block-editor-duotone-control__popover .components-menu-group__label {
padding: 12px 12px 0 12px;
width: 100%;
box-sizing: border-box;
}

.block-editor-duotone-control__popover > .components-popover__content {
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/css/dist/block-editor/style-rtl.min.css

Large diffs are not rendered by default.

44 changes: 40 additions & 4 deletions wp-includes/css/dist/block-editor/style.css
Expand Up @@ -1356,9 +1356,44 @@
display: flex;
}

.block-editor-block-navigator-indentation {
flex-shrink: 0;
width: 28px;
.block-editor-block-navigation-leaf[aria-level] .block-editor-block-icon {
margin-left: 224px;
}

.block-editor-block-navigation-leaf[aria-level="1"] .block-editor-block-icon {
margin-left: 0px;
}

.block-editor-block-navigation-leaf[aria-level="2"] .block-editor-block-icon {
margin-left: 28px;
}

.block-editor-block-navigation-leaf[aria-level="3"] .block-editor-block-icon {
margin-left: 56px;
}

.block-editor-block-navigation-leaf[aria-level="4"] .block-editor-block-icon {
margin-left: 84px;
}

.block-editor-block-navigation-leaf[aria-level="5"] .block-editor-block-icon {
margin-left: 112px;
}

.block-editor-block-navigation-leaf[aria-level="6"] .block-editor-block-icon {
margin-left: 140px;
}

.block-editor-block-navigation-leaf[aria-level="7"] .block-editor-block-icon {
margin-left: 168px;
}

.block-editor-block-navigation-leaf[aria-level="8"] .block-editor-block-icon {
margin-left: 196px;
}

.block-editor-block-navigation-leaf[aria-level="9"] .block-editor-block-icon {
margin-left: 224px;
}

.block-editor-block-parent-selector {
Expand Down Expand Up @@ -1889,7 +1924,7 @@
}
.block-editor-block-variation-transforms .components-dropdown-menu__toggle:focus:not(:disabled) {
border-color: var(--wp-admin-theme-color);
box-shadow: 0 0 0 var(--wp-admin-border-width-focus)-1px var(--wp-admin-theme-color);
box-shadow: 0 0 0 calc(var(--wp-admin-border-width-focus) - 1px) var(--wp-admin-theme-color);
}
.block-editor-block-variation-transforms .components-dropdown-menu__toggle svg {
height: 100%;
Expand Down Expand Up @@ -2039,6 +2074,7 @@
.block-editor-duotone-control__popover .components-menu-group__label {
padding: 12px 12px 0 12px;
width: 100%;
box-sizing: border-box;
}

.block-editor-duotone-control__popover > .components-popover__content {
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/css/dist/block-editor/style.min.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions wp-includes/css/dist/block-library/style-rtl.css
Expand Up @@ -1207,6 +1207,7 @@ ol.wp-block-latest-comments {
.wp-block-latest-posts__featured-image img {
height: auto;
width: auto;
max-width: 100%;
}
.wp-block-latest-posts__featured-image.alignleft {
margin-right: 1em;
Expand Down Expand Up @@ -2773,6 +2774,9 @@ pre.wp-block-verse {
max-width: 100%;
height: auto;
}
.wp-block-post-featured-image.alignwide img, .wp-block-post-featured-image.alignfull img {
width: 100%;
}

:root {
/* stylelint-disable function-comma-space-after */
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/css/dist/block-library/style-rtl.min.css

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions wp-includes/css/dist/block-library/style.css
Expand Up @@ -1230,6 +1230,7 @@ ol.wp-block-latest-comments {
.wp-block-latest-posts__featured-image img {
height: auto;
width: auto;
max-width: 100%;
}
.wp-block-latest-posts__featured-image.alignleft {
/*rtl:ignore*/
Expand Down Expand Up @@ -2813,6 +2814,9 @@ pre.wp-block-verse {
max-width: 100%;
height: auto;
}
.wp-block-post-featured-image.alignwide img, .wp-block-post-featured-image.alignfull img {
width: 100%;
}

:root {
/* stylelint-disable function-comma-space-after */
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/css/dist/block-library/style.min.css

Large diffs are not rendered by default.

0 comments on commit e724b3d

Please sign in to comment.