Make WordPress Core


Ignore:
Timestamp:
05/20/2022 02:31:00 PM (3 years ago)
Author:
gziolo
Message:

Editor: Update WordPress packages for 6.0 RC 4

Included cherry-picked commits from the Gutenberg plugin that fix bugs discovered after WordPress 6.0 RC 3.

Props zieladam.
See #55567.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/gallery.php

    r53157 r53420  
    4949    // Regex for CSS value borrowed from `safecss_filter_attr`, and used here
    5050    // because we only want to match against the value, not the CSS attribute.
    51     $gap     = preg_match( '%[\\\(&=}]|/\*%', $gap ) ? null : $gap;
     51    if ( is_array( $gap ) ) {
     52        foreach ( $gap as $key => $value ) {
     53            $gap[ $key ] = $value && preg_match( '%[\\\(&=}]|/\*%', $value ) ? null : $value;
     54        }
     55    } else {
     56        $gap = $gap && preg_match( '%[\\\(&=}]|/\*%', $gap ) ? null : $gap;
     57    }
     58
    5259    $class   = wp_unique_id( 'wp-block-gallery-' );
    5360    $content = preg_replace(
     
    5764        1
    5865    );
     66
    5967    // --gallery-block--gutter-size is deprecated. --wp--style--gallery-gap-default should be used by themes that want to set a default
    6068    // gap on the gallery.
    61     $gap_value = $gap ? $gap : 'var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )';
    62     $style     = '.' . $class . '{ --wp--style--unstable-gallery-gap: ' . $gap_value . '; gap: ' . $gap_value . '}';
     69    $fallback_gap = 'var( --wp--style--gallery-gap-default, var( --gallery-block--gutter-size, var( --wp--style--block-gap, 0.5em ) ) )';
     70    $gap_value    = $gap ? $gap : $fallback_gap;
     71    $gap_column   = $gap_value;
     72
     73    if ( is_array( $gap_value ) ) {
     74        $gap_row    = isset( $gap_value['top'] ) ? $gap_value['top'] : $fallback_gap;
     75        $gap_column = isset( $gap_value['left'] ) ? $gap_value['left'] : $fallback_gap;
     76        $gap_value  = $gap_row === $gap_column ? $gap_row : $gap_row . ' ' . $gap_column;
     77    }
     78
     79    // Set the CSS variable to the column value, and the `gap` property to the combined gap value.
     80    $style = '.' . $class . '{ --wp--style--unstable-gallery-gap: ' . $gap_column . '; gap: ' . $gap_value . '}';
     81
    6382    // Ideally styles should be loaded in the head, but blocks may be parsed
    6483    // after that, so loading in the footer for now.
Note: See TracChangeset for help on using the changeset viewer.