Fix styles for previews and patterns#37296
Merged
noisysocks merged 1 commit intotrunkfrom Dec 12, 2021
Merged
Conversation
The reason is that there's a couple of places in which we render styles coming from the block editor settings in a iframe (media query previews, block patterns).
jffng
approved these changes
Dec 10, 2021
Contributor
jffng
left a comment
There was a problem hiding this comment.
Tested in tt1-blocks and twentytwentytwo, and this fixes the issue. Thanks @oandregal for the fast work!
noisysocks
pushed a commit
that referenced
this pull request
Dec 13, 2021
…gs (#37296) The reason is that there's a couple of places in which we render styles coming from the block editor settings in a iframe (media query previews, block patterns).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #37292
#36851 introduced a change to how Gutenberg loads some styles: the CSS Custom Properties for the presets. We removed them from the editor settings'
styleand added them via theenqueue_block_editor_assetsfilter so that they were in the scope of both the content and the sidebar.While this change fixed the issue we had gradients, it introduced a regression described at #37292 by which some styles were missing for the previews and patterns. The reason for this appears to be that they load through iframe the styles in editor settings, hence, the CSS Custom Properties were defined in the iframes.
This PR adds back the CSS vars in the editor settings.
How to test
See #37292