Block Editor: Allow themes to add inline styles for all blocks when using lazy styles loading.

Props aristath.
Fixes #53358.

Built from https://develop.svn.wordpress.org/trunk@51102


git-svn-id: http://core.svn.wordpress.org/trunk@50711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
youknowriad 2021-06-08 17:36:58 +00:00
parent 1a7f28b3cd
commit 62be41c079
2 changed files with 17 additions and 1 deletions

View File

@ -209,6 +209,22 @@ function register_block_type_from_metadata( $file_or_folder, $args = array() ) {
*/
$metadata = apply_filters( 'block_type_metadata', $metadata );
/**
* Add `style` and `editor_style` for core blocks if missing.
*
* @since 5.8.0
*/
if ( ! empty( $metadata['name'] ) && 0 === strpos( $metadata['name'], 'core/' ) ) {
$block_name = str_replace( 'core/', '', $metadata['name'] );
if ( ! isset( $metadata['style'] ) ) {
$metadata['style'] = "wp-block-$block_name";
}
if ( ! isset( $metadata['editor_style'] ) ) {
$metadata['editor_style'] = "wp-block-$block_name-editor";
}
}
$settings = array();
$property_mappings = array(
'title' => 'title',

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-alpha-51101';
$wp_version = '5.8-alpha-51102';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.