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

Duotone: Use the style engine to generate CSS for Duotone #48281

Merged
merged 4 commits into from
Feb 22, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions lib/block-supports/duotone.php
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,19 @@ function gutenberg_render_duotone_support( $block_content, $block ) {

// !important is needed because these styles render before global styles,
// and they should be overriding the duotone filters set by global styles.
$filter_style = SCRIPT_DEBUG
? $selector . " {\n\tfilter: " . $filter_property . " !important;\n}\n"
: $selector . '{filter:' . $filter_property . ' !important;}';

wp_register_style( $filter_id, false, array(), true, true );
wp_add_inline_style( $filter_id, $filter_style );
wp_enqueue_style( $filter_id );
$filter_style = gutenberg_style_engine_get_stylesheet_from_css_rules(
draganescu marked this conversation as resolved.
Show resolved Hide resolved
array(
array(
'selector' => $selector,
'declarations' => array(
'filter' => $filter_property . ' !important',
),
),
),
array(
'context' => 'block-supports'
)
);

if ( 'unset' !== $colors ) {
$filter_svg = gutenberg_get_duotone_filter_svg( $filter_preset );
Expand Down