diff --git a/changelog.txt b/changelog.txt index 62aadb76520c79..31b836a69e9103 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,100 @@ == Changelog == += 17.6.0-rc.3 = + + +## Changelog + +### Enhancements + +#### Block Library +- Aspect ratio: Remove support on the Group block for now. ([58414](https://github.com/WordPress/gutenberg/pull/58414)) +- Image block: Move UI for lightbox from sidebar to the content toolbar alongside link settings. ([57608](https://github.com/WordPress/gutenberg/pull/57608)) + +#### Font Library +- Improve font collection rest controller. ([58222](https://github.com/WordPress/gutenberg/pull/58222)) +- Make notices more consistent. ([58180](https://github.com/WordPress/gutenberg/pull/58180)) + +#### REST API +- Updates Font Families and Font Faces endpoints context param. ([58287](https://github.com/WordPress/gutenberg/pull/58287)) + +#### Patterns +- Change text on pattern reset button. ([58286](https://github.com/WordPress/gutenberg/pull/58286)) + +#### Template Editor +- Remove `template-only` mode from editor and edit-post packages. ([57700](https://github.com/WordPress/gutenberg/pull/57700)) + + +### Bug Fixes + +- Interactivity: Fix broken react usage in published package. ([58258](https://github.com/WordPress/gutenberg/pull/58258)) + +#### Data Views +- DataViews: Fix safari grid row height issue. ([58302](https://github.com/WordPress/gutenberg/pull/58302)) +- DataViews: Fix table view cell wrapper and BlockPreviews. ([58062](https://github.com/WordPress/gutenberg/pull/58062)) + +#### Typography +- Revert "Add defaultFontSizes option to theme.json (#56661)". ([58456](https://github.com/WordPress/gutenberg/pull/58456)) + +#### Block Library +- Block Hooks API: Update Navigation block feature gate. ([58388](https://github.com/WordPress/gutenberg/pull/58388)) + +#### Synced Patterns +- Block Bindings: Fix bindings image placeholder showing in patterns overrides. ([58252](https://github.com/WordPress/gutenberg/pull/58252)) + + +### Code Quality + +- Shadow: Remove additional wrapper around getShadowClassesAndStyles. ([58297](https://github.com/WordPress/gutenberg/pull/58297)) + +#### Block Library +- Block Hooks API: Remove $post check from Navigation hooked blocks meta fn. ([58379](https://github.com/WordPress/gutenberg/pull/58379)) +- Post navigation link: Coding standard fixes. ([58380](https://github.com/WordPress/gutenberg/pull/58380)) +- Update docblock for render_block_core_pattern. ([58382](https://github.com/WordPress/gutenberg/pull/58382)) +- Block Hooks API: Update doc block for block_core_navigation_insert_hooked_blocks. ([58378](https://github.com/WordPress/gutenberg/pull/58378)) + +#### Font Library +- Remove unused utilities and rename class. ([58342](https://github.com/WordPress/gutenberg/pull/58342)) +- Rename the slug of the google fonts collection from 'default-font-collection' to 'google-fonts'. ([58331](https://github.com/WordPress/gutenberg/pull/58331)) +- Refactored download/upload logic to support font faces with multiple src assets. ([58216](https://github.com/WordPress/gutenberg/pull/58216)) +- Font Library: Addresses additional REST API feedback. ([58333](https://github.com/WordPress/gutenberg/pull/58333)) + +#### Synced Patterns +- Block Bindings: Change `core/pattern-attributes` source for `core/pattern-overrides`. ([58434](https://github.com/WordPress/gutenberg/pull/58434)) + +#### Custom Fields +- Block Bindings: Simplify block bindings object. ([58337](https://github.com/WordPress/gutenberg/pull/58337)) +- Block Bindings: Adapt block bindings to wordpress code latest changes. ([58383](https://github.com/WordPress/gutenberg/pull/58383)) + + + +## Contributors + +The following contributors merged PRs in this release: + +@andrewserong @artemiomorales @c4rl0sbr4v0 @carolinan @creativecoder @dsas @glendaviesnz @madhusudhand @matiasbenedetto @mikachan @ntsekouras @pbking @SantosGuillamot @sirreal @tjcafferkey + + += 17.5.3 = + + +## Changelog + +### Bug Fixes + +#### Block Library +- Navigation: Update the navigaiton renderer class name so that it doesn't clash with the one backported to core. ([58429](https://github.com/WordPress/gutenberg/pull/58429)) + + + + +## Contributors + +The following contributors merged PRs in this release: + +@scruffian + + = 17.6.0-rc.2 = ## Changelog diff --git a/docs/contributors/code/back-merging-to-wp-core.md b/docs/contributors/code/back-merging-to-wp-core.md index 2b1ec77df1e550..c01fd74382fbca 100644 --- a/docs/contributors/code/back-merging-to-wp-core.md +++ b/docs/contributors/code/back-merging-to-wp-core.md @@ -2,14 +2,16 @@ For major releases of the WordPress software, Gutenberg features need to be merged into WordPress Core. Typically this involves taking changes made in `.php` files within the Gutenberg repository and making the equivalent updates in the WP Core codebase. -## Files/Directories +## Criteria + +### Files/Directories Changes to files within the following files/directories will typically require back-merging to WP Core: - `lib/` - `phpunit/` -## Ignored directories/files +### Ignored directories/files The following directories/files do _not_ require back-merging to WP Core: @@ -21,11 +23,16 @@ The following directories/files do _not_ require back-merging to WP Core: Please note this list is not exhaustive. -## Pull Request Criteria +### Pull Request Criteria In general, all PHP code committed to the Gutenberg repository since the date of the final Gutenberg release that was included in [the _last_ stable WP Core release](https://developer.wordpress.org/block-editor/contributors/versions-in-wordpress/) should be considered for back merging to WP Core. There are however certain exceptions to that rule. PRs with the following criteria do _not_ require back-merging to WP Core: - Does not contain changes to PHP code. -- Has label `Backport from WordPress Core` - this code is already in WP Core. +- Has label `Backport from WordPress Core` - this code is already in WP Core and is being synchronized back to Gutenberg. +- Has label `Backport to WordPress Core` - this code has already been syncrhonized to WP Core. + +## Further Reading + +Please see also additional documentation regarding [Gutenberg PHP code](/lib/README.md). diff --git a/docs/reference-guides/theme-json-reference/theme-json-living.md b/docs/reference-guides/theme-json-reference/theme-json-living.md index d9389597b89da2..c58b8b3239f33e 100644 --- a/docs/reference-guides/theme-json-reference/theme-json-living.md +++ b/docs/reference-guides/theme-json-reference/theme-json-living.md @@ -177,7 +177,6 @@ Settings related to typography. | Property | Type | Default | Props | | --- | --- | --- |--- | -| defaultFontSizes | boolean | true | | | customFontSize | boolean | true | | | fontStyle | boolean | true | | | fontWeight | boolean | true | | diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 2ebebeaaaf3075..e23b0c88dd7070 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -155,7 +155,7 @@ class WP_Theme_JSON_Gutenberg { ), array( 'path' => array( 'typography', 'fontSizes' ), - 'prevent_override' => array( 'typography', 'defaultFontSizes' ), + 'prevent_override' => false, 'use_default_names' => true, 'value_func' => 'gutenberg_get_typography_font_size_value', 'css_vars' => '--wp--preset--font-size--$slug', @@ -413,20 +413,19 @@ class WP_Theme_JSON_Gutenberg { 'defaultPresets' => null, ), 'typography' => array( - 'fluid' => null, - 'customFontSize' => null, - 'defaultFontSizes' => null, - 'dropCap' => null, - 'fontFamilies' => null, - 'fontSizes' => null, - 'fontStyle' => null, - 'fontWeight' => null, - 'letterSpacing' => null, - 'lineHeight' => null, - 'textColumns' => null, - 'textDecoration' => null, - 'textTransform' => null, - 'writingMode' => null, + 'fluid' => null, + 'customFontSize' => null, + 'dropCap' => null, + 'fontFamilies' => null, + 'fontSizes' => null, + 'fontStyle' => null, + 'fontWeight' => null, + 'letterSpacing' => null, + 'lineHeight' => null, + 'textColumns' => null, + 'textDecoration' => null, + 'textTransform' => null, + 'writingMode' => null, ), ); diff --git a/lib/compat/wordpress-6.4/script-loader.php b/lib/compat/wordpress-6.4/script-loader.php index 217cdef053789e..373bb9e90f8583 100644 --- a/lib/compat/wordpress-6.4/script-loader.php +++ b/lib/compat/wordpress-6.4/script-loader.php @@ -5,97 +5,6 @@ * @package gutenberg */ -/** - * Updates the registered inline script `wp-date` required for moment.js localization. - * Changes to the inline script output should be synced with Core in the file - * src/wp-includes/script-loader.php in `wp_default_packages_inline_scripts()`. - * - * @since 6.4.0 - * - * @global WP_Locale $wp_locale WordPress date and time locale object. - * - * @param WP_Scripts $scripts WP_Scripts object. - */ -function gutenberg_update_wp_date_settings( $scripts ) { - if ( did_action( 'init' ) && $scripts->query( 'wp-date', 'registered' ) ) { - global $wp_locale; - // Calculate the timezone abbr (EDT, PST) if possible. - $timezone_string = get_option( 'timezone_string', 'UTC' ); - $timezone_abbr = ''; - - if ( ! empty( $timezone_string ) ) { - $timezone_date = new DateTime( 'now', new DateTimeZone( $timezone_string ) ); - $timezone_abbr = $timezone_date->format( 'T' ); - } - $scripts->registered['wp-date']->extra['after'] = array( - false, - sprintf( - 'wp.date.setSettings( %s );', - wp_json_encode( - array( - 'l10n' => array( - 'locale' => get_user_locale(), - 'months' => array_values( $wp_locale->month ), - 'monthsShort' => array_values( $wp_locale->month_abbrev ), - 'weekdays' => array_values( $wp_locale->weekday ), - 'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ), - 'meridiem' => (object) $wp_locale->meridiem, - 'relative' => array( - /* translators: %s: Duration. */ - 'future' => __( '%s from now', 'gutenberg' ), - /* translators: %s: Duration. */ - 'past' => __( '%s ago', 'gutenberg' ), - /* translators: One second from or to a particular datetime, e.g., "a second ago" or "a second from now". */ - 's' => __( 'a second', 'gutenberg' ), - /* translators: %s: Duration in seconds from or to a particular datetime, e.g., "4 seconds ago" or "4 seconds from now". */ - 'ss' => __( '%d seconds', 'gutenberg' ), - /* translators: One minute from or to a particular datetime, e.g., "a minute ago" or "a minute from now". */ - 'm' => __( 'a minute', 'gutenberg' ), - /* translators: %s: Duration in minutes from or to a particular datetime, e.g., "4 minutes ago" or "4 minutes from now". */ - 'mm' => __( '%d minutes', 'gutenberg' ), - /* translators: %s: One hour from or to a particular datetime, e.g., "an hour ago" or "an hour from now". */ - 'h' => __( 'an hour', 'gutenberg' ), - /* translators: %s: Duration in hours from or to a particular datetime, e.g., "4 hours ago" or "4 hours from now". */ - 'hh' => __( '%d hours', 'gutenberg' ), - /* translators: %s: One day from or to a particular datetime, e.g., "a day ago" or "a day from now". */ - 'd' => __( 'a day', 'gutenberg' ), - /* translators: %s: Duration in days from or to a particular datetime, e.g., "4 days ago" or "4 days from now". */ - 'dd' => __( '%d days', 'gutenberg' ), - /* translators: %s: One month from or to a particular datetime, e.g., "a month ago" or "a month from now". */ - 'M' => __( 'a month', 'gutenberg' ), - /* translators: %s: Duration in months from or to a particular datetime, e.g., "4 months ago" or "4 months from now". */ - 'MM' => __( '%d months', 'gutenberg' ), - /* translators: %s: One year from or to a particular datetime, e.g., "a year ago" or "a year from now". */ - 'y' => __( 'a year', 'gutenberg' ), - /* translators: %s: Duration in years from or to a particular datetime, e.g., "4 years ago" or "4 years from now". */ - 'yy' => __( '%d years', 'gutenberg' ), - ), - 'startOfWeek' => (int) get_option( 'start_of_week', 0 ), - ), - 'formats' => array( - /* translators: Time format, see https://www.php.net/manual/datetime.format.php */ - 'time' => get_option( 'time_format', __( 'g:i a', 'default' ) ), - /* translators: Date format, see https://www.php.net/manual/datetime.format.php */ - 'date' => get_option( 'date_format', __( 'F j, Y', 'default' ) ), - /* translators: Date/Time format, see https://www.php.net/manual/datetime.format.php */ - 'datetime' => __( 'F j, Y g:i a', 'default' ), - /* translators: Abbreviated date/time format, see https://www.php.net/manual/datetime.format.php */ - 'datetimeAbbreviated' => __( 'M j, Y g:i a', 'default' ), - ), - 'timezone' => array( - 'offset' => (float) get_option( 'gmt_offset', 0 ), - 'string' => $timezone_string, - 'abbr' => $timezone_abbr, - ), - ) - ) - ), - ); - } -} - -add_action( 'wp_default_scripts', 'gutenberg_update_wp_date_settings' ); - /** * Collect the block editor assets that need to be loaded into the editor's iframe. * diff --git a/lib/compat/wordpress-6.5/block-bindings/sources/pattern.php b/lib/compat/wordpress-6.5/block-bindings/sources/pattern.php index b43484660f1f8e..503723596bf9cc 100644 --- a/lib/compat/wordpress-6.5/block-bindings/sources/pattern.php +++ b/lib/compat/wordpress-6.5/block-bindings/sources/pattern.php @@ -28,14 +28,14 @@ function gutenberg_block_bindings_pattern_overrides_callback( $source_attrs, $bl } function gutenberg_register_block_bindings_pattern_overrides_source() { - // Override the "core/pattern-attributes" source from core. - if ( array_key_exists( 'core/pattern-attributes', get_all_registered_block_bindings_sources() ) ) { - unregister_block_bindings_source( 'core/pattern-attributes' ); + // Override the "core/pattern-overrides" source from core. + if ( array_key_exists( 'core/pattern-overrides', get_all_registered_block_bindings_sources() ) ) { + unregister_block_bindings_source( 'core/pattern-overrides' ); } register_block_bindings_source( - 'core/pattern-attributes', + 'core/pattern-overrides', array( - 'label' => __( 'Pattern Attributes' ), + 'label' => _x( 'Pattern Overrides', 'block bindings source' ), 'get_value_callback' => 'gutenberg_block_bindings_pattern_overrides_callback', ) ); diff --git a/lib/compat/wordpress-6.5/block-bindings/sources/post-meta.php b/lib/compat/wordpress-6.5/block-bindings/sources/post-meta.php index 4166ed3243ef0d..e9b84108e52a34 100644 --- a/lib/compat/wordpress-6.5/block-bindings/sources/post-meta.php +++ b/lib/compat/wordpress-6.5/block-bindings/sources/post-meta.php @@ -17,6 +17,13 @@ function gutenberg_block_bindings_post_meta_callback( $source_attrs ) { $post_id = get_the_ID(); } + // If a post isn't public, we need to prevent + // unauthorized users from accessing the post meta. + $post = get_post( $post_id ); + if ( ( $post && 'publish' !== $post->post_status && ! current_user_can( 'read_post', $post_id ) ) || post_password_required( $post_id ) ) { + return null; + } + return get_post_meta( $post_id, $source_attrs['key'], true ); } @@ -28,7 +35,7 @@ function gutenberg_register_block_bindings_post_meta_source() { register_block_bindings_source( 'core/post-meta', array( - 'label' => __( 'Post Meta' ), + 'label' => _x( 'Post Meta', 'block bindings source' ), 'get_value_callback' => 'gutenberg_block_bindings_post_meta_callback', ) ); diff --git a/lib/compat/wordpress-6.5/script-loader.php b/lib/compat/wordpress-6.5/script-loader.php index 98efbab397e663..e556fa534be5f7 100644 --- a/lib/compat/wordpress-6.5/script-loader.php +++ b/lib/compat/wordpress-6.5/script-loader.php @@ -10,14 +10,15 @@ * Changes to the inline script output should be synced with Core in the file * src/wp-includes/script-loader.php in `wp_default_packages_inline_scripts()`. * - * @since 6.5.0 + * @since 6.4.0 Added relative time date strings. + * @since 6.5.0 Added timezone offset value. * * @global WP_Locale $wp_locale WordPress date and time locale object. * * @param WP_Scripts $scripts WP_Scripts object. */ -function gutenberg_update_wp_date_timezone_settings( $scripts ) { - if ( $scripts->query( 'wp-date', 'registered' ) ) { +function gutenberg_update_wp_date_settings( $scripts ) { + if ( did_action( 'init' ) && $scripts->query( 'wp-date', 'registered' ) ) { global $wp_locale; // Calculate the timezone abbr (EDT, PST) if possible. $timezone_string = get_option( 'timezone_string', 'UTC' ); @@ -98,4 +99,4 @@ function gutenberg_update_wp_date_timezone_settings( $scripts ) { } } -add_action( 'wp_default_scripts', 'gutenberg_update_wp_date_timezone_settings' ); +add_action( 'wp_default_scripts', 'gutenberg_update_wp_date_settings' ); diff --git a/lib/theme.json b/lib/theme.json index b7bc3cb89e60f2..c2ed7fdca39ed5 100644 --- a/lib/theme.json +++ b/lib/theme.json @@ -236,7 +236,6 @@ }, "typography": { "customFontSize": true, - "defaultFontSizes": true, "dropCap": true, "fontSizes": [ { diff --git a/package-lock.json b/package-lock.json index d20be6cb7e6d91..9571db9cad26ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gutenberg", - "version": "17.6.0-rc.2", + "version": "17.6.0-rc.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "gutenberg", - "version": "17.6.0-rc.2", + "version": "17.6.0-rc.3", "hasInstallScript": true, "license": "GPL-2.0-or-later", "dependencies": { diff --git a/package.json b/package.json index b5ec7663bc0b60..db2775d332627f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "17.6.0-rc.2", + "version": "17.6.0-rc.3", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", diff --git a/packages/block-editor/src/components/global-styles/hooks.js b/packages/block-editor/src/components/global-styles/hooks.js index 7c5cf4cbf3e0fa..6be5481a633daa 100644 --- a/packages/block-editor/src/components/global-styles/hooks.js +++ b/packages/block-editor/src/components/global-styles/hooks.js @@ -67,7 +67,6 @@ const VALID_SETTINGS = [ 'spacing.units', 'typography.fluid', 'typography.customFontSize', - 'typography.defaultFontSizes', 'typography.dropCap', 'typography.fontFamilies', 'typography.fontSizes', @@ -240,7 +239,6 @@ export function useSettingsForBlockElement( ...updatedSettings.typography, fontSizes: {}, customFontSize: false, - defaultFontSizes: false, }; } diff --git a/packages/block-editor/src/components/global-styles/typography-panel.js b/packages/block-editor/src/components/global-styles/typography-panel.js index cc8b0589644bd5..5347ddab922651 100644 --- a/packages/block-editor/src/components/global-styles/typography-panel.js +++ b/packages/block-editor/src/components/global-styles/typography-panel.js @@ -22,7 +22,7 @@ import TextTransformControl from '../text-transform-control'; import TextDecorationControl from '../text-decoration-control'; import WritingModeControl from '../writing-mode-control'; import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils'; -import { setImmutably, uniqByProperty } from '../../utils/object'; +import { setImmutably } from '../../utils/object'; const MIN_TEXT_COLUMNS = 1; const MAX_TEXT_COLUMNS = 6; @@ -53,10 +53,7 @@ export function useHasTypographyPanel( settings ) { function useHasFontSizeControl( settings ) { return ( - ( settings?.typography?.defaultFontSizes !== false && - settings?.typography?.fontSizes?.default?.length ) || - settings?.typography?.fontSizes?.theme?.length || - settings?.typography?.fontSizes?.custom?.length || + hasMergedOrigins( settings?.typography?.fontSizes ) || settings?.typography?.customFontSize ); } @@ -103,45 +100,16 @@ function useHasTextColumnsControl( settings ) { return settings?.typography?.textColumns; } -/** - * TODO: The reversing and filtering of default font sizes is a hack so the - * dropdown UI matches what is generated in the global styles CSS stylesheet. - * - * This is a temporary solution until #57733 is resolved. At which point, - * the mergedFontSizes would just need to be the concatenated array of all - * presets or a custom dropdown with sections for each. - * - * @see {@link https://github.com/WordPress/gutenberg/issues/57733} - * - * @param {Object} settings The global styles settings. - * - * @return {Array} The merged font sizes. - */ -function getMergedFontSizes( settings ) { - // The font size presets are merged in reverse order so that the duplicates - // that may defined later in the array have higher priority to match the CSS. - const mergedFontSizesAll = uniqByProperty( - [ - settings?.typography?.fontSizes?.custom, - settings?.typography?.fontSizes?.theme, - settings?.typography?.fontSizes?.default, - ].flatMap( ( presets ) => presets?.toReversed() ?? [] ), - 'slug' - ).reverse(); - - // Default presets exist in the global styles CSS no matter the setting, so - // filtering them out in the UI has to be done after merging. - const mergedFontSizes = - settings?.typography?.defaultFontSizes === false - ? mergedFontSizesAll.filter( - ( { slug } ) => - ! [ 'small', 'medium', 'large', 'x-large' ].includes( - slug - ) - ) - : mergedFontSizesAll; - - return mergedFontSizes; +function getUniqueFontSizesBySlug( settings ) { + const fontSizes = settings?.typography?.fontSizes; + const mergedFontSizes = fontSizes ? mergeOrigins( fontSizes ) : []; + const uniqueSizes = []; + for ( const currentSize of mergedFontSizes ) { + if ( ! uniqueSizes.some( ( { slug } ) => slug === currentSize.slug ) ) { + uniqueSizes.push( currentSize ); + } + } + return uniqueSizes; } function TypographyToolsPanel( { @@ -217,7 +185,7 @@ export default function TypographyPanel( { // Font Size const hasFontSizeEnabled = useHasFontSizeControl( settings ); const disableCustomFontSizes = ! settings?.typography?.customFontSize; - const mergedFontSizes = getMergedFontSizes( settings ); + const mergedFontSizes = getUniqueFontSizesBySlug( settings ); const fontSize = decodeValue( inheritedValue?.typography?.fontSize ); const setFontSize = ( newValue, metadata ) => { diff --git a/packages/block-editor/src/hooks/utils.js b/packages/block-editor/src/hooks/utils.js index f13963933e5225..2f7a8f3a81f19d 100644 --- a/packages/block-editor/src/hooks/utils.js +++ b/packages/block-editor/src/hooks/utils.js @@ -177,10 +177,7 @@ export function useBlockSettings( name, parentLayout ) { backgroundImage, backgroundSize, fontFamilies, - userFontSizes, - themeFontSizes, - defaultFontSizes, - defaultFontSizesEnabled, + fontSizes, customFontSize, fontStyle, fontWeight, @@ -227,10 +224,7 @@ export function useBlockSettings( name, parentLayout ) { 'background.backgroundImage', 'background.backgroundSize', 'typography.fontFamilies', - 'typography.fontSizes.custom', - 'typography.fontSizes.theme', - 'typography.fontSizes.default', - 'typography.defaultFontSizes', + 'typography.fontSizes', 'typography.customFontSize', 'typography.fontStyle', 'typography.fontWeight', @@ -314,12 +308,9 @@ export function useBlockSettings( name, parentLayout ) { custom: fontFamilies, }, fontSizes: { - custom: userFontSizes, - theme: themeFontSizes, - default: defaultFontSizes, + custom: fontSizes, }, customFontSize, - defaultFontSizes: defaultFontSizesEnabled, fontStyle, fontWeight, lineHeight, @@ -356,10 +347,7 @@ export function useBlockSettings( name, parentLayout ) { backgroundImage, backgroundSize, fontFamilies, - userFontSizes, - themeFontSizes, - defaultFontSizes, - defaultFontSizesEnabled, + fontSizes, customFontSize, fontStyle, fontWeight, diff --git a/packages/block-editor/src/utils/object.js b/packages/block-editor/src/utils/object.js index c78fe0e656dfef..8f6c82a9c3991e 100644 --- a/packages/block-editor/src/utils/object.js +++ b/packages/block-editor/src/utils/object.js @@ -49,19 +49,3 @@ export const getValueFromObjectPath = ( object, path, defaultValue ) => { } ); return value ?? defaultValue; }; - -/** - * Helper util to filter out objects with duplicate values for a given property. - * - * @param {Object[]} array Array of objects to filter. - * @param {string} property Property to filter unique values by. - * - * @return {Object[]} Array of objects with unique values for the specified property. - */ -export function uniqByProperty( array, property ) { - const seen = new Set(); - return array.filter( ( item ) => { - const value = item[ property ]; - return seen.has( value ) ? false : seen.add( value ); - } ); -} diff --git a/packages/block-library/src/block/edit.js b/packages/block-library/src/block/edit.js index b76b655ee0d943..c940f36e1a8b86 100644 --- a/packages/block-library/src/block/edit.js +++ b/packages/block-library/src/block/edit.js @@ -45,14 +45,14 @@ function isPartiallySynced( block ) { ) && !! block.attributes.metadata?.bindings && Object.values( block.attributes.metadata.bindings ).some( - ( binding ) => binding.source === 'core/pattern-attributes' + ( binding ) => binding.source === 'core/pattern-overrides' ) ); } function getPartiallySyncedAttributes( block ) { return Object.entries( block.attributes.metadata.bindings ) .filter( - ( [ , binding ] ) => binding.source === 'core/pattern-attributes' + ( [ , binding ] ) => binding.source === 'core/pattern-overrides' ) .map( ( [ attributeKey ] ) => attributeKey ); } diff --git a/packages/block-library/src/cover/edit/inspector-controls.js b/packages/block-library/src/cover/edit/inspector-controls.js index 6ac708d0462232..9dcbc0c1acb05f 100644 --- a/packages/block-library/src/cover/edit/inspector-controls.js +++ b/packages/block-library/src/cover/edit/inspector-controls.js @@ -188,7 +188,8 @@ export default function CoverInspectorControls( { { showFocalPointPicker && ( diff --git a/packages/blocks/src/api/parser/convert-legacy-block.js b/packages/blocks/src/api/parser/convert-legacy-block.js index c993d450099912..c828a3f5db6c49 100644 --- a/packages/blocks/src/api/parser/convert-legacy-block.js +++ b/packages/blocks/src/api/parser/convert-legacy-block.js @@ -77,5 +77,37 @@ export function convertLegacyBlockNameAndAttributes( name, attributes ) { newAttributes.legacy = true; } + // The following code is only relevant for the Gutenberg plugin. + // It's a stand-alone if statement for dead-code elimination. + if ( process.env.IS_GUTENBERG_PLUGIN ) { + // Convert pattern overrides added during experimental phase. + // Only four blocks were supported initially. + // These checks can be removed in WordPress 6.6. + if ( + newAttributes.metadata?.bindings && + ( name === 'core/paragraph' || + name === 'core/heading' || + name === 'core/image' || + name === 'core/button' ) + ) { + const bindings = [ + 'content', + 'url', + 'title', + 'alt', + 'text', + 'linkTarget', + ]; + bindings.forEach( ( binding ) => { + if ( + newAttributes.metadata.bindings[ binding ]?.source?.name === + 'pattern_attributes' + ) { + newAttributes.metadata.bindings[ binding ].source = + 'core/pattern-overrides'; + } + } ); + } + } return [ name, newAttributes ]; } diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 65ed149e34c216..6080498d5e92ba 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -31,6 +31,7 @@ - `Tooltip` and `Button`: tidy up unit tests ([#57975](https://github.com/WordPress/gutenberg/pull/57975)). - `BorderControl`, `BorderBoxControl`: Replace style picker with ToggleGroupControl ([#57562](https://github.com/WordPress/gutenberg/pull/57562)). - `SlotFill`: fix typo in use-slot-fills return docs ([#57654](https://github.com/WordPress/gutenberg/pull/57654)) +- `Popover`: Adding `constrainTabbing` prop to `useDialog` hook ([#57962](https://github.com/WordPress/gutenberg/pull/57962)) ### Bug Fix diff --git a/packages/components/src/checkbox-control/stories/index.story.tsx b/packages/components/src/checkbox-control/stories/index.story.tsx index ce55cfb655a17c..6752ce07667cbd 100644 --- a/packages/components/src/checkbox-control/stories/index.story.tsx +++ b/packages/components/src/checkbox-control/stories/index.story.tsx @@ -13,6 +13,7 @@ import { useState } from '@wordpress/element'; */ import CheckboxControl from '..'; import { VStack } from '../../v-stack'; +import { HStack } from '../../h-stack'; const meta: Meta< typeof CheckboxControl > = { component: CheckboxControl, @@ -115,3 +116,46 @@ Indeterminate.args = { label: 'Select all', __nextHasNoMarginBottom: true, }; + +/** + * For more complex designs, a custom `