Make WordPress Core


Ignore:
Timestamp:
04/05/2022 12:06:48 PM (5 years ago)
Author:
gziolo
Message:

Editor: Backport block support changes from the Gutenberg plugin

Migrate spacing, border, color, dimensions, elements and typography and associated tests for block supports in the block editor.

Related changes in Gutenberg:

Props ramonopoly, aaronrobertshaw.
See #55505.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/block-supports/typography.php

    r52302 r53076  
    8282        }
    8383
    84         $skip_typography_serialization = _wp_array_get( $typography_supports, array( '__experimentalSkipSerialization' ), false );
    85         if ( $skip_typography_serialization ) {
     84        if ( wp_should_skip_block_supports_serialization( $block_type, 'typography' ) ) {
    8685                return array();
    8786        }
    … …  
    10099        $has_text_transform_support  = _wp_array_get( $typography_supports, array( '__experimentalTextTransform' ), false );
    101100
    102         if ( $has_font_size_support ) {
     101        if ( $has_font_size_support && ! wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontSize' ) ) {
    103102                $has_named_font_size  = array_key_exists( 'fontSize', $block_attributes );
    104103                $has_custom_font_size = isset( $block_attributes['style']['typography']['fontSize'] );
    … …  
    111110        }
    112111
    113         if ( $has_font_family_support ) {
     112        if ( $has_font_family_support && ! wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontFamily' ) ) {
    114113                $has_named_font_family  = array_key_exists( 'fontFamily', $block_attributes );
    115114                $has_custom_font_family = isset( $block_attributes['style']['typography']['fontFamily'] );
    … …  
    130129        }
    131130
    132         if ( $has_font_style_support ) {
     131        if ( $has_font_style_support && ! wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontStyle' ) ) {
    133132                $font_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'fontStyle', 'font-style' );
    134133                if ( $font_style ) {
    … …  
    137136        }
    138137
    139         if ( $has_font_weight_support ) {
     138        if ( $has_font_weight_support && ! wp_should_skip_block_supports_serialization( $block_type, 'typography', 'fontWeight' ) ) {
    140139                $font_weight = wp_typography_get_css_variable_inline_style( $block_attributes, 'fontWeight', 'font-weight' );
    141140                if ( $font_weight ) {
    … …  
    144143        }
    145144
    146         if ( $has_line_height_support ) {
     145        if ( $has_line_height_support && ! wp_should_skip_block_supports_serialization( $block_type, 'typography', 'lineHeight' ) ) {
    147146                $has_line_height = isset( $block_attributes['style']['typography']['lineHeight'] );
    148147                if ( $has_line_height ) {
    … …  
    151150        }
    152151
    153         if ( $has_text_decoration_support ) {
     152        if ( $has_text_decoration_support && ! wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textDecoration' ) ) {
    154153                $text_decoration_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'textDecoration', 'text-decoration' );
    155154                if ( $text_decoration_style ) {
    … …  
    158157        }
    159158
    160         if ( $has_text_transform_support ) {
     159        if ( $has_text_transform_support && ! wp_should_skip_block_supports_serialization( $block_type, 'typography', 'textTransform' ) ) {
    161160                $text_transform_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'textTransform', 'text-transform' );
    162161                if ( $text_transform_style ) {
    … …  
    165164        }
    166165
    167         if ( $has_letter_spacing_support ) {
     166        if ( $has_letter_spacing_support && ! wp_should_skip_block_supports_serialization( $block_type, 'typography', 'letterSpacing' ) ) {
    168167                $letter_spacing_style = wp_typography_get_css_variable_inline_style( $block_attributes, 'letterSpacing', 'letter-spacing' );
    169168                if ( $letter_spacing_style ) {
Note: See TracChangeset for help on using the changeset viewer.