From 62be41c07937008df8c9b80e1d430c0ad683c4e2 Mon Sep 17 00:00:00 2001 From: youknowriad Date: Tue, 8 Jun 2021 17:36:58 +0000 Subject: [PATCH] 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 --- wp-includes/blocks.php | 16 ++++++++++++++++ wp-includes/version.php | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/wp-includes/blocks.php b/wp-includes/blocks.php index f210858e55..f5541e0ae9 100644 --- a/wp-includes/blocks.php +++ b/wp-includes/blocks.php @@ -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', diff --git a/wp-includes/version.php b/wp-includes/version.php index 8d7abc7838..4c0a7b8953 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.