Fix styles for previews and patterns #37296
Merged
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'
style
and added them via theenqueue_block_editor_assets
filter 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