Make WordPress Core

Changeset 54358


Ignore:
Timestamp:
09/29/2022 06:53:57 PM (2 months ago)
Author:
davidbaumwald
Message:

Editor: Reintroduce styles that were removed for classic themes.

After block CSS was merged with theme.json styles in Gutenberg PR #34180, this removed some existing, default styling for some elements, including buttons. This change re-adds the removed styles by enqueueing classic.css for classic themes.

Merges Gutenberg PR #44334 into trunk.

Follow-up to [54257].

Props scruffian, oandregal, ramonopoly, aristath, andrewserong, get_dave, bernhard-reiter.
See #56467.

Location:
trunk/src/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/default-filters.php

    r54278 r54358  
    558558add_action( 'wp_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 );
    559559add_action( 'wp_enqueue_scripts', 'wp_common_block_scripts_and_styles' );
     560add_action( 'wp_enqueue_scripts', 'wp_enqueue_classic_theme_styles' );
    560561add_action( 'admin_enqueue_scripts', 'wp_localize_jquery_ui_datepicker', 1000 );
    561562add_action( 'admin_enqueue_scripts', 'wp_common_block_scripts_and_styles' );
     563add_action( 'admin_enqueue_scripts', 'wp_enqueue_classic_theme_styles' );
    562564add_action( 'enqueue_block_assets', 'wp_enqueue_registered_block_scripts_and_styles' );
    563565add_action( 'enqueue_block_assets', 'enqueue_block_styles_assets', 30 );
  • trunk/src/wp-includes/script-loader.php

    r54354 r54358  
    36413641    add_action( 'admin_init', $fn_generate_and_enqueue_editor_styles );
    36423642}
     3643
     3644/**
     3645 * Loads classic theme styles on classic themes.
     3646 *
     3647 * This is needed for backwards compatibility for button blocks specifically.
     3648 */
     3649function wp_enqueue_classic_theme_styles() {
     3650    if ( ! wp_is_block_theme() ) {
     3651        $suffix = wp_scripts_get_suffix();
     3652        wp_register_style( 'classic-theme-styles', "/wp-includes/css/dist/block-library/classic$suffix.css", array(), true );
     3653        wp_enqueue_style( 'classic-theme-styles' );
     3654    }
     3655}
Note: See TracChangeset for help on using the changeset viewer.