Skip to content

fix: temporary patch BEC editor preview#198

Open
laurelfulford wants to merge 2 commits into
mainfrom
fix/bec-editor-preview
Open

fix: temporary patch BEC editor preview#198
laurelfulford wants to merge 2 commits into
mainfrom
fix/bec-editor-preview

Conversation

@laurelfulford
Copy link
Copy Markdown
Contributor

@laurelfulford laurelfulford commented Jun 2, 2026

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:

  1. Install and activate Block Editor Colors
  2. Navigate to Settings > Editor Colors.
  3. Change one of the Default Colours (rather than adding a new one) and click 'Update':
CleanShot 2026-06-02 at 14 07 36
  1. Edit a post or page and try to apply a colour to a block.
  2. Note that your updated colour appears correctly in the palette, but when you apply it to a block, it uses the original default. If you publish, the custom colour is correctly used on the front-end.
  3. Apply this PR.
  4. Retest the editor; confirm that your editor preview works as expected.

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully run tests with your changes locally?

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@laurelfulford laurelfulford marked this pull request as ready for review June 2, 2026 21:12
@laurelfulford laurelfulford requested a review from a team as a code owner June 2, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants