Skip to content

Commit

Permalink
Merge branch 'trunk' into try/simplify-navigate-regions-shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
stokesman authored Sep 20, 2024
2 parents 6b742a3 + eaf2258 commit c67cad4
Show file tree
Hide file tree
Showing 378 changed files with 3,821 additions and 2,570 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/build-plugin-zip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ name: Build Gutenberg Plugin Zip
on:
pull_request:
push:
branches: [trunk]
branches:
- trunk
- 'release/**'
- 'wp/**'
workflow_dispatch:
inputs:
version:
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ jobs:
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
name: build-assets
path: ./build/
path: |
./build/
./build-module/
test-php:
name: PHP ${{ matrix.php }}${{ matrix.multisite && ' multisite' || '' }}${{ matrix.wordpress != '' && format( ' (WP {0}) ', matrix.wordpress ) || '' }} on ubuntu-latest
Expand Down Expand Up @@ -212,7 +214,6 @@ jobs:
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: build-assets
path: ./build

- name: Docker debug information
run: |
Expand Down
3 changes: 3 additions & 0 deletions backport-changelog/6.7/7298.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7298

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

* https://github.com/WordPress/gutenberg/pull/65460
2 changes: 2 additions & 0 deletions bin/packages/get-babel-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ module.exports = ( environment = '', file ) => {
name: `WP_BUILD_${ environment.toUpperCase() }`,
},
};
// Add `/* wp:polyfill */` magic comment where needed.
callerOpts.caller.addPolyfillComments = true;
switch ( environment ) {
case 'main':
// To be merged as a presetEnv option.
Expand Down
271 changes: 271 additions & 0 deletions changelog.txt

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions docs/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -1697,6 +1697,12 @@
"markdown_source": "../packages/eslint-plugin/README.md",
"parent": "packages"
},
{
"title": "@wordpress/fields",
"slug": "packages-fields",
"markdown_source": "../packages/fields/README.md",
"parent": "packages"
},
{
"title": "@wordpress/format-library",
"slug": "packages-format-library",
Expand Down
18 changes: 7 additions & 11 deletions docs/reference-guides/data/data-core-block-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -857,15 +857,9 @@ _Returns_

### hasBlockMovingClientId

Returns whether block moving mode is enabled.

_Parameters_

- _state_ `Object`: Editor state.

_Returns_
> **Deprecated**
- `string`: Client Id of moving block.
Returns whether block moving mode is enabled.

### hasDraggedInnerBlock

Expand Down Expand Up @@ -1661,11 +1655,13 @@ _Returns_

### setBlockMovingClientId

Action that enables or disables the block moving mode.
> **Deprecated**
_Parameters_
Set the block moving client ID.

- _hasBlockMovingClientId_ `string|null`: Enable/Disable block moving mode.
_Returns_

- `Object`: Action object.

### setBlockVisibility

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.5
* Requires PHP: 7.2
* Version: 19.2.0
* Version: 19.3.0-rc.1
* Author: Gutenberg Team
* Text Domain: gutenberg
*
Expand Down
50 changes: 50 additions & 0 deletions lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,56 @@ function gutenberg_register_vendor_scripts( $scripts ) {
}
add_action( 'wp_default_scripts', 'gutenberg_register_vendor_scripts' );

/**
* Registers or re-registers Gutenberg Script Modules.
*
* Script modules that are registered by Core will be re-registered by Gutenberg.
*
* @since 19.3.0
*/
function gutenberg_default_script_modules() {
/*
* Expects multidimensional array like:
*
* 'interactivity/index.min.js' => array('dependencies' => array(…), 'version' => '…'),
* 'interactivity/debug.min.js' => array('dependencies' => array(…), 'version' => '…'),
* 'interactivity-router/index.min.js' => …
*/
$assets = include gutenberg_dir_path() . '/build-module/assets.php';

foreach ( $assets as $file_name => $script_module_data ) {
/*
* Build the WordPress Script Module ID from the file name.
* Prepend `@wordpress/` and remove extensions and `/index` if present:
* - interactivity/index.min.js => @wordpress/interactivity
* - interactivity/debug.min.js => @wordpress/interactivity/debug
* - block-library/query/view.js => @wordpress/block-library/query/view
*/
$script_module_id = '@wordpress/' . preg_replace( '~(?:/index)?\.min\.js$~D', '', $file_name, 1 );
switch ( $script_module_id ) {
/*
* Interactivity exposes two entrypoints, "/index" and "/debug".
* "/debug" should replalce "/index" in devlopment.
*/
case '@wordpress/interactivity/debug':
if ( ! SCRIPT_DEBUG ) {
continue 2;
}
$script_module_id = '@wordpress/interactivity';
break;
case '@wordpress/interactivity':
if ( SCRIPT_DEBUG ) {
continue 2;
}
break;
}

$path = gutenberg_url( "build-module/{$file_name}" );
wp_register_script_module( $script_module_id, $path, $script_module_data['dependencies'], $script_module_data['version'] );
}
}
remove_action( 'wp_default_scripts', 'wp_default_script_modules' );
add_action( 'wp_default_scripts', 'gutenberg_default_script_modules' );

/*
* Always remove the Core action hook while gutenberg_enqueue_stored_styles() exists to avoid styles being printed twice.
Expand Down
32 changes: 32 additions & 0 deletions lib/compat/wordpress-6.7/block-bindings.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,35 @@ function gutenberg_add_can_update_block_bindings_editor_setting( $editor_setting
}

add_filter( 'block_editor_settings_all', 'gutenberg_add_can_update_block_bindings_editor_setting', 10 );

/**
* Add `label` to `register_meta`.
*
* @param array $args Array of arguments for registering meta.
* @return array Modified arguments array including `label`.
*/
function gutenberg_update_meta_args_with_label( $args ) {
// Don't update schema when label isn't provided.
if ( ! isset( $args['label'] ) ) {
return $args;
}

$schema = array( 'title' => $args['label'] );
if ( ! is_array( $args['show_in_rest'] ) ) {
$args['show_in_rest'] = array(
'schema' => $schema,
);
return $args;
}

if ( ! empty( $args['show_in_rest']['schema'] ) ) {
$args['show_in_rest']['schema'] = array_merge( $args['show_in_rest']['schema'], $schema );
} else {
$args['show_in_rest']['schema'] = $schema;
}

return $args;
}

// Priority must be lower than 10 to ensure the label is not removed.
add_filter( 'register_meta_args', 'gutenberg_update_meta_args_with_label', 5, 1 );
3 changes: 0 additions & 3 deletions lib/experimental/editor-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ function gutenberg_enable_experiments() {
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-media-processing', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalMediaProcessing = true', 'before' );
}
if ( $gutenberg_experiments && array_key_exists( 'gutenberg-zoom-out-experiment', $gutenberg_experiments ) ) {
wp_add_inline_script( 'wp-block-editor', 'window.__experimentalEnableZoomOutExperiment = true', 'before' );
}
}

add_action( 'admin_init', 'gutenberg_enable_experiments' );
Expand Down
25 changes: 2 additions & 23 deletions lib/experimental/script-modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,26 +239,5 @@ function gutenberg_a11y_script_module_html() {
. '<div id="a11y-speak-polite" class="a11y-speak-region" aria-live="polite" aria-relevant="additions text" aria-atomic="true"></div>'
. '</div>';
}

/**
* Registers Gutenberg Script Modules.
*
* @since 19.3
*/
function gutenberg_register_script_modules() {
// When in production, use the plugin's version as the default asset version;
// else (for development or test) default to use the current time.
$default_version = defined( 'GUTENBERG_VERSION' ) && ! SCRIPT_DEBUG ? GUTENBERG_VERSION : time();

wp_deregister_script_module( '@wordpress/a11y' );
wp_register_script_module(
'@wordpress/a11y',
gutenberg_url( 'build-module/a11y/index.min.js' ),
array(),
$default_version
);

add_action( 'wp_footer', 'gutenberg_a11y_script_module_html' );
add_action( 'admin_footer', 'gutenberg_a11y_script_module_html' );
}
add_action( 'init', 'gutenberg_register_script_modules' );
add_action( 'wp_footer', 'gutenberg_a11y_script_module_html' );
add_action( 'admin_footer', 'gutenberg_a11y_script_module_html' );
11 changes: 0 additions & 11 deletions lib/experiments-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,17 +175,6 @@ function gutenberg_initialize_experiments_settings() {
)
);

add_settings_field(
'gutenberg-zoom-out-experiment',
__( 'Zoom out experiments', 'gutenberg' ),
'gutenberg_display_experiment_field',
'gutenberg-experiments',
'gutenberg_experiments_section',
array(
'label' => __( 'Enable zoom out experiments; shows zoom out in the device preview and other zoom out experiments.', 'gutenberg' ),
'id' => 'gutenberg-zoom-out-experiment',
)
);
register_setting(
'gutenberg-experiments',
'gutenberg-experiments'
Expand Down
31 changes: 0 additions & 31 deletions lib/interactivity-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,6 @@
* @package gutenberg
*/

/**
* Deregisters the Core Interactivity API Modules and replace them
* with the ones from the Gutenberg plugin.
*/
function gutenberg_reregister_interactivity_script_modules() {
$default_version = defined( 'GUTENBERG_VERSION' ) && ! SCRIPT_DEBUG ? GUTENBERG_VERSION : time();
wp_deregister_script_module( '@wordpress/interactivity' );
wp_deregister_script_module( '@wordpress/interactivity-router' );

wp_register_script_module(
'@wordpress/interactivity',
gutenberg_url( '/build-module/' . ( SCRIPT_DEBUG ? 'interactivity/debug.min.js' : 'interactivity/index.min.js' ) ),
array(),
$default_version
);

wp_register_script_module(
'@wordpress/interactivity-router',
gutenberg_url( '/build-module/interactivity-router/index.min.js' ),
array(
array(
'id' => '@wordpress/a11y',
'import' => 'dynamic',
),
'@wordpress/interactivity',
),
$default_version
);
}
add_action( 'init', 'gutenberg_reregister_interactivity_script_modules' );

/**
* Adds script data to the interactivity-router script module.
*
Expand Down
Loading

0 comments on commit c67cad4

Please sign in to comment.