Skip to content

Commit 89b582f

Browse files
committed
Merge branch 'trunk' of https://github.com/WordPress/gutenberg into add/static-closures
* 'trunk' of https://github.com/WordPress/gutenberg: (26 commits) Add transparent outline to input control BackdropUI focus style. (#50772) Added wrapper element for RichText in File block (#50607) Remove the experimental flag of the command center (#50781) Update the document title in the site editor to open the command center (#50369) Remove `unwrap` from transforms and add `ungroup` to more blocks (#50385) Add new experimental version of DropdownMenu (#49473) Force display of in custom css input boxes to LTR (#50768) Polish experimental navigation block (#50670) Support negation operator in selectors in the Interactivity API (#50732) Minor updates to theme.json schema pages (#50742) $revisions_controller is not used. Let's delete it. (#50763) Remove OffCanvasEditor (#50705) Mobile - E2E test - Update code to use the new navigateUp helper (#50736) Try: Smaller external link icon (#50728) Block Editor: Remove unused 'useIsDimensionsSupportValid' method (#50735) Fix flaky media inserter drag-and-dropping e2e test (#50740) docs: Fix change log typo (#50737) Edit Site: Fix `useEditedEntityRecord()` loading state (#50730) Fix labelling, description, and focus style of the block transform to pattern previews (#50577) Fix Global Styles sidebar block selection on zoom out mode (#50708) ...
2 parents 0ff05d9 + 064f731 commit 89b582f

File tree

118 files changed

+3415
-3888
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+3415
-3888
lines changed

docs/manifest.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -594,13 +594,13 @@
594594
"parent": "reference-guides"
595595
},
596596
{
597-
"title": "Version 2 (living reference)",
597+
"title": "Theme.json Version 2",
598598
"slug": "theme-json-living",
599599
"markdown_source": "../docs/reference-guides/theme-json-reference/theme-json-living.md",
600600
"parent": "theme-json-reference"
601601
},
602602
{
603-
"title": "Version 1 Reference",
603+
"title": "Theme.json Version 1 Reference",
604604
"slug": "theme-json-v1",
605605
"markdown_source": "../docs/reference-guides/theme-json-reference/theme-json-v1.md",
606606
"parent": "theme-json-reference"

docs/reference-guides/block-api/block-transforms.md

+26-4
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ When pasting content it's possible to define a [content model](https://html.spec
228228
When writing `raw` transforms you can control this by supplying a `schema` which describes allowable content and which will be applied to clean up the pasted content before attempting to match with your block. The schemas are passed into [`cleanNodeList` from `@wordpress/dom`](https://github.com/wordpress/gutenberg/blob/trunk/packages/dom/src/dom/clean-node-list.js); check there for a [complete description of the schema](https://github.com/wordpress/gutenberg/blob/trunk/packages/dom/src/phrasing-content.js).
229229

230230
```js
231-
schema = { span: { children: { '#text': {} } } }
231+
schema = { span: { children: { '#text': {} } } };
232232
```
233233

234234
**Example: a custom content model**
@@ -237,8 +237,8 @@ Suppose we want to match the following HTML snippet and turn it into some kind o
237237

238238
```html
239239
<div data-post-id="13">
240-
<h2>The Post Title</h2>
241-
<p>Some <em>great</em> content.</p>
240+
<h2>The Post Title</h2>
241+
<p>Some <em>great</em> content.</p>
242242
</div>
243243
```
244244

@@ -270,7 +270,7 @@ A transformation of type `shortcode` is an object that takes the following param
270270

271271
- **type** _(string)_: the value `shortcode`.
272272
- **tag** _(string|array)_: the shortcode tag or list of shortcode aliases this transform can work with.
273-
- **transform** _(function, optional): a callback that receives the shortcode attributes as the first argument and the [WPShortcodeMatch](/packages/shortcode/README.md#next) as the second. It should return a block object or an array of block objects. When this parameter is defined, it will take precedence over the `attributes` parameter.
273+
- **transform** _(function, optional)_: a callback that receives the shortcode attributes as the first argument and the [WPShortcodeMatch](/packages/shortcode/README.md#next) as the second. It should return a block object or an array of block objects. When this parameter is defined, it will take precedence over the `attributes` parameter.
274274
- **attributes** _(object, optional)_: object representing where the block attributes should be sourced from, according to the attributes shape defined by the [block configuration object](./block-registration.md). If a particular attribute contains a `shortcode` key, it should be a function that receives the shortcode attributes as the first arguments and the [WPShortcodeMatch](/packages/shortcode/README.md#next) as second, and returns a value for the attribute that will be sourced in the block's comment.
275275
- **isMatch** _(function, optional)_: a callback that receives the shortcode attributes per the [Shortcode API](https://codex.wordpress.org/Shortcode_API) and should return a boolean. Returning `false` from this function will prevent the shortcode to be transformed into this block.
276276
- **priority** _(number, optional)_: controls the priority with which a transform is applied, where a lower value will take precedence over higher values. This behaves much like a [WordPress hook](https://codex.wordpress.org/Plugin_API#Hook_to_WordPress). Like hooks, the default priority is `10` when not otherwise set.
@@ -336,3 +336,25 @@ transforms: {
336336
]
337337
},
338338
```
339+
340+
## `ungroup` blocks
341+
342+
Via the optional `transforms` key of the block configuration, blocks can use the `ungroup` subkey to define the blocks that will replace the block being processed. These new blocks will usually be a subset of the existing inner blocks, but could also include new blocks.
343+
344+
If a block has an `ungroup` transform, it is eligible for ungrouping, without the requirement of being the default grouping block. The UI used to ungroup a block with this API is the same as the one used for the default grouping block. In order for the Ungroup button to be displayed, we must have a single grouping block selected, which also contains some inner blocks.
345+
346+
**ungroup** is a callback function that receives the attributes and inner blocks of the block being processed. It should return an array of block objects.
347+
348+
Example:
349+
350+
```js
351+
export const settings = {
352+
title: 'My grouping Block Title',
353+
description: 'My grouping block description',
354+
/* ... */
355+
transforms: {
356+
ungroup: ( attributes, innerBlocks ) =>
357+
innerBlocks.flatMap( ( innerBlock ) => innerBlock.innerBlocks ),
358+
},
359+
};
360+
```

docs/reference-guides/theme-json-reference/theme-json-living.md

+17-6
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,27 @@
1-
# Version 2 (living reference)
1+
# Theme.json Version 2
22

3-
> This is the living specification for the **version 2** of theme.json. This version works with WordPress 5.9 or later, and the latest Gutenberg plugin.
3+
> This is the living specification for **version 2** of `theme.json`. This version works with WordPress 5.9 or later, and the latest Gutenberg plugin.
44
>
5-
> There're related documents you may be interested in: the [theme.json v1](/docs/reference-guides/theme-json-reference/theme-json-v1.md) specification and the [reference to migrate from theme.json v1 to v2](/docs/reference-guides/theme-json-reference/theme-json-migrations.md).
5+
> There are some related documents that you may be interested in:
6+
> - the [theme.json v1](/docs/reference-guides/theme-json-reference/theme-json-v1.md) specification, and
7+
> - the [reference to migrate from theme.json v1 to v2](/docs/reference-guides/theme-json-reference/theme-json-migrations.md).
68
7-
This reference guide lists the settings and style properties defined in the theme.json schema. See the [theme.json how to guide](/docs/how-to-guides/themes/theme-json.md) for examples and guide on how to use the theme.json file in your theme.
9+
This reference guide lists the settings and style properties defined in the `theme.json` schema. See the [theme.json how to guide](/docs/how-to-guides/themes/theme-json.md) for examples and guidance on how to use the `theme.json` file in your theme.
810

911
## Schema
1012

11-
It can be difficult to remember the theme.json settings and properties while you develop, so a JSON scheme was created to help. The schema is available at https://schemas.wp.org/trunk/theme.json
13+
Remembering the `theme.json` settings and properties while you develop can be difficult, so a [JSON schema](https://schemas.wp.org/trunk/theme.json) was created to help.
14+
15+
Code editors can pick up the schema and can provide helpful hints and suggestions such as tooltips, autocomplete, or schema validation in the editor. To use the schema in Visual Studio Code, add `$schema`: "https://schemas.wp.org/trunk/theme.json" to the beginning of your theme.json file together with a `version` corresponding to the version you wish to use, e.g.:
16+
17+
```
18+
{
19+
"$schema": "https://schemas.wp.org/trunk/theme.json",
20+
"version": 2,
21+
...
22+
}
23+
```
1224

13-
Code editors can pick up the schema and can provide help like tooltips, autocomplete, or schema validation in the editor. To use the schema in Visual Studio Code, add "$schema": "https://schemas.wp.org/trunk/theme.json" to the beginning of your theme.json file.
1425

1526
<!-- START TOKEN Autogenerated - DO NOT EDIT -->
1627
## Settings

docs/reference-guides/theme-json-reference/theme-json-v1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Version 1 Reference
1+
# Theme.json Version 1 Reference
22

33
Theme.json version 2 has been released, see the [theme.json migration guide](/docs/reference-guides/theme-json-reference/theme-json-migrations.md#migrating-from-v1-to-v2) for updating to the latest version.
44

docs/tool/manifest.js

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const componentPaths = glob( 'packages/components/src/*/**/README.md', {
1414
'**/src/ui/**/README.md',
1515
'packages/components/src/theme/README.md',
1616
'packages/components/src/view/README.md',
17+
'packages/components/src/dropdown-menu-v2/README.md',
1718
],
1819
} );
1920
const packagePaths = glob( 'packages/*/package.json' )

lib/compat/wordpress-6.3/class-gutenberg-rest-global-styles-controller-6-3.php

-8
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@
1010
* Base Global Styles REST API Controller.
1111
*/
1212
class Gutenberg_REST_Global_Styles_Controller_6_3 extends Gutenberg_REST_Global_Styles_Controller_6_2 {
13-
/**
14-
* Revision controller.
15-
*
16-
* @since 6.3.0
17-
* @var WP_REST_Revisions_Controller
18-
*/
19-
private $revisions_controller;
20-
2113
/**
2214
* Prepares links for the request.
2315
*

lib/experimental/editor-settings.php

-6
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,6 @@ function gutenberg_enable_experiments() {
8383
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-color-randomizer', $gutenberg_experiments ) ) {
8484
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableColorRandomizer = true', 'before' );
8585
}
86-
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-command-center', $gutenberg_experiments ) ) {
87-
wp_add_inline_script( 'wp-edit-site', 'window.__experimentalEnableCommandCenter = true', 'before' );
88-
}
89-
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-command-center', $gutenberg_experiments ) ) {
90-
wp_add_inline_script( 'wp-edit-post', 'window.__experimentalEnableCommandCenter = true', 'before' );
91-
}
9286
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-group-grid-variation', $gutenberg_experiments ) ) {
9387
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableGroupGridVariation = true', 'before' );
9488
}

lib/experimental/interactivity-api/blocks.php

+6-21
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function gutenberg_block_core_file_add_directives_to_content( $block_content, $b
2323
$processor->next_tag();
2424
$processor->set_attribute( 'data-wp-island', '' );
2525
$processor->next_tag( 'object' );
26-
$processor->set_attribute( 'data-wp-bind.hidden', 'selectors.core.file.hasNoPdfPreview' );
26+
$processor->set_attribute( 'data-wp-bind.hidden', '!selectors.core.file.hasPdfPreview' );
2727
$processor->set_attribute( 'hidden', true );
2828
return $processor->get_updated_html();
2929
}
@@ -47,8 +47,8 @@ function gutenberg_block_core_file_add_directives_to_content( $block_content, $b
4747
* data-wp-class.has-modal-open="context.core.navigation.isMenuOpen"
4848
* data-wp-class.is-menu-open="context.core.navigation.isMenuOpen"
4949
* data-wp-bind.aria-hidden="!context.core.navigation.isMenuOpen"
50-
* data-wp-effect="effects.core.navigation.initModal"
51-
* data-wp-on.keydow="actions.core.navigation.handleMenuKeydown"
50+
* data-wp-effect="effects.core.navigation.initMenu"
51+
* data-wp-on.keydown="actions.core.navigation.handleMenuKeydown"
5252
* data-wp-on.focusout="actions.core.navigation.handleMenuFocusout"
5353
* tabindex="-1"
5454
* >
@@ -97,21 +97,6 @@ function gutenberg_block_core_navigation_add_directives_to_markup( $block_conten
9797
// If the open modal button not found, we handle submenus immediately.
9898
$w = new WP_HTML_Tag_Processor( $w->get_updated_html() );
9999

100-
// Add directives to the menu container.
101-
if ( $w->next_tag(
102-
array(
103-
'tag_name' => 'UL',
104-
'class_name' => 'wp-block-navigation__container',
105-
)
106-
) ) {
107-
$w->set_attribute( 'data-wp-class.is-menu-open', 'context.core.navigation.isMenuOpen' );
108-
$w->set_attribute( 'data-wp-bind.aria-hidden', '!context.core.navigation.isMenuOpen' );
109-
$w->set_attribute( 'data-wp-effect', 'effects.core.navigation.initModal' );
110-
$w->set_attribute( 'data-wp-on.keydown', 'actions.core.navigation.handleMenuKeydown' );
111-
$w->set_attribute( 'data-wp-on.focusout', 'actions.core.navigation.handleMenuFocusout' );
112-
$w->set_attribute( 'tabindex', '-1' );
113-
};
114-
115100
gutenberg_block_core_navigation_add_directives_to_submenu( $w );
116101

117102
return $w->get_updated_html();
@@ -127,7 +112,7 @@ function gutenberg_block_core_navigation_add_directives_to_markup( $block_conten
127112
$w->set_attribute( 'data-wp-class.has-modal-open', 'context.core.navigation.isMenuOpen' );
128113
$w->set_attribute( 'data-wp-class.is-menu-open', 'context.core.navigation.isMenuOpen' );
129114
$w->set_attribute( 'data-wp-bind.aria-hidden', '!context.core.navigation.isMenuOpen' );
130-
$w->set_attribute( 'data-wp-effect', 'effects.core.navigation.initModal' );
115+
$w->set_attribute( 'data-wp-effect', 'effects.core.navigation.initMenu' );
131116
$w->set_attribute( 'data-wp-on.keydown', 'actions.core.navigation.handleMenuKeydown' );
132117
$w->set_attribute( 'data-wp-on.focusout', 'actions.core.navigation.handleMenuFocusout' );
133118
$w->set_attribute( 'tabindex', '-1' );
@@ -191,7 +176,7 @@ function gutenberg_block_core_navigation_add_directives_to_markup( $block_conten
191176
* <span>Title</span>
192177
* <ul
193178
* class="wp-block-navigation__submenu-container"
194-
* data-wp-effect="effects.core.navigation.initModal"
179+
* data-wp-effect="effects.core.navigation.initMenu"
195180
* data-wp-on.focusout="actions.core.navigation.handleMenuFocusout"
196181
* data-wp-on.keydown="actions.core.navigation.handleMenuKeydown"
197182
* >
@@ -233,7 +218,7 @@ function gutenberg_block_core_navigation_add_directives_to_submenu( $w ) {
233218
'class_name' => 'wp-block-navigation__submenu-container',
234219
)
235220
) ) {
236-
$w->set_attribute( 'data-wp-effect', 'effects.core.navigation.initModal' );
221+
$w->set_attribute( 'data-wp-effect', 'effects.core.navigation.initMenu' );
237222
$w->set_attribute( 'data-wp-on.focusout', 'actions.core.navigation.handleMenuFocusout' );
238223
$w->set_attribute( 'data-wp-on.keydown', 'actions.core.navigation.handleMenuKeydown' );
239224
};

lib/experiments-page.php

-12
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,6 @@ function gutenberg_initialize_experiments_settings() {
6565
)
6666
);
6767

68-
add_settings_field(
69-
'gutenberg-command-center',
70-
__( 'Command center ', 'gutenberg' ),
71-
'gutenberg_display_experiment_field',
72-
'gutenberg-experiments',
73-
'gutenberg_experiments_section',
74-
array(
75-
'label' => __( 'Test the command center; Open it using cmd + k in the site or post editors.', 'gutenberg' ),
76-
'id' => 'gutenberg-command-center',
77-
)
78-
);
79-
8068
add_settings_field(
8169
'gutenberg-group-grid-variation',
8270
__( 'Grid variation for Group block ', 'gutenberg' ),

0 commit comments

Comments
 (0)