Changeset 51241 for trunk/src/wp-includes/blocks/file.php
- Timestamp:
- 06/25/2021 03:50:14 PM (5 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-includes/blocks/file.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/file.php
r50824 r51241 7 7 8 8 /** 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. 10 10 * 11 11 * @param array $attributes The block attributes. … … 15 15 */ 16 16 function 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' ); 22 20 } 23 21
Note:
See TracChangeset
for help on using the changeset viewer.