Fix responsive embeds on widget screen#26263
Conversation
|
I've left a note on WordPress/wordpress-develop#603 that this will have to be implemented in core too. |
lib/widgets-page.php
Outdated
| * to work. | ||
| * See wp_enqueue_registered_block_scripts_and_styles in wp-includes/script-loader.php | ||
| */ | ||
| $current_screen->is_block_editor( true ); |
There was a problem hiding this comment.
I copied most of the comment from the site editor:
gutenberg/lib/edit-site-page.php
Lines 90 to 102 in 277506e
Two questions:
- Is there a reason the site editor uses
global $current_screeninstead ofget_current_screen()? - The comment implies this duplicates what we've implemented here, can this code now be removed? -
gutenberg/lib/widgets-page.php
Lines 135 to 143 in 277506e
There was a problem hiding this comment.
-
The only difference between
get_current_screen()andglobal $current_screenis that the former will instantiateWP_Screenif it hasn't already been instantiated. What you did here looks good to me. -
Yes, we should be able to remove all of that. It worked when I tried it in Add block-based widget editor wordpress-develop#603 🙂
|
Size Change: 0 B Total Size: 1.21 MB ℹ️ View Unchanged
|
|
Just noting that https://core.trac.wordpress.org/ticket/51566 and #26180 are tracking the issue of actually displaying the embed in the frontend. |
draganescu
left a comment
There was a problem hiding this comment.
Tested this and works as described. It's not clear to me if we need to act on this comment.
noisysocks
left a comment
There was a problem hiding this comment.
Remove the now redundant should_load_block_editor_scripts_and_styles filter that we're adding in lib/widegts-page.php and then we'll be cooking with gas 😎
ca79442 to
4595803
Compare
4595803 to
e333254
Compare
|
I've changed this PR to use the |
outdated
draganescu
left a comment
There was a problem hiding this comment.
Tested again and it works!
Description
Fixes #26104
WordPress keeps some internal state to determine whether the current screen is a block editor. Setting this to true has the side effect of enabling responsive embeds in the editor, solving the issues seen in #26104:
https://github.com/WordPress/wordpress-develop/blob/master/src/wp-admin/admin-header.php#L192-L199
How has this been tested?
Screenshots
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist: