Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 4 additions & 0 deletions backport-changelog/7.2/14092.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
https://github.com/WordPress/wordpress-develop/pull/14092

* https://github.com/WordPress/gutenberg/pull/84294
* https://github.com/WordPress/gutenberg/pull/84302
3 changes: 3 additions & 0 deletions backport-changelog/7.2/14190.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/14190

* https://github.com/WordPress/gutenberg/pull/84523
19 changes: 13 additions & 6 deletions lib/class-wp-theme-json-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ public function __construct( $theme_json = array( 'version' => WP_Theme_JSON_Gut
// In addition to presets, spacingScale (which generates presets) is also keyed by origin.
$scale_path = array( 'settings', 'spacing', 'spacingScale' );
$spacing_scale = _wp_array_get( $this->theme_json, $scale_path, null );
if ( null !== $spacing_scale ) {
if ( is_array( $spacing_scale ) ) {
// If the spacingScale is not already keyed by origin.
if ( empty( array_intersect( array_keys( $spacing_scale ), static::VALID_ORIGINS ) ) ) {
_wp_array_set( $this->theme_json, $scale_path, array( $origin => $spacing_scale ) );
Expand Down Expand Up @@ -1185,7 +1185,10 @@ private static function unwrap_shared_block_style_variations( $theme_json, $vali
foreach ( $registered_variations as $variation_name ) {
$block_level_data = $new_theme_json['styles']['blocks'][ $block_type ]['variations'][ $variation_name ] ?? array();
$top_level_data = $variations[ $variation_name ] ?? array();
$merged_data = array_replace_recursive( $top_level_data, $block_level_data );
if ( ! is_array( $block_level_data ) || ! is_array( $top_level_data ) ) {
continue;
}
$merged_data = array_replace_recursive( $top_level_data, $block_level_data );
if ( ! empty( $merged_data ) ) {
_wp_array_set( $new_theme_json, array( 'styles', 'blocks', $block_type, 'variations', $variation_name ), $merged_data );
}
Expand Down Expand Up @@ -1460,7 +1463,7 @@ protected static function sanitize( $input, $valid_block_names, $valid_element_n
if ( ! empty( $input['blockTypes'] ) && is_array( $input['blockTypes'] ) ) {
$variation_pseudo_selectors = array();
foreach ( $input['blockTypes'] as $variation_block_type ) {
if ( isset( static::VALID_BLOCK_PSEUDO_SELECTORS[ $variation_block_type ] ) ) {
if ( is_string( $variation_block_type ) && isset( static::VALID_BLOCK_PSEUDO_SELECTORS[ $variation_block_type ] ) ) {
$variation_pseudo_selectors = array_merge(
$variation_pseudo_selectors,
static::VALID_BLOCK_PSEUDO_SELECTORS[ $variation_block_type ]
Expand Down Expand Up @@ -2062,7 +2065,10 @@ public function get_stylesheet( $types = array( 'variables', 'styles', 'presets'
// Load the custom CSS last so it has the highest specificity.
if ( in_array( 'custom-css', $types, true ) ) {
// Add the global styles root CSS.
$stylesheet .= _wp_array_get( $this->theme_json, array( 'styles', 'css' ) );
$root_css = $this->theme_json['styles']['css'] ?? '';
if ( is_string( $root_css ) ) {
$stylesheet .= $root_css;
}
}

return $stylesheet;
Expand All @@ -2080,7 +2086,7 @@ public function get_stylesheet( $types = array( 'variables', 'styles', 'presets'
public static function process_blocks_custom_css( $css, $selector ) {
$processed_css = '';

if ( empty( $css ) ) {
if ( empty( $css ) || ! is_string( $css ) ) {
return $processed_css;
}

Expand Down Expand Up @@ -3260,7 +3266,7 @@ protected static function get_property_value( $styles, $path, $theme_json = null
* to a path, this converts that path into the value at that path.
* For example: { "ref": "style.color.background" } => "#fff".
*/
if ( is_array( $value ) && isset( $value['ref'] ) ) {
if ( is_array( $value ) && isset( $value['ref'] ) && is_string( $value['ref'] ) ) {
$value_path = explode( '.', $value['ref'] );
$ref_value = _wp_array_get( $theme_json, $value_path, null );
// Background Image refs can refer to a string or an array containing a URL string.
Expand Down Expand Up @@ -5571,6 +5577,7 @@ private static function compute_spacing_sizes( $spacing_scale ) {
! isset( $spacing_scale['mediumStep'] ) ||
! is_numeric( $spacing_scale['mediumStep'] ) ||
! isset( $spacing_scale['unit'] ) ||
! is_string( $spacing_scale['unit'] ) ||
! isset( $spacing_scale['operator'] ) ||
( '+' !== $spacing_scale['operator'] && '*' !== $spacing_scale['operator'] ) ||
! isset( $spacing_scale['increment'] ) ||
Expand Down
11 changes: 9 additions & 2 deletions lib/experimental/experiments/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,15 @@ function gutenberg_initialize_experiments_settings() {
'label' => __( 'Gutenberg Experiments', 'gutenberg' ),
'show_in_rest' => array(
'schema' => array(
'type' => 'object',
'properties' => $properties,
'type' => 'object',
'properties' => $properties,
/*
* A site that enabled an experiment which was since removed still
* carries that ID in the saved option.
*/
'additionalProperties' => array(
'type' => 'boolean',
),
),
),
'default' => array(),
Expand Down
5 changes: 5 additions & 0 deletions lib/experimental/experiments/react-19.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,20 @@ function gutenberg_get_react_19_incompatible_plugins() {
'adminify/adminify.php' => null,
'advanced-coupons-for-woocommerce-free/advanced-coupons-for-woocommerce-free.php' => null,
'advanced-coupons-for-woocommerce/advanced-coupons-for-woocommerce.php' => null,
'astra-pro-sites/astra-pro-sites.php' => null,
'astra-sites/astra-sites.php' => null,
'beehive-analytics/beehive-analytics.php' => null,
'brave-popup-builder/index.php' => null,
'bravepopup-pro/index.php' => null,
'classified-listing/classified-listing.php' => null,
'echo-rewards/echo-rewards.php' => null,
'forminator/forminator.php' => null,
'iron-security/iron-security.php' => null,
'llms-full-txt-generator/llms-txt-generator.php' => null,
'mail-mint/mail-mint.php' => null,
'meetinghub/meetinghub.php' => null,
'sb-analytics/sb-analytics-pro.php' => null,
'stackable-ultimate-gutenberg-blocks/plugin.php' => null,
'ultimate-blocks/ultimate-blocks.php' => '3.6.0',
'wp-letsencrypt-ssl-pro/wp-letsencrypt.php' => null,
'wp-post-author/aft-wp-post-author.php' => null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ exports[`AlignmentUI > should allow custom alignment controls to be specified 1`
>
<path
d="M4 5H13M4 12H20M4 19H13"
vector-effect="non-scaling-stroke"
/>
</svg>
</button>
Expand All @@ -56,7 +55,6 @@ exports[`AlignmentUI > should allow custom alignment controls to be specified 1`
>
<path
d="M7.5 5H16.5M4 12H20M7.5 19H16.5"
vector-effect="non-scaling-stroke"
/>
</svg>
</button>
Expand Down Expand Up @@ -92,7 +90,6 @@ exports[`AlignmentUI > should match snapshot when controls are hidden 1`] = `
>
<path
d="M4 5H13M4 12H20M4 19H13"
vector-effect="non-scaling-stroke"
/>
</svg>
</button>
Expand Down Expand Up @@ -129,7 +126,6 @@ exports[`AlignmentUI > should match snapshot when controls are visible 1`] = `
>
<path
d="M4 5H13M4 12H20M4 19H13"
vector-effect="non-scaling-stroke"
/>
</svg>
</button>
Expand All @@ -156,7 +152,6 @@ exports[`AlignmentUI > should match snapshot when controls are visible 1`] = `
>
<path
d="M7.5 5H16.5M4 12H20M7.5 19H16.5"
vector-effect="non-scaling-stroke"
/>
</svg>
</button>
Expand All @@ -183,7 +178,6 @@ exports[`AlignmentUI > should match snapshot when controls are visible 1`] = `
>
<path
d="M11 5H20M4 12H20M11 19H20"
vector-effect="non-scaling-stroke"
/>
</svg>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ exports[`BlockAlignmentUI > should match snapshot when controls are hidden 1`] =
>
<path
d="M5 4.75H13M5 19.25H13"
vector-effect="non-scaling-stroke"
/>
<rect
fill="currentColor"
Expand Down Expand Up @@ -71,7 +70,6 @@ exports[`BlockAlignmentUI > should match snapshot when controls are visible 1`]
>
<path
d="M5 5H19M5 19H19"
vector-effect="non-scaling-stroke"
/>
<rect
fill="currentColor"
Expand Down Expand Up @@ -105,7 +103,6 @@ exports[`BlockAlignmentUI > should match snapshot when controls are visible 1`]
>
<path
d="M5 4.75H13M5 19.25H13"
vector-effect="non-scaling-stroke"
/>
<rect
fill="currentColor"
Expand Down Expand Up @@ -139,7 +136,6 @@ exports[`BlockAlignmentUI > should match snapshot when controls are visible 1`]
>
<path
d="M5 4.75H19M5 19.25H19"
vector-effect="non-scaling-stroke"
/>
<rect
fill="currentColor"
Expand Down Expand Up @@ -173,7 +169,6 @@ exports[`BlockAlignmentUI > should match snapshot when controls are visible 1`]
>
<path
d="M11 4.75H19M11 19.25H19"
vector-effect="non-scaling-stroke"
/>
<rect
fill="currentColor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ exports[`BlockVerticalAlignmentUI > should match snapshot when controls are hidd
/>
<path
d="M4 4.75H20"
vector-effect="non-scaling-stroke"
/>
</svg>
</button>
Expand Down Expand Up @@ -79,7 +78,6 @@ exports[`BlockVerticalAlignmentUI > should match snapshot when controls are visi
/>
<path
d="M4 4.75H20"
vector-effect="non-scaling-stroke"
/>
</svg>
</button>
Expand All @@ -105,7 +103,6 @@ exports[`BlockVerticalAlignmentUI > should match snapshot when controls are visi
>
<path
d="M4 12H20"
vector-effect="non-scaling-stroke"
/>
<rect
fill="currentColor"
Expand Down Expand Up @@ -139,7 +136,6 @@ exports[`BlockVerticalAlignmentUI > should match snapshot when controls are visi
>
<path
d="M4 19.25H20"
vector-effect="non-scaling-stroke"
/>
<rect
fill="currentColor"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ exports[`hooks > enhanceNavigationLinkVariations > enhances variations with icon
>
<Path
d="M8 12V8M8 4V8M8 8H12M8 8H4M8 8L10.8284 10.8284M8 8L5.17157 5.17157M8 8L10.8284 5.17157M8 8L5.17157 10.8284M4 15H20M4 19H13"
vectorEffect="non-scaling-stroke"
/>
</SVG>,
"isActive": [Function],
Expand All @@ -46,7 +45,6 @@ exports[`hooks > enhanceNavigationLinkVariations > enhances variations with icon
>
<Path
d="M7 10H8.5M10 10H17M7 14H8.5M10 14H17M6 19.25H18C18.6904 19.25 19.25 18.6904 19.25 18V6C19.25 5.30964 18.6904 4.75 18 4.75H6C5.30964 4.75 4.75 5.30964 4.75 6V18C4.75 18.6904 5.30964 19.25 6 19.25Z"
vectorEffect="non-scaling-stroke"
/>
</SVG>,
"isActive": [Function],
Expand All @@ -71,7 +69,6 @@ exports[`hooks > enhanceNavigationLinkVariations > enhances variations with icon
>
<Path
d="M8.5 8.25H15.5M8.5 11.75H15.5M8.5 15.25H15.5M18.25 18V6C18.25 5.30964 17.6904 4.75 17 4.75H7C6.30964 4.75 5.75 5.30964 5.75 6L5.75 18C5.75 18.6904 6.30964 19.25 7 19.25H17C17.6904 19.25 18.25 18.6904 18.25 18Z"
vectorEffect="non-scaling-stroke"
/>
</SVG>,
"isActive": [Function],
Expand All @@ -96,19 +93,15 @@ exports[`hooks > enhanceNavigationLinkVariations > enhances variations with icon
>
<Path
d="M4.75 6C4.75 5.30964 5.30964 4.75 6 4.75H9C9.69036 4.75 10.25 5.30964 10.25 6V9C10.25 9.69036 9.69036 10.25 9 10.25H6C5.30964 10.25 4.75 9.69036 4.75 9V6Z"
vectorEffect="non-scaling-stroke"
/>
<Path
d="M4.75 15C4.75 14.3096 5.30964 13.75 6 13.75H9C9.69036 13.75 10.25 14.3096 10.25 15V18C10.25 18.6904 9.69036 19.25 9 19.25H6C5.30964 19.25 4.75 18.6904 4.75 18V15Z"
vectorEffect="non-scaling-stroke"
/>
<Path
d="M13.75 6C13.75 5.30964 14.3096 4.75 15 4.75H18C18.6904 4.75 19.25 5.30964 19.25 6V9C19.25 9.69036 18.6904 10.25 18 10.25H15C14.3096 10.25 13.75 9.69036 13.75 9V6Z"
vectorEffect="non-scaling-stroke"
/>
<Path
d="M13.75 15C13.75 14.3096 14.3096 13.75 15 13.75H18C18.6904 13.75 19.25 14.3096 19.25 15V18C19.25 18.6904 18.6904 19.25 18 19.25H15C14.3096 19.25 13.75 18.6904 13.75 18V15Z"
vectorEffect="non-scaling-stroke"
/>
</SVG>,
"isActive": [Function],
Expand All @@ -133,7 +126,6 @@ exports[`hooks > enhanceNavigationLinkVariations > enhances variations with icon
>
<Path
d="M4.75 12.5429V4.85C4.75 4.79477 4.79477 4.75 4.85 4.75H12.5429C12.6755 4.75 12.8027 4.80268 12.8964 4.89645L20.1464 12.1464C20.3417 12.3417 20.3417 12.6583 20.1464 12.8536L12.8536 20.1464C12.6583 20.3417 12.3417 20.3417 12.1464 20.1464L4.89645 12.8964C4.80268 12.8027 4.75 12.6755 4.75 12.5429Z"
vectorEffect="non-scaling-stroke"
/>
<Path
d="M9.75 8.75a1 1 0 1 1-2 0 1 1 0 0 1 2 0Z"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Snapshot Diff:
- First value
+ Second value

@@ -18,10 +18,28 @@
@@ -18,10 +18,27 @@
class="components-checkbox-control__input"
id="checkbox-control"
type="checkbox"
Expand All @@ -26,7 +26,6 @@ Snapshot Diff:
+ >
+ <path
+ d="M7 12H17"
+ vector-effect="non-scaling-stroke"
+ />
+ </svg>
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ exports[`MenuItem > should match snapshot when all props provided 1`] = `
>
<path
d="M4 10H20M4 14H8M10 14H14M16 14H20"
vector-effect="non-scaling-stroke"
/>
</svg>
</button>
Expand Down Expand Up @@ -94,7 +93,6 @@ exports[`MenuItem > should match snapshot when isSelected and role are optionall
>
<path
d="M4 10H20M4 14H8M10 14H14M16 14H20"
vector-effect="non-scaling-stroke"
/>
</svg>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ exports[`Notice > should match snapshot 1`] = `
>
<path
d="M7.75 16.25L16.25 7.75M16.25 16.25L7.75 7.75"
vector-effect="non-scaling-stroke"
/>
</svg>
</button>
Expand Down
38 changes: 38 additions & 0 deletions packages/e2e-tests/plugins/react-18-compat-block/editor.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
( function () {
const { registerBlockType } = wp.blocks;
const { useBlockProps } = wp.blockEditor;
const { createElement, memo } = wp.element;

// The externalized React JSX runtime (the `react-jsx-runtime` script
// handle). When the React 19 experiment is enabled this is React 19's
Expand Down Expand Up @@ -89,6 +90,23 @@
label: 'Hello from defaultProps',
};

// The same, wrapped in `memo()`. React 18 resolved the inner component's
// `defaultProps` in `updateMemoComponent`, not at element creation, so no
// runtime ever wrote them into the element. All three ways of creating the
// element are exercised — the classic `createElement`, the externalized JSX
// runtime, and the bundled React 18 one — because the fix has to live in
// the reconciler to cover the last of them.
function MemoGreetingBase( props ) {
return jsx( 'span', {
className: props.className,
children: props.label,
} );
}
MemoGreetingBase.defaultProps = {
label: 'Hello from memo defaultProps',
};
const MemoGreeting = memo( MemoGreetingBase );

registerBlockType( 'test/react-18-compat-block', {
apiVersion: 3,
edit: function Edit() {
Expand Down Expand Up @@ -122,6 +140,26 @@
// The `defaultProps` component, created with the
// externalized React runtime.
jsx( Greeting, {}, 'greeting' ),
createElement( MemoGreeting, {
key: 'memo-greeting',
className: 'react-18-compat-block__memo-greeting',
} ),
jsx(
MemoGreeting,
{
className:
'react-18-compat-block__memo-greeting-jsx',
},
'memo-greeting-jsx'
),
jsxDEV(
MemoGreeting,
{
className:
'react-18-compat-block__memo-greeting-legacy',
},
'memo-greeting-legacy'
),
],
} );
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ exports[`PluginPostPublishPanel > renders fill properly 1`] = `
>
<path
d="M7 13L12 9L17 13"
vector-effect="non-scaling-stroke"
/>
</svg>
</span>
Expand Down
Loading
Loading