Make WordPress Core

Changeset 56783


Ignore:
Timestamp:
10/04/2023 08:54:34 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.
Fixes #59086.

Location:
trunk/src/wp-content/themes/twentytwenty
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwenty/functions.php

    r56569 r56783  
    417417 *
    418418 * @since Twenty Twenty 1.0
     419 * @since Twenty Twenty 2.4 Removed a script related to the obsolete Squared style of Button blocks.
    419420 */
    420421function twentytwenty_block_editor_styles() {
     
    435436        wp_add_inline_style( 'twentytwenty-block-editor-styles', $custom_css );
    436437    }
    437 
    438     // Enqueue the editor script.
    439     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' ), array( 'in_footer' => true ) );
    440 }
    441 
    442 add_action( 'enqueue_block_editor_assets', 'twentytwenty_block_editor_styles', 1, 1 );
     438}
     439
     440if ( is_admin() && version_compare( $GLOBALS['wp_version'], '6.3', '>=' ) ) {
     441    add_action( 'enqueue_block_assets', 'twentytwenty_block_editor_styles', 1, 1 );
     442} else {
     443    add_action( 'enqueue_block_editor_assets', 'twentytwenty_block_editor_styles', 1, 1 );
     444}
    443445
    444446/**
  • trunk/src/wp-content/themes/twentytwenty/inc/custom-css.php

    r56548 r56783  
    145145            // Text color.
    146146            if ( $body && $body !== $body_default ) {
    147                 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 );
     147                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 );
    148148            }
    149149
Note: See TracChangeset for help on using the changeset viewer.