WordPress.org

Make WordPress Core

Changeset 51090


Ignore:
Timestamp:
06/08/2021 08:14:59 AM (6 months ago)
Author:
youknowriad
Message:

Block Editor: Add a type property to allow Core to identify the source of the editor styles.

Gutenberg plugin need to override the editor styles provided by core selectively,
this added property allows it to do so without committing to a public API.

Props nosolosw, jorgefilipecosta.
See #53175.

Location:
trunk/src
Files:
2 edited

Legend:

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

    r51003 r51090  
    132132$styles = array(
    133133    array(
    134         'css' => 'body { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif }',
     134        'css'            => 'body { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif }',
     135        '__unstableType' => 'core',
    135136    ),
    136137);
     
    141142            if ( ! is_wp_error( $response ) ) {
    142143                $styles[] = array(
    143                     'css' => wp_remote_retrieve_body( $response ),
     144                    'css'            => wp_remote_retrieve_body( $response ),
     145                    '__unstableType' => 'theme',
    144146                );
    145147            }
     
    148150            if ( is_file( $file ) ) {
    149151                $styles[] = array(
    150                     'css'     => file_get_contents( $file ),
    151                     'baseURL' => get_theme_file_uri( $style ),
     152                    'css'            => file_get_contents( $file ),
     153                    'baseURL'        => get_theme_file_uri( $style ),
     154                    '__unstableType' => 'theme',
    152155                );
    153156            }
  • trunk/src/wp-includes/block-editor.php

    r51067 r51090  
    284284
    285285    if ( WP_Theme_JSON_Resolver::theme_has_support() ) {
    286         $editor_settings['styles'][] = array( 'css' => $theme_json->get_stylesheet( 'block_styles' ) );
     286        $editor_settings['styles'][] = array(
     287            'css'            => $theme_json->get_stylesheet( 'block_styles' ),
     288            '__unstableType' => 'globalStyles',
     289        );
    287290        $editor_settings['styles'][] = array(
    288291            'css'                     => $theme_json->get_stylesheet( 'css_variables' ),
    289292            '__experimentalNoWrapper' => true,
     293            '__unstableType'          => 'globalStyles',
    290294        );
    291295    }
Note: See TracChangeset for help on using the changeset viewer.