Skip to content

Commit

Permalink
Editor: update duotone support.
Browse files Browse the repository at this point in the history
Updates duotone support after stabilisation of selectors API and adds a few small code quality and UI improvements.

Props onemaggie, peterwilsoncc, ajlende, audrasjb, mikeschroder, ramonopoly.
Fixes #58555.


git-svn-id: https://develop.svn.wordpress.org/trunk@56101 602fd350-edb4-49c9-b593-d223f7449a82
  • Loading branch information
tellthemachines committed Jun 29, 2023
1 parent 91a95fe commit d966798
Show file tree
Hide file tree
Showing 11 changed files with 1,924 additions and 693 deletions.
580 changes: 23 additions & 557 deletions src/wp-includes/block-supports/duotone.php

Large diffs are not rendered by default.

1,274 changes: 1,274 additions & 0 deletions src/wp-includes/class-wp-duotone.php

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/wp-includes/class-wp-theme-json.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class WP_Theme_JSON {
* @since 6.0.0 Replaced `override` with `prevent_override` and updated the
* `prevent_override` value for `color.duotone` to use `color.defaultDuotone`.
* @since 6.2.0 Added 'shadow' presets.
* @since 6.3.0 Replaced value_func for duotone with `null`. Custom properties are handled by class-wp-duotone.php.
* @var array
*/
const PRESETS_METADATA = array(
Expand Down Expand Up @@ -143,8 +144,8 @@ class WP_Theme_JSON {
'path' => array( 'color', 'duotone' ),
'prevent_override' => array( 'color', 'defaultDuotone' ),
'use_default_names' => false,
'value_func' => 'wp_get_duotone_filter_property',
'css_vars' => '--wp--preset--duotone--$slug',
'value_func' => null, // CSS Custom Properties for duotone are handled by block supports in class-wp-duotone.php.
'css_vars' => null,
'classes' => array(),
'properties' => array( 'filter' ),
),
Expand Down
4 changes: 0 additions & 4 deletions src/wp-includes/default-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,6 @@
add_action( 'wp_enqueue_scripts', 'wp_enqueue_stored_styles' );
add_action( 'wp_footer', 'wp_enqueue_stored_styles', 1 );

// SVG filters like duotone have to be loaded at the beginning of the body in both admin and the front-end.
add_action( 'wp_body_open', 'wp_global_styles_render_svg_filters' );
add_action( 'in_admin_header', 'wp_global_styles_render_svg_filters' );

add_action( 'wp_default_styles', 'wp_default_styles' );
add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );

Expand Down
Loading

0 comments on commit d966798

Please sign in to comment.