Changeset 48537 – WordPress Trac (original) (raw)
Timestamp:
07/21/2020 03:36:17 PM (6 years ago)
desrosj
Message:
Editor: Ensure the required assets for the block directory are enqueued.
This fixes an issue where the block directory appears unstyled due to the stylesheets not being enqueued.
Props ryelle, timothyblynjacobs, earnjam.
Fixes #50661.
Location:
Files:
- wp-admin/edit-form-blocks.php (2 diffs)
- wp-includes/default-filters.php (1 diff)
- wp-includes/script-loader.php (3 diffs)
Legend:
Unmodified
Added
Removed
| r48527 | r48537 | |
|---|---|---|
| 366 | 366 | wp_tinymce_inline_scripts(); |
| 367 | 367 | wp_enqueue_editor(); |
| 368 | wp_enqueue_script( 'wp-block-directory' ); | |
| 368 | ||
| 369 | 369 | |
| 370 | 370 | /** |
| … | … | |
| 373 | 373 | wp_enqueue_style( 'wp-edit-post' ); |
| 374 | 374 | wp_enqueue_style( 'wp-format-library' ); |
| 375 | ||
| 376 | 375 | |
| 377 | 376 | /** |
| r48533 | r48537 | |
|---|---|---|
| 517 | 517 | add_action( 'enqueue_block_assets', 'enqueue_block_styles_assets', 30 ); |
| 518 | 518 | add_action( 'enqueue_block_editor_assets', 'enqueue_editor_block_styles_assets' ); |
| 519 | add_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' ); | |
| 519 | 520 | |
| 520 | 521 | add_action( 'wp_default_styles', 'wp_default_styles' ); |
| r48396 | r48537 | |
|---|---|---|
| 1464 | 1464 | ), |
| 1465 | 1465 | 'block-library' => array(), |
| 1466 | 'block-directory' => array(), | |
| 1466 | 1467 | 'components' => array(), |
| 1467 | 1468 | 'edit-post' => array( |
| … | … | |
| 1528 | 1529 | 'wp-block-editor', |
| 1529 | 1530 | 'wp-block-library', |
| 1531 | 'wp-block-directory', | |
| 1530 | 1532 | 'wp-components', |
| 1531 | 1533 | 'wp-edit-post', |
| … | … | |
| 2270 | 2272 | wp_enqueue_script( 'wp-block-styles' ); |
| 2271 | 2273 | } |
| 2274 | ||
| 2275 | /** | |
| 2276 | * Enqueues the assets required for the block directory within the block editor. | |
| 2277 | * | |
| 2278 | * @since 5.5.0 | |
| 2279 | */ | |
| 2280 | function wp_enqueue_editor_block_directory_assets() { | |
| 2281 | wp_enqueue_script( 'wp-block-directory' ); | |
| 2282 | wp_enqueue_style( 'wp-block-directory' ); | |
| 2283 | } |
Note: See TracChangeset for help on using the changeset viewer.