-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Block editor: Iframe: Remove reset styles #33204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
|
||
| wp_styles()->done = array(); | ||
| // We do not need reset styles for the iframed editor. | ||
| wp_styles()->done = array( 'wp-reset-editor-styles' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the easiest way to get the job done. We trick do_items in thinking that the handle has already been added, so it will be skipped.
| // Don't try to add the reset styles, which were removed as a dependency | ||
| // from `edit-blocks` for the iframe since we don't need to reset admin | ||
| // styles. | ||
| if ( ownerNode.id === 'wp-reset-editor-styles-css' ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to ignore this in the compatibility layer because it will search stylesheet for relevant selectors, which also matches wp-reset-editor-styles.
|
Size Change: +15 B (0%) Total Size: 1.05 MB
ℹ️ View Unchanged
|
|
Thanks for this. One of the biggest benefits of the iframe is that it blocks wp-admin styles from bleeding in. I can confirm this PR does that: Compare to the block editor, which still has CSS bleed and shows the wp-admin link focus style here: I'm happy to give this a green check as it works for me, but I'd love a sanity check by someone more familiar with the code. Thanks again! |
youknowriad
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM


Description
This removes three stylesheets from the iframed editor:
wp-reset-editor-styles,commonandforms. These are not necessary since no admin styles need to be reset.commonalso seems to be adding focus styles that we don't want.Not sure if this is worth back porting.
How has this been tested?
Screenshots
Types of changes
Checklist:
*.native.jsfiles for terms that need renaming or removal).