Make WordPress Core


Ignore:
Timestamp:
01/29/2024 09:04:18 PM (17 months ago)
Author:
youknowriad
Message:

Editor: Update the WordPress packages to the Gutenberg 16.7 RC2 version.

This patch, somewhat small brings a lot to WordPress.
This includes features like:

  • DataViews.
  • Customization tools like box shadow, background size and repeat.
  • UI improvements in the site editor.
  • Preferences sharing between the post and site editors.
  • Unified panels and editors between post and site editors.
  • Improved template mode in the post editor.
  • Iterations to multiple interactive blocks.
  • Preparing the blocks and UI for pattern overrides.
  • and a lot more.

Props luisherranz, gziolo, isabel_brison, costdev, jonsurrell, peterwilsoncc, get_dave, antonvlasenko, desrosj.
See #60315.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/post-featured-image.php

    r56710 r57377  
    5555
    5656    $featured_image = get_the_post_thumbnail( $post_ID, $size_slug, $attr );
     57
     58    // Get the first image from the post.
     59    if ( $attributes['useFirstImageFromPost'] && ! $featured_image ) {
     60        $content_post = get_post( $post_ID );
     61        $content      = $content_post->post_content;
     62        $processor    = new WP_HTML_Tag_Processor( $content );
     63
     64        /*
     65         * Transfer the image tag from the post into a new text snippet.
     66         * Because the HTML API doesn't currently expose a way to extract
     67         * HTML substrings this is necessary as a workaround. Of note, this
     68         * is different than directly extracting the IMG tag:
     69         * - If there are duplicate attributes in the source there will only be one in the output.
     70         * - If there are single-quoted or unquoted attributes they will be double-quoted in the output.
     71         * - If there are named character references in the attribute values they may be replaced with their direct code points. E.g. `…` becomes `…`.
     72         * In the future there will likely be a mechanism to copy snippets of HTML from
     73         * one document into another, via the HTML Processor's `get_outer_html()` or
     74         * equivalent. When that happens it would be appropriate to replace this custom
     75         * code with that canonical code.
     76         */
     77        if ( $processor->next_tag( 'img' ) ) {
     78            $tag_html = new WP_HTML_Tag_Processor( '<img>' );
     79            $tag_html->next_tag();
     80            foreach ( $processor->get_attribute_names_with_prefix( '' ) as $name ) {
     81                $tag_html->set_attribute( $name, $processor->get_attribute( $name ) );
     82            }
     83            $featured_image = $tag_html->get_updated_html();
     84        }
     85    }
     86
    5787    if ( ! $featured_image ) {
    5888        return '';
    5989    }
     90
    6091    if ( $is_link ) {
    6192        $link_target    = $attributes['linkTarget'];
Note: See TracChangeset for help on using the changeset viewer.