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/layout.php

    r52410 r52434  
    4040 *                                      the existence of default block layout.
    4141 * @param bool   $has_block_gap_support Whether the theme has support for the block gap.
     42 * @param string $gap_value             The block gap value to apply.
    4243 * @return string CSS style.
    4344 */
    44 function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false ) {
     45function wp_get_layout_style( $selector, $layout, $has_block_gap_support = false, $gap_value = null ) {
    4546    $layout_type = isset( $layout['type'] ) ? $layout['type'] : 'default';
    4647
     
    7374        $style .= "$selector .alignright { float: right; margin-left: 2em; }";
    7475        if ( $has_block_gap_support ) {
    75             $style .= "$selector > * { margin-top: 0; margin-bottom: 0; }";
    76             $style .= "$selector > * + * { margin-top: var( --wp--style--block-gap ); margin-bottom: 0; }";
     76            $gap_style = $gap_value ? $gap_value : 'var( --wp--style--block-gap )';
     77            $style    .= "$selector > * { margin-top: 0; margin-bottom: 0; }";
     78            $style    .= "$selector > * + * { margin-top: $gap_style;  margin-bottom: 0; }";
    7779        }
    7880    } elseif ( 'flex' === $layout_type ) {
     
    9799        $style .= 'display: flex;';
    98100        if ( $has_block_gap_support ) {
    99             $style .= 'gap: var( --wp--style--block-gap, 0.5em );';
     101            $gap_style = $gap_value ? $gap_value : 'var( --wp--style--block-gap, 0.5em )';
     102            $style    .= "gap: $gap_style;";
    100103        } else {
    101104            $style .= 'gap: 0.5em;';
     
    157160    }
    158161
    159     $id    = uniqid();
    160     $style = wp_get_layout_style( ".wp-container-$id", $used_layout, $has_block_gap_support );
     162    $id        = uniqid();
     163    $gap_value = _wp_array_get( $block, array( 'attrs', 'style', 'spacing', 'blockGap' ) );
     164    // Skip if gap value contains unsupported characters.
     165    // Regex for CSS value borrowed from `safecss_filter_attr`, and used here
     166    // because we only want to match against the value, not the CSS attribute.
     167    $gap_value = preg_match( '%[\\\(&=}]|/\*%', $gap_value ) ? null : $gap_value;
     168    $style     = wp_get_layout_style( ".wp-container-$id", $used_layout, $has_block_gap_support, $gap_value );
    161169    // This assumes the hook only applies to blocks with a single wrapper.
    162170    // I think this is a reasonable limitation for that particular hook.
Note: See TracChangeset for help on using the changeset viewer.