Skip to content

Commit

Permalink
Merge branch 'WordPress:trunk' into fix/issue-63991
Browse files Browse the repository at this point in the history
  • Loading branch information
sarthaknagoshe2002 authored Dec 20, 2024
2 parents aaf94cd + 12f7764 commit 212590e
Show file tree
Hide file tree
Showing 178 changed files with 3,843 additions and 1,135 deletions.
5 changes: 5 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,11 @@ const restrictedSyntax = [
message:
'Avoid truthy checks on length property rendering, as zero length is rendered verbatim.',
},
{
selector:
'CallExpression[callee.name=/^(__|_x|_n|_nx)$/] > Literal[value=/^toggle\\b/i]',
message: "Avoid using the verb 'Toggle' in translatable strings",
},
];

/** `no-restricted-syntax` rules for components. */
Expand Down
48 changes: 48 additions & 0 deletions .github/workflows/sync-assets-to-plugin-repo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Sync Gutenberg plugin assets to WordPress.org plugin repo

on:
push:
branches:
- trunk
paths:
- assets/**

jobs:
sync-assets:
name: Sync assets to WordPress.org plugin repo
runs-on: ubuntu-latest
environment: wp.org plugin
env:
PLUGIN_REPO_URL: 'https://plugins.svn.wordpress.org/gutenberg'
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}

steps:
- name: Check out Gutenberg assets folder from WP.org plugin repo
run: |
svn checkout "$PLUGIN_REPO_URL/assets" \
--username "$SVN_USERNAME" --password "$SVN_PASSWORD"
- name: Delete everything
run: find assets -type f -not -path 'assets/.svn/*' -delete

- name: Checkout assets from current release
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: |
assets
show-progress: ${{ runner.debug == '1' && 'true' || 'false' }}
path: git

- name: Copy files from git checkout to svn working copy
run: cp -R git/assets/* assets

- name: Commit the updated assets
working-directory: ./assets
run: |
svn st | awk '/^?/ {print $2}' | xargs -r svn add
svn st | awk '/^!/ {print $2}' | xargs -r svn rm
svn commit . \
-m "Sync assets for commit $GITHUB_SHA" \
--no-auth-cache --non-interactive --username "$SVN_USERNAME" --password "$SVN_PASSWORD" \
--config-option=servers:global:http-timeout=600
7 changes: 7 additions & 0 deletions assets/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Gutenberg Plugin Assets

The contents of this directory are synced from the [`assets/` directory in the Gutenberg repository on GitHub](https://github.com/WordPress/gutenberg/tree/trunk/assets) to the [`assets/` directory of the Gutenberg WordPress.org plugin repository](https://plugins.trac.wordpress.org/browser/gutenberg/assets). **Any changes committed directly to the plugin repository on WordPress.org will be overwritten.**

The sync is performed by a [GitHub Actions workflow](https://github.com/WordPress/gutenberg/actions/workflows/sync-assets-to-plugin-repo.yml) that is triggered whenever a file in this directory is changed.

Since that workflow requires access to WP.org plugin repository credentials, it needs to be approved manually by a member of the Gutenberg Core team. If you don't have the necessary permissions, please ask someone in [#core-editor](https://wordpress.slack.com/archives/C02QB2JS7).
Binary file added assets/banner-1544x500.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/banner-772x250.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon-128x128.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icon-256x256.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions backport-changelog/6.8/8014.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/8014

* https://github.com/WordPress/gutenberg/pull/66479
3 changes: 3 additions & 0 deletions backport-changelog/6.8/8015.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/8015

* https://github.com/WordPress/gutenberg/pull/68058
1 change: 0 additions & 1 deletion bin/api-docs/gen-components-docs/markdown/props.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,3 @@ export function generateMarkdownPropsJson( props, { headingLevel = 2 } = {} ) {

return [ { [ `h${ headingLevel }` ]: 'Props' }, ...propsJson ];
}

19 changes: 12 additions & 7 deletions bin/plugin/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* External dependencies
*/
// @ts-ignore
const inquirer = require( 'inquirer' );
const { confirm } = require( '@inquirer/prompts' );
const fs = require( 'fs' );
const childProcess = require( 'child_process' );
const { v4: uuid } = require( 'uuid' );
Expand Down Expand Up @@ -97,14 +97,19 @@ async function askForConfirmation(
isDefault = true,
abortMessage = 'Aborting.'
) {
const { isReady } = await inquirer.prompt( [
{
type: 'confirm',
name: 'isReady',
let isReady = false;
try {
isReady = await confirm( {
default: isDefault,
message,
},
] );
} );
} catch ( error ) {
if ( error instanceof Error && error.name === 'ExitPromptError' ) {
console.log( 'Cancelled.' );
process.exit( 1 );
}
throw error;
}

if ( ! isReady ) {
log( formats.error( '\n' + abortMessage ) );
Expand Down
11 changes: 7 additions & 4 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
== Changelog ==

= 19.9.0-rc.1 =
= 19.9.0 =

## Changelog

Expand Down Expand Up @@ -35,8 +35,8 @@
- Navigation: Enable all non-interactive formats. ([67585](https://github.com/WordPress/gutenberg/pull/67585))
- Query block: Move patterns modal to dropdown on block toolbar. ([66993](https://github.com/WordPress/gutenberg/pull/66993))
- Separator block: Allow divs to be used as separators. ([67530](https://github.com/WordPress/gutenberg/pull/67530))
- [ New Block ] Add Query Total block for displaying total query results or ranges. ([67629](https://github.com/WordPress/gutenberg/pull/67629))
- [Block Library]: Update the relationship of `No results` block to `ancestor`. ([48348](https://github.com/WordPress/gutenberg/pull/48348))
- New Block: Add Query Total block for displaying total query results or ranges. ([67629](https://github.com/WordPress/gutenberg/pull/67629))
- Block Library: Update the relationship of `No results` block to `ancestor`. ([48348](https://github.com/WordPress/gutenberg/pull/48348))

#### DataViews
- Add header to the quick edit when bulk editing. ([67390](https://github.com/WordPress/gutenberg/pull/67390))
Expand Down Expand Up @@ -335,6 +335,7 @@
- DataViews build-wp: Don't bundle the date package. ([67612](https://github.com/WordPress/gutenberg/pull/67612))
- Keycodes: Improve tree shaking by annotating exports as pure. ([67615](https://github.com/WordPress/gutenberg/pull/67615))
- Upgrade TypeScript to 5.7 and fix types. ([67461](https://github.com/WordPress/gutenberg/pull/67461))
- Combine the release steps to ensure that releases are tagged. ([65591](https://github.com/WordPress/gutenberg/pull/65591))

#### Testing
- e2e-test-utils-playwright: Increase timeout of site-editor selector. ([66672](https://github.com/WordPress/gutenberg/pull/66672))
Expand Down Expand Up @@ -381,7 +382,9 @@ The following PRs were merged by first-time contributors:

The following contributors merged PRs in this release:

@aaronrobertshaw @afercia @akasunil @alexflorisca @annezazu @benazeer-ben @ciampo @creador-dev @creativecoder @DAreRodz @dcalhoun @dknauss @draganescu @ellatrix @fabiankaegy @getdave @gigitux @gvgvgvijayan @gziolo @hbhalodia @im3dabasia @imrraaj @jameskoster @jeryj @jorgefilipecosta @jsnajdr @juanfra @louwie17 @Mamaduka @manzoorwanijk @matiasbenedetto @Mayank-Tripathi32 @mcsf @michalczaplinski @miminari @mirka @ntsekouras @oandregal @ockham @prajapatisagar @ramonjd @sabernhardt @SantosGuillamot @sarthaknagoshe2002 @sgomes @shail-mehta @stokesman @subodhr258 @Sukhendu2002 @t-hamano @talldan @tellthemachines @tyxla @viralsampat-multidots @wwdes @yogeshbhutkar @youknowriad
@aaronrobertshaw @afercia @akasunil @alexflorisca @annezazu @benazeer-ben @ciampo @creador-dev @creativecoder @DAreRodz @dcalhoun @dd32 @dknauss @draganescu @ellatrix @fabiankaegy @getdave @gigitux @gvgvgvijayan @gziolo @hbhalodia @im3dabasia @imrraaj @jameskoster @jeryj @jorgefilipecosta @jsnajdr @juanfra @louwie17 @Mamaduka @manzoorwanijk @matiasbenedetto @Mayank-Tripathi32 @mcsf @michalczaplinski @miminari @mirka @ntsekouras @oandregal @ockham @prajapatisagar @ramonjd @sabernhardt @SantosGuillamot @sarthaknagoshe2002 @sgomes @shail-mehta @stokesman @subodhr258 @Sukhendu2002 @t-hamano @talldan @tellthemachines @tyxla @viralsampat-multidots @wwdes @yogeshbhutkar @youknowriad




= 19.8.0 =
Expand Down
101 changes: 97 additions & 4 deletions docs/how-to-guides/themes/global-settings-and-styles.md
Original file line number Diff line number Diff line change
Expand Up @@ -1053,16 +1053,16 @@ Pseudo selectors `:hover`, `:focus`, `:visited`, `:active`, `:link`, `:any-link`

#### Variations

A block can have a "style variation", as defined per the [block.json specification](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/#styles-optional). Theme authors can define the style attributes for an existing style variation using the theme.json file. Styles for unregistered style variations will be ignored.
A block can have a "style variation," as defined in the [block.json specification](https://developer.wordpress.org/block-editor/reference-guides/block-api/block-registration/#styles-optional). Theme authors can define the style attributes for an existing style variation using the `theme.json` file. Styles for unregistered style variations will be ignored.

Note that variations are a "block concept", they only exist bound to blocks. The `theme.json` specification respects that distinction by only allowing `variations` at the block-level but not at the top-level. It's also worth highlighting that only variations defined in the `block.json` file of the block are considered "registered": so far, the style variations added via `register_block_style` or in the client are ignored, see [this issue](https://github.com/WordPress/gutenberg/issues/49602) for more information.
Note that variations are a "block concept"they only exist when bound to blocks. The `theme.json` specification respects this distinction by only allowing `variations` at the block level, not the top level. Its also worth highlighting that only variations defined in the `block.json` file of the block or via `register_block_style` on the server are considered "registered" for `theme.json` styling purposes.

For example, this is how to provide styles for the existing `plain` variation for the `core/quote` block:

```json
{
"version": 3,
"styles":{
"styles": {
"blocks": {
"core/quote": {
"variations": {
Expand All @@ -1078,14 +1078,107 @@ For example, this is how to provide styles for the existing `plain` variation fo
}
```

The resulting CSS output is this:
The resulting CSS output is:

```css
.wp-block-quote.is-style-plain {
background-color: red;
}
```

It is also possible for multiple block types to share the same variation styles. There are two recommended ways to define such shared styles:

1. `theme.json` partial files
2. programmatically, using `register_block_style`

##### Variation Theme.json Partials

Like theme style variation partials, those for block style variations reside within a theme's `/styles` directory. However, they are differentiated from theme style variations by the introduction of a top-level property called `blockTypes`. The `blockTypes` property is an array of block types for which the block style variation has been registered.

Additionally, a `slug` property is available to provide consistency between the different sources that may define block style variations and to decouple the `slug` from the translatable `title` property.

The following is an example of a `theme.json` partial that defines styles for the "Variation A" block style for the Group, Columns, and Media & Text block types:

```json
{
"$schema": "https://schemas.wp.org/trunk/theme.json",
"version": 3,
"title": "Variation A",
"slug": "variation-a",
"blockTypes": [ "core/group", "core/columns", "core/media-text" ],
"styles": {
"color": {
"background": "#eed8d3",
"text": "#201819"
},
"elements": {
"heading": {
"color": {
"text": "#201819"
}
}
},
"blocks": {
"core/group": {
"color": {
"background": "#825f58",
"text": "#eed8d3"
},
"elements": {
"heading": {
"color": {
"text": "#eed8d3"
}
}
}
}
}
}
}
```

##### Programmatically Registering Variation Styles

As an alternative to `theme.json` partials, you can register variation styles at the same time as registering the variation itself through `register_block_style`. This is done by registering the block style for an array of block types while also passing a "style object" within the `style_data` option.

The example below registers a "Green" variation for the Group and Columns blocks. Note that the style object passed via `style_data` follows the same shape as the `styles` property of a `theme.json` partial.

```php
register_block_style(
array( 'core/group', 'core/columns' ),
array(
'name' => 'green',
'label' => __( 'Green' ),
'style_data' => array(
'color' => array(
'background' => '#4f6f52',
'text' => '#d2e3c8',
),
'blocks' => array(
'core/group' => array(
'color' => array(
'background' => '#739072',
'text' => '#e3eedd',
),
),
),
'elements' => array(
'link' => array(
'color' => array(
'text' => '#ead196',
),
':hover' => array(
'color' => array(
'text' => '#ebd9b4',
),
),
),
),
),
)
);
```

### customTemplates

<div class="callout callout-alert">Supported in WordPress from version 5.9.</div>
Expand Down
8 changes: 4 additions & 4 deletions docs/reference-guides/data/data-core-block-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ _Parameters_

_Returns_

- `Object?`: Block attributes.
- `?Object`: Block attributes.

### getBlockCount

Expand Down Expand Up @@ -448,7 +448,7 @@ Determines the items that appear in the available block transforms list.

Each item object contains what's necessary to display a menu item in the transform list and handle its selection.

The 'frecency' property is a heuristic (<https://en.wikipedia.org/wiki/Frecency>) that combines block usage frequenty and recency.
The 'frecency' property is a heuristic (<https://en.wikipedia.org/wiki/Frecency>) that combines block usage frequency and recency.

Items are returned ordered descendingly by their 'frecency'.

Expand Down Expand Up @@ -521,7 +521,7 @@ _Properties_

- _name_ `string`: The type of block.
- _attributes_ `?Object`: Attributes to pass to the newly created block.
- _attributesToCopy_ `?Array<string>`: Attributes to be copied from adjecent blocks when inserted.
- _attributesToCopy_ `?Array<string>`: Attributes to be copied from adjacent blocks when inserted.

### getDraggedBlockClientIds

Expand Down Expand Up @@ -580,7 +580,7 @@ Determines the items that appear in the inserter. Includes both static items (e.

Each item object contains what's necessary to display a button in the inserter and handle its selection.

The 'frecency' property is a heuristic (<https://en.wikipedia.org/wiki/Frecency>) that combines block usage frequenty and recency.
The 'frecency' property is a heuristic (<https://en.wikipedia.org/wiki/Frecency>) that combines block usage frequency and recency.

Items are returned ordered descendingly by their 'utility' and 'frecency'.

Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ _Parameters_

_Returns_

- `Object?`: Block Type.
- `?Object`: Block Type.

### getBlockTypes

Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-edit-post.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Retrieves the template of the currently edited post.

_Returns_

- `Object?`: Post Template.
- `?Object`: Post Template.

### getEditorMode

Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core-rich-text.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ _Parameters_
_Returns_
- `Object?`: Format type.
- `?Object`: Format type.
### getFormatTypeForBareElement
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.6
* Requires PHP: 7.2
* Version: 19.9.0-rc.1
* Version: 19.9.0
* Author: Gutenberg Team
* Text Domain: gutenberg
*
Expand Down
Loading

0 comments on commit 212590e

Please sign in to comment.