From 8f23e951a0e6a4ddbb022dca3dac2dece948ae38 Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Thu, 16 Feb 2023 13:07:32 +1100 Subject: [PATCH 01/15] Style Book: Allow button text labels for style book icon (#48088) * Global styles sidebar: Allow text labels on buttons * Simplify labels * Update e2e tests * Fix failing test Co-authored-by: Kai Hao --------- Co-authored-by: Kai Hao --- .../edit-site/src/components/global-styles/ui.js | 2 +- .../sidebar-edit-mode/global-styles-sidebar.js | 10 +++------- .../src/components/sidebar-edit-mode/style.scss | 16 ++++++++++++++++ test/e2e/specs/site-editor/style-book.spec.js | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/ui.js b/packages/edit-site/src/components/global-styles/ui.js index 5372ce9e5fbd5..13c1d0f2067a1 100644 --- a/packages/edit-site/src/components/global-styles/ui.js +++ b/packages/edit-site/src/components/global-styles/ui.js @@ -68,7 +68,7 @@ function GlobalStylesActionMenu() { - + + { __( 'Styles' ) } + + + + ); +} diff --git a/packages/block-library/src/page-list/edit.js b/packages/block-library/src/page-list/edit.js index 6b525960db224..876496686929a 100644 --- a/packages/block-library/src/page-list/edit.js +++ b/packages/block-library/src/page-list/edit.js @@ -23,7 +23,6 @@ import { Notice, ComboboxControl, Button, - Modal, } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; import { useMemo, useState, useEffect } from '@wordpress/element'; @@ -34,16 +33,15 @@ import { useSelect } from '@wordpress/data'; * Internal dependencies */ import { useConvertToNavigationLinks } from './use-convert-to-navigation-links'; +import { + convertDescription, + ConvertToLinksModal, +} from './convert-to-links-modal'; // We only show the edit option when page count is <= MAX_PAGE_COUNT // Performance of Navigation Links is not good past this value. const MAX_PAGE_COUNT = 100; const NOOP = () => {}; - -const convertDescription = __( - 'This menu is automatically kept in sync with pages on your site. You can manage the menu yourself by clicking "Edit" below.' -); - function BlockContent( { blockProps, innerBlocksProps, @@ -113,7 +111,7 @@ function BlockContent( { } } -function ConvertToLinksModal( { onClick, disabled } ) { +function ConvertToLinks( { onClick, disabled } ) { const [ isOpen, setOpen ] = useState( false ); const openModal = () => setOpen( true ); const closeModal = () => setOpen( false ); @@ -126,30 +124,11 @@ function ConvertToLinksModal( { onClick, disabled } ) { { isOpen && ( - -

- { convertDescription } -

-
- - -
-
+ ) } ); @@ -344,7 +323,7 @@ export default function PageListEdit( { ) } { allowConvertToLinks && ( - From 11525f7c9ad1f0cb7f464d86cdc0b9e207bb3d45 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Thu, 16 Feb 2023 11:17:41 +0000 Subject: [PATCH 05/15] Navigation List View: Add block movers to the more menu (#48099) * Navigation List View: Add block movers to the more menu * add arrows * put the remove action in its own group --- .../off-canvas-editor/leaf-more-menu.js | 67 ++++++++++++++----- 1 file changed, 52 insertions(+), 15 deletions(-) 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 a266f0d9377c3..a3829998361bc 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 @@ -2,9 +2,14 @@ * WordPress dependencies */ import { createBlock } from '@wordpress/blocks'; -import { addSubmenu, moreVertical } from '@wordpress/icons'; +import { + addSubmenu, + chevronUp, + chevronDown, + moreVertical, +} from '@wordpress/icons'; import { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components'; -import { useDispatch } from '@wordpress/data'; +import { useDispatch, useSelect } from '@wordpress/data'; import { __, sprintf } from '@wordpress/i18n'; /** @@ -80,14 +85,24 @@ function AddSubmenuItem( { block, onClose } ) { export default function LeafMoreMenu( props ) { const { clientId, block } = props; - const { removeBlocks } = useDispatch( blockEditorStore ); + const { moveBlocksDown, moveBlocksUp, removeBlocks } = + useDispatch( blockEditorStore ); - const label = sprintf( + const removeLabel = sprintf( /* translators: %s: block name */ __( 'Remove %s' ), BlockTitle( { clientId, maximumLength: 25 } ) ); + const rootClientId = useSelect( + ( select ) => { + const { getBlockRootClientId } = select( blockEditorStore ); + + return getBlockRootClientId( clientId ); + }, + [ clientId ] + ); + return ( { ( { onClose } ) => ( - - - { - removeBlocks( [ clientId ], false ); - onClose(); - } } - > - { label } - - + <> + + { + moveBlocksUp( [ clientId ], rootClientId ); + onClose(); + } } + > + { __( 'Move up' ) } + + { + moveBlocksDown( [ clientId ], rootClientId ); + onClose(); + } } + > + { __( 'Move down' ) } + + + + + { + removeBlocks( [ clientId ], false ); + onClose(); + } } + > + { removeLabel } + + + ) } ); From b9fb37a75b484eaefc81aababa95be2c83f68d4d Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Thu, 16 Feb 2023 17:26:57 +0000 Subject: [PATCH 06/15] Bump plugin version to 15.2.0-rc.2 --- gutenberg.php | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gutenberg.php b/gutenberg.php index ca9be89162ebc..fe3e8669605eb 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/package-lock.json b/package-lock.json index a59aa9f4bbae2..19fa9b1cf2bd3 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": { diff --git a/package.json b/package.json index cdac43e2d4ecb..50806050edf99 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", From 67fcff1789fa6d07eb28d0d6e03725f93d0f7c92 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Thu, 16 Feb 2023 19:21:05 +0000 Subject: [PATCH 07/15] Update Changelog for 15.2.0-rc.2 --- changelog.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/changelog.txt b/changelog.txt index 46f339243bd08..798ea972663f9 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 = From eb7bafdc244bc207eb1f4d491bf61ee268b003ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Feb 2023 22:44:02 -0500 Subject: [PATCH 08/15] Bump actions/setup-java from 3.9.0 to 3.10.0 (#47877) Bumps [actions/setup-java](https://github.com/actions/setup-java) from 3.9.0 to 3.10.0. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/1df8dbefe2a8cbc99770194893dd902763bee34b...3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/rnmobile-android-runner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index fc019dfa5d504..b319f3bddea53 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' From b9e5514d1b899ca7125f6d2768e3a19d59c470aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Feb 2023 22:44:33 -0500 Subject: [PATCH 09/15] Bump @sideway/formula from 3.0.0 to 3.0.1 (#47894) Bumps [@sideway/formula](https://github.com/sideway/formula) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/sideway/formula/releases) - [Commits](https://github.com/sideway/formula/compare/v3.0.0...v3.0.1) --- updated-dependencies: - dependency-name: "@sideway/formula" dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 19fa9b1cf2bd3..1ec271075a176 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", From 75054160e4e0462b1b801ec892e688d35a9800ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Feb 2023 22:44:51 -0500 Subject: [PATCH 10/15] Bump actions/cache from 3.2.4 to 3.2.5 (#47970) Bumps [actions/cache](https://github.com/actions/cache) from 3.2.4 to 3.2.5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/627f0f41f6904a5b1efbaed9f96d9eb58e92e920...6998d139ddd3e68c71e9e398d8e40b71a2f39812) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pull-request-automation.yml | 2 +- .github/workflows/rnmobile-android-runner.yml | 2 +- .github/workflows/rnmobile-ios-runner.yml | 4 ++-- .github/workflows/unit-test.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull-request-automation.yml b/.github/workflows/pull-request-automation.yml index 6219c5ae3c848..5163ae3f0ea0c 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 b319f3bddea53..033789ee30a92 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -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 6d497491bdf9c..52fab007b1917 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 8b1884835f416..6552f2ecf6a2b 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') }} From 05d3575c66d86299f668b2fcbf04107a668094fb Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Fri, 17 Feb 2023 11:19:53 +0100 Subject: [PATCH 11/15] Fix the Publish region position and focus style. (#48102) --- .../higher-order/navigate-regions/style.scss | 3 ++- .../edit-post/src/components/layout/index.js | 16 +++++++++------- .../edit-site/src/components/editor/style.scss | 6 ------ .../edit-site/src/components/layout/style.scss | 9 ++++++++- .../src/components/save-panel/index.js | 9 ++++++++- .../components/interface-skeleton/style.scss | 18 +++++++++++------- 6 files changed, 38 insertions(+), 23 deletions(-) diff --git a/packages/components/src/higher-order/navigate-regions/style.scss b/packages/components/src/higher-order/navigate-regions/style.scss index 6e66c854dd70e..f146413a09dc9 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/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js index 8353b4ed6b15e..3fe02dbe5004f 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 c63a0dcb954d2..1a24d3ee1475e 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/layout/style.scss b/packages/edit-site/src/components/layout/style.scss index f9837e5fa3c84..5e47588369c80 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 0c3a2083af696..7b8993c0be495 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/interface/src/components/interface-skeleton/style.scss b/packages/interface/src/components/interface-skeleton/style.scss index 57d88626636dd..a45239b529ddd 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; } } From 0b5ca2239f012e676d70d5011f9f96c503cc8220 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Fri, 17 Feb 2023 11:46:28 +0100 Subject: [PATCH 12/15] Fix site editor switch mode message. (#48136) --- packages/edit-site/src/store/actions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/edit-site/src/store/actions.js b/packages/edit-site/src/store/actions.js index a535d9916b2d2..48ac0a343a59f 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' ); } }; From 0414d3a1b35e564b7c407c3018c55e49c1aaa660 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Fri, 17 Feb 2023 16:07:31 +0000 Subject: [PATCH 13/15] Fix: Multiple overwrites on rest_controller_class for wp_template/wp_template_part. (#48078) --- ...utenberg-rest-templates-controller-6-3.php | 61 +++++++++++++++ ...gutenberg-rest-template-revision-count.php | 75 ------------------- lib/experimental/rest-api.php | 21 ------ lib/load.php | 1 - ...tenberg-rest-templates-controller-test.php | 2 +- 5 files changed, 62 insertions(+), 98 deletions(-) delete mode 100644 lib/experimental/class-gutenberg-rest-template-revision-count.php 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 f857cedd37f9a..2f9bd7a8cd9e4 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 82bedd6e0c8ff..0000000000000 --- 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 31a96b6572f26..77f7d091d2655 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 c99668ff3739c..e00c20286d4e7 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/phpunit/class-gutenberg-rest-templates-controller-test.php b/phpunit/class-gutenberg-rest-templates-controller-test.php index 81d7f2758c643..d8447704bd373 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() { From 356a1b1555ab7302a6e17d88c32abcace6feb1e7 Mon Sep 17 00:00:00 2001 From: Rich Tabor Date: Fri, 17 Feb 2023 22:41:13 -0500 Subject: [PATCH 14/15] Remove "& Shadow" from ScreenHeader (#48043) --- .../edit-site/src/components/global-styles/screen-border.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 8312483cce6b2..6a5578e20fcef 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 && ( From 7f4bc290d92c661f8d0e7e259166bfdae702b043 Mon Sep 17 00:00:00 2001 From: Vijayan Date: Sun, 19 Feb 2023 12:33:28 +0530 Subject: [PATCH 15/15] Markdown fix for wp_enqueue_script (#48212) --- docs/contributors/code/scripts.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/contributors/code/scripts.md b/docs/contributors/code/scripts.md index b7cabe0130d71..d4ce263c80ad1 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)