diff --git a/.github/workflows/pull-request-automation.yml b/.github/workflows/pull-request-automation.yml
index 6219c5ae3c8483..5163ae3f0ea0cb 100644
--- a/.github/workflows/pull-request-automation.yml
+++ b/.github/workflows/pull-request-automation.yml
@@ -25,7 +25,7 @@ jobs:
node-version: ${{ matrix.node }}
- name: Cache NPM packages
- uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
+ uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml
index fc019dfa5d504d..033789ee30a92d 100644
--- a/.github/workflows/rnmobile-android-runner.yml
+++ b/.github/workflows/rnmobile-android-runner.yml
@@ -26,7 +26,7 @@ jobs:
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- name: Use desired version of Java
- uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # v3.9.0
+ uses: actions/setup-java@3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98 # v3.10.0
with:
distribution: 'temurin'
java-version: '11'
@@ -43,7 +43,7 @@ jobs:
uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef # v2.3.3
- name: AVD cache
- uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
+ uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
id: avd-cache
with:
path: |
diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml
index 6d497491bdf9c3..52fab007b19173 100644
--- a/.github/workflows/rnmobile-ios-runner.yml
+++ b/.github/workflows/rnmobile-ios-runner.yml
@@ -37,7 +37,7 @@ jobs:
run: find package-lock.json packages/react-native-editor/ios packages/react-native-aztec/ios packages/react-native-bridge/ios -type f -print0 | sort -z | xargs -0 shasum | tee ios-checksums.txt
- name: Restore build cache
- uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
+ uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
with:
path: |
packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app
@@ -45,7 +45,7 @@ jobs:
key: ${{ runner.os }}-ios-build-${{ matrix.xcode }}-${{ matrix.device }}-${{ hashFiles('ios-checksums.txt') }}
- name: Restore pods cache
- uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4
+ uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5
with:
path: |
packages/react-native-editor/ios/Pods
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml
index 8b1884835f416e..6552f2ecf6a2b0 100644
--- a/.github/workflows/unit-test.yml
+++ b/.github/workflows/unit-test.yml
@@ -182,7 +182,7 @@ jobs:
run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT
- name: Cache PHPCS scan cache
- uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.0.11
+ uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.0.11
with:
path: .cache/phpcs.json
key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }}
diff --git a/changelog.txt b/changelog.txt
index 46f339243bd085..798ea972663f9e 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,5 +1,18 @@
== Changelog ==
+= 15.2.0-rc.2 =
+
+Various
+Fonts API: Add missing files to lib/load.php. (https://github.com/WordPress/gutenberg/pull/48108)
+First time contributors
+The following PRs were merged by first time contributors:
+
+Contributors
+The following contributors merged PRs in this release:
+
+@hellofromtonya
+
+
= 15.1.1 =
diff --git a/docs/contributors/code/scripts.md b/docs/contributors/code/scripts.md
index b7cabe0130d71c..d4ce263c80ad14 100644
--- a/docs/contributors/code/scripts.md
+++ b/docs/contributors/code/scripts.md
@@ -68,8 +68,8 @@ It is recommended to use the main `wp-polyfill` script handle which takes care o
## Bundling and code sharing
When using a JavaScript bundler like [webpack](https://webpack.js.org/), the scripts mentioned here
-can be excluded from the bundle and provided by WordPress in the form of script dependencies [(see
-`wp_enqueue_script`)][https://developer.wordpress.org/reference/functions/wp_enqueue_script/#default-scripts-included-and-registered-by-wordpress].
+can be excluded from the bundle and provided by WordPress in the form of script dependencies [see
+`wp_enqueue_script`](https://developer.wordpress.org/reference/functions/wp_enqueue_script/#default-scripts-included-and-registered-by-wordpress).
The
[`@wordpress/dependency-extraction-webpack-plugin`](https://github.com/WordPress/gutenberg/tree/HEAD/packages/dependency-extraction-webpack-plugin)
diff --git a/gutenberg.php b/gutenberg.php
index ca9be89162ebc8..fe3e8669605ebe 100644
--- a/gutenberg.php
+++ b/gutenberg.php
@@ -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.0
* Requires PHP: 5.6
- * Version: 15.2.0-rc.1
+ * Version: 15.2.0-rc.2
* Author: Gutenberg Team
* Text Domain: gutenberg
*
diff --git a/lib/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php b/lib/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php
index f857cedd37f9a1..2f9bd7a8cd9e42 100644
--- a/lib/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php
+++ b/lib/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php
@@ -65,4 +65,65 @@ public function get_template_fallback( $request ) {
$response = $this->prepare_item_for_response( $fallback_template, $request );
return rest_ensure_response( $response );
}
+
+ /**
+ * Add revisions to the response.
+ *
+ * @param WP_Block_Template $item Template instance.
+ * @param WP_REST_Request $request Request object.
+ * @return WP_REST_Response Response object.
+ */
+ public function prepare_item_for_response( $item, $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
+ $template = $item;
+
+ $fields = $this->get_fields_for_response( $request );
+
+ $response = parent::prepare_item_for_response( $item, $request );
+
+ if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
+ $links = $this->prepare_revision_links( $template );
+ $response->add_links( $links );
+ if ( ! empty( $links['self']['href'] ) ) {
+ $actions = $this->get_available_actions();
+ $self = $links['self']['href'];
+ foreach ( $actions as $rel ) {
+ $response->add_link( $rel, $self );
+ }
+ }
+ }
+
+ return $response;
+ }
+
+ /**
+ * Adds revisions to links.
+ *
+ * @since 6.2.0
+ *
+ * @param WP_Block_Template $template Template instance.
+ * @return array Links for the given post.
+ */
+ protected function prepare_revision_links( $template ) {
+ $links = array();
+
+ if ( post_type_supports( $this->post_type, 'revisions' ) && (int) $template->wp_id ) {
+ $revisions = wp_get_latest_revision_id_and_total_count( (int) $template->wp_id );
+ $revisions_count = ! is_wp_error( $revisions ) ? $revisions['count'] : 0;
+ $revisions_base = sprintf( '/%s/%s/%s/revisions', $this->namespace, $this->rest_base, $template->id );
+
+ $links['version-history'] = array(
+ 'href' => rest_url( $revisions_base ),
+ 'count' => $revisions_count,
+ );
+
+ if ( $revisions_count > 0 ) {
+ $links['predecessor-version'] = array(
+ 'href' => rest_url( $revisions_base . '/' . $revisions['latest_id'] ),
+ 'id' => $revisions['latest_id'],
+ );
+ }
+ }
+
+ return $links;
+ }
}
diff --git a/lib/experimental/class-gutenberg-rest-template-revision-count.php b/lib/experimental/class-gutenberg-rest-template-revision-count.php
deleted file mode 100644
index 82bedd6e0c8fff..00000000000000
--- a/lib/experimental/class-gutenberg-rest-template-revision-count.php
+++ /dev/null
@@ -1,75 +0,0 @@
-get_fields_for_response( $request );
-
- $response = parent::prepare_item_for_response( $item, $request );
-
- if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
- $links = $this->prepare_revision_links( $template );
- $response->add_links( $links );
- if ( ! empty( $links['self']['href'] ) ) {
- $actions = $this->get_available_actions();
- $self = $links['self']['href'];
- foreach ( $actions as $rel ) {
- $response->add_link( $rel, $self );
- }
- }
- }
-
- return $response;
- }
-
- /**
- * Adds revisions to links.
- *
- * @since 6.2.0
- *
- * @param WP_Block_Template $template Template instance.
- * @return array Links for the given post.
- */
- protected function prepare_revision_links( $template ) {
- $links = array();
-
- if ( post_type_supports( $this->post_type, 'revisions' ) && (int) $template->wp_id ) {
- $revisions = wp_get_latest_revision_id_and_total_count( (int) $template->wp_id );
- $revisions_count = ! is_wp_error( $revisions ) ? $revisions['count'] : 0;
- $revisions_base = sprintf( '/%s/%s/%s/revisions', $this->namespace, $this->rest_base, $template->id );
-
- $links['version-history'] = array(
- 'href' => rest_url( $revisions_base ),
- 'count' => $revisions_count,
- );
-
- if ( $revisions_count > 0 ) {
- $links['predecessor-version'] = array(
- 'href' => rest_url( $revisions_base . '/' . $revisions['latest_id'] ),
- 'id' => $revisions['latest_id'],
- );
- }
- }
-
- return $links;
- }
-}
diff --git a/lib/experimental/rest-api.php b/lib/experimental/rest-api.php
index 31a96b6572f26b..77f7d091d2655d 100644
--- a/lib/experimental/rest-api.php
+++ b/lib/experimental/rest-api.php
@@ -29,27 +29,6 @@ function gutenberg_register_block_editor_settings() {
add_action( 'rest_api_init', 'gutenberg_register_block_editor_settings' );
-/**
- * Hook in to the template and template part post types and decorate
- * the rest endpoint with the revision count.
- *
- * When merging to core, this can be removed once Gutenberg_REST_Template_Revision_Count is
- * merged with WP_REST_Template_Controller.
- *
- * @param array $args Current registered post type args.
- * @param string $post_type Name of post type.
- *
- * @return array
- */
-function wp_api_template_revision_args( $args, $post_type ) {
- if ( 'wp_template' === $post_type || 'wp_template_part' === $post_type ) {
- $args['rest_controller_class'] = 'Gutenberg_REST_Template_Revision_Count';
- }
-
- return $args;
-}
-add_filter( 'register_post_type_args', 'wp_api_template_revision_args', 10, 2 );
-
/**
* Shim for get_sample_permalink() to add support for auto-draft status.
*
diff --git a/lib/load.php b/lib/load.php
index c99668ff3739c0..e00c20286d4e70 100644
--- a/lib/load.php
+++ b/lib/load.php
@@ -57,7 +57,6 @@ function gutenberg_is_experiment_enabled( $name ) {
if ( ! class_exists( 'WP_Rest_Customizer_Nonces' ) ) {
require_once __DIR__ . '/experimental/class-wp-rest-customizer-nonces.php';
}
- require_once __DIR__ . '/experimental/class-gutenberg-rest-template-revision-count.php';
require_once __DIR__ . '/experimental/rest-api.php';
}
diff --git a/package-lock.json b/package-lock.json
index a59aa9f4bbae24..4dce5bc1ffe168 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
- "version": "15.2.0-rc.1",
+ "version": "15.2.0-rc.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -9242,9 +9242,9 @@
}
},
"@sideway/formula": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz",
- "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg=="
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz",
+ "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg=="
},
"@sideway/pinpoint": {
"version": "2.0.0",
@@ -17475,7 +17475,7 @@
"remove-accents": "^0.4.2",
"use-lilius": "^2.0.1",
"uuid": "^8.3.0",
- "valtio": "^1.7.0"
+ "valtio": "1.7.0"
},
"dependencies": {
"date-fns": {
diff --git a/package.json b/package.json
index cdac43e2d4ecb6..50806050edf995 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "gutenberg",
- "version": "15.2.0-rc.1",
+ "version": "15.2.0-rc.2",
"private": true,
"description": "A new WordPress editor experience.",
"author": "The WordPress Contributors",
diff --git a/packages/block-editor/src/components/global-styles/hooks.js b/packages/block-editor/src/components/global-styles/hooks.js
index b843b978bbd4b3..020b84705958d3 100644
--- a/packages/block-editor/src/components/global-styles/hooks.js
+++ b/packages/block-editor/src/components/global-styles/hooks.js
@@ -252,6 +252,7 @@ export function overrideSettingsWithSupports( settings, supports ) {
'fontWeight',
'letterSpacing',
'textTransform',
+ 'textDecoration',
].forEach( ( key ) => {
if ( ! supports.includes( key ) ) {
updatedSettings.typography = {
diff --git a/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js b/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js
index a3829998361bc0..d79f71638cbdf8 100644
--- a/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js
+++ b/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js
@@ -17,6 +17,7 @@ import { __, sprintf } from '@wordpress/i18n';
*/
import { store as blockEditorStore } from '../../store';
import BlockTitle from '../block-title';
+import { useListViewContext } from './context';
const POPOVER_PROPS = {
className: 'block-editor-block-settings-menu__popover',
@@ -30,6 +31,7 @@ const BLOCKS_THAT_CAN_BE_CONVERTED_TO_SUBMENU = [
];
function AddSubmenuItem( { block, onClose } ) {
+ const { expandedState, expand } = useListViewContext();
const { insertBlock, replaceBlock, replaceInnerBlocks } =
useDispatch( blockEditorStore );
@@ -74,6 +76,9 @@ function AddSubmenuItem( { block, onClose } ) {
updateSelectionOnInsert
);
}
+ if ( ! expandedState[ block.clientId ] ) {
+ expand( block.clientId );
+ }
onClose();
} }
>
diff --git a/packages/block-editor/src/hooks/align.js b/packages/block-editor/src/hooks/align.js
index 184f490ef6df5c..8d5c7f850e89b5 100644
--- a/packages/block-editor/src/hooks/align.js
+++ b/packages/block-editor/src/hooks/align.js
@@ -119,7 +119,7 @@ export function addAttribute( settings ) {
*/
export const withToolbarControls = createHigherOrderComponent(
( BlockEdit ) => ( props ) => {
- const blockEdit = ;
+ const blockEdit = ;
const { name: blockName } = props;
// Compute the block valid alignments by taking into account,
// if the theme supports wide alignments or not and the layout's
diff --git a/packages/block-library/src/columns/test/utils.js b/packages/block-library/src/columns/test/utils.js
index d99a7b3d4a6205..72d29c6d77f7df 100644
--- a/packages/block-library/src/columns/test/utils.js
+++ b/packages/block-library/src/columns/test/utils.js
@@ -1,3 +1,8 @@
+/**
+ * External dependencies
+ */
+import deepFreeze from 'deep-freeze';
+
/**
* Internal dependencies
*/
@@ -280,4 +285,53 @@ describe( 'getMappedColumnWidths', () => {
{ clientId: 'b', attributes: { width: '35%' } },
] );
} );
+
+ it( 'always returns new objects and does not mutate input blocks', () => {
+ const blocks = [
+ deepFreeze( { clientId: 'a', attributes: { width: 30 } } ),
+ deepFreeze( { clientId: 'b', attributes: { width: 40 } } ),
+ ];
+ const widths = {
+ a: 25,
+ b: 35,
+ };
+
+ const result = getMappedColumnWidths( blocks, widths );
+
+ expect( blocks[ 0 ] ).not.toBe( result[ 0 ] );
+ expect( blocks[ 1 ] ).not.toBe( result[ 1 ] );
+ } );
+
+ it( 'merges to block attributes if original blocks do not have any attributes', () => {
+ const blocks = [ { clientId: 'a' }, { clientId: 'b' } ];
+ const widths = {
+ a: 25,
+ b: 35,
+ };
+
+ const result = getMappedColumnWidths( blocks, widths );
+
+ expect( result ).toEqual( [
+ { clientId: 'a', attributes: { width: '25%' } },
+ { clientId: 'b', attributes: { width: '35%' } },
+ ] );
+ } );
+
+ it( 'merges to block attributes if original blocks do not have a width attribute', () => {
+ const blocks = [
+ { clientId: 'a', attributes: { align: 'left' } },
+ { clientId: 'b', attributes: { align: 'right' } },
+ ];
+ const widths = {
+ a: 25,
+ b: 35,
+ };
+
+ const result = getMappedColumnWidths( blocks, widths );
+
+ expect( result ).toEqual( [
+ { clientId: 'a', attributes: { align: 'left', width: '25%' } },
+ { clientId: 'b', attributes: { align: 'right', width: '35%' } },
+ ] );
+ } );
} );
diff --git a/packages/block-library/src/columns/utils.js b/packages/block-library/src/columns/utils.js
index b75a7ad77bba18..12cb45a9874d74 100644
--- a/packages/block-library/src/columns/utils.js
+++ b/packages/block-library/src/columns/utils.js
@@ -1,7 +1,7 @@
/**
* External dependencies
*/
-import { merge, mapValues } from 'lodash';
+import { mapValues } from 'lodash';
/**
* Returns a column width attribute value rounded to standard precision.
@@ -121,13 +121,13 @@ export function hasExplicitPercentColumnWidths( blocks ) {
* @return {WPBlock[]} blocks Mapped block objects.
*/
export function getMappedColumnWidths( blocks, widths ) {
- return blocks.map( ( block ) =>
- merge( {}, block, {
- attributes: {
- width: `${ widths[ block.clientId ] }%`,
- },
- } )
- );
+ return blocks.map( ( block ) => ( {
+ ...block,
+ attributes: {
+ ...block.attributes,
+ width: `${ widths[ block.clientId ] }%`,
+ },
+ } ) );
}
/**
diff --git a/packages/components/package.json b/packages/components/package.json
index df4f01273bedff..36693bbdac619c 100644
--- a/packages/components/package.json
+++ b/packages/components/package.json
@@ -76,7 +76,7 @@
"remove-accents": "^0.4.2",
"use-lilius": "^2.0.1",
"uuid": "^8.3.0",
- "valtio": "^1.7.0"
+ "valtio": "1.7.0"
},
"peerDependencies": {
"react": "^18.0.0",
diff --git a/packages/components/src/higher-order/navigate-regions/style.scss b/packages/components/src/higher-order/navigate-regions/style.scss
index 6e66c854dd70ee..f146413a09dc9e 100644
--- a/packages/components/src/higher-order/navigate-regions/style.scss
+++ b/packages/components/src/higher-order/navigate-regions/style.scss
@@ -24,13 +24,14 @@
// visible. For the future, it's important to take into consideration that
// the navigable regions should always have a computed size. For now, we can
// fix some edge cases but these CSS rules should be later removed in favor of
- // a more abstracted approach to make the navigabel regions focus style work
+ // a more abstracted approach to make the navigable regions focus style work
// regardles of the CSS used on other components.
// Header top bar when Distraction free mode is on.
&.is-distraction-free .interface-interface-skeleton__header .edit-post-header,
.interface-interface-skeleton__sidebar .edit-post-layout__toggle-sidebar-panel,
.interface-interface-skeleton__actions .edit-post-layout__toggle-publish-panel,
+ .interface-interface-skeleton__actions .edit-post-layout__toggle-entities-saved-states-panel,
.editor-post-publish-panel {
outline: 4px solid $components-color-accent;
outline-offset: -4px;
diff --git a/packages/compose/src/hooks/use-async-list/index.ts b/packages/compose/src/hooks/use-async-list/index.ts
index b1856efbaa2c7f..ff53bc7b9eb99d 100644
--- a/packages/compose/src/hooks/use-async-list/index.ts
+++ b/packages/compose/src/hooks/use-async-list/index.ts
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
-import { useEffect, useState } from '@wordpress/element';
+import { flushSync, useEffect, useState } from '@wordpress/element';
import { createQueue } from '@wordpress/priority-queue';
type AsyncListConfig = {
@@ -57,17 +57,16 @@ function useAsyncList< T >(
setCurrent( firstItems );
const asyncQueue = createQueue();
- const append = ( nextIndex: number ) => () => {
- if ( list.length <= nextIndex ) {
- return;
- }
- setCurrent( ( state ) => [
- ...state,
- ...list.slice( nextIndex, nextIndex + step ),
- ] );
- asyncQueue.add( {}, append( nextIndex + step ) );
- };
- asyncQueue.add( {}, append( firstItems.length ) );
+ for ( let i = firstItems.length; i < list.length; i += step ) {
+ asyncQueue.add( {}, () => {
+ flushSync( () => {
+ setCurrent( ( state ) => [
+ ...state,
+ ...list.slice( i, i + step ),
+ ] );
+ } );
+ } );
+ }
return () => asyncQueue.reset();
}, [ list ] );
diff --git a/packages/e2e-tests/specs/performance/site-editor.test.js b/packages/e2e-tests/specs/performance/site-editor.test.js
index a14b40d72b01bc..e67aad6d0ff6c0 100644
--- a/packages/e2e-tests/specs/performance/site-editor.test.js
+++ b/packages/e2e-tests/specs/performance/site-editor.test.js
@@ -90,6 +90,10 @@ describe( 'Site Editor Performance', () => {
await visitSiteEditor( {
postId: id,
postType: 'page',
+ // This shouldn't be necessary, but without it the tests fail.
+ // Could be related to having the necessary cookies in the browser.
+ // See https://github.com/WordPress/gutenberg/pull/48240/files#r1111760556
+ path: '/navigation/single',
} );
} );
@@ -147,7 +151,7 @@ describe( 'Site Editor Performance', () => {
'[data-type="core/post-content"] [data-type="core/paragraph"]'
);
await enterEditMode();
- await canvas().click(
+ await canvas().focus(
'[data-type="core/post-content"] [data-type="core/paragraph"]'
);
await insertBlock( 'Paragraph' );
diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js
index 8353b4ed6b15e7..3fe02dbe5004f9 100644
--- a/packages/edit-post/src/components/layout/index.js
+++ b/packages/edit-post/src/components/layout/index.js
@@ -128,13 +128,6 @@ function Layout( { styles } ) {
const isDistractionFree = isDistractionFreeMode && isLargeViewport;
- const className = classnames( 'edit-post-layout', 'is-mode-' + mode, {
- 'is-sidebar-opened': sidebarIsOpened,
- 'has-fixed-toolbar': hasFixedToolbar,
- 'has-metaboxes': hasActiveMetaboxes,
- 'show-icon-labels': showIconLabels,
- 'is-distraction-free': isDistractionFree,
- } );
const openSidebarPanel = () =>
openGeneralSidebar(
hasBlockSelected ? 'edit-post/block' : 'edit-post/document'
@@ -166,6 +159,15 @@ function Layout( { styles } ) {
[ entitiesSavedStatesCallback ]
);
+ const className = classnames( 'edit-post-layout', 'is-mode-' + mode, {
+ 'is-sidebar-opened': sidebarIsOpened,
+ 'has-fixed-toolbar': hasFixedToolbar,
+ 'has-metaboxes': hasActiveMetaboxes,
+ 'show-icon-labels': showIconLabels,
+ 'is-distraction-free': isDistractionFree,
+ 'is-entity-save-view-open': !! entitiesSavedStatesCallback,
+ } );
+
const secondarySidebarLabel = isListViewOpened
? __( 'Document Overview' )
: __( 'Block Library' );
diff --git a/packages/edit-site/src/components/editor/style.scss b/packages/edit-site/src/components/editor/style.scss
index c63a0dcb954d2b..1a24d3ee1475e7 100644
--- a/packages/edit-site/src/components/editor/style.scss
+++ b/packages/edit-site/src/components/editor/style.scss
@@ -6,12 +6,6 @@
padding: $grid-unit-30;
display: flex;
justify-content: center;
-
- .edit-site-layout__actions:focus &,
- .edit-site-layout__actions:focus-within & {
- top: auto;
- bottom: 0;
- }
}
// Adjust the position of the notices
diff --git a/packages/edit-site/src/components/global-styles/screen-border.js b/packages/edit-site/src/components/global-styles/screen-border.js
index 8312483cce6b2f..6a5578e20fcefa 100644
--- a/packages/edit-site/src/components/global-styles/screen-border.js
+++ b/packages/edit-site/src/components/global-styles/screen-border.js
@@ -16,7 +16,7 @@ function ScreenBorder( { name, variation = '' } ) {
const variationClassName = getVariationClassName( variation );
return (
<>
-
+
{ hasBorderPanel && (
diff --git a/packages/edit-site/src/components/layout/style.scss b/packages/edit-site/src/components/layout/style.scss
index f9837e5fa3c84b..5e47588369c80d 100644
--- a/packages/edit-site/src/components/layout/style.scss
+++ b/packages/edit-site/src/components/layout/style.scss
@@ -207,10 +207,17 @@
&:focus,
&:focus-within {
- top: 0;
+ top: auto;
bottom: 0;
}
+ &.is-entity-save-view-open {
+ &:focus,
+ &:focus-within {
+ top: 0;
+ }
+ }
+
@include break-medium {
border-left: $border-width solid $gray-300;
}
diff --git a/packages/edit-site/src/components/save-panel/index.js b/packages/edit-site/src/components/save-panel/index.js
index 0c3a2083af6961..7b8993c0be4956 100644
--- a/packages/edit-site/src/components/save-panel/index.js
+++ b/packages/edit-site/src/components/save-panel/index.js
@@ -1,3 +1,8 @@
+/**
+ * External dependencies
+ */
+import classnames from 'classnames';
+
/**
* WordPress dependencies
*/
@@ -46,7 +51,9 @@ export default function SavePanel() {
return (
{ isSaveViewOpen ? (
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen/style.scss b/packages/edit-site/src/components/sidebar-navigation-screen/style.scss
index 06d81fef33402b..e454d4fa4f1b87 100644
--- a/packages/edit-site/src/components/sidebar-navigation-screen/style.scss
+++ b/packages/edit-site/src/components/sidebar-navigation-screen/style.scss
@@ -33,6 +33,7 @@
color: $gray-200;
&:hover,
+ &:focus,
&:not([aria-disabled="true"]):active {
color: $white;
}
diff --git a/packages/edit-site/src/store/actions.js b/packages/edit-site/src/store/actions.js
index a535d9916b2d2e..48ac0a343a59fc 100644
--- a/packages/edit-site/src/store/actions.js
+++ b/packages/edit-site/src/store/actions.js
@@ -526,7 +526,7 @@ export const switchEditorMode =
if ( mode === 'visual' ) {
speak( __( 'Visual editor selected' ), 'assertive' );
- } else if ( mode === 'mosaic' ) {
- speak( __( 'Mosaic view selected' ), 'assertive' );
+ } else if ( mode === 'text' ) {
+ speak( __( 'Code editor selected' ), 'assertive' );
}
};
diff --git a/packages/element/CHANGELOG.md b/packages/element/CHANGELOG.md
index 1f314874f65c45..562585ecf1f779 100644
--- a/packages/element/CHANGELOG.md
+++ b/packages/element/CHANGELOG.md
@@ -2,6 +2,10 @@
## Unreleased
+### New Features
+
+- Started exporting the `flushSync` function from `react-dom`
+
## 5.4.0 (2023-02-15)
## 5.3.0 (2023-02-01)
diff --git a/packages/element/README.md b/packages/element/README.md
index aaf145b4e46efd..9fda8a6c01eaf4 100755
--- a/packages/element/README.md
+++ b/packages/element/README.md
@@ -213,6 +213,14 @@ _Parameters_
- _component_ `import('./react').WPComponent`: Component's instance.
+### flushSync
+
+Forces React to flush any updates inside the provided callback synchronously.
+
+_Parameters_
+
+- _callback_ `Function`: Callback to run synchronously.
+
### forwardRef
Component enhancer used to enable passing a ref to its wrapped component.
diff --git a/packages/element/src/react-platform.js b/packages/element/src/react-platform.js
index c819565b79553d..38ab823f357e6b 100644
--- a/packages/element/src/react-platform.js
+++ b/packages/element/src/react-platform.js
@@ -4,6 +4,7 @@
import {
createPortal,
findDOMNode,
+ flushSync,
render,
hydrate,
unmountComponentAtNode,
@@ -28,6 +29,13 @@ export { createPortal };
*/
export { findDOMNode };
+/**
+ * Forces React to flush any updates inside the provided callback synchronously.
+ *
+ * @param {Function} callback Callback to run synchronously.
+ */
+export { flushSync };
+
/**
* Renders a given element into the target DOM node.
*
diff --git a/packages/interface/src/components/interface-skeleton/style.scss b/packages/interface/src/components/interface-skeleton/style.scss
index 57d88626636dde..a45239b529ddd0 100644
--- a/packages/interface/src/components/interface-skeleton/style.scss
+++ b/packages/interface/src/components/interface-skeleton/style.scss
@@ -184,16 +184,20 @@ html.interface-interface-skeleton__html-container {
&:focus,
&:focus-within {
- top: $admin-bar-height-big;
+ top: auto;
+ bottom: 0;
- @include break-medium() {
- border-left: $border-width solid $gray-300;
- top: $admin-bar-height;
+ .is-entity-save-view-open & {
+ top: $admin-bar-height-big;
- .is-fullscreen-mode & {
- top: 0;
+ @include break-medium() {
+ border-left: $border-width solid $gray-300;
+ top: $admin-bar-height;
+
+ .is-fullscreen-mode & {
+ top: 0;
+ }
}
}
- bottom: 0;
}
}
diff --git a/phpunit/class-gutenberg-rest-templates-controller-test.php b/phpunit/class-gutenberg-rest-templates-controller-test.php
index 81d7f2758c6436..d8447704bd3739 100644
--- a/phpunit/class-gutenberg-rest-templates-controller-test.php
+++ b/phpunit/class-gutenberg-rest-templates-controller-test.php
@@ -59,7 +59,7 @@ public function test_get_template_fallback() {
$request->set_param( 'is_custom', false );
$request->set_param( 'template_prefix', 'tag' );
$response = rest_get_server()->dispatch( $request );
- $this->assertSame( 'tag', $response->get_data()['slug'], 'Should fallback to `index.html`.' );
+ $this->assertSame( 'index', $response->get_data()['slug'], 'Should fallback to `index.html`.' );
}
public function test_context_param() {