From 9f66f6ae1c52c43690eb172e0691181dcef20e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= Date: Wed, 26 Apr 2023 15:32:33 +0300 Subject: [PATCH] Fix e2e test: add theme and edit-site styles correctly --- lib/compat/wordpress-6.3/script-loader.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/compat/wordpress-6.3/script-loader.php b/lib/compat/wordpress-6.3/script-loader.php index 561b7c3c3b963f..0231431dbf50c7 100644 --- a/lib/compat/wordpress-6.3/script-loader.php +++ b/lib/compat/wordpress-6.3/script-loader.php @@ -27,7 +27,7 @@ * } */ function _gutenberg_get_iframed_editor_assets() { - global $wp_styles, $wp_scripts; + global $wp_styles, $wp_scripts, $pagenow; // Keep track of the styles and scripts instance to restore later. $current_wp_styles = $wp_styles; @@ -45,8 +45,17 @@ function _gutenberg_get_iframed_editor_assets() { // We do not need reset styles for the iframed editor. $wp_styles->done = array( 'wp-reset-editor-styles' ); - wp_enqueue_style( 'wp-edit-blocks' ); wp_enqueue_script( 'wp-polyfill' ); + // Enqueue the `editorStyle` handles for all core block, and dependencies. + wp_enqueue_style( 'wp-edit-blocks' ); + + if ( 'site-editor.php' === $pagenow ) { + wp_enqueue_style( 'wp-edit-site' ); + } + + if ( current_theme_supports( 'wp-block-styles' ) ) { + wp_enqueue_style( 'wp-block-library-theme' ); + } // We don't want to load EDITOR scripts in the iframe, only enqueue // front-end assets for the content.