diff --git a/changelog.txt b/changelog.txt
index 9505059dd3b706..f88f39e5968db0 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,257 @@
== Changelog ==
+= 17.8.0-rc.1 =
+
+## Changelog
+
+### Features
+
+- Patterns: add bulk export patterns action. ([58897](https://github.com/WordPress/gutenberg/pull/58897))
+- Template editor/inspector: show and select related patterns. ([55091](https://github.com/WordPress/gutenberg/pull/55091))
+
+#### Layout
+- Add toggle for grid types and stabilise Grid block variation. ([59051](https://github.com/WordPress/gutenberg/pull/59051) and [59116](https://github.com/WordPress/gutenberg/pull/59116))
+- Add support for column and row span in grid children. ([58539](https://github.com/WordPress/gutenberg/pull/58539))
+
+
+### Enhancements
+
+- Patterns Page: Make category action button compact. ([59203](https://github.com/WordPress/gutenberg/pull/59203))
+- Block Editor: Use hooks instead of HoC in 'SkipToSelectedBlock'. ([59202](https://github.com/WordPress/gutenberg/pull/59202))
+- Font Library: Adds the ability to use generic() in font family names. ([59103](https://github.com/WordPress/gutenberg/pull/59103) and [59037](https://github.com/WordPress/gutenberg/pull/59037))
+- REST API Global Styles Revisions Controller: Return single revision only when it matches the parent id. ([59049](https://github.com/WordPress/gutenberg/pull/59049))
+- CSS & Styling: Tweak link focus outline styles in HTML anchor and custom CSS. ([59048](https://github.com/WordPress/gutenberg/pull/59048))
+- Data Views: Make 'All pages' view label consistent with template and patterns. ([59009](https://github.com/WordPress/gutenberg/pull/59009))
+- Script Modules API: Script Modules add deregister option. ([58830](https://github.com/WordPress/gutenberg/pull/58830))
+
+#### Custom Fields
+- Block Bindings: Lock editing of blocks by default. ([58787](https://github.com/WordPress/gutenberg/pull/58787))
+- Style engine: Rename at_rule to rules_groups and update test/docs. ([58922](https://github.com/WordPress/gutenberg/pull/58922))
+
+#### Block Library
+- Gallery: Set the 'defaultBlock' setting for inner blocks. ([59168](https://github.com/WordPress/gutenberg/pull/59168))
+- Remove the navigation edit button because it leads to a useless screen. ([59211](https://github.com/WordPress/gutenberg/pull/59211))
+- Set the 'defaultBlock' setting for Columns & List blocks. ([59196](https://github.com/WordPress/gutenberg/pull/59196))
+- Update: Increase footnotes meta priority and separate footnotes meta registration. ([58882](https://github.com/WordPress/gutenberg/pull/58882))
+
+#### Site Editor
+- Editor: Hide template part and post content blocks in some site editor contexts. ([58928](https://github.com/WordPress/gutenberg/pull/58928))
+- Tweak save hub button. ([58917](https://github.com/WordPress/gutenberg/pull/58917) and [59200](https://github.com/WordPress/gutenberg/pull/59200))
+
+#### Components
+- CustomSelect: Adapt component for legacy props. ([57902](https://github.com/WordPress/gutenberg/pull/57902))
+- Use `Element.scrollIntoView()` instead of `dom-scroll-into-view`. ([59085](https://github.com/WordPress/gutenberg/pull/59085))
+
+#### Global Styles
+- Global style changes: Refactor output for a more flexible UI and grouping. ([59055](https://github.com/WordPress/gutenberg/pull/59055))
+- Style theme variations: Add property extraction and merge utils. ([58803](https://github.com/WordPress/gutenberg/pull/58803))
+
+
+### Bug Fixes
+
+- Distraction Free Mode: fix ui toggling bugs. ([59061](https://github.com/WordPress/gutenberg/pull/59061))
+- Layout: Refactor responsive logic for grid column spans. ([59057](https://github.com/WordPress/gutenberg/pull/59057))
+- Interactivity API: Only add proxies to plain objects inside the store. ([59039](https://github.com/WordPress/gutenberg/pull/59039))
+- Block Hooks: Fix in Navigation block. ([59021](https://github.com/WordPress/gutenberg/pull/59021))
+
+#### List View
+- Editor: Do not open list view by default on mobile. ([59016](https://github.com/WordPress/gutenberg/pull/59016))
+- Create Block: Add missing `viewScriptModule` field. ([59140](https://github.com/WordPress/gutenberg/pull/59140))
+- Ignore the 'twentytwentyfour' test theme dir created by wp-env. ([59072](https://github.com/WordPress/gutenberg/pull/59072))
+- useEntityBlockEditor: Update 'content' type check. ([59058](https://github.com/WordPress/gutenberg/pull/59058))
+
+#### Block Library
+- Author, Author Bio, Author Name: Add a fallback for Author Archive Template. ([55451](https://github.com/WordPress/gutenberg/pull/55451))
+- Fix Spacer orientation when inside a block with default flex layout. ([58921](https://github.com/WordPress/gutenberg/pull/58921))
+- Fix WP 6.4/6.3 compat for navigation link variations. ([59126](https://github.com/WordPress/gutenberg/pull/59126))
+- Interactivity API: Fix server side rendering for Search block. ([59029](https://github.com/WordPress/gutenberg/pull/59029))
+- Navigation: Avoid using embedded record from fallback API. ([59076](https://github.com/WordPress/gutenberg/pull/59076))
+- Pagination Numbers: Add `data-wp-key` to pagination numbers if enhanced pagination is enabled. ([58189](https://github.com/WordPress/gutenberg/pull/58189))
+- Revert "Navigation: Refactor mobile overlay breakpoints to JS (#57520)". ([59149](https://github.com/WordPress/gutenberg/pull/59149))
+- Spacer block: Fix `null` label in tooltip when horizontal layout. ([58909](https://github.com/WordPress/gutenberg/pull/58909))
+
+#### Data Views
+- DataViews: Add loading/no results message in grid view. ([59002](https://github.com/WordPress/gutenberg/pull/59002))
+- DataViews: Correctly display featured image that don't have image sizes. ([59111](https://github.com/WordPress/gutenberg/pull/59111))
+- DataViews: Fix pages list back path. ([59201](https://github.com/WordPress/gutenberg/pull/59201))
+- DataViews: Fix patterns, templates and template parts pagination `z-index`. ([58965](https://github.com/WordPress/gutenberg/pull/58965))
+- DataViews: Fix storybook. ([58842](https://github.com/WordPress/gutenberg/pull/58842))
+- DataViews: Remove second `reset filter` button in filter dialog. ([58960](https://github.com/WordPress/gutenberg/pull/58960))
+- Revert footer in pages list with DataViews. ([59151](https://github.com/WordPress/gutenberg/pull/59151))
+
+#### Block Editor
+- After Enter transform, skip other onEnter actions like splitting. ([59064](https://github.com/WordPress/gutenberg/pull/59064))
+- Close link preview if collapsed selection when creating link. ([58896](https://github.com/WordPress/gutenberg/pull/58896))
+- Editor: Limit spotlight mode to the editor. ([58817](https://github.com/WordPress/gutenberg/pull/58817))
+- Fix incorrect useAnchor positioning when switching from virtual to rich text elements. ([58900](https://github.com/WordPress/gutenberg/pull/58900))
+- Inserter: Don't select the closest block with 'disabled' editing mode. ([58971](https://github.com/WordPress/gutenberg/pull/58971))
+- Inserter: Fix title condition for media tab previews. ([58993](https://github.com/WordPress/gutenberg/pull/58993))
+
+#### Site Editor
+- Fix navigation on mobile web. ([59014](https://github.com/WordPress/gutenberg/pull/59014))
+- Fix: Don't render the Transform Into panel if there are no patterns. ([59217](https://github.com/WordPress/gutenberg/pull/59217))
+- Fix: Logical error in filterPatterns on template-panel/hooks.js. ([59218](https://github.com/WordPress/gutenberg/pull/59218))
+- Make command palette string transatables. ([59133](https://github.com/WordPress/gutenberg/pull/59133))
+- Remove left margin on Status help text. ([58775](https://github.com/WordPress/gutenberg/pull/58775))
+
+#### Patterns
+- Allow editing of image block alt and title attributes in content only mode. ([58998](https://github.com/WordPress/gutenberg/pull/58998))
+- Avoid showing block removal warning when deleting a pattern instance that has overrides. ([59044](https://github.com/WordPress/gutenberg/pull/59044))
+- Block editor: Pass patterns selector as setting. ([58661](https://github.com/WordPress/gutenberg/pull/58661))
+- Fix pattern categories on import. ([58926](https://github.com/WordPress/gutenberg/pull/58926))
+- Site editor: Fix start patterns store selector. ([58813](https://github.com/WordPress/gutenberg/pull/58813))
+
+#### Global Styles
+- Fix console error in block preview. ([59112](https://github.com/WordPress/gutenberg/pull/59112))
+- Revert "Use all the settings origins for a block that consumes paths with merge #55219" ([58951](https://github.com/WordPress/gutenberg/pull/58951) and [59101](https://github.com/WordPress/gutenberg/pull/59101))
+- Shadows: Don't assume that core provides default shadows. ([58973](https://github.com/WordPress/gutenberg/pull/58973))
+
+#### Font Library
+- Fixes installed font families not rendering in the editor or frontend. ([59019](https://github.com/WordPress/gutenberg/pull/59019))
+- Font Libary: Add missing translation functions. ([58104](https://github.com/WordPress/gutenberg/pull/58104))
+- Show error message when no fonts found to install. ([58914](https://github.com/WordPress/gutenberg/pull/58914))
+
+#### Synced Patterns
+- Fix missing source for binding attributes. ([59194](https://github.com/WordPress/gutenberg/pull/59194))
+- Fix resetting individual blocks to empty optional values for Pattern Overrides. ([59170](https://github.com/WordPress/gutenberg/pull/59170))
+- Fix upload button on overridden empty image block in patterns. ([59169](https://github.com/WordPress/gutenberg/pull/59169))
+
+#### Design Tools
+- Background image support: Fix issue with background position keyboard entry. ([59050](https://github.com/WordPress/gutenberg/pull/59050))
+- Cover block: Clear the min height field when aspect ratio is set. ([59191](https://github.com/WordPress/gutenberg/pull/59191))
+- Elements: Fix block instance element styles for links applying to buttons. ([59114](https://github.com/WordPress/gutenberg/pull/59114))
+
+#### Components
+- Modal: Add `box-sizing` reset style. ([58905](https://github.com/WordPress/gutenberg/pull/58905))
+- ToolbarButton: Fix text centering for short labels. ([59117](https://github.com/WordPress/gutenberg/pull/59117))
+- Upgrade Floating UI packages, fix nested iframe positioning bug. ([58932](https://github.com/WordPress/gutenberg/pull/58932))
+
+#### Post Editor
+- Editor: Fix 'useHideBlocksFromInserter' hook filename. ([59150](https://github.com/WordPress/gutenberg/pull/59150))
+- Fix layout for non viewable post types. ([58962](https://github.com/WordPress/gutenberg/pull/58962))
+
+#### Rich Text
+- Fix link paste for internal paste. ([59063](https://github.com/WordPress/gutenberg/pull/59063))
+- Revert "Rich text: Pad multiple spaces through en/em replacement". ([58792](https://github.com/WordPress/gutenberg/pull/58792))
+
+#### Custom Fields
+- Block Bindings: Add block context needed for bindings in PHP. ([58554](https://github.com/WordPress/gutenberg/pull/58554))
+- Block Bindings: Fix disable bindings editing when source is undefined. ([58961](https://github.com/WordPress/gutenberg/pull/58961))
+
+
+### Accessibility
+
+- Enter editing mode via Enter or Spacebar. ([58795](https://github.com/WordPress/gutenberg/pull/58795))
+- Block Bindings > Image Block:Mark connected controls as 'readonly'. ([59059](https://github.com/WordPress/gutenberg/pull/59059))
+- Details Block: Try double enter to escape inner blocks. ([58903](https://github.com/WordPress/gutenberg/pull/58903))
+- Font Library: Replace infinite scroll by pagination. ([58794](https://github.com/WordPress/gutenberg/pull/58794))
+- Global Styles: Remove menubar role and improve complementary area header semantics. ([58740](https://github.com/WordPress/gutenberg/pull/58740))
+
+#### Block Editor
+- Block Mover: Unify visual separator when show button label is on. ([59158](https://github.com/WordPress/gutenberg/pull/59158))
+- Make the custom CSS validation error message accessible. ([56690](https://github.com/WordPress/gutenberg/pull/56690))
+- Restore default border and focus style on image URL input field. ([58505](https://github.com/WordPress/gutenberg/pull/58505))
+
+### Performance
+
+- Pattern Block: Batch replacing actions. ([59075](https://github.com/WordPress/gutenberg/pull/59075))
+- Block Editor: Move StopEditingAsBlocksOnOutsideSelect to Root. ([58412](https://github.com/WordPress/gutenberg/pull/58412))
+
+
+### Documentation
+
+- Add contributing guidlines around Component versioning. ([58789](https://github.com/WordPress/gutenberg/pull/58789))
+- Clarify the performance reference commit and how to pick it. ([58927](https://github.com/WordPress/gutenberg/pull/58927))
+- DataViews: Update documentation. ([58847](https://github.com/WordPress/gutenberg/pull/58847))
+- Docs: Clarify the status of the wp-block-styles theme support, and its intent. ([58915](https://github.com/WordPress/gutenberg/pull/58915))
+- Fix move interactivity schema to supports property instead of selectors property. ([59166](https://github.com/WordPress/gutenberg/pull/59166))
+- Storybook: Show badges in sidebar. ([58518](https://github.com/WordPress/gutenberg/pull/58518))
+- Theme docs: Update appearance-tools documentation to reflect opt-in for backgroundSize and aspectRatio. ([59165](https://github.com/WordPress/gutenberg/pull/59165))
+- Update richtext.md. ([59089](https://github.com/WordPress/gutenberg/pull/59089))
+
+#### Interactivity API
+- Interactivity API: Fix WP version, update new store documentation. ([59107](https://github.com/WordPress/gutenberg/pull/59107))
+- Interactivity API: Update documentation guide with new `wp-interactivity` directive implementation. ([59018](https://github.com/WordPress/gutenberg/pull/59018))
+- Add interactivity property to block supports reference documentation. ([59152](https://github.com/WordPress/gutenberg/pull/59152))
+
+#### Schemas
+- Block JSON schema: Add `viewScriptModule` field. ([59060](https://github.com/WordPress/gutenberg/pull/59060))
+- Block JSON schema: Update `shadow` definition. ([58910](https://github.com/WordPress/gutenberg/pull/58910))
+- JSON schema: Update schema for background support. ([59127](https://github.com/WordPress/gutenberg/pull/59127))
+
+### Code Quality
+
+- Create Block: Remove deprecated viewModule field. ([59198](https://github.com/WordPress/gutenberg/pull/59198))
+- Editor: Remove the 'all' rendering mode. ([58935](https://github.com/WordPress/gutenberg/pull/58935))
+- Editor: Unify the editor commands between post and site editors. ([59005](https://github.com/WordPress/gutenberg/pull/59005))
+- Relocate 'ErrorBoundary' component unit test folders. ([59031](https://github.com/WordPress/gutenberg/pull/59031))
+- Remove obsolete wp-env configuration from package.json (#58877). ([58899](https://github.com/WordPress/gutenberg/pull/58899))
+- Design Tools > Elements: Make editor selector match theme.json and frontend. ([59167](https://github.com/WordPress/gutenberg/pull/59167))
+- Global Styles: Update sprintf calls using `_n`. ([59160](https://github.com/WordPress/gutenberg/pull/59160))
+- Block API: Revert "Block Hooks: Set ignoredHookedBlocks metada attr upon insertion". ([58969](https://github.com/WordPress/gutenberg/pull/58969))
+- Editor > Rich Text: Remove inline toolbar preference. ([58945](https://github.com/WordPress/gutenberg/pull/58945))
+- Style Variations: Remove preferred style variations legacy support. ([58930](https://github.com/WordPress/gutenberg/pull/58930))
+- REST API > Template Revisions: Move from experimental to compat/6.4. ([58920](https://github.com/WordPress/gutenberg/pull/58920))
+
+#### Block Editor
+- Block-editor: Auto-register block commands. ([59079](https://github.com/WordPress/gutenberg/pull/59079))
+- BlockSettingsMenu: Combine 'block-editor' store selectors. ([59153](https://github.com/WordPress/gutenberg/pull/59153))
+- Clean up link control CSS. ([58934](https://github.com/WordPress/gutenberg/pull/58934))
+- HeadingLevelDropdown: Remove unnecessary isPressed prop. ([56636](https://github.com/WordPress/gutenberg/pull/56636))
+- Move 'ParentSelectorMenuItem' into a separate file. ([59146](https://github.com/WordPress/gutenberg/pull/59146))
+- Remove 'BlockSettingsMenu' styles. ([59147](https://github.com/WordPress/gutenberg/pull/59147))
+
+#### Components
+- Add Higher Order Function to ignore Input Method Editor (IME) keydowns. ([59081](https://github.com/WordPress/gutenberg/pull/59081))
+- Add lint rules for theme color CSS var usage. ([59022](https://github.com/WordPress/gutenberg/pull/59022))
+- ColorPicker: Style without accessing InputControl internals. ([59069](https://github.com/WordPress/gutenberg/pull/59069))
+- CustomSelectControl (v1 & v2): Fix errors in unit test setup. ([59038](https://github.com/WordPress/gutenberg/pull/59038))
+- CustomSelectControl: Hard deprecate constrained width. ([58974](https://github.com/WordPress/gutenberg/pull/58974))
+
+#### Post Editor
+- DocumentBar: Fix browser warning error. ([59193](https://github.com/WordPress/gutenberg/pull/59193))
+- DocumentBar: Simplify component, use framer for animation. ([58656](https://github.com/WordPress/gutenberg/pull/58656))
+- Editor: Remove unused selector value from 'PostTitle'. ([59204](https://github.com/WordPress/gutenberg/pull/59204))
+- Editor: Unify Mode Switcher component between post and site editor. ([59100](https://github.com/WordPress/gutenberg/pull/59100))
+
+#### Interactivity API
+- Refactor to use string instead of an object on `wp-data-interactive`. ([59034](https://github.com/WordPress/gutenberg/pull/59034))
+- Remove `data-wp-interactive` object for core/router. ([59030](https://github.com/WordPress/gutenberg/pull/59030))
+- Use `data_wp_context` helper in core blocks and remove `data-wp-interactive` object. ([58943](https://github.com/WordPress/gutenberg/pull/58943))
+
+#### Site Editor
+- Add stylelint rule to prevent theme CSS vars outside of wp-components. ([59020](https://github.com/WordPress/gutenberg/pull/59020))
+- Don't memoize the canvas container title. ([59000](https://github.com/WordPress/gutenberg/pull/59000))
+- Remove old patterns list code and styles. ([58966](https://github.com/WordPress/gutenberg/pull/58966))
+
+
+### Tools
+
+- Remove reference to CODE_OF_CONDUCT.md in documentation. ([59206](https://github.com/WordPress/gutenberg/pull/59206))
+- Remove repository specific Code of Conduct. ([59027](https://github.com/WordPress/gutenberg/pull/59027))
+- env: Fix mariadb version to LTS. ([59237](https://github.com/WordPress/gutenberg/pull/59237))
+
+#### Testing
+- Components: Add sleep() before all Tab() to fix flaky tests. ([59012](https://github.com/WordPress/gutenberg/pull/59012))
+- Components: Try fixing some flaky `Composite` and `Tabs` tests. ([58968](https://github.com/WordPress/gutenberg/pull/58968))
+- Migrate `change-detection` to Playwright. ([58767](https://github.com/WordPress/gutenberg/pull/58767))
+- Tabs: Fix flaky unit tests. ([58629](https://github.com/WordPress/gutenberg/pull/58629))
+- Update test environment default theme versions to latest. ([58955](https://github.com/WordPress/gutenberg/pull/58955))
+
+#### Build Tooling
+- Add test:e2e:playwright:debug command to debug Playwright tests. ([58808](https://github.com/WordPress/gutenberg/pull/58808))
+- Updating Storybook to v7.6.15 (latest). ([59074](https://github.com/WordPress/gutenberg/pull/59074))
+
+
+
+
+## Contributors
+
+The following contributors merged PRs in this release:
+
+@aaronrobertshaw @afercia @ajlende @alexstine @andrewhayward @andrewserong @brookewp @c4rl0sbr4v0 @chad1008 @ciampo @DAreRodz @derekblank @desrosj @draganescu @ellatrix @fabiankaegy @gaambo @glendaviesnz @jameskoster @janboddez @jasmussen @jeryj @jorgefilipecosta @jsnajdr @juanfra @kevin940726 @Mamaduka @MarieComet @matiasbenedetto @mirka @noisysocks @ntsekouras @oandregal @ockham @pbking @ramonjd @SantosGuillamot @scruffian @shreyash3087 @t-hamano @talldan @tellthemachines @tyxla @youknowriad
+
+
= 17.7.0 =
## Changelog
diff --git a/docs/reference-guides/data/data-core-block-editor.md b/docs/reference-guides/data/data-core-block-editor.md
index eaffc0a875ca3b..9e9c1ef140c76a 100644
--- a/docs/reference-guides/data/data-core-block-editor.md
+++ b/docs/reference-guides/data/data-core-block-editor.md
@@ -1263,7 +1263,7 @@ Action that hides the insertion point.
### insertAfterBlock
-Action that inserts an empty block after a given block.
+Action that inserts a default block after a given block.
_Parameters_
@@ -1271,7 +1271,7 @@ _Parameters_
### insertBeforeBlock
-Action that inserts an empty block before a given block.
+Action that inserts a default block before a given block.
_Parameters_
diff --git a/gutenberg.php b/gutenberg.php
index c9edbb32024c8c..a6b4577d10a2d7 100644
--- a/gutenberg.php
+++ b/gutenberg.php
@@ -5,7 +5,7 @@
* Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality.
* Requires at least: 6.3
* Requires PHP: 7.0
- * Version: 17.7.0
+ * Version: 17.8.0-rc.1
* Author: Gutenberg Team
* Text Domain: gutenberg
*
diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php
index 0d2520ff9682a4..82e5503a6b225d 100644
--- a/lib/class-wp-theme-json-gutenberg.php
+++ b/lib/class-wp-theme-json-gutenberg.php
@@ -3807,12 +3807,18 @@ private static function resolve_custom_css_format( $tree ) {
* Replaces CSS variables with their values in place.
*
* @since 6.3.0
+ * @since 6.6.0 Check for empty style before processing.
+ *
* @param array $styles CSS declarations to convert.
* @param array $values key => value pairs to use for replacement.
* @return array
*/
private static function convert_variables_to_value( $styles, $values ) {
foreach ( $styles as $key => $style ) {
+ if ( empty( $style ) ) {
+ continue;
+ }
+
if ( is_array( $style ) ) {
$styles[ $key ] = self::convert_variables_to_value( $style, $values );
continue;
diff --git a/lib/compat/wordpress-6.5/fonts/class-wp-font-collection.php b/lib/compat/wordpress-6.5/fonts/class-wp-font-collection.php
index cd402a8e545003..3ccbed6ed275e9 100644
--- a/lib/compat/wordpress-6.5/fonts/class-wp-font-collection.php
+++ b/lib/compat/wordpress-6.5/fonts/class-wp-font-collection.php
@@ -48,12 +48,11 @@ final class WP_Font_Collection {
*
* @since 6.5.0
*
- * @param string $slug Font collection slug.
- * @param array|string $data_or_file Font collection data array or a path/URL to a JSON file
- * containing the font collection.
- * See {@see wp_register_font_collection()} for the supported fields.
+ * @param string $slug Font collection slug. May only contain alphanumeric characters, dashes,
+ * and underscores. See sanitize_title().
+ * @param array $args Font collection data. See wp_register_font_collection() for information on accepted arguments.
*/
- public function __construct( $slug, $data_or_file ) {
+ public function __construct( string $slug, array $args ) {
$this->slug = sanitize_title( $slug );
if ( $this->slug !== $slug ) {
_doing_it_wrong(
@@ -64,12 +63,17 @@ public function __construct( $slug, $data_or_file ) {
);
}
- if ( is_array( $data_or_file ) ) {
- $this->data = $this->sanitize_and_validate_data( $data_or_file );
- } else {
+ $required_properties = array( 'name', 'font_families' );
+
+ if ( isset( $args['font_families'] ) && is_string( $args['font_families'] ) ) {
// JSON data is lazy loaded by ::get_data().
- $this->src = $data_or_file;
+ $this->src = $args['font_families'];
+ unset( $args['font_families'] );
+
+ $required_properties = array( 'name' );
}
+
+ $this->data = $this->sanitize_and_validate_data( $args, $required_properties );
}
/**
@@ -80,8 +84,12 @@ public function __construct( $slug, $data_or_file ) {
* @return array|WP_Error An array containing the font collection data, or a WP_Error on failure.
*/
public function get_data() {
+ if ( is_wp_error( $this->data ) ) {
+ return $this->data;
+ }
+
// If the collection uses JSON data, load it and cache the data/error.
- if ( $this->src && empty( $this->data ) ) {
+ if ( isset( $this->src ) ) {
$this->data = $this->load_from_json( $this->src );
}
@@ -118,7 +126,26 @@ private function load_from_json( $file_or_url ) {
return new WP_Error( 'font_collection_json_missing', $message );
}
- return $url ? $this->load_from_url( $url ) : $this->load_from_file( $file );
+ $data = $url ? $this->load_from_url( $url ) : $this->load_from_file( $file );
+
+ if ( is_wp_error( $data ) ) {
+ return $data;
+ }
+
+ $data = array(
+ 'name' => $this->data['name'],
+ 'font_families' => $data['font_families'],
+ );
+
+ if ( isset( $this->data['description'] ) ) {
+ $data['description'] = $this->data['description'];
+ }
+
+ if ( isset( $this->data['categories'] ) ) {
+ $data['categories'] = $this->data['categories'];
+ }
+
+ return $data;
}
/**
@@ -136,7 +163,7 @@ private function load_from_file( $file ) {
return new WP_Error( 'font_collection_decode_error', __( 'Error decoding the font collection JSON file contents.', 'gutenberg' ) );
}
- return $this->sanitize_and_validate_data( $data );
+ return $this->sanitize_and_validate_data( $data, array( 'font_families' ) );
}
/**
@@ -156,8 +183,14 @@ private function load_from_url( $url ) {
if ( false === $data ) {
$response = wp_safe_remote_get( $url );
if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
- // translators: %s: Font collection URL.
- return new WP_Error( 'font_collection_request_error', sprintf( __( 'Error fetching the font collection data from "%s".', 'gutenberg' ), $url ) );
+ return new WP_Error(
+ 'font_collection_request_error',
+ sprintf(
+ // translators: %s: Font collection URL.
+ __( 'Error fetching the font collection data from "%s".', 'gutenberg' ),
+ $url
+ )
+ );
}
$data = json_decode( wp_remote_retrieve_body( $response ), true );
@@ -166,7 +199,7 @@ private function load_from_url( $url ) {
}
// Make sure the data is valid before storing it in a transient.
- $data = $this->sanitize_and_validate_data( $data );
+ $data = $this->sanitize_and_validate_data( $data, array( 'font_families' ) );
if ( is_wp_error( $data ) ) {
return $data;
}
@@ -182,18 +215,18 @@ private function load_from_url( $url ) {
*
* @since 6.5.0
*
- * @param array $data Font collection data to sanitize and validate.
+ * @param array $data Font collection data to sanitize and validate.
+ * @param array $required_properties Required properties that must exist in the passed data.
* @return array|WP_Error Sanitized data if valid, otherwise a WP_Error instance.
*/
- private function sanitize_and_validate_data( $data ) {
+ private function sanitize_and_validate_data( $data, $required_properties = array() ) {
$schema = self::get_sanitization_schema();
$data = WP_Font_Utils::sanitize_from_schema( $data, $schema );
- $required_properties = array( 'name', 'font_families' );
foreach ( $required_properties as $property ) {
if ( empty( $data[ $property ] ) ) {
$message = sprintf(
- // translators: 1: Font collection slug, 2: Missing property name, e.g. "font_families".
+ // translators: 1: Font collection slug, 2: Missing property name, e.g. "font_families".
__( 'Font collection "%1$s" has missing or empty property: "%2$s".', 'gutenberg' ),
$this->slug,
$property
diff --git a/lib/compat/wordpress-6.5/fonts/class-wp-font-library.php b/lib/compat/wordpress-6.5/fonts/class-wp-font-library.php
index 141dff730a15fc..eb4a269b3a8068 100644
--- a/lib/compat/wordpress-6.5/fonts/class-wp-font-library.php
+++ b/lib/compat/wordpress-6.5/fonts/class-wp-font-library.php
@@ -39,20 +39,19 @@ class WP_Font_Library {
*
* @since 6.5.0
*
- * @param string $slug Font collection slug.
- * @param array $data_or_file Font collection data array or a path/URL to a JSON file
- * containing the font collection.
- * See {@see wp_register_font_collection()} for the supported fields.
+ * @param string $slug Font collection slug. May only contain alphanumeric characters, dashes,
+ * and underscores. See sanitize_title().
+ * @param array $args Font collection data. See wp_register_font_collection() for information on accepted arguments.
* @return WP_Font_Collection|WP_Error A font collection if it was registered successfully,
* or WP_Error object on failure.
*/
- public function register_font_collection( $slug, $data_or_file ) {
- $new_collection = new WP_Font_Collection( $slug, $data_or_file );
+ public function register_font_collection( string $slug, array $args ) {
+ $new_collection = new WP_Font_Collection( $slug, $args );
if ( $this->is_collection_registered( $new_collection->slug ) ) {
$error_message = sprintf(
/* translators: %s: Font collection slug. */
- __( 'Font collection with slug "%s" is already registered.', 'gutenberg' ),
+ __( 'Font collection with slug: "%s" is already registered.', 'gutenberg' ),
$new_collection->slug
);
_doing_it_wrong(
@@ -74,7 +73,7 @@ public function register_font_collection( $slug, $data_or_file ) {
* @param string $slug Font collection slug.
* @return bool True if the font collection was unregistered successfully and false otherwise.
*/
- public function unregister_font_collection( $slug ) {
+ public function unregister_font_collection( string $slug ) {
if ( ! $this->is_collection_registered( $slug ) ) {
_doing_it_wrong(
__METHOD__,
@@ -96,7 +95,7 @@ public function unregister_font_collection( $slug ) {
* @param string $slug Font collection slug.
* @return bool True if the font collection is registered and false otherwise.
*/
- private function is_collection_registered( $slug ) {
+ private function is_collection_registered( string $slug ) {
return array_key_exists( $slug, $this->collections );
}
@@ -119,7 +118,7 @@ public function get_font_collections() {
* @param string $slug Font collection slug.
* @return WP_Font_Collection|null Font collection object, or null if the font collection doesn't exist.
*/
- public function get_font_collection( $slug ) {
+ public function get_font_collection( string $slug ) {
if ( $this->is_collection_registered( $slug ) ) {
return $this->collections[ $slug ];
}
diff --git a/lib/compat/wordpress-6.5/fonts/class-wp-rest-font-collections-controller.php b/lib/compat/wordpress-6.5/fonts/class-wp-rest-font-collections-controller.php
index 97aba89a8b24e9..2433a8d4ff9553 100644
--- a/lib/compat/wordpress-6.5/fonts/class-wp-rest-font-collections-controller.php
+++ b/lib/compat/wordpress-6.5/fonts/class-wp-rest-font-collections-controller.php
@@ -106,7 +106,7 @@ public function get_items( $request ) {
$response = rest_ensure_response( $items );
$response->header( 'X-WP-Total', (int) $total_items );
- $response->header( 'X-WP-TotalPages', (int) $max_pages );
+ $response->header( 'X-WP-TotalPages', $max_pages );
$request_params = $request->get_query_params();
$collection_url = rest_url( $this->namespace . '/' . $this->rest_base );
diff --git a/lib/compat/wordpress-6.5/fonts/fonts.php b/lib/compat/wordpress-6.5/fonts/fonts.php
index 1f29645a9c2b90..8307d5217ad426 100644
--- a/lib/compat/wordpress-6.5/fonts/fonts.php
+++ b/lib/compat/wordpress-6.5/fonts/fonts.php
@@ -114,28 +114,30 @@ function gutenberg_init_font_library() {
if ( ! function_exists( 'wp_register_font_collection' ) ) {
/**
- * Registers a new Font Collection in the Font Library.
+ * Registers a new font collection in the font library.
+ *
+ * See {@link https://schemas.wp.org/trunk/font-collection.json} for the schema
+ * the font collection data must adhere to.
*
* @since 6.5.0
*
- * @param string $slug Font collection slug. May only contain alphanumeric characters, dashes,
+ * @param string $slug Font collection slug. May only contain alphanumeric characters, dashes,
* and underscores. See sanitize_title().
- * @param array|string $data_or_file {
- * Font collection data array or a path/URL to a JSON file containing the font collection.
- *
- * @link https://schemas.wp.org/trunk/font-collection.json
+ * @param array $args {
+ * Font collection data.
*
- * @type string $name Required. Name of the font collection shown in the Font Library.
- * @type string $description Optional. A short descriptive summary of the font collection. Default empty.
- * @type array $font_families Required. Array of font family definitions that are in the collection.
- * @type array $categories Optional. Array of categories, each with a name and slug, that are used by the
- * fonts in the collection. Default empty.
+ * @type string $name Required. Name of the font collection shown in the Font Library.
+ * @type string $description Optional. A short descriptive summary of the font collection. Default empty.
+ * @type array|string $font_families Required. Array of font family definitions that are in the collection,
+ * or a string containing the path or URL to a JSON file containing the font collection.
+ * @type array $categories Optional. Array of categories, each with a name and slug, that are used by the
+ * fonts in the collection. Default empty.
* }
* @return WP_Font_Collection|WP_Error A font collection if it was registered
* successfully, or WP_Error object on failure.
*/
- function wp_register_font_collection( $slug, $data_or_file ) {
- return WP_Font_Library::get_instance()->register_font_collection( $slug, $data_or_file );
+ function wp_register_font_collection( string $slug, array $args ) {
+ return WP_Font_Library::get_instance()->register_font_collection( $slug, $args );
}
}
@@ -148,7 +150,7 @@ function wp_register_font_collection( $slug, $data_or_file ) {
* @param string $slug Font collection slug.
* @return bool True if the font collection was unregistered successfully, else false.
*/
- function wp_unregister_font_collection( $slug ) {
+ function wp_unregister_font_collection( string $slug ) {
return WP_Font_Library::get_instance()->unregister_font_collection( $slug );
}
}
@@ -157,7 +159,36 @@ function gutenberg_register_font_collections() {
if ( null !== WP_Font_Library::get_instance()->get_font_collection( 'google-fonts' ) ) {
return;
}
- wp_register_font_collection( 'google-fonts', 'https://s.w.org/images/fonts/17.7/collections/google-fonts-with-preview.json' );
+ wp_register_font_collection(
+ 'google-fonts',
+ array(
+ 'name' => _x( 'Google Fonts', 'font collection name', 'gutenberg' ),
+ 'description' => __( 'Install from Google Fonts. Fonts are copied to and served from your site.', 'gutenberg' ),
+ 'font_families' => 'https://s.w.org/images/fonts/17.7/collections/google-fonts-with-preview.json',
+ 'categories' => array(
+ array(
+ 'name' => _x( 'Sans Serif', 'font category', 'gutenberg' ),
+ 'slug' => 'sans-serif',
+ ),
+ array(
+ 'name' => _x( 'Display', 'font category', 'gutenberg' ),
+ 'slug' => 'display',
+ ),
+ array(
+ 'name' => _x( 'Serif', 'font category', 'gutenberg' ),
+ 'slug' => 'serif',
+ ),
+ array(
+ 'name' => _x( 'Handwriting', 'font category', 'gutenberg' ),
+ 'slug' => 'handwriting',
+ ),
+ array(
+ 'name' => _x( 'Monospace', 'font category', 'gutenberg' ),
+ 'slug' => 'monospace',
+ ),
+ ),
+ )
+ );
}
add_action( 'init', 'gutenberg_register_font_collections', 11 );
diff --git a/package-lock.json b/package-lock.json
index 9ca357997a7f5a..eb752483cecfd7 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "gutenberg",
- "version": "17.7.0",
+ "version": "17.8.0-rc.1",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "gutenberg",
- "version": "17.7.0",
+ "version": "17.8.0-rc.1",
"hasInstallScript": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -54176,7 +54176,7 @@
},
"packages/a11y": {
"name": "@wordpress/a11y",
- "version": "3.51.0",
+ "version": "3.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54189,7 +54189,7 @@
},
"packages/annotations": {
"name": "@wordpress/annotations",
- "version": "2.51.1",
+ "version": "2.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54217,7 +54217,7 @@
},
"packages/api-fetch": {
"name": "@wordpress/api-fetch",
- "version": "6.48.0",
+ "version": "6.49.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54230,7 +54230,7 @@
},
"packages/autop": {
"name": "@wordpress/autop",
- "version": "3.51.0",
+ "version": "3.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0"
@@ -54241,7 +54241,7 @@
},
"packages/babel-plugin-import-jsx-pragma": {
"name": "@wordpress/babel-plugin-import-jsx-pragma",
- "version": "4.34.0",
+ "version": "4.35.0",
"dev": true,
"license": "GPL-2.0-or-later",
"engines": {
@@ -54253,7 +54253,7 @@
},
"packages/babel-plugin-makepot": {
"name": "@wordpress/babel-plugin-makepot",
- "version": "5.35.0",
+ "version": "5.36.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -54270,7 +54270,7 @@
},
"packages/babel-preset-default": {
"name": "@wordpress/babel-preset-default",
- "version": "7.35.0",
+ "version": "7.36.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -54293,13 +54293,13 @@
},
"packages/base-styles": {
"name": "@wordpress/base-styles",
- "version": "4.42.0",
+ "version": "4.43.0",
"dev": true,
"license": "GPL-2.0-or-later"
},
"packages/blob": {
"name": "@wordpress/blob",
- "version": "3.51.0",
+ "version": "3.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0"
@@ -54310,7 +54310,7 @@
},
"packages/block-directory": {
"name": "@wordpress/block-directory",
- "version": "4.28.1",
+ "version": "4.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54345,7 +54345,7 @@
},
"packages/block-editor": {
"name": "@wordpress/block-editor",
- "version": "12.19.1",
+ "version": "12.20.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54441,7 +54441,7 @@
},
"packages/block-library": {
"name": "@wordpress/block-library",
- "version": "8.28.1",
+ "version": "8.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54505,7 +54505,7 @@
},
"packages/block-serialization-default-parser": {
"name": "@wordpress/block-serialization-default-parser",
- "version": "4.51.0",
+ "version": "4.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0"
@@ -54516,7 +54516,7 @@
},
"packages/block-serialization-spec-parser": {
"name": "@wordpress/block-serialization-spec-parser",
- "version": "4.51.0",
+ "version": "4.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"pegjs": "^0.10.0",
@@ -54528,7 +54528,7 @@
},
"packages/blocks": {
"name": "@wordpress/blocks",
- "version": "12.28.1",
+ "version": "12.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54582,7 +54582,7 @@
},
"packages/browserslist-config": {
"name": "@wordpress/browserslist-config",
- "version": "5.34.0",
+ "version": "5.35.0",
"dev": true,
"license": "GPL-2.0-or-later",
"engines": {
@@ -54591,7 +54591,7 @@
},
"packages/commands": {
"name": "@wordpress/commands",
- "version": "0.22.1",
+ "version": "0.23.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54616,7 +54616,7 @@
},
"packages/components": {
"name": "@wordpress/components",
- "version": "26.0.1",
+ "version": "27.0.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@ariakit/react": "^0.3.12",
@@ -54707,7 +54707,7 @@
},
"packages/compose": {
"name": "@wordpress/compose",
- "version": "6.28.0",
+ "version": "6.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54743,7 +54743,7 @@
},
"packages/core-commands": {
"name": "@wordpress/core-commands",
- "version": "0.20.1",
+ "version": "0.21.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54769,7 +54769,7 @@
},
"packages/core-data": {
"name": "@wordpress/core-data",
- "version": "6.28.1",
+ "version": "6.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54813,7 +54813,7 @@
},
"packages/create-block": {
"name": "@wordpress/create-block",
- "version": "4.35.0",
+ "version": "4.36.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -54841,13 +54841,13 @@
},
"packages/create-block-tutorial-template": {
"name": "@wordpress/create-block-tutorial-template",
- "version": "3.5.0",
+ "version": "3.6.0",
"dev": true,
"license": "GPL-2.0-or-later"
},
"packages/customize-widgets": {
"name": "@wordpress/customize-widgets",
- "version": "4.28.1",
+ "version": "4.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54884,7 +54884,7 @@
},
"packages/data": {
"name": "@wordpress/data",
- "version": "9.21.0",
+ "version": "9.22.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54912,7 +54912,7 @@
},
"packages/data-controls": {
"name": "@wordpress/data-controls",
- "version": "3.20.0",
+ "version": "3.21.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -54929,7 +54929,7 @@
},
"packages/dataviews": {
"name": "@wordpress/dataviews",
- "version": "0.5.1",
+ "version": "0.6.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@ariakit/react": "^0.3.12",
@@ -54990,7 +54990,7 @@
},
"packages/date": {
"name": "@wordpress/date",
- "version": "4.51.0",
+ "version": "4.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55004,7 +55004,7 @@
},
"packages/dependency-extraction-webpack-plugin": {
"name": "@wordpress/dependency-extraction-webpack-plugin",
- "version": "5.2.0",
+ "version": "5.3.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -55019,7 +55019,7 @@
},
"packages/deprecated": {
"name": "@wordpress/deprecated",
- "version": "3.51.0",
+ "version": "3.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55031,7 +55031,7 @@
},
"packages/docgen": {
"name": "@wordpress/docgen",
- "version": "1.60.0",
+ "version": "1.61.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -55049,7 +55049,7 @@
},
"packages/dom": {
"name": "@wordpress/dom",
- "version": "3.51.0",
+ "version": "3.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55061,7 +55061,7 @@
},
"packages/dom-ready": {
"name": "@wordpress/dom-ready",
- "version": "3.51.0",
+ "version": "3.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0"
@@ -55072,7 +55072,7 @@
},
"packages/e2e-test-utils": {
"name": "@wordpress/e2e-test-utils",
- "version": "10.22.0",
+ "version": "10.23.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -55094,7 +55094,7 @@
},
"packages/e2e-test-utils-playwright": {
"name": "@wordpress/e2e-test-utils-playwright",
- "version": "0.19.0",
+ "version": "0.20.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -55117,7 +55117,7 @@
},
"packages/e2e-tests": {
"name": "@wordpress/e2e-tests",
- "version": "7.22.0",
+ "version": "7.23.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -55156,7 +55156,7 @@
},
"packages/edit-post": {
"name": "@wordpress/edit-post",
- "version": "7.28.1",
+ "version": "7.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55204,7 +55204,7 @@
},
"packages/edit-site": {
"name": "@wordpress/edit-site",
- "version": "5.28.1",
+ "version": "5.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55270,7 +55270,7 @@
},
"packages/edit-widgets": {
"name": "@wordpress/edit-widgets",
- "version": "5.28.1",
+ "version": "5.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55313,7 +55313,7 @@
},
"packages/editor": {
"name": "@wordpress/editor",
- "version": "13.28.1",
+ "version": "13.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55364,7 +55364,7 @@
},
"packages/element": {
"name": "@wordpress/element",
- "version": "5.28.0",
+ "version": "5.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55382,7 +55382,7 @@
},
"packages/env": {
"name": "@wordpress/env",
- "version": "9.3.0",
+ "version": "9.4.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -55516,7 +55516,7 @@
},
"packages/escape-html": {
"name": "@wordpress/escape-html",
- "version": "2.51.0",
+ "version": "2.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0"
@@ -55527,7 +55527,7 @@
},
"packages/eslint-plugin": {
"name": "@wordpress/eslint-plugin",
- "version": "17.8.0",
+ "version": "17.9.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -55570,7 +55570,7 @@
},
"packages/format-library": {
"name": "@wordpress/format-library",
- "version": "4.28.1",
+ "version": "4.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55597,7 +55597,7 @@
},
"packages/hooks": {
"name": "@wordpress/hooks",
- "version": "3.51.0",
+ "version": "3.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0"
@@ -55608,7 +55608,7 @@
},
"packages/html-entities": {
"name": "@wordpress/html-entities",
- "version": "3.51.0",
+ "version": "3.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0"
@@ -55619,7 +55619,7 @@
},
"packages/i18n": {
"name": "@wordpress/i18n",
- "version": "4.51.0",
+ "version": "4.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55638,7 +55638,7 @@
},
"packages/icons": {
"name": "@wordpress/icons",
- "version": "9.42.0",
+ "version": "9.43.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55651,7 +55651,7 @@
},
"packages/interactivity": {
"name": "@wordpress/interactivity",
- "version": "5.0.0",
+ "version": "5.1.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@preact/signals": "^1.2.2",
@@ -55664,7 +55664,7 @@
},
"packages/interactivity-router": {
"name": "@wordpress/interactivity-router",
- "version": "1.1.0",
+ "version": "1.2.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@wordpress/interactivity": "file:../interactivity"
@@ -55724,7 +55724,7 @@
},
"packages/interface": {
"name": "@wordpress/interface",
- "version": "5.28.1",
+ "version": "5.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55752,7 +55752,7 @@
},
"packages/is-shallow-equal": {
"name": "@wordpress/is-shallow-equal",
- "version": "4.51.0",
+ "version": "4.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0"
@@ -55763,7 +55763,7 @@
},
"packages/jest-console": {
"name": "@wordpress/jest-console",
- "version": "7.22.0",
+ "version": "7.23.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -55779,7 +55779,7 @@
},
"packages/jest-preset-default": {
"name": "@wordpress/jest-preset-default",
- "version": "11.22.0",
+ "version": "11.23.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -55796,7 +55796,7 @@
},
"packages/jest-puppeteer-axe": {
"name": "@wordpress/jest-puppeteer-axe",
- "version": "6.22.0",
+ "version": "6.23.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -55818,7 +55818,7 @@
},
"packages/keyboard-shortcuts": {
"name": "@wordpress/keyboard-shortcuts",
- "version": "4.28.0",
+ "version": "4.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55836,7 +55836,7 @@
},
"packages/keycodes": {
"name": "@wordpress/keycodes",
- "version": "3.51.0",
+ "version": "3.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55848,7 +55848,7 @@
},
"packages/lazy-import": {
"name": "@wordpress/lazy-import",
- "version": "1.38.0",
+ "version": "1.39.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -55862,7 +55862,7 @@
},
"packages/list-reusable-blocks": {
"name": "@wordpress/list-reusable-blocks",
- "version": "4.28.1",
+ "version": "4.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55884,7 +55884,7 @@
},
"packages/media-utils": {
"name": "@wordpress/media-utils",
- "version": "4.42.0",
+ "version": "4.43.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55899,7 +55899,7 @@
},
"packages/notices": {
"name": "@wordpress/notices",
- "version": "4.19.0",
+ "version": "4.20.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55915,7 +55915,7 @@
},
"packages/npm-package-json-lint-config": {
"name": "@wordpress/npm-package-json-lint-config",
- "version": "4.36.0",
+ "version": "4.37.0",
"dev": true,
"license": "GPL-2.0-or-later",
"engines": {
@@ -55927,7 +55927,7 @@
},
"packages/nux": {
"name": "@wordpress/nux",
- "version": "8.13.1",
+ "version": "8.14.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55950,7 +55950,7 @@
},
"packages/patterns": {
"name": "@wordpress/patterns",
- "version": "1.12.1",
+ "version": "1.13.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -55980,7 +55980,7 @@
},
"packages/plugins": {
"name": "@wordpress/plugins",
- "version": "6.19.1",
+ "version": "6.20.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56002,7 +56002,7 @@
},
"packages/postcss-plugins-preset": {
"name": "@wordpress/postcss-plugins-preset",
- "version": "4.35.0",
+ "version": "4.36.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -56018,7 +56018,7 @@
},
"packages/postcss-themes": {
"name": "@wordpress/postcss-themes",
- "version": "5.34.0",
+ "version": "5.35.0",
"dev": true,
"license": "GPL-2.0-or-later",
"engines": {
@@ -56030,7 +56030,7 @@
},
"packages/preferences": {
"name": "@wordpress/preferences",
- "version": "3.28.1",
+ "version": "3.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56055,7 +56055,7 @@
},
"packages/preferences-persistence": {
"name": "@wordpress/preferences-persistence",
- "version": "1.43.0",
+ "version": "1.44.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56067,7 +56067,7 @@
},
"packages/prettier-config": {
"name": "@wordpress/prettier-config",
- "version": "3.8.0",
+ "version": "3.9.0",
"dev": true,
"license": "GPL-2.0-or-later",
"engines": {
@@ -56079,7 +56079,7 @@
},
"packages/primitives": {
"name": "@wordpress/primitives",
- "version": "3.49.0",
+ "version": "3.50.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56092,7 +56092,7 @@
},
"packages/priority-queue": {
"name": "@wordpress/priority-queue",
- "version": "2.51.0",
+ "version": "2.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56104,7 +56104,7 @@
},
"packages/private-apis": {
"name": "@wordpress/private-apis",
- "version": "0.33.0",
+ "version": "0.34.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0"
@@ -56115,7 +56115,7 @@
},
"packages/project-management-automation": {
"name": "@wordpress/project-management-automation",
- "version": "1.50.0",
+ "version": "1.51.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -56128,7 +56128,7 @@
},
"packages/react-i18n": {
"name": "@wordpress/react-i18n",
- "version": "3.49.0",
+ "version": "3.50.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56276,7 +56276,7 @@
},
"packages/readable-js-assets-webpack-plugin": {
"name": "@wordpress/readable-js-assets-webpack-plugin",
- "version": "2.34.0",
+ "version": "2.35.0",
"dev": true,
"license": "GPL-2.0-or-later",
"engines": {
@@ -56288,7 +56288,7 @@
},
"packages/redux-routine": {
"name": "@wordpress/redux-routine",
- "version": "4.51.0",
+ "version": "4.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56332,7 +56332,7 @@
},
"packages/reusable-blocks": {
"name": "@wordpress/reusable-blocks",
- "version": "4.28.1",
+ "version": "4.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56358,7 +56358,7 @@
},
"packages/rich-text": {
"name": "@wordpress/rich-text",
- "version": "6.28.1",
+ "version": "6.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56382,7 +56382,7 @@
},
"packages/router": {
"name": "@wordpress/router",
- "version": "0.20.0",
+ "version": "0.21.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56400,7 +56400,7 @@
},
"packages/scripts": {
"name": "@wordpress/scripts",
- "version": "27.2.0",
+ "version": "27.3.0",
"dev": true,
"license": "GPL-2.0-or-later",
"dependencies": {
@@ -56622,7 +56622,7 @@
},
"packages/server-side-render": {
"name": "@wordpress/server-side-render",
- "version": "4.28.1",
+ "version": "4.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56647,7 +56647,7 @@
},
"packages/shortcode": {
"name": "@wordpress/shortcode",
- "version": "3.51.0",
+ "version": "3.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56659,7 +56659,7 @@
},
"packages/style-engine": {
"name": "@wordpress/style-engine",
- "version": "1.34.0",
+ "version": "1.35.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56671,7 +56671,7 @@
},
"packages/stylelint-config": {
"name": "@wordpress/stylelint-config",
- "version": "21.34.0",
+ "version": "21.35.0",
"dev": true,
"license": "MIT",
"dependencies": {
@@ -56687,7 +56687,7 @@
},
"packages/sync": {
"name": "@wordpress/sync",
- "version": "0.13.0",
+ "version": "0.14.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56707,7 +56707,7 @@
},
"packages/token-list": {
"name": "@wordpress/token-list",
- "version": "2.51.0",
+ "version": "2.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0"
@@ -56718,7 +56718,7 @@
},
"packages/undo-manager": {
"name": "@wordpress/undo-manager",
- "version": "0.11.0",
+ "version": "0.12.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56730,7 +56730,7 @@
},
"packages/url": {
"name": "@wordpress/url",
- "version": "3.52.0",
+ "version": "3.53.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56742,7 +56742,7 @@
},
"packages/viewport": {
"name": "@wordpress/viewport",
- "version": "5.28.0",
+ "version": "5.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56759,7 +56759,7 @@
},
"packages/warning": {
"name": "@wordpress/warning",
- "version": "2.51.0",
+ "version": "2.52.0",
"license": "GPL-2.0-or-later",
"engines": {
"node": ">=12"
@@ -56767,7 +56767,7 @@
},
"packages/widgets": {
"name": "@wordpress/widgets",
- "version": "3.28.1",
+ "version": "3.29.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0",
@@ -56791,7 +56791,7 @@
},
"packages/wordcount": {
"name": "@wordpress/wordcount",
- "version": "3.51.0",
+ "version": "3.52.0",
"license": "GPL-2.0-or-later",
"dependencies": {
"@babel/runtime": "^7.16.0"
diff --git a/package.json b/package.json
index b54be23041128f..467d5b44a5d5f7 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
- "version": "17.7.0",
+ "version": "17.8.0-rc.1",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
diff --git a/packages/a11y/CHANGELOG.md b/packages/a11y/CHANGELOG.md
index 21ff2989058194..b55b3424c5c47b 100644
--- a/packages/a11y/CHANGELOG.md
+++ b/packages/a11y/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 3.52.0 (2024-02-21)
+
## 3.51.0 (2024-02-09)
## 3.50.0 (2024-01-24)
diff --git a/packages/a11y/package.json b/packages/a11y/package.json
index c93ceb7ae55e7e..18622e22ad8c28 100644
--- a/packages/a11y/package.json
+++ b/packages/a11y/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/a11y",
- "version": "3.51.0",
+ "version": "3.52.0",
"description": "Accessibility (a11y) utilities for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/annotations/CHANGELOG.md b/packages/annotations/CHANGELOG.md
index e475705c4dc561..3da67470f7677d 100644
--- a/packages/annotations/CHANGELOG.md
+++ b/packages/annotations/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 2.52.0 (2024-02-21)
+
## 2.51.0 (2024-02-09)
## 2.50.0 (2024-01-24)
diff --git a/packages/annotations/package.json b/packages/annotations/package.json
index 1257778703aa18..b92beeb7f99d59 100644
--- a/packages/annotations/package.json
+++ b/packages/annotations/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/annotations",
- "version": "2.51.1",
+ "version": "2.52.0",
"description": "Annotate content in the Gutenberg editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/api-fetch/CHANGELOG.md b/packages/api-fetch/CHANGELOG.md
index 7746db7508cee1..317daffd26fa8e 100644
--- a/packages/api-fetch/CHANGELOG.md
+++ b/packages/api-fetch/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 6.49.0 (2024-02-21)
+
## 6.48.0 (2024-02-09)
## 6.47.0 (2024-01-24)
diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json
index 65ba4fc9897514..0b5da9906e6327 100644
--- a/packages/api-fetch/package.json
+++ b/packages/api-fetch/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/api-fetch",
- "version": "6.48.0",
+ "version": "6.49.0",
"description": "Utility to make WordPress REST API requests.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/autop/CHANGELOG.md b/packages/autop/CHANGELOG.md
index e5fd1e245d2846..521bab1f64f2a2 100644
--- a/packages/autop/CHANGELOG.md
+++ b/packages/autop/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 3.52.0 (2024-02-21)
+
## 3.51.0 (2024-02-09)
## 3.50.0 (2024-01-24)
diff --git a/packages/autop/package.json b/packages/autop/package.json
index 102e20235fd96d..44c9f8585ee3d8 100644
--- a/packages/autop/package.json
+++ b/packages/autop/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/autop",
- "version": "3.51.0",
+ "version": "3.52.0",
"description": "WordPress's automatic paragraph functions `autop` and `removep`.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md
index 046380922e9662..c0e414b2158408 100644
--- a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md
+++ b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.35.0 (2024-02-21)
+
## 4.34.0 (2024-02-09)
## 4.33.0 (2024-01-24)
diff --git a/packages/babel-plugin-import-jsx-pragma/package.json b/packages/babel-plugin-import-jsx-pragma/package.json
index 0a066c01db3987..399732060884e2 100644
--- a/packages/babel-plugin-import-jsx-pragma/package.json
+++ b/packages/babel-plugin-import-jsx-pragma/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/babel-plugin-import-jsx-pragma",
- "version": "4.34.0",
+ "version": "4.35.0",
"description": "Babel transform plugin for automatically injecting an import to be used as the pragma for the React JSX Transform plugin.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/babel-plugin-makepot/CHANGELOG.md b/packages/babel-plugin-makepot/CHANGELOG.md
index f27508610e1325..700ae9d80c6a5d 100644
--- a/packages/babel-plugin-makepot/CHANGELOG.md
+++ b/packages/babel-plugin-makepot/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 5.36.0 (2024-02-21)
+
## 5.35.0 (2024-02-09)
## 5.34.0 (2024-01-24)
diff --git a/packages/babel-plugin-makepot/package.json b/packages/babel-plugin-makepot/package.json
index d467854c25f0ca..61ff6931337908 100644
--- a/packages/babel-plugin-makepot/package.json
+++ b/packages/babel-plugin-makepot/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/babel-plugin-makepot",
- "version": "5.35.0",
+ "version": "5.36.0",
"description": "WordPress Babel internationalization (i18n) plugin.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/babel-preset-default/CHANGELOG.md b/packages/babel-preset-default/CHANGELOG.md
index 0f472e67287302..344222a17330db 100644
--- a/packages/babel-preset-default/CHANGELOG.md
+++ b/packages/babel-preset-default/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 7.36.0 (2024-02-21)
+
## 7.35.0 (2024-02-09)
## 7.34.0 (2024-01-24)
diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json
index 44fbed125a7a12..4cdb41058f60a3 100644
--- a/packages/babel-preset-default/package.json
+++ b/packages/babel-preset-default/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/babel-preset-default",
- "version": "7.35.0",
+ "version": "7.36.0",
"description": "Default Babel preset for WordPress development.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/base-styles/CHANGELOG.md b/packages/base-styles/CHANGELOG.md
index 56b393a140851c..488a598d7df5b0 100644
--- a/packages/base-styles/CHANGELOG.md
+++ b/packages/base-styles/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.43.0 (2024-02-21)
+
## 4.42.0 (2024-02-09)
## 4.41.0 (2024-01-24)
diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json
index 93df4497445423..17bb579e4c8c9f 100644
--- a/packages/base-styles/package.json
+++ b/packages/base-styles/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/base-styles",
- "version": "4.42.0",
+ "version": "4.43.0",
"description": "Base SCSS utilities and variables for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/blob/CHANGELOG.md b/packages/blob/CHANGELOG.md
index 5cb62e3734bfa4..2dccf51fe6cde3 100644
--- a/packages/blob/CHANGELOG.md
+++ b/packages/blob/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 3.52.0 (2024-02-21)
+
## 3.51.0 (2024-02-09)
## 3.50.0 (2024-01-24)
diff --git a/packages/blob/package.json b/packages/blob/package.json
index b8f073003d1be8..333ed8ab3f6ed2 100644
--- a/packages/blob/package.json
+++ b/packages/blob/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/blob",
- "version": "3.51.0",
+ "version": "3.52.0",
"description": "Blob utilities for WordPress.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-directory/CHANGELOG.md b/packages/block-directory/CHANGELOG.md
index 547bc80bee02b2..0e7476075781cc 100644
--- a/packages/block-directory/CHANGELOG.md
+++ b/packages/block-directory/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 4.29.0 (2024-02-21)
+
## 4.28.0 (2024-02-09)
## 4.27.0 (2024-01-24)
diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json
index d892e359511938..24112ce327346b 100644
--- a/packages/block-directory/package.json
+++ b/packages/block-directory/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-directory",
- "version": "4.28.1",
+ "version": "4.29.0",
"description": "Extend editor with block directory features to search, download and install blocks.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-editor/CHANGELOG.md b/packages/block-editor/CHANGELOG.md
index c19c025bf17ae2..2ce86bdec8e1db 100644
--- a/packages/block-editor/CHANGELOG.md
+++ b/packages/block-editor/CHANGELOG.md
@@ -2,6 +2,8 @@
## Unreleased
+## 12.20.0 (2024-02-21)
+
## 12.19.0 (2024-02-09)
- `FontSizePicker`: Remove deprecated `__nextHasNoMarginBottom` prop and promote to default behavior ([#58702](https://github.com/WordPress/gutenberg/pull/58702)).
diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json
index fcc36c14a09d06..971613a0586b75 100644
--- a/packages/block-editor/package.json
+++ b/packages/block-editor/package.json
@@ -1,6 +1,6 @@
{
"name": "@wordpress/block-editor",
- "version": "12.19.1",
+ "version": "12.20.0",
"description": "Generic block editor.",
"author": "The WordPress Contributors",
"license": "GPL-2.0-or-later",
diff --git a/packages/block-editor/src/components/block-actions/index.js b/packages/block-editor/src/components/block-actions/index.js
index 5d942d2b25c708..760f0f4daabde9 100644
--- a/packages/block-editor/src/components/block-actions/index.js
+++ b/packages/block-editor/src/components/block-actions/index.js
@@ -20,42 +20,55 @@ export default function BlockActions( {
children,
__experimentalUpdateSelection: updateSelection,
} ) {
- const {
- canInsertBlockType,
- getBlockRootClientId,
- getBlocksByClientId,
- canMoveBlocks,
- canRemoveBlocks,
- } = useSelect( blockEditorStore );
const { getDefaultBlockName, getGroupingBlockName } =
useSelect( blocksStore );
-
- const blocks = getBlocksByClientId( clientIds );
- const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
-
- const canCopyStyles = blocks.every( ( block ) => {
- return (
- !! block &&
- ( hasBlockSupport( block.name, 'color' ) ||
- hasBlockSupport( block.name, 'typography' ) )
- );
- } );
-
- const canDuplicate = blocks.every( ( block ) => {
- return (
- !! block &&
- hasBlockSupport( block.name, 'multiple', true ) &&
- canInsertBlockType( block.name, rootClientId )
- );
- } );
-
- const canInsertDefaultBlock = canInsertBlockType(
- getDefaultBlockName(),
- rootClientId
+ const selected = useSelect(
+ ( select ) => {
+ const {
+ canInsertBlockType,
+ getBlockRootClientId,
+ getBlocksByClientId,
+ getDirectInsertBlock,
+ canMoveBlocks,
+ canRemoveBlocks,
+ } = select( blockEditorStore );
+
+ const blocks = getBlocksByClientId( clientIds );
+ const rootClientId = getBlockRootClientId( clientIds[ 0 ] );
+ const canInsertDefaultBlock = canInsertBlockType(
+ getDefaultBlockName(),
+ rootClientId
+ );
+ const directInsertBlock = rootClientId
+ ? getDirectInsertBlock( rootClientId )
+ : null;
+
+ return {
+ canMove: canMoveBlocks( clientIds, rootClientId ),
+ canRemove: canRemoveBlocks( clientIds, rootClientId ),
+ canInsertBlock: canInsertDefaultBlock || !! directInsertBlock,
+ canCopyStyles: blocks.every( ( block ) => {
+ return (
+ !! block &&
+ ( hasBlockSupport( block.name, 'color' ) ||
+ hasBlockSupport( block.name, 'typography' ) )
+ );
+ } ),
+ canDuplicate: blocks.every( ( block ) => {
+ return (
+ !! block &&
+ hasBlockSupport( block.name, 'multiple', true ) &&
+ canInsertBlockType( block.name, rootClientId )
+ );
+ } ),
+ };
+ },
+ [ clientIds, getDefaultBlockName ]
);
+ const { getBlocksByClientId, getBlocks } = useSelect( blockEditorStore );
- const canMove = canMoveBlocks( clientIds, rootClientId );
- const canRemove = canRemoveBlocks( clientIds, rootClientId );
+ const { canMove, canRemove, canInsertBlock, canCopyStyles, canDuplicate } =
+ selected;
const {
removeBlocks,
@@ -75,11 +88,9 @@ export default function BlockActions( {
return children( {
canCopyStyles,
canDuplicate,
- canInsertDefaultBlock,
+ canInsertBlock,
canMove,
canRemove,
- rootClientId,
- blocks,
onDuplicate() {
return duplicateBlocks( clientIds, updateSelection );
},
@@ -104,14 +115,17 @@ export default function BlockActions( {
setBlockMovingClientId( clientIds[ 0 ] );
},
onGroup() {
- if ( ! blocks.length ) {
+ if ( ! clientIds.length ) {
return;
}
const groupingBlockName = getGroupingBlockName();
// Activate the `transform` on `core/group` which does the conversion.
- const newBlocks = switchToBlockType( blocks, groupingBlockName );
+ const newBlocks = switchToBlockType(
+ getBlocksByClientId( clientIds ),
+ groupingBlockName
+ );
if ( ! newBlocks ) {
return;
@@ -119,12 +133,11 @@ export default function BlockActions( {
replaceBlocks( clientIds, newBlocks );
},
onUngroup() {
- if ( ! blocks.length ) {
+ if ( ! clientIds.length ) {
return;
}
- const innerBlocks = blocks[ 0 ].innerBlocks;
-
+ const innerBlocks = getBlocks( clientIds[ 0 ] );
if ( ! innerBlocks.length ) {
return;
}
@@ -132,16 +145,13 @@ export default function BlockActions( {
replaceBlocks( clientIds, innerBlocks );
},
onCopy() {
- const selectedBlockClientIds = blocks.map(
- ( { clientId } ) => clientId
- );
- if ( blocks.length === 1 ) {
- flashBlock( selectedBlockClientIds[ 0 ] );
+ if ( clientIds.length === 1 ) {
+ flashBlock( clientIds[ 0 ] );
}
- notifyCopy( 'copy', selectedBlockClientIds );
+ notifyCopy( 'copy', clientIds );
},
async onPasteStyles() {
- await pasteStyles( blocks );
+ await pasteStyles( getBlocksByClientId( clientIds ) );
},
} );
}
diff --git a/packages/block-editor/src/components/block-popover/cover.js b/packages/block-editor/src/components/block-popover/cover.js
new file mode 100644
index 00000000000000..6d2d5b8ce1ac03
--- /dev/null
+++ b/packages/block-editor/src/components/block-popover/cover.js
@@ -0,0 +1,63 @@
+/**
+ * WordPress dependencies
+ */
+import { useEffect, useState, useMemo, forwardRef } from '@wordpress/element';
+
+/**
+ * Internal dependencies
+ */
+import { __unstableUseBlockElement as useBlockElement } from '../block-list/use-block-props/use-block-refs';
+import BlockPopover from '.';
+
+function BlockPopoverCover(
+ { clientId, bottomClientId, children, shift = false, ...props },
+ ref
+) {
+ bottomClientId ??= clientId;
+
+ const selectedElement = useBlockElement( clientId );
+
+ return (
+
+ { selectedElement && clientId === bottomClientId ? (
+
+ { children }
+
+ ) : (
+ children
+ ) }
+
+ );
+}
+
+function CoverContainer( { selectedElement, children } ) {
+ const [ width, setWidth ] = useState( selectedElement.offsetWidth );
+ const [ height, setHeight ] = useState( selectedElement.offsetHeight );
+
+ useEffect( () => {
+ const observer = new window.ResizeObserver( () => {
+ setWidth( selectedElement.offsetWidth );
+ setHeight( selectedElement.offsetHeight );
+ } );
+ observer.observe( selectedElement, { box: 'border-box' } );
+ return () => observer.disconnect();
+ }, [ selectedElement ] );
+
+ const style = useMemo( () => {
+ return {
+ position: 'absolute',
+ width,
+ height,
+ };
+ }, [ width, height ] );
+
+ return
{ children }
;
+}
+
+export default forwardRef( BlockPopoverCover );
diff --git a/packages/block-editor/src/components/block-popover/drop-zone.js b/packages/block-editor/src/components/block-popover/drop-zone.js
index c26f28127022d6..1174c619cb3f43 100644
--- a/packages/block-editor/src/components/block-popover/drop-zone.js
+++ b/packages/block-editor/src/components/block-popover/drop-zone.js
@@ -9,7 +9,7 @@ import { __unstableMotion as motion } from '@wordpress/components';
* Internal dependencies
*/
import { store as blockEditorStore } from '../../store';
-import BlockPopover from './index';
+import BlockPopoverCover from './cover';
const animateVariants = {
hide: { opacity: 0, scaleY: 0.75 },
@@ -38,9 +38,8 @@ function BlockDropZonePopover( {
const reducedMotion = useReducedMotion();
return (
-
-
+
);
}
diff --git a/packages/block-editor/src/components/block-popover/index.js b/packages/block-editor/src/components/block-popover/index.js
index 13e6ba4d9e7f81..d5ac90c68745ec 100644
--- a/packages/block-editor/src/components/block-popover/index.js
+++ b/packages/block-editor/src/components/block-popover/index.js
@@ -28,8 +28,6 @@ function BlockPopover(
clientId,
bottomClientId,
children,
- __unstableRefreshSize,
- __unstableCoverTarget = false,
__unstablePopoverSlot,
__unstableContentRef,
shift = true,
@@ -75,30 +73,6 @@ function BlockPopover(
};
}, [ selectedElement ] );
- const style = useMemo( () => {
- if (
- // popoverDimensionsRecomputeCounter is by definition always equal or greater
- // than 0. This check is only there to satisfy the correctness of the
- // exhaustive-deps rule for the `useMemo` hook.
- popoverDimensionsRecomputeCounter < 0 ||
- ! selectedElement ||
- lastSelectedElement !== selectedElement
- ) {
- return {};
- }
-
- return {
- position: 'absolute',
- width: selectedElement.offsetWidth,
- height: selectedElement.offsetHeight,
- };
- }, [
- selectedElement,
- lastSelectedElement,
- __unstableRefreshSize,
- popoverDimensionsRecomputeCounter,
- ] );
-
const popoverAnchor = useMemo( () => {
if (
// popoverDimensionsRecomputeCounter is by definition always equal or greater
@@ -176,8 +150,7 @@ function BlockPopover(
) }
variant="unstyled"
>
- { __unstableCoverTarget && { children }
}
- { ! __unstableCoverTarget && children }
+ { children }
);
}
diff --git a/packages/block-editor/src/components/block-removal-warning-modal/index.js b/packages/block-editor/src/components/block-removal-warning-modal/index.js
index 167f87654259f8..fca8098c4cd398 100644
--- a/packages/block-editor/src/components/block-removal-warning-modal/index.js
+++ b/packages/block-editor/src/components/block-removal-warning-modal/index.js
@@ -8,7 +8,7 @@ import {
Button,
__experimentalHStack as HStack,
} from '@wordpress/components';
-import { __, _n } from '@wordpress/i18n';
+import { __ } from '@wordpress/i18n';
/**
* Internal dependencies
@@ -17,10 +17,9 @@ import { store as blockEditorStore } from '../../store';
import { unlock } from '../../lock-unlock';
export function BlockRemovalWarningModal( { rules } ) {
- const { clientIds, selectPrevious, blockNamesForPrompt, messageType } =
- useSelect( ( select ) =>
- unlock( select( blockEditorStore ) ).getRemovalPromptData()
- );
+ const { clientIds, selectPrevious, message } = useSelect( ( select ) =>
+ unlock( select( blockEditorStore ) ).getRemovalPromptData()
+ );
const {
clearBlockRemovalPrompt,
@@ -37,23 +36,10 @@ export function BlockRemovalWarningModal( { rules } ) {
};
}, [ rules, setBlockRemovalRules ] );
- if ( ! blockNamesForPrompt ) {
+ if ( ! message ) {
return;
}
- const message =
- messageType === 'templates'
- ? _n(
- 'Deleting this block will stop your post or page content from displaying on this template. It is not recommended.',
- 'Deleting these blocks will stop your post or page content from displaying on this template. It is not recommended.',
- blockNamesForPrompt.length
- )
- : _n(
- 'Deleting this block could break patterns on your site that have content linked to it. Are you sure you want to delete it?',
- 'Deleting these blocks could break patterns on your site that have content linked to them. Are you sure you want to delete them?',
- blockNamesForPrompt.length
- );
-
const onConfirmRemoval = () => {
privateRemoveBlocks( clientIds, selectPrevious, /* force */ true );
clearBlockRemovalPrompt();
diff --git a/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js b/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js
index ae28ca6e5bad97..f3d22e6557a674 100644
--- a/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js
+++ b/packages/block-editor/src/components/block-settings-menu/block-settings-dropdown.js
@@ -33,8 +33,12 @@ const POPOVER_PROPS = {
placement: 'bottom-start',
};
-function CopyMenuItem( { blocks, onCopy, label } ) {
- const ref = useCopyToClipboard( () => serialize( blocks ), onCopy );
+function CopyMenuItem( { clientIds, onCopy, label } ) {
+ const { getBlocksByClientId } = useSelect( blockEditorStore );
+ const ref = useCopyToClipboard(
+ () => serialize( getBlocksByClientId( clientIds ) ),
+ onCopy
+ );
const copyMenuItemLabel = label ? label : __( 'Copy' );
return ;
}
@@ -198,7 +202,7 @@ export function BlockSettingsDropdown( {
{ ( {
canCopyStyles,
canDuplicate,
- canInsertDefaultBlock,
+ canInsertBlock,
canMove,
canRemove,
onDuplicate,
@@ -208,7 +212,6 @@ export function BlockSettingsDropdown( {
onCopy,
onPasteStyles,
onMoveTo,
- blocks,
} ) => (
) }
{ canDuplicate && (
@@ -301,7 +304,7 @@ export function BlockSettingsDropdown( {
{ __( 'Duplicate' ) }
) }
- { canInsertDefaultBlock && (
+ { canInsertBlock && (
<>