Make WordPress Core

Changeset 50620


Ignore:
Timestamp:
03/31/2021 05:50:50 AM (4 years ago)
Author:
gziolo
Message:

Editor: Enqueue assets for format library for the block editor

Ensures that wp-format-library assets are always loaded for the block editor. Otherwise, they have to be loaded individually for every screen that needs it. It's similar to how wp-block-directory assets are handled.

Props ellatrix.
See #52920.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-blocks.php

    r50570 r50620  
    4040wp_enqueue_script( 'heartbeat' );
    4141wp_enqueue_script( 'wp-edit-post' );
    42 wp_enqueue_script( 'wp-format-library' );
    4342
    4443$rest_base = ! empty( $post_type_object->rest_base ) ? $post_type_object->rest_base : $post_type_object->name;
     
    399398 */
    400399wp_enqueue_style( 'wp-edit-post' );
    401 wp_enqueue_style( 'wp-format-library' );
    402400
    403401/**
  • trunk/src/wp-includes/default-filters.php

    r50375 r50620  
    539539add_action( 'admin_enqueue_scripts', 'wp_common_block_scripts_and_styles' );
    540540add_action( 'enqueue_block_assets', 'wp_enqueue_registered_block_scripts_and_styles' );
     541add_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_format_library_assets' );
    541542add_action( 'enqueue_block_editor_assets', 'wp_enqueue_registered_block_scripts_and_styles' );
    542543add_action( 'admin_print_scripts-index.php', 'wp_localize_community_events' );
  • trunk/src/wp-includes/script-loader.php

    r50619 r50620  
    23252325
    23262326/**
     2327 * Enqueues the assets required for the format library within the block editor.
     2328 *
     2329 * @since 5.8.0
     2330 */
     2331function wp_enqueue_editor_format_library_assets() {
     2332    wp_enqueue_script( 'wp-format-library' );
     2333    wp_enqueue_style( 'wp-format-library' );
     2334}
     2335
     2336/**
    23272337 * Enqueues the assets required for the block directory within the block editor.
    23282338 *
Note: See TracChangeset for help on using the changeset viewer.