Skip to content

Commit

Permalink
Merge branch 'trunk' of github.com:WordPress/gutenberg into enhanceme…
Browse files Browse the repository at this point in the history
…nt/resolution-option-for-featured-image-media-text-block
  • Loading branch information
akasunil committed Dec 6, 2024
2 parents 2cc9a63 + 5ed400c commit 3f9ad85
Show file tree
Hide file tree
Showing 266 changed files with 2,170 additions and 1,352 deletions.
1 change: 1 addition & 0 deletions backport-changelog/6.8/7069.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ https://github.com/WordPress/wordpress-develop/pull/7069
* https://github.com/WordPress/gutenberg/pull/63401
* https://github.com/WordPress/gutenberg/pull/66918
* https://github.com/WordPress/gutenberg/pull/67018
* https://github.com/WordPress/gutenberg/pull/67552
1 change: 1 addition & 0 deletions backport-changelog/6.8/7695.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ https://github.com/WordPress/wordpress-develop/pull/7695
* https://github.com/WordPress/gutenberg/pull/67465
* https://github.com/WordPress/gutenberg/pull/66579
* https://github.com/WordPress/gutenberg/pull/66654
* https://github.com/WordPress/gutenberg/pull/67518
249 changes: 249 additions & 0 deletions changelog.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/contributors/code/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ To encourage better practices for querying elements, selectors are [strict](http

### Favor Page Object Model over utils

As mentioned above, [Page Object Model](https://playwright.dev/docs/test-pom) is the preferred way to create reusable utility functions on a certain page.
As mentioned above, [Page Object Model](https://playwright.dev/docs/pom) is the preferred way to create reusable utility functions on a certain page.

The rationale behind using a POM is to group utils under namespaces to be easier to discover and use. In fact, `PageUtils` in the `e2e-test-utils-playwright` package is also a POM, which avoids the need for global variables, and utils can reference each other with `this`.

Expand Down
6 changes: 0 additions & 6 deletions docs/contributors/repository-management.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,3 @@ If you meet this criterion of several meaningful contributions having been accep
## Projects

We use [GitHub projects](https://github.com/WordPress/gutenberg/projects) to keep track of details that aren't immediately actionable, but that we want to keep around for future reference.

Some key projects include:

- [Phase 2](https://github.com/WordPress/gutenberg/projects/13) - Development tasks needed for Phase 2 of Gutenberg.
- [Phase 2 design](https://github.com/WordPress/gutenberg/projects/21) - Tasks for design in Phase 2. Note: specific projects may have their own boards.
- [Ideas](https://github.com/WordPress/gutenberg/projects/8) - Project containing tickets that, while closed for the time being, can be revisited in the future.
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ As of Gutenberg version 14.2, the following controls are available:
- `taxQuery` - Shows available taxonomies filters for the currently selected post type.
- `author` - Shows an input field to filter the query by author.
- `search` - Shows an input field to filter the query by keywords.
- `format` - Shows an input field to filter the query by array/collection of [formats](https://developer.wordpress.org/advanced-administration/wordpress/post-formats/#supported-formats).
- `parents` - Shows an input field to filter the query using parent(s) entity.

In our case, the property would look like this:

Expand Down
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ Create a break between ideas or sections with a horizontal separator. ([Source](
- **Name:** core/separator
- **Category:** design
- **Supports:** align (center, full, wide), anchor, color (background, gradients, ~~enableContrastChecker~~, ~~text~~), interactivity (clientNavigation), spacing (margin)
- **Attributes:** opacity
- **Attributes:** opacity, tagName

## Shortcode

Expand Down
8 changes: 4 additions & 4 deletions docs/reference-guides/data/data-core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ _Parameters_

_Returns_

- `string?`: Default block name.
- `?string`: Default block name.

### getDefaultBlockVariation

Expand Down Expand Up @@ -464,7 +464,7 @@ _Parameters_

_Returns_

- `string?`: Name of the block for handling non-block content.
- `?string`: Name of the block for handling non-block content.

### getGroupingBlockName

Expand Down Expand Up @@ -502,7 +502,7 @@ _Parameters_

_Returns_

- `string?`: Name of the block for handling the grouping of blocks.
- `?string`: Name of the block for handling the grouping of blocks.

### getUnregisteredFallbackBlockName

Expand Down Expand Up @@ -540,7 +540,7 @@ _Parameters_

_Returns_

- `string?`: Name of the block for handling unregistered blocks.
- `?string`: Name of the block for handling unregistered blocks.

### hasBlockSupport

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

_Returns_

- `string?`: Template ID.
- `?string`: Template ID.

### getDeviceType

Expand Down
4 changes: 2 additions & 2 deletions docs/reference-guides/data/data-core-keyboard-shortcuts.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ _Parameters_

_Returns_

- `string?`: Shortcut description.
- `?string`: Shortcut description.

### getShortcutKeyCombination

Expand Down Expand Up @@ -335,7 +335,7 @@ _Parameters_

_Returns_

- `string?`: Shortcut representation.
- `?string`: Shortcut representation.

<!-- END TOKEN(Autogenerated selectors|../../../packages/keyboard-shortcuts/src/store/selectors.js) -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -745,15 +745,15 @@ When using region-based navigation, it's crucial to ensure that your interactive

`getServerState()` allows you to subscribe to changes in the **global state** that occur during client-side navigation. This function is analogous to `getServerContext()`, but it works with the global state instead of the local context.

The `getServerState()` function returns a read-only reactive object. This means that any [callbacks](/docs/reference-guides/interactivity-api/api-reference.md#accessing-data-in-callbacks) you have defined that watch the returned object will only trigger when the value returned by the function changes. If the value remains the same, the callback will not re-trigger.

Let's consider a quiz that has multiple questions. Each question is a separate page. When the user navigates to a new question, the server provides the new question and the time left to answer all the questions.

```php
<?php
wp_interactivity_state( 'myPlugin', array(
<div <?php echo wp_interactivity_state( 'myPlugin', array(
'question' => get_question_for_page( get_the_ID() ),
'timeLeft' => 5 * 60, // Time to answer all the questions.
) );
?>
) ); ?>>
```

```javascript
Expand Down Expand Up @@ -789,14 +789,14 @@ store( 'myPlugin', {

`getServerContext()` allows you to subscribe to changes in the **local context** that occur during client-side navigation. This function is analogous to `getServerState()`, but it works with the local context instead of the global state.

The `getServerContext()` function returns a read-only reactive object. This means that any [callbacks](/docs/reference-guides/interactivity-api/api-reference.md#accessing-data-in-callbacks) you have defined that watch the returned object will only trigger when the value returned by the function changes. If the value remains the same, the callback will not re-trigger.

Consider a quiz that has multiple questions. Each question is a separate page. When the user navigates to a new question, the server provides the new question and the time left to answer all the questions.

```php
<?php
wp_interactivity_context( 'myPlugin', array(
<div <?php echo wp_interactivity_data_wp_context( array(
'currentQuestion' => get_question_for_page( get_the_ID() ),
) );
?>
), ); ?>>
```

```javascript
Expand Down Expand Up @@ -830,12 +830,12 @@ store( 'myPlugin', {

### When to Use

Whenever you have interactive blocks that rely on global state that may change due to navigation events, ensuring consistency across different parts of your application.
Whenever you have interactive blocks that rely on global state or local context that may change due to navigation events, ensuring consistency across different parts of your application.

### Best Practices for using `getServerState()` and `getServerContext()`

- **Read-Only References:** Both `getServerState()` and `getServerContext()` return read-only objects. You can use those objects to update the global state or local context.
- **Callback Integration:** Incorporate these functions within your store [callbacks](/docs/reference-guides/interactivity-api/api-reference.md#accessing-data-in-callbacks) to react to state and context changes.
- **Callback Integration:** Incorporate these functions within your store [callbacks](/docs/reference-guides/interactivity-api/api-reference.md#accessing-data-in-callbacks) to react to state and context changes. Both `getServerState()` and `getServerContext()` return reactive objects. This means that their watch callbacks will only trigger when the value of a property changes. If the value remains the same, the callback will not re-trigger.

## Conclusion

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.8.0-rc.1
* Version: 19.8.0
* Author: Gutenberg Team
* Text Domain: gutenberg
*
Expand Down
25 changes: 15 additions & 10 deletions lib/compat/wordpress-6.8/blocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ function gutenberg_stabilize_experimental_block_supports( $args ) {
}

$stabilize_config = function ( $unstable_config, $stable_support_key ) use ( $experimental_support_properties, $common_experimental_properties ) {
if ( ! is_array( $unstable_config ) ) {
return $unstable_config;
}

$stable_config = array();
foreach ( $unstable_config as $key => $value ) {
// Get stable key from support-specific map, common properties map, or keep original.
Expand Down Expand Up @@ -116,18 +120,19 @@ function gutenberg_stabilize_experimental_block_supports( $args ) {
( $key_positions[ $support ] ?? PHP_INT_MAX ) <
( $key_positions[ $stable_support_key ] ?? PHP_INT_MAX );

if ( is_array( $args['supports'][ $stable_support_key ] ) ) {
/*
* To merge the alternative support config effectively, it also needs to be
* stabilized before merging to keep stabilized and experimental flags in
* sync.
*/
$args['supports'][ $stable_support_key ] = $stabilize_config( $args['supports'][ $stable_support_key ], $stable_support_key );
$stable_config = $experimental_first
/*
* To merge the alternative support config effectively, it also needs to be
* stabilized before merging to keep stabilized and experimental flags in
* sync.
*/
$args['supports'][ $stable_support_key ] = $stabilize_config( $args['supports'][ $stable_support_key ], $stable_support_key );
// Prevents reprocessing this support as it was stabilized above.
$done[ $stable_support_key ] = true;

if ( is_array( $stable_config ) && is_array( $args['supports'][ $stable_support_key ] ) ) {
$stable_config = $experimental_first
? array_merge( $stable_config, $args['supports'][ $stable_support_key ] )
: array_merge( $args['supports'][ $stable_support_key ], $stable_config );
// Prevents reprocessing this support as it was merged above.
$done[ $stable_support_key ] = true;
} else {
$stable_config = $experimental_first
? $args['supports'][ $stable_support_key ]
Expand Down
1 change: 1 addition & 0 deletions lib/compat/wordpress-6.8/preload.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) {
$route_for_post = rest_get_route_for_post( $post );
if ( $route_for_post ) {
$paths[] = add_query_arg( 'context', 'edit', $route_for_post );
$paths[] = add_query_arg( 'context', 'edit', '/wp/v2/types/' . $post->post_type );
if ( 'page' === $post->post_type ) {
$paths[] = add_query_arg(
'slug',
Expand Down
5 changes: 3 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
"version": "19.8.0-rc.1",
"version": "19.8.0",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
Expand Down
21 changes: 21 additions & 0 deletions packages/babel-preset-default/polyfill-exclusions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,25 @@ module.exports = [
// This is an IE-only feature which we don't use, and don't want to polyfill.
// @see https://github.com/WordPress/gutenberg/pull/49234
'web.immediate',
// Remove Set feature polyfills.
//
// The Babel/core-js integration has a severe limitation, in that any Set
// objects (e.g. `new Set()`) are assumed to need all instance methods, and
// get them all polyfilled. There is no validation as to whether those
// methods are actually in use.
//
// This limitation causes a number of packages to unnecessarily get a
// dependency on `wp-polyfill`, which in most cases gets loaded as part of
// the critical path and can thus have an impact on performance.
//
// There is no good solution to this, and the one we've opted for here is
// to disable polyfilling these features entirely. Developers will need to
// take care not to use them in scenarios where the code may be running in
// older browsers without native support for them.
//
// These need to be specified as both `es.` and `esnext.` due to the way
// internal dependencies are set up in Babel / core-js.
//
// @see https://github.com/WordPress/gutenberg/pull/67230
/^es(next)?\.set\./,
];
3 changes: 2 additions & 1 deletion packages/base-styles/_z-index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ $z-layers: (
// Should be above the popover (dropdown)
".reusable-blocks-menu-items__convert-modal": 1000001,
".patterns-menu-items__convert-modal": 1000001,
".editor-create-template-part-modal": 1000001,
".fields-create-template-part-modal": 1000001,
".block-editor-block-lock-modal": 1000001,
".block-editor-template-part__selection-modal": 1000001,
".block-editor-block-rename-modal": 1000001,
Expand All @@ -132,6 +132,7 @@ $z-layers: (
".editor-action-modal": 1000001,
".editor-post-template__swap-template-modal": 1000001,
".edit-site-template-panel__replace-template-modal": 1000001,
".fields-controls__template-modal": 1000001,

// Note: The ConfirmDialog component's z-index is being set to 1000001 in packages/components/src/confirm-dialog/styles.ts
// because it uses emotion and not sass. We need it to render on top its parent popover.
Expand Down
6 changes: 2 additions & 4 deletions packages/block-editor/src/autocompleters/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ import { orderInserterBlockItems } from '../utils/order-inserter-block-items';
const noop = () => {};
const SHOWN_BLOCK_TYPES = 9;

/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */

/**
* Creates a blocks repeater for replacing the current block with a selected block type.
*
* @return {WPCompleter} A blocks completer.
* @return {Object} A blocks completer.
*/
function createBlockCompleter() {
return {
Expand Down Expand Up @@ -157,6 +155,6 @@ function createBlockCompleter() {
/**
* Creates a blocks repeater for replacing the current block with a selected block type.
*
* @return {WPCompleter} A blocks completer.
* @return {Object} A blocks completer.
*/
export default createBlockCompleter();
6 changes: 2 additions & 4 deletions packages/block-editor/src/autocompleters/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ import { decodeEntities } from '@wordpress/html-entities';

const SHOWN_SUGGESTIONS = 10;

/** @typedef {import('@wordpress/components').WPCompleter} WPCompleter */

/**
* Creates a suggestion list for links to posts or pages.
*
* @return {WPCompleter} A links completer.
* @return {Object} A links completer.
*/
function createLinkCompleter() {
return {
Expand Down Expand Up @@ -60,6 +58,6 @@ function createLinkCompleter() {
/**
* Creates a suggestion list for links to posts or pages..
*
* @return {WPCompleter} A link completer.
* @return {Object} A link completer.
*/
export default createLinkCompleter();
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ const meta = {
component: AlignmentToolbar,
argTypes: {
value: {
control: { type: null },
control: false,
defaultValue: 'undefined',
description: 'The current value of the alignment setting.',
},
onChange: {
action: 'onChange',
control: { type: null },
control: false,
description:
"A callback function invoked when the toolbar's alignment value is changed via an interaction with any of the toolbar's buttons. Called with the new alignment value (ie: `left`, `center`, `right`, `undefined`) as the only argument.",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ const meta = {
component: AlignmentControl,
argTypes: {
value: {
control: { type: null },
control: false,
defaultValue: 'undefined',
description: 'The current value of the alignment setting.',
},
onChange: {
action: 'onChange',
control: { type: null },
control: false,
description:
"A callback function invoked when the toolbar's alignment value is changed via an interaction with any of the toolbar's buttons. Called with the new alignment value (ie: `left`, `center`, `right`, `undefined`) as the only argument.",
},
Expand Down
Loading

0 comments on commit 3f9ad85

Please sign in to comment.