You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* '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)
...
Copy file name to clipboardexpand all lines: docs/reference-guides/block-api/block-transforms.md
+26-4
Original file line number
Diff line number
Diff line change
@@ -228,7 +228,7 @@ When pasting content it's possible to define a [content model](https://html.spec
228
228
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).
229
229
230
230
```js
231
-
schema = { span: { children: { '#text': {} } } }
231
+
schema = { span: { children: { '#text': {} } } };
232
232
```
233
233
234
234
**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
237
237
238
238
```html
239
239
<divdata-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>
242
242
</div>
243
243
```
244
244
@@ -270,7 +270,7 @@ A transformation of type `shortcode` is an object that takes the following param
270
270
271
271
-**type**_(string)_: the value `shortcode`.
272
272
-**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.
274
274
-**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.
275
275
-**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.
276
276
-**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: {
336
336
]
337
337
},
338
338
```
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.
Copy file name to clipboardexpand all lines: docs/reference-guides/theme-json-reference/theme-json-living.md
+17-6
Original file line number
Diff line number
Diff line change
@@ -1,16 +1,27 @@
1
-
# Version 2 (living reference)
1
+
# Theme.json Version 2
2
2
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.
4
4
>
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).
6
8
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.
8
10
9
11
## Schema
10
12
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.:
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.
Copy file name to clipboardexpand all lines: docs/reference-guides/theme-json-reference/theme-json-v1.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
# Version 1 Reference
1
+
# Theme.json Version 1 Reference
2
2
3
3
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.
0 commit comments