Skip to content

Commit

Permalink
Block Editor: Update the WordPress packages with the fixes for 5.8 be…
Browse files Browse the repository at this point in the history
…ta 2.

This includes:

**Various**

 - Fix multi selection for nested blocks WordPress/gutenberg#32536
 - Consistently show the drop indicator while dragging blocks WordPress/gutenberg#31896
 - Fix horizontal drop indicator WordPress/gutenberg#32589
 - Fix Safari flickering issue WordPress/gutenberg#32581
 - Silence useSelect zombie bug errors WordPress/gutenberg#32088

**Template Editor**

 - Clarify the template creation modal WordPress/gutenberg#32427
 - Only add skip links for block templates WordPress/gutenberg#32451

**Widgets Editor**

 - Add block breadcrumb WordPress/gutenberg#32498 WordPress/gutenberg#32528 WordPress/gutenberg#32569
 - Saved deleted and restored widgets. WordPress/gutenberg#32534
 - Fix unsaved changes detection WordPress/gutenberg#32573
 - Fix button spacing in the header WordPress/gutenberg#32585
 - Avoid extra undo levels WordPress/gutenberg#32572
 - Move Legacy Widget block to the `@wordpress/widgets` package WordPress/gutenberg#32501
 - Fix Social Links color inheritance WordPress/gutenberg#32625
 - Use Button appender WordPress/gutenberg#32580

**Global Styles (theme.json)**
 
 - Separate the presets per origin in the block editor settings WordPress/gutenberg#32358 WordPress/gutenberg#32622
 - Use CSS Custom Properties for the preset styles WordPress/gutenberg#32627

**Performance**

 - Remove is-typing classname to improve typing performance WordPress/gutenberg#32567

Props nosolosw, jorgefilipecosta, aristath, ntsekouras, peterwilsoncc, mcsf.
See #53397.

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


git-svn-id: https://core.svn.wordpress.org/trunk@50758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
youknowriad committed Jun 15, 2021
1 parent cc7b653 commit 4942fad
Show file tree
Hide file tree
Showing 63 changed files with 2,323 additions and 2,142 deletions.
5 changes: 4 additions & 1 deletion wp-admin/widgets-form-blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
);
block_editor_rest_api_preload( $preload_paths, $block_editor_context );

$editor_settings = get_block_editor_settings( array(), $block_editor_context );
$editor_settings = get_block_editor_settings(
get_legacy_widget_block_editor_settings(),
$block_editor_context
);

wp_add_inline_script(
'wp-edit-widgets',
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/assets/script-loader-packages.php

Large diffs are not rendered by default.

49 changes: 39 additions & 10 deletions wp-includes/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,20 @@ function get_default_block_editor_settings() {
$editor_settings['gradients'] = $gradient_presets;
}

return $editor_settings;
}

/**
* Returns the block editor settings needed to use the Legacy Widget block which
* is not registered by default.
*
* @since 5.8.0
*
* @return array Settings to be used with get_block_editor_settings().
*/
function get_legacy_widget_block_editor_settings() {
$editor_settings = array();

/**
* Filters the list of widget-type IDs that should **not** be offered by the
* Legacy Widget block.
Expand Down Expand Up @@ -296,13 +310,32 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex

$editor_settings['__experimentalFeatures'] = $theme_json->get_settings();
// These settings may need to be updated based on data coming from theme.json sources.
if ( isset( $editor_settings['__experimentalFeatures']['color']['palette'] ) ) {
$editor_settings['colors'] = $editor_settings['__experimentalFeatures']['color']['palette'];
unset( $editor_settings['__experimentalFeatures']['color']['palette'] );
if ( isset( $settings['__experimentalFeatures']['color']['palette'] ) ) {
$colors_by_origin = $settings['__experimentalFeatures']['color']['palette'];
$settings['colors'] = isset( $colors_by_origin['user'] ) ?
$colors_by_origin['user'] : (
isset( $colors_by_origin['theme'] ) ?
$colors_by_origin['theme'] :
$colors_by_origin['core']
);
}
if ( isset( $editor_settings['__experimentalFeatures']['color']['gradients'] ) ) {
$editor_settings['gradients'] = $editor_settings['__experimentalFeatures']['color']['gradients'];
unset( $editor_settings['__experimentalFeatures']['color']['gradients'] );
if ( isset( $settings['__experimentalFeatures']['color']['gradients'] ) ) {
$gradients_by_origin = $settings['__experimentalFeatures']['color']['gradients'];
$settings['gradients'] = isset( $gradients_by_origin['user'] ) ?
$gradients_by_origin['user'] : (
isset( $gradients_by_origin['theme'] ) ?
$gradients_by_origin['theme'] :
$gradients_by_origin['core']
);
}
if ( isset( $settings['__experimentalFeatures']['typography']['fontSizes'] ) ) {
$font_sizes_by_origin = $settings['__experimentalFeatures']['typography']['fontSizes'];
$settings['fontSizes'] = isset( $font_sizes_by_origin['user'] ) ?
$font_sizes_by_origin['user'] : (
isset( $font_sizes_by_origin['theme'] ) ?
$font_sizes_by_origin['theme'] :
$font_sizes_by_origin['core']
);
}
if ( isset( $editor_settings['__experimentalFeatures']['color']['custom'] ) ) {
$editor_settings['disableCustomColors'] = ! $editor_settings['__experimentalFeatures']['color']['custom'];
Expand All @@ -312,10 +345,6 @@ function get_block_editor_settings( array $custom_settings, $block_editor_contex
$editor_settings['disableCustomGradients'] = ! $editor_settings['__experimentalFeatures']['color']['customGradient'];
unset( $editor_settings['__experimentalFeatures']['color']['customGradient'] );
}
if ( isset( $editor_settings['__experimentalFeatures']['typography']['fontSizes'] ) ) {
$editor_settings['fontSizes'] = $editor_settings['__experimentalFeatures']['typography']['fontSizes'];
unset( $editor_settings['__experimentalFeatures']['typography']['fontSizes'] );
}
if ( isset( $editor_settings['__experimentalFeatures']['typography']['customFontSize'] ) ) {
$editor_settings['disableCustomFontSizes'] = ! $editor_settings['__experimentalFeatures']['typography']['customFontSize'];
unset( $editor_settings['__experimentalFeatures']['typography']['customFontSize'] );
Expand Down
1 change: 0 additions & 1 deletion wp-includes/blocks/legacy-widget/editor-rtl.min.css

This file was deleted.

1 change: 0 additions & 1 deletion wp-includes/blocks/legacy-widget/editor.min.css

This file was deleted.

2 changes: 1 addition & 1 deletion wp-includes/blocks/post-content/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"category": "design",
"description": "Displays the contents of a post or page.",
"textdomain": "default",
"usesContext": [ "postId", "postType" ],
"usesContext": [ "postId", "postType", "queryId" ],
"supports": {
"align": [ "wide", "full" ],
"html": false,
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/post-date/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"default": false
}
},
"usesContext": [ "postId", "postType" ],
"usesContext": [ "postId", "postType", "queryId" ],
"supports": {
"html": false,
"color": {
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/post-excerpt/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"default": true
}
},
"usesContext": [ "postId", "postType" ],
"usesContext": [ "postId", "postType", "queryId" ],
"supports": {
"html": false,
"color": {
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/post-featured-image/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"default": false
}
},
"usesContext": [ "postId", "postType" ],
"usesContext": [ "postId", "postType", "queryId" ],
"supports": {
"align": [ "left", "right", "center", "wide", "full" ],
"html": false
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/post-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"category": "design",
"description": "Displays the title of a post, page, or any other content-type.",
"textdomain": "default",
"usesContext": [ "postId", "postType" ],
"usesContext": [ "postId", "postType", "queryId" ],
"attributes": {
"textAlign": {
"type": "string"
Expand Down
20 changes: 9 additions & 11 deletions wp-includes/blocks/social-links/style-rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,34 +112,32 @@
justify-content: flex-end;
}

.wp-social-link {
.wp-block-social-link {
display: block;
border-radius: 9999px;
transition: transform 0.1s ease;
height: auto;
}
@media (prefers-reduced-motion: reduce) {
.wp-social-link {
.wp-block-social-link {
transition-duration: 0s;
transition-delay: 0s;
}
}
.wp-social-link a {
.wp-block-social-link a {
display: block;
line-height: 0;
transition: transform 0.1s ease;
}
.wp-social-link a,
.wp-social-link a:hover,
.wp-social-link a:active,
.wp-social-link a:visited,
.wp-social-link svg {
.wp-block-social-link:hover {
transform: scale(1.1);
}

.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:hover, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:active, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:visited,
.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor svg {
color: currentColor;
fill: currentColor;
}
.wp-social-link:hover {
transform: scale(1.1);
}

.wp-block-social-links:not(.is-style-logos-only) .wp-social-link {
background-color: #f0f0f0;
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/social-links/style-rtl.min.css

Large diffs are not rendered by default.

20 changes: 9 additions & 11 deletions wp-includes/blocks/social-links/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -112,34 +112,32 @@
justify-content: flex-end;
}

.wp-social-link {
.wp-block-social-link {
display: block;
border-radius: 9999px;
transition: transform 0.1s ease;
height: auto;
}
@media (prefers-reduced-motion: reduce) {
.wp-social-link {
.wp-block-social-link {
transition-duration: 0s;
transition-delay: 0s;
}
}
.wp-social-link a {
.wp-block-social-link a {
display: block;
line-height: 0;
transition: transform 0.1s ease;
}
.wp-social-link a,
.wp-social-link a:hover,
.wp-social-link a:active,
.wp-social-link a:visited,
.wp-social-link svg {
.wp-block-social-link:hover {
transform: scale(1.1);
}

.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:hover, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:active, .wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor:visited,
.wp-block-social-links .wp-block-social-link .wp-block-social-link-anchor svg {
color: currentColor;
fill: currentColor;
}
.wp-social-link:hover {
transform: scale(1.1);
}

.wp-block-social-links:not(.is-style-logos-only) .wp-social-link {
background-color: #f0f0f0;
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/blocks/social-links/style.min.css

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion wp-includes/class-wp-customize-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,10 @@ public function enqueue_scripts() {
if ( wp_use_widgets_block_editor() ) {
$block_editor_context = new WP_Block_Editor_Context();

$editor_settings = get_block_editor_settings( array(), $block_editor_context );
$editor_settings = get_block_editor_settings(
get_legacy_widget_block_editor_settings(),
$block_editor_context
);

wp_add_inline_script(
'wp-customize-widgets',
Expand Down
4 changes: 2 additions & 2 deletions wp-includes/class-wp-theme-json-resolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ public static function get_core_data() {

$config = self::read_json_file( __DIR__ . '/theme.json' );
$config = self::translate( $config );
self::$core = new WP_Theme_JSON( $config );
self::$core = new WP_Theme_JSON( $config, 'core' );

return self::$core;
}
Expand Down Expand Up @@ -301,7 +301,7 @@ public static function get_theme_data( $theme_support_data = array() ) {
*
* @since 5.8.0
*
* @param array $settings Existing block editor settings.
* @param array $settings Existing block editor settings.
* Empty array by default.
* @return WP_Theme_JSON
*/
Expand Down
Loading

0 comments on commit 4942fad

Please sign in to comment.