WordPress.org

Make WordPress Core


Ignore:
Timestamp:
06/25/2021 03:50:14 PM (7 months ago)
Author:
youknowriad
Message:

Block Editor: Update the packages with a number of fixes targeted for Beta 4.

It includes fixes from these two backport PRs:

Props gziolo, ryelle, ntsekouras, desrosj, jorgefilipecosta.
See #53397

File:
1 edited

Legend:

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

    r50824 r51241  
    77
    88/**
    9  * When the `core/file` block is rendering, check if we need to enqueue the `'wp-block-library-file` script.
     9 * When the `core/file` block is rendering, check if we need to enqueue the `'wp-block-file-view` script.
    1010 *
    1111 * @param array $attributes The block attributes.
     
    1515 */
    1616function render_block_core_file( $attributes, $content ) {
    17     if ( ! empty( $attributes['displayPreview'] ) ) {
    18         // Check if it's already enqueued, so we don't add the inline script multiple times.
    19         if ( ! wp_script_is( 'wp-block-library-file' ) ) {
    20             wp_enqueue_script( 'wp-block-library-file', plugins_url( 'file/frontend.js', __FILE__ ) );
    21         }
     17    $should_load_view_script = ! empty( $attributes['displayPreview'] ) && ! wp_script_is( 'wp-block-file-view' );
     18    if ( $should_load_view_script ) {
     19        wp_enqueue_script( 'wp-block-file-view' );
    2220    }
    2321
Note: See TracChangeset for help on using the changeset viewer.