Make WordPress Core

Changeset 56784


Ignore:
Timestamp:
10/04/2023 10:14:18 PM (14 months ago)
Author:
audrasjb
Message:

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.

Location:
branches/6.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/6.3

  • branches/6.3/src/wp-content/themes/twentytwenty/functions.php

    r56106 r56784  
    412412 *
    413413 * @since Twenty Twenty 1.0
     414 * @since Twenty Twenty 2.4 Removed a script related to the obsolete Squared style of Button blocks.
    414415 */
    415416function twentytwenty_block_editor_styles() {
     
    430431        wp_add_inline_style( 'twentytwenty-block-editor-styles', $custom_css );
    431432    }
    432 
    433     // Enqueue the editor script.
    434     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 );
    435 }
    436 
    437 add_action( 'enqueue_block_editor_assets', 'twentytwenty_block_editor_styles', 1, 1 );
     433}
     434
     435if ( is_admin() && version_compare( $GLOBALS['wp_version'], '6.3', '>=' ) ) {
     436    add_action( 'enqueue_block_assets', 'twentytwenty_block_editor_styles', 1, 1 );
     437} else {
     438    add_action( 'enqueue_block_editor_assets', 'twentytwenty_block_editor_styles', 1, 1 );
     439}
    438440
    439441/**
  • branches/6.3/src/wp-content/themes/twentytwenty/inc/custom-css.php

    r53284 r56784  
    146146            // Text color.
    147147            if ( $body && $body !== $body_default ) {
    148                 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 );
     148                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 );
    149149            }
    150150
Note: See TracChangeset for help on using the changeset viewer.