wp core update 6.6
This commit is contained in:
@@ -215,7 +215,7 @@ class WP_Duotone {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses any valid Hex3, Hex4, Hex6 or Hex8 string and converts it to an RGBA object
|
||||
* Parses any valid Hex3, Hex4, Hex6 or Hex8 string and converts it to an RGBA object.
|
||||
*
|
||||
* Direct port of colord's parseHex function.
|
||||
*
|
||||
@@ -286,7 +286,7 @@ class WP_Duotone {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses a valid RGB[A] CSS color function/string
|
||||
* Parses a valid RGB[A] CSS color function/string.
|
||||
*
|
||||
* Direct port of colord's parseRgbaString function.
|
||||
*
|
||||
@@ -809,12 +809,13 @@ class WP_Duotone {
|
||||
* @internal
|
||||
*
|
||||
* @since 6.3.0
|
||||
* @since 6.6.0 Replaced body selector with `WP_Theme_JSON::ROOT_CSS_PROPERTIES_SELECTOR`.
|
||||
*
|
||||
* @param array $sources The duotone presets.
|
||||
* @return string The CSS for global styles.
|
||||
*/
|
||||
private static function get_global_styles_presets( $sources ) {
|
||||
$css = 'body{';
|
||||
$css = WP_Theme_JSON::ROOT_CSS_PROPERTIES_SELECTOR . '{';
|
||||
foreach ( $sources as $filter_id => $filter_data ) {
|
||||
$slug = $filter_data['slug'];
|
||||
$colors = $filter_data['colors'];
|
||||
@@ -1153,6 +1154,45 @@ class WP_Duotone {
|
||||
return $tags->get_updated_html();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixes the issue with our generated class name not being added to the block's outer container
|
||||
* in classic themes due to gutenberg_restore_image_outer_container from layout block supports.
|
||||
*
|
||||
* @since 6.6.0
|
||||
*
|
||||
* @param string $block_content Rendered block content.
|
||||
* @return string Filtered block content.
|
||||
*/
|
||||
public static function restore_image_outer_container( $block_content ) {
|
||||
if ( wp_theme_has_theme_json() ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$tags = new WP_HTML_Tag_Processor( $block_content );
|
||||
$wrapper_query = array(
|
||||
'tag_name' => 'div',
|
||||
'class_name' => 'wp-block-image',
|
||||
);
|
||||
if ( ! $tags->next_tag( $wrapper_query ) ) {
|
||||
return $block_content;
|
||||
}
|
||||
|
||||
$tags->set_bookmark( 'wrapper-div' );
|
||||
$tags->next_tag();
|
||||
|
||||
$inner_classnames = explode( ' ', $tags->get_attribute( 'class' ) );
|
||||
foreach ( $inner_classnames as $classname ) {
|
||||
if ( 0 === strpos( $classname, 'wp-duotone' ) ) {
|
||||
$tags->remove_class( $classname );
|
||||
$tags->seek( 'wrapper-div' );
|
||||
$tags->add_class( $classname );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $tags->get_updated_html();
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the used block duotone filter declarations to the inline block supports CSS.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user