Skip to content

Commit

Permalink
Merge branch 'feature/block-comments-scroll' of github.com:karthick-m…
Browse files Browse the repository at this point in the history
…urugan/gutenberg into feature/block-comments-scroll
  • Loading branch information
karthick-murugan committed Dec 5, 2024
2 parents de2c602 + cc4c27a commit 07453a5
Show file tree
Hide file tree
Showing 404 changed files with 6,620 additions and 4,345 deletions.
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ https://github.com/WordPress/gutenberg/blob/trunk/CONTRIBUTING.md -->
<!-- How can you test the changes by using the keyboard only? Please note, this is required for PRs that change the user interface (UI). This ensures the PR can be tested for any possible accessibility regressions. -->

## Screenshots or screencast <!-- if applicable -->

<!-- If you would like to upload screenshots, feel free to use the table below when it is useful to show the difference between before and after the change. -->

|Before|After|
|-|-|
|<!-- Before screenshot here -->|<!-- After screenshot here -->|
1 change: 1 addition & 0 deletions backport-changelog/6.8/7687.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
https://github.com/WordPress/wordpress-develop/pull/7687

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

* https://github.com/WordPress/gutenberg/pull/66631
* 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
3 changes: 3 additions & 0 deletions backport-changelog/6.8/7903.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7903

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

* https://github.com/WordPress/gutenberg/pull/67330
249 changes: 249 additions & 0 deletions changelog.txt

Large diffs are not rendered by default.

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
12 changes: 6 additions & 6 deletions docs/reference-guides/block-api/block-transforms.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ A transformation of type `block` is an object that takes the following parameter
- **transform** _(function)_: a callback that receives the attributes and inner blocks of the block being processed. It should return a block object or an array of block objects.
- **isMatch** _(function, optional)_: a callback that receives the block attributes as the first argument and the block object as the second argument and should return a boolean. Returning `false` from this function will prevent the transform from being available and displayed as an option to the user.
- **isMultiBlock** _(boolean, optional)_: whether the transformation can be applied when multiple blocks are selected. If true, the `transform` function's first parameter will be an array containing each selected block's attributes, and the second an array of each selected block's inner blocks. False by default.
- **priority** _(number, optional)_: controls the priority with which a transformation 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.
- **priority** _(number, optional)_: controls the priority with which a transformation is applied, where a lower value will take precedence over higher values. This behaves much like a [WordPress hook](https://developer.wordpress.org/reference/#Hook_to_WordPress). Like hooks, the default priority is `10` when not otherwise set.

**Example: from Paragraph block to Heading block**

Expand Down Expand Up @@ -97,7 +97,7 @@ A transformation of type `enter` is an object that takes the following parameter
- **type** _(string)_: the value `enter`.
- **regExp** _(RegExp)_: the Regular Expression to use as a matcher. If the value matches, the transformation will be applied.
- **transform** _(function)_: a callback that receives an object with a `content` field containing the value that has been entered. It should return a block object or an array of block objects.
- **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.
- **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://developer.wordpress.org/reference/#Hook_to_WordPress). Like hooks, the default priority is `10` when not otherwise set.

**Example: from --- to Separator block**

Expand All @@ -124,7 +124,7 @@ A transformation of type `files` is an object that takes the following parameter
- **type** _(string)_: the value `files`.
- **transform** _(function)_: a callback that receives the array of files being processed. It should return a block object or an array of block objects.
- **isMatch** _(function, optional)_: a callback that receives the array of files being processed and should return a boolean. Returning `false` from this function will prevent the transform from being applied.
- **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.
- **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://developer.wordpress.org/reference/#Hook_to_WordPress). Like hooks, the default priority is `10` when not otherwise set.

**Example: from file to File block**

Expand Down Expand Up @@ -164,7 +164,7 @@ A transformation of type `prefix` is an object that takes the following paramete
- **type** _(string)_: the value `prefix`.
- **prefix** _(string)_: the character or sequence of characters that match this transform.
- **transform** _(function)_: a callback that receives the content introduced. It should return a block object or an array of block objects.
- **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.
- **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://developer.wordpress.org/reference/#Hook_to_WordPress). Like hooks, the default priority is `10` when not otherwise set.

**Example: from text to custom block**

Expand Down Expand Up @@ -197,7 +197,7 @@ A transformation of type `raw` is an object that takes the following parameters:
- **schema** _(object|function, optional)_: defines an [HTML content model](https://html.spec.whatwg.org/multipage/dom.html#content-models) used to detect and process pasted contents. See [below](#schemas-and-content-models).
- **selector** _(string, optional)_: a CSS selector string to determine whether the element matches according to the [element.matches](https://developer.mozilla.org/en-US/docs/Web/API/Element/matches) method. The transform won't be executed if the element doesn't match. This is a shorthand and alternative to using `isMatch`, which, if present, will take precedence.
- **isMatch** _(function, optional)_: a callback that receives the node being processed and should return a boolean. Returning `false` from this function will prevent the transform from being applied.
- **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.
- **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://developer.wordpress.org/reference/#Hook_to_WordPress). Like hooks, the default priority is `10` when not otherwise set.

**Example: from URLs to Embed block**

Expand Down Expand Up @@ -273,7 +273,7 @@ A transformation of type `shortcode` is an object that takes the following param
- **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.
- **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://developer.wordpress.org/reference/#Hook_to_WordPress). Like hooks, the default priority is `10` when not otherwise set.

**Example: from shortcode to block using `transform`**

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
2 changes: 1 addition & 1 deletion docs/reference-guides/data/data-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ _Parameters_
- _state_ `State`: State tree
- _kind_ `string`: Entity kind.
- _name_ `string`: Entity name.
- _key_ `EntityRecordKey`: Record's key
- _key_ `EntityRecordKey`: Optional record's key. If requesting a global record (e.g. site settings), the key can be omitted. If requesting a specific item, the key must always be included.
- _query_ `GetRecordsHttpQuery`: Optional query. If requesting specific fields, fields must always include the ID. For valid query parameters see the [Reference](https://developer.wordpress.org/rest-api/reference/) in the REST API Handbook and select the entity kind. Then see the arguments available "Retrieve a [Entity kind]".

_Returns_
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
62 changes: 62 additions & 0 deletions lib/compat/wordpress-6.8/class-gutenberg-rest-user-controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

/**
* Add search_columns parameter to users endpoint parameters
*
* @param array $query_params JSON Schema-formatted collection parameters.
* @return array Updated collection parameters
*/
function gutenberg_add_search_columns_param( $query_params ) {
$query_params['search_columns'] = array(
'default' => array(),
'description' => __( 'Array of column names to be searched.' ),
'type' => 'array',
'items' => array(
'enum' => array( 'email', 'name', 'id', 'username', 'slug' ),
'type' => 'string',
),
);

return $query_params;
}

add_filter( 'rest_user_collection_params', 'gutenberg_add_search_columns_param', 10, 1 );

/**
* Modify user query based on search_columns parameter
*
* @param array $prepared_args Array of arguments for WP_User_Query.
* @param WP_REST_Request $request The REST API request.
* @return array Modified arguments
*/
function gutenberg_modify_user_query_args( $prepared_args, $request ) {
if ( $request->get_param( 'search' ) && $request->get_param( 'search_columns' ) ) {
$search_columns = $request->get_param( 'search_columns' );

// Validate search columns
$valid_columns = isset( $prepared_args['search_columns'] )
? $prepared_args['search_columns']
: array( 'ID', 'user_login', 'user_nicename', 'user_email', 'user_url', 'display_name' );
$search_columns_mapping = array(
'id' => 'ID',
'username' => 'user_login',
'slug' => 'user_nicename',
'email' => 'user_email',
'name' => 'display_name',
);
$search_columns = array_map(
static function ( $column ) use ( $search_columns_mapping ) {
return $search_columns_mapping[ $column ];
},
$search_columns
);
$search_columns = array_intersect( $search_columns, $valid_columns );

if ( ! empty( $search_columns ) ) {
$prepared_args['search_columns'] = $search_columns;
}
}

return $prepared_args;
}
add_filter( 'rest_user_query', 'gutenberg_modify_user_query_args', 10, 2 );
Loading

0 comments on commit 07453a5

Please sign in to comment.