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. Built from https://develop.svn.wordpress.org/trunk@51090 git-svn-id: http://core.svn.wordpress.org/trunk@50699 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -131,7 +131,8 @@ $available_templates = ! empty( $available_templates ) ? array_merge(
|
||||
// Editor Styles.
|
||||
$styles = array(
|
||||
array(
|
||||
'css' => 'body { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif }',
|
||||
'css' => 'body { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif }',
|
||||
'__unstableType' => 'core',
|
||||
),
|
||||
);
|
||||
if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
|
||||
@@ -140,15 +141,17 @@ if ( $editor_styles && current_theme_supports( 'editor-styles' ) ) {
|
||||
$response = wp_remote_get( $style );
|
||||
if ( ! is_wp_error( $response ) ) {
|
||||
$styles[] = array(
|
||||
'css' => wp_remote_retrieve_body( $response ),
|
||||
'css' => wp_remote_retrieve_body( $response ),
|
||||
'__unstableType' => 'theme',
|
||||
);
|
||||
}
|
||||
} else {
|
||||
$file = get_theme_file_path( $style );
|
||||
if ( is_file( $file ) ) {
|
||||
$styles[] = array(
|
||||
'css' => file_get_contents( $file ),
|
||||
'baseURL' => get_theme_file_uri( $style ),
|
||||
'css' => file_get_contents( $file ),
|
||||
'baseURL' => get_theme_file_uri( $style ),
|
||||
'__unstableType' => 'theme',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user