Block Editor: Fix color support for dynamic blocks

Changes wp_apply_colors_support to check for for color instead of
experimentalColor when determining block support for color.

Props nosolosw, rafhun, youknowriad.
See #52709.

Built from https://develop.svn.wordpress.org/branches/5.7@50489


git-svn-id: http://core.svn.wordpress.org/branches/5.7@50102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
noisysocks 2021-03-03 23:33:06 +00:00
parent cd0cb23aca
commit 8d05380afc
2 changed files with 4 additions and 4 deletions

View File

@ -15,7 +15,7 @@
function wp_register_colors_support( $block_type ) { function wp_register_colors_support( $block_type ) {
$color_support = false; $color_support = false;
if ( property_exists( $block_type, 'supports' ) ) { if ( property_exists( $block_type, 'supports' ) ) {
$color_support = _wp_array_get( $block_type->supports, array( '__experimentalColor' ), false ); $color_support = _wp_array_get( $block_type->supports, array( 'color' ), false );
} }
$has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) ); $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_background_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'background' ), true ) );
@ -63,10 +63,10 @@ function wp_register_colors_support( $block_type ) {
* @return array Colors CSS classes and inline styles. * @return array Colors CSS classes and inline styles.
*/ */
function wp_apply_colors_support( $block_type, $block_attributes ) { function wp_apply_colors_support( $block_type, $block_attributes ) {
$color_support = _wp_array_get( $block_type->supports, array( '__experimentalColor' ), false ); $color_support = _wp_array_get( $block_type->supports, array( 'color' ), false );
$has_text_colors_support = true === $color_support || ( is_array( $color_support ) && _wp_array_get( $color_support, array( 'text' ), true ) ); $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_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( 'linkColor' ), false ); $has_link_colors_support = _wp_array_get( $color_support, array( 'link' ), false );
$has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false ); $has_gradients_support = _wp_array_get( $color_support, array( 'gradients' ), false );
$classes = array(); $classes = array();
$styles = array(); $styles = array();

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.7-RC2-50482'; $wp_version = '5.7-RC2-50489';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.