Skip to content
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

Backport from core: Global styles duotone not rendering in post editor #38897

Merged
merged 2 commits into from
Feb 21, 2022

Conversation

ajlende
Copy link
Contributor

@ajlende ajlende commented Feb 17, 2022

Description

Backport the changes from changeset/52768. As part of the 5.9.1-RC1 release, these changes were made to core.

In addition, since core is loading the global duotone SVG filters, they can be skipped in the plugin if running with WP 5.9.1 or later.

Testing

Using wordpress-develop 5.9.0 and 5.9.1-RC1.

Using a theme that uses global duotone styles such as Skatepark or Twenty Twenty-Two with the following added to the theme.json

{
    "styles": {
        "blocks": {
            "core/image": {
                "filter": {
                    "duotone": "var(--wp--preset--duotone--primary-and-secondary)"
                }
            }
        }
    }
}

Check that the global duotones are applied to images in the post editor without manually adding them via the block interface. And check that there are no duplicate SVGs generated (ex. #wp-duotone-dark-grayscale).

Screenshots

Duotone image in the Skatepark theme post editor

@ajlende ajlende marked this pull request as ready for review February 17, 2022 23:45
@ajlende
Copy link
Contributor Author

ajlende commented Feb 17, 2022

I see an issue that the SVGs are getting generated at the bottom of the body when testing against 5.9.0. I will look at that tomorrow, but until then, the rest can still be tested.

Copy link
Member

@oandregal oandregal left a comment

Choose a reason for hiding this comment

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

The code is the same as in core, so this can go in.

The function name is not a blocker, just a convention we follow. The other one we should address as a follow-up and port to 5.9.1 as well.

@ajlende ajlende merged commit 7471ea7 into trunk Feb 21, 2022
@ajlende ajlende deleted the backport/fix-duotone-global-styles-render branch February 21, 2022 17:30
@github-actions github-actions bot added this to the Gutenberg 12.7 milestone Feb 21, 2022
Copy link
Contributor

@hellofromtonya hellofromtonya left a comment

Choose a reason for hiding this comment

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

Sorry for my tardiness in reviewing. LGTM 👍

Thanks @ajlende for porting these changes back to this repo ⭐

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants