Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fix editor history link test #50849

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
1664d5e
Navigation: Unlock private APIs outside of the component (#50509)
Mamaduka May 11, 2023
ed9be12
Remove the loader from sidebar navigation screen. (#50326)
juanfra May 11, 2023
8346327
Edit Site: Unlock private APIs outside of the component (#50534)
Mamaduka May 11, 2023
2f77022
Remove the check for draft navigation menus from the UnsavedInnerBloc…
scruffian May 11, 2023
cb87840
Apply useShouldContextualToolbarShow to edit site header navigable to…
jeryj May 11, 2023
e7e1b7c
Improve Nav block loading UX by preloading Navigation menu requests (…
getdave May 11, 2023
37d9839
Add `lang` and `dir` attributes to text-formatting tools (#49985)
aristath May 11, 2023
aed9a0d
Remove the wrong docblock for `WP_Theme_JSON_Gutenberg::get_property_…
samnajian May 11, 2023
0f56002
Plugin: Use bundled files for enqueuing global styles (#50310)
Mamaduka May 11, 2023
ab5c883
Duplicate LeafMoreMenu into the navigation block and the global sideb…
jeryj May 11, 2023
d24ac78
Browse mode Navigation: Fix broken submenu items (#50551)
MaggieCabrera May 11, 2023
f4da241
Modals: Update the secondary action's button design (#50544)
Mamaduka May 12, 2023
4ebe5ca
Mobile Release v1.95.0 (#50547)
fluiddot May 12, 2023
5ef52d5
[Site Editor]: Always show the `styles` navigation item (#50573)
ntsekouras May 12, 2023
662b8b5
Edit Site: Optimize loading useSelect call (#50546)
tyxla May 12, 2023
3483740
Adjust the logic of Post Title edit, so it avoids unnecessary OPTIONS…
kmanijak May 12, 2023
71644b7
[Mobile] - Update E2E config to support an iPad simulator (#50528)
May 12, 2023
25dadb0
update site editor sidebar alignment (#50561)
SaxonF May 12, 2023
524f7ca
Enable iframe-inline-styles e2e test (#50548)
scruffian May 12, 2023
0bf1e79
perf: Reduce inner blocks tree depth (#50447)
dcalhoun May 12, 2023
07b87a1
feat: Add disabled prop to SwitchCell component (#50560)
May 12, 2023
f6291fc
[Mobile] EmptyList now uses `useEditorWrapperStyles` hook and removes…
May 12, 2023
6606da4
Block Library: Remove unnecessary lodash mock from Buttons tests (#50…
tyxla May 12, 2023
831a536
Lodash: Remove from template part block (#50586)
tyxla May 12, 2023
298df3a
Lodash: Remove from Media & Text block (#50587)
tyxla May 12, 2023
7250336
Lodash: Remove from Latest Posts block (#50593)
tyxla May 12, 2023
99c3dda
Lodash: Remove from Image block (#50592)
tyxla May 12, 2023
f32c9a4
This commit: (#50563)
ramonjd May 13, 2023
8853016
Plugin: Fix building plugin zip to include interactive blocks (#50598)
gziolo May 13, 2023
4af25a1
Navigation: Fix warning when stretch justification is used (#50568)
andrewserong May 14, 2023
91dce95
Pattern block: Add experimental flag and syncStatus attrib to allow d…
glendaviesnz May 15, 2023
596838f
Update README.md to include a link to the docs (#50606)
bacoords May 15, 2023
a9fbca5
List View: Ensure settings menu is visible when focused (#50572)
andrewserong May 15, 2023
024d004
Prevent stacking of the entity revert and site save notices (#50302)
glendaviesnz May 15, 2023
3f5da7a
Removing `isStylePreview` prop, which is not used anywhere (#50622)
ramonjd May 15, 2023
c6ed0e4
Move gutenberg_get_global_styles (#50596)
oandregal May 15, 2023
71c18bd
chore: update memize to v2 (#50172)
johnhooks May 15, 2023
3bf54f6
Ensure pattern block doesn't duplicate client ids (#50629)
talldan May 15, 2023
d66e670
Move `gutenberg_get_remote_theme_patterns` (#50597)
oandregal May 15, 2023
6c83e67
Button: Update disabled state to be without background. (#50496)
jasmussen May 15, 2023
9e6b646
Migrate Cover Block tests to Playwright (#45784)
worldomonation May 15, 2023
efaadb1
Simplify the template revert snackbar by showing template name which …
glendaviesnz May 15, 2023
541b0dd
Site editor: convert device type margin styles into non-shorthand syn…
ciampo May 15, 2023
adefb89
Add new API to allow inserter items to be prioritised (#50510)
scruffian May 15, 2023
f8d74a6
Unlock useShouldContextualToolbarShow outside of the component (#50612)
Mamaduka May 15, 2023
a0e2d1d
Give template deleted snackbar an id so only one appears at a time (#…
glendaviesnz May 15, 2023
fc714ab
Removes the Post Content block from the inserter in the post editor a…
glendaviesnz May 15, 2023
b0d2da0
Add slug as classname to pattern block wrapper (#50641)
glendaviesnz May 16, 2023
744ab2c
Pattern block: update frontend render code to match the new version o…
glendaviesnz May 16, 2023
4adde6c
List block: fix merging nested list into paragraph (#50634)
ellatrix May 16, 2023
25dbbbb
Dimensions Panel: Fix resetting of axial spacing controls (#50654)
aaronrobertshaw May 16, 2023
b9b7c1b
Add contextual commands (#50543)
youknowriad May 16, 2023
283c674
Fix coding-standards issues in test themes (#50656)
aristath May 16, 2023
4deac62
Update `rel` and `title` labels for navigation and submenu links (#50…
juanfra May 16, 2023
0765968
Add `prioritizedInserterBlocks` to slash inserter (#50658)
ntsekouras May 16, 2023
60984b3
Command center: Add searchLabel property to commands (#50663)
youknowriad May 16, 2023
37dc9f6
[RNMobile] Fix embed webview endcoding (#50555)
jhnstn May 16, 2023
4556c86
Template pattern modal: remove internal modal classnames (#50655)
ciampo May 16, 2023
76319f8
Fix navigation tests by creating pages for link control (#50680)
jeryj May 16, 2023
f0266c2
Editor canvas container: include resizeable iframe in component (#50682)
ramonjd May 16, 2023
86dfd21
Edit Site: Simplofy variation selectors (#50687)
Mamaduka May 17, 2023
83a33e7
Cover: Unlock private APIs outside of the component (#50686)
Mamaduka May 17, 2023
522e1f1
Lodash: Remove from Gallery block (#50591)
tyxla May 17, 2023
6f2d112
File: Add experimental integration with Interactivity API (#50377)
gziolo May 17, 2023
9018b15
[Site Editor]: Update the add template menu (#50595)
ntsekouras May 17, 2023
2452a92
Marks the commands APIs as stable (#50691)
youknowriad May 17, 2023
22c837b
DropdownMenu: refactor to TypeScript (#50187)
chad1008 May 17, 2023
b1066e5
Navigation: Use the ListView in the Navigation block inspector contro…
scruffian May 17, 2023
e312f9c
Fix release performance tests (#50699)
WunderBart May 17, 2023
01248b8
Combine frontend navigation tests into fewer tests to speed up e2e te…
jeryj May 17, 2023
8d9752e
Add block variations transformation in block switcher (#50139)
ntsekouras May 17, 2023
6caf489
Respect showAppender when there are no items in list view (#50711)
jeryj May 17, 2023
5750a77
Bump plugin version to 15.8.0
gutenbergplugin May 17, 2023
5e1a0a8
Update Changelog for 15.8.0
gutenbergplugin May 17, 2023
2922d6b
Add wide align support to code block (#50710)
richtabor May 17, 2023
91dbcff
Added Unknown Config Option Detection (#50642)
ObliviousHarmony May 17, 2023
6bfafd0
Fix custom duotone filters in frontend (#50678)
May 17, 2023
c34280b
Styles Navigation Screen: Add Style Book (#50566)
andrewserong May 17, 2023
671d727
DateTime: Remove deprecated props (and fix static analysis action in …
andrewserong May 18, 2023
b0d20ed
Global styles revisions: highlight currently-loaded revision (#50725)
ramonjd May 18, 2023
2d794c7
Use `bdo` element when setting the language and direction attributes …
aristath May 18, 2023
a0a1fd5
Update `runtime` test field in WebPack config (#50727)
SantosGuillamot May 18, 2023
91fc1cc
[Mobile] - Block selection - Expand tapping on nested blocks directly…
May 18, 2023
6725f29
Fix Global Styles sidebar block selection on zoom out mode (#50708)
ntsekouras May 18, 2023
589fc18
Fix labelling, description, and focus style of the block transform to…
afercia May 18, 2023
37a691f
Edit Site: Fix `useEditedEntityRecord()` loading state (#50730)
tyxla May 18, 2023
0f893f7
docs: Fix change log typo (#50737)
dcalhoun May 18, 2023
02a7c49
Fix flaky media inserter drag-and-dropping e2e test (#50740)
Mamaduka May 18, 2023
b057776
Block Editor: Remove unused 'useIsDimensionsSupportValid' method (#50…
Mamaduka May 18, 2023
0146b37
Try: Smaller external link icon (#50728)
jasmussen May 18, 2023
714d1f0
Mobile - E2E test - Update code to use the new navigateUp helper (#50…
May 18, 2023
aa8bc55
Remove OffCanvasEditor (#50705)
scruffian May 18, 2023
bf80b72
$revisions_controller is not used. Let's delete it. (#50763)
ramonjd May 19, 2023
a8da93f
Minor updates to theme.json schema pages (#50742)
mburridge May 19, 2023
ac28fa6
Support negation operator in selectors in the Interactivity API (#50732)
SantosGuillamot May 19, 2023
f91be8d
Polish experimental navigation block (#50670)
SantosGuillamot May 19, 2023
c1238e4
Force display of in custom css input boxes to LTR (#50768)
glendaviesnz May 19, 2023
fc3c4f5
Add new experimental version of DropdownMenu (#49473)
ciampo May 19, 2023
7a93783
Remove `unwrap` from transforms and add `ungroup` to more blocks (#50…
ntsekouras May 19, 2023
542fa17
Update the document title in the site editor to open the command cent…
youknowriad May 19, 2023
d746e55
Remove the experimental flag of the command center (#50781)
youknowriad May 19, 2023
ce29b86
Added wrapper element for RichText in File block (#50607)
n2erjo00 May 19, 2023
064f731
Add transparent outline to input control BackdropUI focus style. (#50…
afercia May 19, 2023
c689d9f
Update frame resizing (#49910)
SaxonF May 19, 2023
3b71878
Site Editor navigation: Add corresponding area icon to template part …
ntsekouras May 19, 2023
5584713
Better error message when theme.json styles use a duotone preset not …
May 19, 2023
dc3832f
Fix inconsistent Link UI in Nav block list view editor (#50774)
getdave May 19, 2023
3dc64ad
Process template part shortcodes before blocks (#50801)
antpb May 20, 2023
e619119
Bump plugin version to 15.8.1
gutenbergplugin May 20, 2023
f861fa0
Update Changelog for 15.8.1
gutenbergplugin May 20, 2023
dc2eeba
Remove unintentionally added test artifact (#50795)
jeryj May 20, 2023
1c0bde9
add grab cursor style for mover button (#50808)
kutsu123 May 20, 2023
d42095c
Add t-hamano as codeowner for `env` package (#50817)
t-hamano May 20, 2023
2e40379
We want to have at least 2 revisions before showing the revisions lin…
ramonjd May 21, 2023
c40aad6
Library: Rename template parts to library in nav (#50769)
aaronrobertshaw May 22, 2023
0b6a426
Fix column block category (#46048)
shimotmk May 22, 2023
8b12c1c
Update border and focus style of the Input selector in ColorPicker Co…
falgunihdesai May 22, 2023
801681b
Remove all edit functionality from Navigation in Browse Mode (#50788)
getdave May 22, 2023
1939eae
Command center: Enable e2e tests (#50833)
youknowriad May 22, 2023
d6a482e
Fix custom template creation regression (#50797)
ntsekouras May 22, 2023
119a279
Fix width of Template Parts view (#50836)
mirka May 22, 2023
166256e
Fix contextual commands selectors (#50829)
youknowriad May 22, 2023
eecc955
[Site Editor]: Sort template parts by type in navigation screen (#50841)
ntsekouras May 22, 2023
a093361
[RNMobile] Add disabled style to `Cell` component (#50665)
fluiddot May 22, 2023
ffc592a
[Fonts API] Automatically enqueue user-selected global fonts (#50529)
hellofromtonya May 22, 2023
1a12859
test: Fix React prop typo
dcalhoun May 22, 2023
c1336f3
test: Simplify test queries
dcalhoun May 22, 2023
2c272f7
test: Increase editor history link test accuracy
dcalhoun May 22, 2023
85ae2f8
Add an outline when the color picker select box is focused (#50609)
megane9988 May 22, 2023
c11ac48
Update tooltip colors (#50792)
jameskoster May 22, 2023
7bac5ee
Fix gutenberg_get_block_editor_settings overriding other hooks (#50760)
May 22, 2023
2a3e708
Merge remote-tracking branch 'origin' into test/fix-editor-history-li…
derekblank May 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
/packages/report-flaky-tests @kevin940726

# wp-env
/packages/env @noahtallen @ObliviousHarmony
/packages/env @noahtallen @ObliviousHarmony @t-hamano

# PHP
/lib @spacedmonkey
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
WP_VERSION=$(awk -F ': ' '/^Tested up to/{print $2}' readme.txt)
IFS=. read -ra WP_VERSION_ARRAY <<< "$WP_VERSION"
WP_MAJOR="${WP_VERSION_ARRAY[0]}.${WP_VERSION_ARRAY[1]}"
./bin/plugin/cli.js perf "wp/$WP_MAJOR" "$PREVIOUS_RELEASE_BRANCH" "$CURRENT_RELEASE_BRANCH" --wp-version "$WP_MAJOR"
./bin/plugin/cli.js perf "wp/$WP_MAJOR" "$PREVIOUS_RELEASE_BRANCH" "$CURRENT_RELEASE_BRANCH" --tests-branch $GITHUB_SHA --wp-version "$WP_MAJOR"

- name: Compare performance with base branch
if: github.event_name == 'push'
Expand Down
1 change: 1 addition & 0 deletions bin/build-plugin-zip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ build_files=$(
build/block-library/blocks/*.php \
build/block-library/blocks/*/block.json \
build/block-library/blocks/*/*.{js,js.map,css,asset.php} \
build/block-library/interactivity/*.{js,js.map,asset.php} \
build/edit-widgets/blocks/*/block.json \
build/widgets/blocks/*.php \
build/widgets/blocks/*/block.json \
Expand Down
24 changes: 23 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
== Changelog ==

= 15.8.0-rc.1 =
= 15.8.1 =



Error: There are no unreleased pull requests associated with the milestone.
at fetchAllPullRequests (/home/runner/work/gutenberg/gutenberg/bin/plugin/commands/changelog.js:684:10)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async createChangelog (/home/runner/work/gutenberg/gutenberg/bin/plugin/commands/changelog.js:994:24)
at async getReleaseChangelog (/home/runner/work/gutenberg/gutenberg/bin/plugin/commands/changelog.js:1020:2)
at async Command.<anonymous> (/home/runner/work/gutenberg/gutenberg/bin/plugin/cli.js:11:4)


= 15.8.0 =

## Contributors

The following contributors merged PRs in this release:


## Changelog

Expand Down Expand Up @@ -103,6 +120,8 @@
- Fix/wp get global styles for custom props returns internal variable. ([50366](https://github.com/WordPress/gutenberg/pull/50366))
- Revisions controller: Fix author and date fields. ([50117](https://github.com/WordPress/gutenberg/pull/50117))
- Fix hover/focus styles for `style variation` buttons. ([50056](https://github.com/WordPress/gutenberg/pull/50056))
- Use bundled files for enqueuing global styles. ([50310](https://github.com/WordPress/gutenberg/pull/50310))


#### Block Editor
- Fix issue with margin collapsing when selecting blocks. ([50215](https://github.com/WordPress/gutenberg/pull/50215))
Expand Down Expand Up @@ -158,6 +177,7 @@
#### Interactivity API
- Add Interactivity API runtime. ([49994](https://github.com/WordPress/gutenberg/pull/49994))
- Navigation block with the Interactivity API. ([50041](https://github.com/WordPress/gutenberg/pull/50041))
- Fix building plugin zip to include interactive blocks. ([50598](https://github.com/WordPress/gutenberg/pull/50598))

#### Command Center
- Update the experiment label. ([50467](https://github.com/WordPress/gutenberg/pull/50467))
Expand Down Expand Up @@ -298,6 +318,8 @@ The following contributors merged PRs in this release:
@aaronrobertshaw @afercia @ajlende @alexstine @andrewserong @apeatling @artemiomorales @aurooba @bph @chad1008 @ciampo @DAreRodz @dcalhoun @draganescu @ecgan @fluiddot @fullofcaffeine @geriux @getdave @glendaviesnz @gziolo @hellofromtonya @ironprogrammer @jameskoster @jasmussen @jeryj @jhnstn @johnhooks @jsnajdr @juanfra @kevin940726 @kienstra @Mamaduka @margolisj @mburridge @mirka @mokagio @mtias @n2erjo00 @ndiego @noahtallen @noisysocks @ntsekouras @oandregal @ObliviousHarmony @ocean90 @ockham @pavanpatil1 @pooja-muchandikar @priethor @ramonjd @richtabor @samnajian @SantosGuillamot @scruffian @SiobhyB @t-hamano @talldan @tellthemachines @torounit @tyxla @westonruter @youknowriad




= 15.7.1 =


Expand Down
4 changes: 2 additions & 2 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -594,13 +594,13 @@
"parent": "reference-guides"
},
{
"title": "Version 2 (living reference)",
"title": "Theme.json Version 2",
"slug": "theme-json-living",
"markdown_source": "../docs/reference-guides/theme-json-reference/theme-json-living.md",
"parent": "theme-json-reference"
},
{
"title": "Version 1 Reference",
"title": "Theme.json Version 1 Reference",
"slug": "theme-json-v1",
"markdown_source": "../docs/reference-guides/theme-json-reference/theme-json-v1.md",
"parent": "theme-json-reference"
Expand Down
30 changes: 26 additions & 4 deletions docs/reference-guides/block-api/block-transforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ When pasting content it's possible to define a [content model](https://html.spec
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).

```js
schema = { span: { children: { '#text': {} } } }
schema = { span: { children: { '#text': {} } } };
```

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

```html
<div data-post-id="13">
<h2>The Post Title</h2>
<p>Some <em>great</em> content.</p>
<h2>The Post Title</h2>
<p>Some <em>great</em> content.</p>
</div>
```

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

- **type** _(string)_: the value `shortcode`.
- **tag** _(string|array)_: the shortcode tag or list of shortcode aliases this transform can work with.
- **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.
- **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.
- **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.
- **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.
- **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.
Expand Down Expand Up @@ -336,3 +336,25 @@ transforms: {
]
},
```

## `ungroup` blocks

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.

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.

**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.

Example:

```js
export const settings = {
title: 'My grouping Block Title',
description: 'My grouping block description',
/* ... */
transforms: {
ungroup: ( attributes, innerBlocks ) =>
innerBlocks.flatMap( ( innerBlock ) => innerBlock.innerBlocks ),
},
};
```
6 changes: 3 additions & 3 deletions docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ Display code snippets that respect your spacing and tabs. ([Source](https://gith

- **Name:** core/code
- **Category:** text
- **Supports:** anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight)
- **Supports:** align (wide), anchor, color (background, gradients, text), spacing (margin, padding), typography (fontSize, lineHeight)
- **Attributes:** content

## Column

A single column within a columns block. ([Source](https://github.com/WordPress/gutenberg/tree/trunk/packages/block-library/src/column))

- **Name:** core/column
- **Category:** text
- **Category:** design
- **Supports:** anchor, color (background, gradients, link, text), spacing (blockGap, padding), typography (fontSize, lineHeight), ~~html~~, ~~reusable~~
- **Attributes:** allowedBlocks, templateLock, verticalAlignment, width

Expand Down Expand Up @@ -465,7 +465,7 @@ Show a block pattern. ([Source](https://github.com/WordPress/gutenberg/tree/trun
- **Name:** core/pattern
- **Category:** theme
- **Supports:** ~~html~~, ~~inserter~~
- **Attributes:** slug
- **Attributes:** slug, syncStatus

## Post Author

Expand Down
23 changes: 17 additions & 6 deletions docs/reference-guides/theme-json-reference/theme-json-living.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
# Version 2 (living reference)
# Theme.json Version 2

> 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.
> 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.
>
> 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).
> There are some related documents that 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).

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.
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.

## Schema

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
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.

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.:

```
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 2,
...
}
```

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.

<!-- START TOKEN Autogenerated - DO NOT EDIT -->
## Settings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Version 1 Reference
# Theme.json Version 1 Reference

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.

Expand Down
1 change: 1 addition & 0 deletions docs/tool/manifest.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const componentPaths = glob( 'packages/components/src/*/**/README.md', {
'**/src/ui/**/README.md',
'packages/components/src/theme/README.md',
'packages/components/src/view/README.md',
'packages/components/src/dropdown-menu-v2/README.md',
],
} );
const packagePaths = glob( 'packages/*/package.json' )
Expand Down
2 changes: 1 addition & 1 deletion gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.1
* Requires PHP: 5.6
* Version: 15.8.0-rc.1
* Version: 15.8.1
* Author: Gutenberg Team
* Text Domain: gutenberg
*
Expand Down
151 changes: 151 additions & 0 deletions lib/block-editor-settings.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
<?php
/**
* Adds settings to the block editor.
*
* @package gutenberg
*/

/**
* Replaces core 'styles' and '__experimentalFeatures' block editor settings from
* wordpress-develop/block-editor.php with the Gutenberg versions. Much of the
* code is copied from get_block_editor_settings() in that file.
*
* This hook should run first as it completely replaces the core settings that
* other hooks may need to update.
*
* Note: The settings that are WP version specific should be handled inside the `compat` directory.
*
* @param array $settings Existing block editor settings.
*
* @return array New block editor settings.
*/
function gutenberg_get_block_editor_settings( $settings ) {
$global_styles = array();
$presets = array(
array(
'css' => 'variables',
'__unstableType' => 'presets',
'isGlobalStyles' => true,
),
array(
'css' => 'presets',
'__unstableType' => 'presets',
'isGlobalStyles' => true,
),
);
foreach ( $presets as $preset_style ) {
$actual_css = gutenberg_get_global_stylesheet( array( $preset_style['css'] ) );
if ( '' !== $actual_css ) {
$preset_style['css'] = $actual_css;
$global_styles[] = $preset_style;
}
}

if ( wp_theme_has_theme_json() ) {
$block_classes = array(
'css' => 'styles',
'__unstableType' => 'theme',
'isGlobalStyles' => true,
);
$actual_css = gutenberg_get_global_stylesheet( array( $block_classes['css'] ) );
if ( '' !== $actual_css ) {
$block_classes['css'] = $actual_css;
$global_styles[] = $block_classes;
}

/*
* Add the custom CSS as a separate stylesheet so any invalid CSS
* entered by users does not break other global styles.
*/
$global_styles[] = array(
'css' => gutenberg_get_global_styles_custom_css(),
'__unstableType' => 'user',
'isGlobalStyles' => true,
);
} else {
// If there is no `theme.json` file, ensure base layout styles are still available.
$block_classes = array(
'css' => 'base-layout-styles',
'__unstableType' => 'base-layout',
'isGlobalStyles' => true,
);
$actual_css = gutenberg_get_global_stylesheet( array( $block_classes['css'] ) );
if ( '' !== $actual_css ) {
$block_classes['css'] = $actual_css;
$global_styles[] = $block_classes;
}
}

$settings['styles'] = array_merge( $global_styles, get_block_editor_theme_styles() );

$settings['__experimentalFeatures'] = gutenberg_get_global_settings();
// These settings may need to be updated based on data coming from theme.json sources.
if ( isset( $settings['__experimentalFeatures']['color']['palette'] ) ) {
$colors_by_origin = $settings['__experimentalFeatures']['color']['palette'];
$settings['colors'] = isset( $colors_by_origin['custom'] ) ?
$colors_by_origin['custom'] : (
isset( $colors_by_origin['theme'] ) ?
$colors_by_origin['theme'] :
$colors_by_origin['default']
);
}
if ( isset( $settings['__experimentalFeatures']['color']['gradients'] ) ) {
$gradients_by_origin = $settings['__experimentalFeatures']['color']['gradients'];
$settings['gradients'] = isset( $gradients_by_origin['custom'] ) ?
$gradients_by_origin['custom'] : (
isset( $gradients_by_origin['theme'] ) ?
$gradients_by_origin['theme'] :
$gradients_by_origin['default']
);
}
if ( isset( $settings['__experimentalFeatures']['typography']['fontSizes'] ) ) {
$font_sizes_by_origin = $settings['__experimentalFeatures']['typography']['fontSizes'];
$settings['fontSizes'] = isset( $font_sizes_by_origin['custom'] ) ?
$font_sizes_by_origin['custom'] : (
isset( $font_sizes_by_origin['theme'] ) ?
$font_sizes_by_origin['theme'] :
$font_sizes_by_origin['default']
);
}
if ( isset( $settings['__experimentalFeatures']['color']['custom'] ) ) {
$settings['disableCustomColors'] = ! $settings['__experimentalFeatures']['color']['custom'];
unset( $settings['__experimentalFeatures']['color']['custom'] );
}
if ( isset( $settings['__experimentalFeatures']['color']['customGradient'] ) ) {
$settings['disableCustomGradients'] = ! $settings['__experimentalFeatures']['color']['customGradient'];
unset( $settings['__experimentalFeatures']['color']['customGradient'] );
}
if ( isset( $settings['__experimentalFeatures']['typography']['customFontSize'] ) ) {
$settings['disableCustomFontSizes'] = ! $settings['__experimentalFeatures']['typography']['customFontSize'];
unset( $settings['__experimentalFeatures']['typography']['customFontSize'] );
}
if ( isset( $settings['__experimentalFeatures']['typography']['lineHeight'] ) ) {
$settings['enableCustomLineHeight'] = $settings['__experimentalFeatures']['typography']['lineHeight'];
unset( $settings['__experimentalFeatures']['typography']['lineHeight'] );
}
if ( isset( $settings['__experimentalFeatures']['spacing']['units'] ) ) {
$settings['enableCustomUnits'] = $settings['__experimentalFeatures']['spacing']['units'];
unset( $settings['__experimentalFeatures']['spacing']['units'] );
}
if ( isset( $settings['__experimentalFeatures']['spacing']['padding'] ) ) {
$settings['enableCustomSpacing'] = $settings['__experimentalFeatures']['spacing']['padding'];
unset( $settings['__experimentalFeatures']['spacing']['padding'] );
}
if ( isset( $settings['__experimentalFeatures']['spacing']['customSpacingSize'] ) ) {
$settings['disableCustomSpacingSizes'] = ! $settings['__experimentalFeatures']['spacing']['customSpacingSize'];
unset( $settings['__experimentalFeatures']['spacing']['customSpacingSize'] );
}

if ( isset( $settings['__experimentalFeatures']['spacing']['spacingSizes'] ) ) {
$spacing_sizes_by_origin = $settings['__experimentalFeatures']['spacing']['spacingSizes'];
$settings['spacingSizes'] = isset( $spacing_sizes_by_origin['custom'] ) ?
$spacing_sizes_by_origin['custom'] : (
isset( $spacing_sizes_by_origin['theme'] ) ?
$spacing_sizes_by_origin['theme'] :
$spacing_sizes_by_origin['default']
);
}

return $settings;
}
add_filter( 'block_editor_settings_all', 'gutenberg_get_block_editor_settings', 0 );
Loading