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 Duotone fixes for 5.9.1 #2326

Closed
wants to merge 14 commits into from

Conversation

Mamaduka
Copy link
Member

This is a backporting patch for the following Gutenberg PRs:

Props @ajlende, @scruffian

Trac ticket: https://core.trac.wordpress.org/ticket/55179


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Comment on lines 595 to 611
/**
* Render the SVG filters supplied by theme.json.
*
* Note that this doesn't render the per-block user-defined
* filters which are handled by wp_render_duotone_support,
* but it should be rendered in the same location as those to satisfy
* Safari's rendering quirks.
*
* @since 5.9.0
*/
function wp_global_styles_render_svg_filters() {
$filters = wp_get_global_styles_svg_filters();
if ( ! empty( $filters ) ) {
echo $filters;
}
}
add_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
Copy link

Choose a reason for hiding this comment

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

For some reason the SVG filters are not rendering in the post-editor for me as if wp_body_open() is not being called. It works fine when viewing the post. Testing with TwentyTwentyTwo with the following added to the theme.json.

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

Copy link
Member Author

Choose a reason for hiding this comment

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

The wp_body_open is template action. I don't think it's called or should be called in Dashboard.

Copy link

Choose a reason for hiding this comment

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

Hmm. It was being called with this setup back when I wrote that code. We'll have to find a similar action that gets called in <body> before everything else, then

Mamaduka and others added 10 commits February 17, 2022 08:04
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
Co-authored-by: Tonya Mork <tonya.mork@automattic.com>
@Mamaduka
Copy link
Member Author

@ajlende created PR on my fork that contains a much-requested feature, allowing users to disable Duotone - Mamaduka#12.

@audrasjb
Copy link
Contributor

@audrasjb audrasjb closed this Feb 17, 2022
@Mamaduka Mamaduka deleted the backport/duotone-5.9 branch April 7, 2022 10:12
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.

4 participants