Make WordPress Core


Ignore:
Timestamp:
04/15/2021 02:41:38 PM (5 years ago)
Author:
gziolo
Message:

Editor: Update WordPress packages to use with WordPress 5.8

In the response to the discussion during the Dev Chat, I'm doing a first pass to keep WordPress packages up to date in the WordPress 5.8 release cycle.

See https://github.com/WordPress/wordpress-develop/pull/1176 for more details.

Props youknowriad, aristath, andraganescu.
See #52991.

Location:
trunk/src/wp-includes/blocks
Files:
1 deleted
11 edited

Legend:

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

    r50137 r50761  
    3030                sprintf(
    3131                    // translators: %s is the user-provided title of the reusable block.
    32                     __( 'Could not render Reusable Block <strong>%s</strong>: blocks cannot be rendered inside themselves.' ),
     32                    __( 'Could not render Reusable Block <strong>%s</strong>. Block cannot be rendered inside itself.' ),
    3333                    $reusable_block->post_title
    3434                ),
  • trunk/src/wp-includes/blocks/button/block.json

    r50048 r50761  
    6262        "align": true,
    6363        "alignWide": false,
     64        "color": {
     65            "__experimentalSkipSerialization": true,
     66            "gradients": true
     67        },
    6468        "reusable": false,
    65         "__experimentalSelector": ".wp-block-button > a"
     69        "__experimentalSelector": ".wp-block-button__link"
    6670    },
    6771    "editorStyle": "wp-block-button-editor",
  • trunk/src/wp-includes/blocks/group/block.json

    r50048 r50761  
    1313    },
    1414    "supports": {
    15         "align": [
    16             "wide",
    17             "full"
    18         ],
     15        "align": [ "wide", "full" ],
    1916        "anchor": true,
    2017        "html": false,
     
    2724        },
    2825        "__experimentalBorder": {
    29             "radius": true
    30         }
     26            "color": true,
     27            "radius": true,
     28            "style": true,
     29            "width": true
     30        },
     31        "__experimentalLayout": true
    3132    },
    3233    "editorStyle": "wp-block-group-editor",
  • trunk/src/wp-includes/blocks/index.php

    r50048 r50761  
    5353        'social-links',
    5454        'spacer',
    55         'subhead',
    5655        'table',
    5756        'text-columns',
  • trunk/src/wp-includes/blocks/latest-posts.php

    r50760 r50761  
    1212 * @var int
    1313 */
     14global $block_core_latest_posts_excerpt_length;
    1415$block_core_latest_posts_excerpt_length = 0;
    1516
  • trunk/src/wp-includes/blocks/preformatted/block.json

    r50048 r50761  
    1414    "supports": {
    1515        "anchor": true,
     16        "color": {
     17            "gradients": true
     18        },
    1619        "fontSize": true
    1720    },
  • trunk/src/wp-includes/blocks/search.php

    r49226 r50761  
    3737    $input_markup    = '';
    3838    $button_markup   = '';
    39     $width_styles    = '';
     39    $inline_styles   = styles_for_block_core_search( $attributes );
    4040
    4141    if ( $show_label ) {
     
    5757    if ( $show_input ) {
    5858        $input_markup = sprintf(
    59             '<input type="search" id="%s" class="wp-block-search__input" name="s" value="%s" placeholder="%s" required />',
     59            '<input type="search" id="%s" class="wp-block-search__input" name="s" value="%s" placeholder="%s" %s required />',
    6060            $input_id,
    6161            esc_attr( get_search_query() ),
    62             esc_attr( $attributes['placeholder'] )
     62            esc_attr( $attributes['placeholder'] ),
     63            $inline_styles['shared']
    6364        );
    6465    }
     
    8182
    8283        $button_markup = sprintf(
    83             '<button type="submit"class="wp-block-search__button ' . $button_classes . '">%s</button>',
     84            '<button type="submit" class="wp-block-search__button %s"%s>%s</button>',
     85            $button_classes,
     86            $inline_styles['shared'],
    8487            $button_internal_markup
    8588        );
    8689    }
    8790
    88     if ( ! empty( $attributes['width'] ) && ! empty( $attributes['widthUnit'] ) ) {
    89         if ( ! empty( $attributes['buttonPosition'] ) && 'button-only' !== $attributes['buttonPosition'] ) {
    90             $width_styles = ' style="width: ' . $attributes['width'] . $attributes['widthUnit'] . ';"';
    91         }
    92     }
    93 
    9491    $field_markup       = sprintf(
    9592        '<div class="wp-block-search__inside-wrapper"%s>%s</div>',
    96         $width_styles,
     93        $inline_styles['wrapper'],
    9794        $input_markup . $button_markup
    9895    );
     
    160157    return implode( ' ', $classnames );
    161158}
     159
     160/**
     161 * Builds an array of inline styles for the search block.
     162 *
     163 * The result will contain one entry for shared styles such as those for the
     164 * inner input or button and a second for the inner wrapper should the block
     165 * be positioning the button "inside".
     166 *
     167 * @param  array $attributes The block attributes.
     168 *
     169 * @return array Style HTML attribute.
     170 */
     171function styles_for_block_core_search( $attributes ) {
     172    $shared_styles  = array();
     173    $wrapper_styles = array();
     174
     175    // Add width styles.
     176    $has_width   = ! empty( $attributes['width'] ) && ! empty( $attributes['widthUnit'] );
     177    $button_only = ! empty( $attributes['buttonPosition'] ) && 'button-only' === $attributes['buttonPosition'];
     178
     179    if ( $has_width && ! $button_only ) {
     180        $wrapper_styles[] = sprintf(
     181            'width: %d%s;',
     182            esc_attr( $attributes['width'] ),
     183            esc_attr( $attributes['widthUnit'] )
     184        );
     185    }
     186
     187    // Add border radius styles.
     188    $has_border_radius = ! empty( $attributes['style']['border']['radius'] );
     189
     190    if ( $has_border_radius ) {
     191        // Shared style for button and input radius values.
     192        $border_radius   = $attributes['style']['border']['radius'];
     193        $shared_styles[] = sprintf( 'border-radius: %spx;', esc_attr( $border_radius ) );
     194
     195        // Apply wrapper border radius if button placed inside.
     196        $button_inside = ! empty( $attributes['buttonPosition'] ) &&
     197            'button-inside' === $attributes['buttonPosition'];
     198
     199        if ( $button_inside ) {
     200            // We adjust the border radius value for the outer wrapper element
     201            // to make it visually consistent with the radius applied to inner
     202            // elements.
     203            $default_padding  = 4;
     204            $adjusted_radius  = $border_radius + $default_padding;
     205            $wrapper_styles[] = sprintf( 'border-radius: %dpx;', esc_attr( $adjusted_radius ) );
     206        }
     207    }
     208
     209    return array(
     210        'shared'  => ! empty( $shared_styles ) ? sprintf( ' style="%s"', implode( ' ', $shared_styles ) ) : '',
     211        'wrapper' => ! empty( $wrapper_styles ) ? sprintf( ' style="%s"', implode( ' ', $wrapper_styles ) ) : '',
     212    );
     213}
  • trunk/src/wp-includes/blocks/search/block.json

    r50048 r50761  
    3535    "supports": {
    3636        "align": [ "left", "center", "right" ],
     37        "__experimentalBorder": {
     38            "radius": true,
     39            "__experimentalSkipSerialization": true
     40        },
    3741        "html": false
    3842    },
  • trunk/src/wp-includes/blocks/social-link.php

    r50458 r50761  
    1818    $open_in_new_tab = isset( $block->context['openInNewTab'] ) ? $block->context['openInNewTab'] : false;
    1919
    20     $service    = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon';
    21     $url        = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false;
    22     $label      = ( isset( $attributes['label'] ) ) ? $attributes['label'] : block_core_social_link_get_name( $service );
     20    $service = ( isset( $attributes['service'] ) ) ? $attributes['service'] : 'Icon';
     21    $url     = ( isset( $attributes['url'] ) ) ? $attributes['url'] : false;
     22    $label   = ( isset( $attributes['label'] ) ) ? $attributes['label'] : sprintf(
     23        /* translators: %1$s: Social-network name. %2$s: URL. */
     24        __( '%1$s: %2$s', 'gutenberg' ),
     25        block_core_social_link_get_name( $service ),
     26        $url
     27    );
    2328    $class_name = isset( $attributes['className'] ) ? ' ' . $attributes['className'] : false;
    2429
  • trunk/src/wp-includes/blocks/spacer/block.json

    r50048 r50761  
    77            "type": "number",
    88            "default": 100
     9        },
     10        "width": {
     11            "type": "number"
    912        }
    1013    },
     14    "usesContext": [
     15        "orientation"
     16    ],
    1117    "supports": {
    1218        "anchor": true
  • trunk/src/wp-includes/blocks/verse/block.json

    r50048 r50761  
    1818        "anchor": true,
    1919        "__experimentalFontFamily": true,
    20         "fontSize": true
     20        "fontSize": true,
     21        "spacing": {
     22            "padding": true
     23        }
    2124    },
    2225    "style": "wp-block-verse",
Note: See TracChangeset for help on using the changeset viewer.