Make WordPress Core


Ignore:
Timestamp:
01/04/2022 05:37:25 AM (3 years ago)
Author:
noisysocks
Message:

Update @wordpress packages

Update packages to include these bug fixes from Gutenberg:

  • Site Logo: Add option to set site icon from Site Logo block
  • Navigation: Enable even more compact setup state.
  • Remove template parts from post content inserter an unstable filter
  • Template Editor Mode: Hide editor mode switcher
  • Avoid using CSS variables for block gap styles
  • Try to fix auto resizing in template part focus mode
  • Lower the specificity of font size CSS Custom Properties in the editor
  • Site icon: Fix site icon styling to display non-square site icons within a square button
  • [Site Editor]: Register block editor shortcuts
  • Update regex to handle 404 template slug
  • Site Editor: Remove dead code
  • [Block Editor]: Restrict delete multi selected blocks shortcut
  • Fix: Gradients are not being applied by class
  • Update: Make the global styles subtitles font smaller
  • Post Content/Title: Reflect changes when previewing post
  • ServerSideRender: Fix loading state
  • [Block Library]: Fix editable post blocks in Query Loop with zero queryId
  • Post Excerpt: Fix previews
  • WP59: Contextualize "Export" string to differentiate it from other occurrences in WP Core
  • Tools Panel: Fix race conditions caused by conditionally displayed ToolsPanelItems
  • ToolsPanel: Allow items to register when panelId is null
  • Font Size Picker: Allow non-integers as simple CSS values and in hints
  • [Components - FontSizePicker]: Use incremental sequence of numbers as labels for the available font-sizes at the segmented control (conditionally)

See #54487.

File:
1 edited

Legend:

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

    r52302 r52434  
    9696}
    9797
    98 /**
    99  * Renders the spacing gap support to the block wrapper, to ensure
    100  * that the CSS variable is rendered in all environments.
    101  *
    102  * @since 5.9.0
    103  * @access private
    104  *
    105  * @param string $block_content Rendered block content.
    106  * @param array  $block         Block object.
    107  * @return string Filtered block content.
    108  */
    109 function wp_render_spacing_gap_support( $block_content, $block ) {
    110     $block_type      = WP_Block_Type_Registry::get_instance()->get_registered( $block['blockName'] );
    111     $has_gap_support = block_has_support( $block_type, array( 'spacing', 'blockGap' ), false );
    112     if ( ! $has_gap_support || ! isset( $block['attrs']['style']['spacing']['blockGap'] ) ) {
    113         return $block_content;
    114     }
    115 
    116     $gap_value = $block['attrs']['style']['spacing']['blockGap'];
    117 
    118     // Skip if gap value contains unsupported characters.
    119     // Regex for CSS value borrowed from `safecss_filter_attr`, and used here
    120     // because we only want to match against the value, not the CSS attribute.
    121     if ( preg_match( '%[\\\(&=}]|/\*%', $gap_value ) ) {
    122         return $block_content;
    123     }
    124 
    125     $style = sprintf(
    126         '--wp--style--block-gap: %s',
    127         esc_attr( $gap_value )
    128     );
    129 
    130     // Attempt to update an existing style attribute on the wrapper element.
    131     $injected_style = preg_replace(
    132         '/^([^>.]+?)(' . preg_quote( 'style="', '/' ) . ')(?=.+?>)/',
    133         '$1$2' . $style . '; ',
    134         $block_content,
    135         1
    136     );
    137 
    138     // If there is no existing style attribute, add one to the wrapper element.
    139     if ( $injected_style === $block_content ) {
    140         $injected_style = preg_replace(
    141             '/<([a-zA-Z0-9]+)([ >])/',
    142             '<$1 style="' . $style . '"$2',
    143             $block_content,
    144             1
    145         );
    146     };
    147 
    148     return $injected_style;
    149 }
    150 
    15198// Register the block support.
    15299WP_Block_Supports::get_instance()->register(
     
    157104    )
    158105);
    159 
    160 add_filter( 'render_block', 'wp_render_spacing_gap_support', 10, 2 );
Note: See TracChangeset for help on using the changeset viewer.