fix: temporary patch BEC editor preview#198
Open
laurelfulford wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a temporary compatibility layer in the Newspack classic theme to ensure the Block Editor Colors plugin’s override palette CSS is applied inside the block editor iframe (WordPress 7.0+), restoring correct editor-side preview behavior for overridden default colors.
Changes:
- Add a theme-side compatibility shim that injects Block Editor Colors’ generated CSS into the editor iframe via
block_editor_settings_all. - Load the shim conditionally from the theme when the Block Editor Colors plugin is present.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
themes/newspack-theme/newspack-theme/inc/block-editor-colors.php |
Adds a block_editor_settings_all filter to append plugin-generated override CSS to the editor iframe’s injected styles. |
themes/newspack-theme/newspack-theme/functions.php |
Conditionally loads the new compatibility file when Block Editor Colors is detected. |
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.
All Submissions:
Changes proposed in this Pull Request:
We use the Block Editor Color plugin whenever we need to add to or override the classic theme's editor palette.
As of WordPress 7.0, the editor preview stopped working for colours overriding default colours - it still works fine for additive colours.
This has been reported to the plugin's support forum, but this PR also adds a temporary fix to the Newspack Theme (I opted to add it here so it's strictly adding to the theme's functionality -- or lack thereof. We won't need to use this plugin once we move to a block theme).
Closes NPPM-2892
How to test the changes in this Pull Request:
Other information: