diff --git a/backport-changelog/6.8/7687.md b/backport-changelog/6.8/7687.md index f1505645df20c6..0b5af190964df1 100644 --- a/backport-changelog/6.8/7687.md +++ b/backport-changelog/6.8/7687.md @@ -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 diff --git a/backport-changelog/6.8/7695.md b/backport-changelog/6.8/7695.md index f45b2039e30274..d69a59f2d67d12 100644 --- a/backport-changelog/6.8/7695.md +++ b/backport-changelog/6.8/7695.md @@ -2,3 +2,5 @@ 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 diff --git a/lib/compat/wordpress-6.8/preload.php b/lib/compat/wordpress-6.8/preload.php index 494e3ad32ec02e..0a36ea7f7227d4 100644 --- a/lib/compat/wordpress-6.8/preload.php +++ b/lib/compat/wordpress-6.8/preload.php @@ -10,18 +10,26 @@ */ function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) { if ( 'core/edit-site' === $context->name ) { - $post_id = null; + $post = null; if ( isset( $_GET['postId'] ) && is_numeric( $_GET['postId'] ) ) { - $post_id = (int) $_GET['postId']; + $post = get_post( (int) $_GET['postId'] ); } if ( isset( $_GET['p'] ) && preg_match( '/^\/page\/(\d+)$/', $_GET['p'], $matches ) ) { - $post_id = (int) $matches[1]; + $post = get_post( (int) $matches[1] ); } - if ( $post_id ) { - $route_for_post = rest_get_route_for_post( $post_id ); + if ( $post ) { + $route_for_post = rest_get_route_for_post( $post ); if ( $route_for_post ) { $paths[] = add_query_arg( 'context', 'edit', $route_for_post ); + if ( 'page' === $post->post_type ) { + $paths[] = add_query_arg( + 'slug', + // @see https://github.com/WordPress/gutenberg/blob/489f6067c623926bce7151a76755bb68d8e22ea7/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js#L139-L140 + 'page-' . $post->post_name, + '/wp/v2/templates/lookup' + ); + } } } @@ -78,6 +86,9 @@ function gutenberg_block_editor_preload_paths_6_8( $paths, $context ) { */ $context = current_user_can( 'edit_theme_options' ) ? 'edit' : 'view'; $paths[] = "/wp/v2/global-styles/$global_styles_id?context=$context"; + + // Used by getBlockPatternCategories in useBlockEditorSettings. + $paths[] = '/wp/v2/block-patterns/categories'; } return $paths; } diff --git a/packages/block-editor/src/components/alignment-control/test/__snapshots__/index.js.snap b/packages/block-editor/src/components/alignment-control/test/__snapshots__/index.js.snap index f2915ead7417b1..c1383ae8ecc44a 100644 --- a/packages/block-editor/src/components/alignment-control/test/__snapshots__/index.js.snap +++ b/packages/block-editor/src/components/alignment-control/test/__snapshots__/index.js.snap @@ -12,7 +12,7 @@ exports[`AlignmentUI should allow custom alignment controls to be specified 1`] align="custom-left" aria-label="My custom left" aria-pressed="false" - class="components-button components-toolbar__control has-icon" + class="components-button components-toolbar__control is-compact has-icon" data-toolbar-item="true" type="button" > @@ -35,7 +35,7 @@ exports[`AlignmentUI should allow custom alignment controls to be specified 1`] align="custom-right" aria-label="My custom right" aria-pressed="true" - class="components-button components-toolbar__control is-pressed has-icon" + class="components-button components-toolbar__control is-compact is-pressed has-icon" data-toolbar-item="true" type="button" > @@ -100,7 +100,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = ` align="left" aria-label="Align text left" aria-pressed="true" - class="components-button components-toolbar__control is-pressed has-icon" + class="components-button components-toolbar__control is-compact is-pressed has-icon" data-toolbar-item="true" type="button" > @@ -123,7 +123,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = ` align="center" aria-label="Align text center" aria-pressed="false" - class="components-button components-toolbar__control has-icon" + class="components-button components-toolbar__control is-compact has-icon" data-toolbar-item="true" type="button" > @@ -146,7 +146,7 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = ` align="right" aria-label="Align text right" aria-pressed="false" - class="components-button components-toolbar__control has-icon" + class="components-button components-toolbar__control is-compact has-icon" data-toolbar-item="true" type="button" > diff --git a/packages/block-editor/src/components/block-alignment-control/test/__snapshots__/index.js.snap b/packages/block-editor/src/components/block-alignment-control/test/__snapshots__/index.js.snap index 246e5dca2ae324..9e7e59c0c31447 100644 --- a/packages/block-editor/src/components/block-alignment-control/test/__snapshots__/index.js.snap +++ b/packages/block-editor/src/components/block-alignment-control/test/__snapshots__/index.js.snap @@ -42,7 +42,7 @@ exports[`BlockAlignmentUI should match snapshot when controls are visible 1`] = ' @@ -15,8 +22,10 @@ function DeletedNavigationWarning( { onCreateNew, isNotice = false } ) { button: (