From 9a5c4b6919be80a70a96a23b86cbea793e392f38 Mon Sep 17 00:00:00 2001 From: audrasjb Date: Wed, 4 Oct 2023 22:16:26 +0000 Subject: [PATCH] Twenty Twenty: Fix style issues within iframed editor. This changeset: - Replaces `body` with `html` for the first CSS selector that makes text white against a dark background - Moves `twentytwenty_block_editor_styles()` from the `enqueue_block_editor_assets` action to `enqueue_block_assets` for WordPress 6.3 and later - Removes the obsolete `twentytwenty-block-editor-script` from the styles function to avoid an error in the iframe Props floydwilde, poena, huzaifaalmesbah, greenshady, sabernhardt, audrasjb, pooja1210, shailu25, joemcgill. Merges [56783] to the 6.3 branch. Fixes #59086. Built from https://develop.svn.wordpress.org/branches/6.3@56784 git-svn-id: http://core.svn.wordpress.org/branches/6.3@56296 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentytwenty/functions.php | 10 ++++++---- wp-content/themes/twentytwenty/inc/custom-css.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/wp-content/themes/twentytwenty/functions.php b/wp-content/themes/twentytwenty/functions.php index be61189ea2..a4674fc6dc 100644 --- a/wp-content/themes/twentytwenty/functions.php +++ b/wp-content/themes/twentytwenty/functions.php @@ -411,6 +411,7 @@ add_action( 'widgets_init', 'twentytwenty_sidebar_registration' ); * Enqueue supplemental block editor styles. * * @since Twenty Twenty 1.0 + * @since Twenty Twenty 2.4 Removed a script related to the obsolete Squared style of Button blocks. */ function twentytwenty_block_editor_styles() { @@ -429,12 +430,13 @@ function twentytwenty_block_editor_styles() { if ( $custom_css ) { wp_add_inline_style( 'twentytwenty-block-editor-styles', $custom_css ); } - - // Enqueue the editor script. - wp_enqueue_script( 'twentytwenty-block-editor-script', get_theme_file_uri( '/assets/js/editor-script-block.js' ), array( 'wp-blocks', 'wp-dom' ), wp_get_theme()->get( 'Version' ), true ); } -add_action( 'enqueue_block_editor_assets', 'twentytwenty_block_editor_styles', 1, 1 ); +if ( is_admin() && version_compare( $GLOBALS['wp_version'], '6.3', '>=' ) ) { + add_action( 'enqueue_block_assets', 'twentytwenty_block_editor_styles', 1, 1 ); +} else { + add_action( 'enqueue_block_editor_assets', 'twentytwenty_block_editor_styles', 1, 1 ); +} /** * Enqueue classic editor styles. diff --git a/wp-content/themes/twentytwenty/inc/custom-css.php b/wp-content/themes/twentytwenty/inc/custom-css.php index 815f5d1b72..f2f8ffaed3 100644 --- a/wp-content/themes/twentytwenty/inc/custom-css.php +++ b/wp-content/themes/twentytwenty/inc/custom-css.php @@ -145,7 +145,7 @@ if ( ! function_exists( 'twentytwenty_get_customizer_css' ) ) { // Text color. if ( $body && $body !== $body_default ) { - twentytwenty_generate_css( 'body .editor-styles-wrapper, .editor-post-title__block .editor-post-title__input, .editor-post-title__block .editor-post-title__input:focus', 'color', $body ); + twentytwenty_generate_css( 'html .editor-styles-wrapper, .editor-post-title__block .editor-post-title__input, .editor-post-title__block .editor-post-title__input:focus', 'color', $body ); } // Secondary color. diff --git a/wp-includes/version.php b/wp-includes/version.php index 5466b5e14b..4692e1cc1f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3.2-alpha-56782'; +$wp_version = '6.3.2-alpha-56784'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.