Skip to content

Commit

Permalink
Twenty Twenty: Fix style issues within iframed editor.
Browse files Browse the repository at this point in the history
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.





git-svn-id: https://develop.svn.wordpress.org/trunk@56783 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
audrasjb committed Oct 4, 2023
1 parent 0d844c1 commit 89da2ff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/wp-content/themes/twentytwenty/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ function 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() {

Expand All @@ -434,12 +435,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' ), array( 'in_footer' => 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.
Expand Down
2 changes: 1 addition & 1 deletion src/wp-content/themes/twentytwenty/inc/custom-css.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function twentytwenty_get_customizer_css( $type = 'front-end' ) {

// 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.
Expand Down

0 comments on commit 89da2ff

Please sign in to comment.