From 9e80dabebd0218074f2b84f98223667b7ff1b110 Mon Sep 17 00:00:00 2001 From: Robert Anderson Date: Wed, 24 Aug 2022 20:16:01 +1000 Subject: [PATCH 01/68] `DateTimePicker`: address feedback after recent refactor to `date-fns` and `use-lilius` (#43495) * Use compiler-time cast instead of run-time cast * Add box-sizing: border-box * Prevent scroll on arrow press * Implement PageUp, PageDown, Home and End keyboard shortcuts * Set DayOfWeek font-size * Use advanceTimersByTime * Add line-height * Add comment explaining type cast * Add exhaustive-deps ignore * Update CHANGELOG.md --- packages/components/CHANGELOG.md | 1 + .../src/date-time/date-time/index.tsx | 7 ++-- .../src/date-time/date-time/styles.ts | 9 ++++++ .../components/src/date-time/date/index.tsx | 32 +++++++++++++++---- .../components/src/date-time/date/styles.ts | 6 ++++ .../src/date-time/date/test/index.tsx | 8 +++-- .../components/src/date-time/time/styles.ts | 1 + packages/date/src/index.js | 3 +- 8 files changed, 54 insertions(+), 13 deletions(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 248802890e46d6..5bfb10af6c3148 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -35,6 +35,7 @@ - Update `floating-ui` to the latest version ([#43206](https://github.com/WordPress/gutenberg/pull/43206)). - `DateTimePicker`, `TimePicker`, `DatePicker`: Switch from `moment` to `date-fns` ([#43005](https://github.com/WordPress/gutenberg/pull/43005)). - `DatePicker`: Switch from `react-dates` to `use-lilius` ([#43005](https://github.com/WordPress/gutenberg/pull/43005)). +- `DateTimePicker`: address feedback after recent refactor to `date-fns` and `use-lilius` ([#43495](https://github.com/WordPress/gutenberg/pull/43495)). - `convertLTRToRTL()`: Refactor away from `_.mapKeys()` ([#43258](https://github.com/WordPress/gutenberg/pull/43258/)). - `withSpokenMessages`: Update to use `@testing-library/react` ([#43273](https://github.com/WordPress/gutenberg/pull/43273)). - `MenuGroup`: Refactor unit tests to use `@testing-library/react` ([#43275](https://github.com/WordPress/gutenberg/pull/43275)). diff --git a/packages/components/src/date-time/date-time/index.tsx b/packages/components/src/date-time/date-time/index.tsx index 5324a13a8d7cc8..07e0c6e0d89465 100644 --- a/packages/components/src/date-time/date-time/index.tsx +++ b/packages/components/src/date-time/date-time/index.tsx @@ -17,11 +17,10 @@ import Button from '../../button'; import { default as DatePicker } from '../date'; import { default as TimePicker } from '../time'; import type { DateTimePickerProps } from '../types'; -import { CalendarHelp } from './styles'; +import { Wrapper, CalendarHelp } from './styles'; import { HStack } from '../../h-stack'; import { Heading } from '../../heading'; import { Spacer } from '../../spacer'; -import { VStack } from '../../v-stack'; export { DatePicker, TimePicker }; @@ -64,7 +63,7 @@ function UnforwardedDateTimePicker( } return ( - + { ! calendarHelpIsVisible && ( <> ) } - + ); } diff --git a/packages/components/src/date-time/date-time/styles.ts b/packages/components/src/date-time/date-time/styles.ts index 8c5693213eabbe..a7f23eb276e047 100644 --- a/packages/components/src/date-time/date-time/styles.ts +++ b/packages/components/src/date-time/date-time/styles.ts @@ -3,6 +3,15 @@ */ import styled from '@emotion/styled'; +/** + * Internal dependencies + */ +import { VStack } from '../../v-stack'; + +export const Wrapper = styled( VStack )` + box-sizing: border-box; +`; + export const CalendarHelp = styled.div` min-width: 260px; `; diff --git a/packages/components/src/date-time/date/index.tsx b/packages/components/src/date-time/date/index.tsx index 2cad8a18131c81..b3f64868f80bf3 100644 --- a/packages/components/src/date-time/date/index.tsx +++ b/packages/components/src/date-time/date/index.tsx @@ -13,6 +13,8 @@ import { subWeeks, addWeeks, isSameMonth, + startOfWeek, + endOfWeek, } from 'date-fns'; /** @@ -28,6 +30,7 @@ import { useState, useRef, useEffect } from '@wordpress/element'; */ import type { DatePickerProps } from '../types'; import { + Wrapper, Navigator, NavigatorHeading, Calendar, @@ -63,7 +66,7 @@ export function DatePicker( { events = [], isInvalidDate, onMonthPreviewed, - startOfWeek = 0, + startOfWeek: weekStartsOn = 0, }: DatePickerProps ) { const date = currentDate ? inputToDate( currentDate ) : new Date(); @@ -78,7 +81,7 @@ export function DatePicker( { } = useLilius( { selected: [ startOfDay( date ) ], viewing: startOfDay( date ), - weekStartsOn: startOfWeek, + weekStartsOn, } ); // Used to implement a roving tab index. Tracks the day that receives focus @@ -101,7 +104,7 @@ export function DatePicker( { } return ( -
-
+ ); } @@ -274,12 +292,14 @@ function Day( { // Focus the day when it becomes focusable, e.g. because an arrow key is // pressed. Only do this if focus is allowed - this stops us stealing focus - // from e.g. a TimePicker input. Note that isFocusAllowed is not a dep as - // there is no point calling focus() on an already focused element. + // from e.g. a TimePicker input. useEffect( () => { if ( ref.current && isFocusable && isFocusAllowed ) { ref.current.focus(); } + // isFocusAllowed is not a dep as there is no point calling focus() on + // an already focused element. + // eslint-disable-next-line react-hooks/exhaustive-deps }, [ isFocusable ] ); return ( diff --git a/packages/components/src/date-time/date/styles.ts b/packages/components/src/date-time/date/styles.ts index 76288be8a2ef62..a0f1853098f16e 100644 --- a/packages/components/src/date-time/date/styles.ts +++ b/packages/components/src/date-time/date/styles.ts @@ -12,6 +12,10 @@ import { HStack } from '../../h-stack'; import { Heading } from '../../heading'; import { space } from '../../ui/utils/space'; +export const Wrapper = styled.div` + box-sizing: border-box; +`; + export const Navigator = styled( HStack )` margin-bottom: ${ space( 4 ) }; `; @@ -35,6 +39,8 @@ export const Calendar = styled.div` export const DayOfWeek = styled.div` color: ${ COLORS.gray[ 700 ] }; + font-size: ${ CONFIG.fontSize }; + line-height: ${ CONFIG.fontLineHeightBase }; &:nth-of-type( 1 ) { justify-self: start; diff --git a/packages/components/src/date-time/date/test/index.tsx b/packages/components/src/date-time/date/test/index.tsx index 7cd7eeaf6a10c8..c519d34d911692 100644 --- a/packages/components/src/date-time/date/test/index.tsx +++ b/packages/components/src/date-time/date/test/index.tsx @@ -31,7 +31,9 @@ describe( 'DatePicker', () => { } ); it( 'should call onChange when a day is selected', async () => { - const user = userEvent.setup( { delay: null } ); + const user = userEvent.setup( { + advanceTimers: jest.advanceTimersByTime, + } ); const onChange = jest.fn(); @@ -50,7 +52,9 @@ describe( 'DatePicker', () => { } ); it( 'should call onMonthPreviewed and onChange when a day in a different month is selected', async () => { - const user = userEvent.setup( { delay: null } ); + const user = userEvent.setup( { + advanceTimers: jest.advanceTimersByTime, + } ); const onMonthPreviewed = jest.fn(); const onChange = jest.fn(); diff --git a/packages/components/src/date-time/time/styles.ts b/packages/components/src/date-time/time/styles.ts index 68c59d08873922..bc579a6731ee98 100644 --- a/packages/components/src/date-time/time/styles.ts +++ b/packages/components/src/date-time/time/styles.ts @@ -18,6 +18,7 @@ import SelectControl from '../../select-control'; import { Select } from '../../select-control/styles/select-control-styles'; export const Wrapper = styled.div` + box-sizing: border-box; font-size: ${ CONFIG.fontSize }; `; diff --git a/packages/date/src/index.js b/packages/date/src/index.js index 2a67fc35d59a26..520d3468fd0c5a 100644 --- a/packages/date/src/index.js +++ b/packages/date/src/index.js @@ -580,7 +580,8 @@ function buildMoment( dateValue, timezone = '' ) { const dateMoment = momentLib( dateValue ); if ( timezone && ! isUTCOffset( timezone ) ) { - return dateMoment.tz( String( timezone ) ); + // The ! isUTCOffset() check guarantees that timezone is a string. + return dateMoment.tz( /** @type {string} */ ( timezone ) ); } if ( timezone && isUTCOffset( timezone ) ) { From f5d805e7712df4e8fc3b35608563c84f2e17808c Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Wed, 24 Aug 2022 10:40:33 +0000 Subject: [PATCH 02/68] Bump plugin version to 14.0.0-rc.1 --- 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 8f631ed25f2413..1d5cd83741484c 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -5,7 +5,7 @@ * Description: Printing since 1440. This is the development plugin for the new block editor in core. * Requires at least: 5.9 * Requires PHP: 5.6 - * Version: 13.9.0 + * Version: 14.0.0-rc.1 * Author: Gutenberg Team * Text Domain: gutenberg * diff --git a/package-lock.json b/package-lock.json index 0f81633e458430..e35bd0491294fb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "13.9.0", + "version": "14.0.0-rc.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index e075a83646ef69..01a1bb132966a7 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "13.9.0", + "version": "14.0.0-rc.1", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", From e5d9a436d5426aeb19e9de910d52505b55edce36 Mon Sep 17 00:00:00 2001 From: Maggie Date: Wed, 24 Aug 2022 13:01:54 +0200 Subject: [PATCH 03/68] skip navigation block e2e tests (#43571) --- packages/e2e-tests/specs/editor/blocks/navigation.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/e2e-tests/specs/editor/blocks/navigation.test.js b/packages/e2e-tests/specs/editor/blocks/navigation.test.js index f95b8064959579..78733038ea977d 100644 --- a/packages/e2e-tests/specs/editor/blocks/navigation.test.js +++ b/packages/e2e-tests/specs/editor/blocks/navigation.test.js @@ -278,8 +278,9 @@ async function waitForBlock( blockName ) { } // Disable reason - these tests are to be re-written. +// Skipped temporarily due to issues with GH actions: https://wordpress.slack.com/archives/C02QB2JS7/p1661331673166269. // eslint-disable-next-line jest/no-disabled-tests -describe( 'Navigation', () => { +describe.skip( 'Navigation', () => { const contributorUsername = `contributoruser_${ ++uniqueId }`; let contributorPassword; From 9963f040f06099071d4bbf60baa90eb3512aedd9 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 24 Aug 2022 15:46:02 +0400 Subject: [PATCH 04/68] Post Terms: Use unbound query in the usePostTerms hook (#43501) --- packages/block-library/src/post-terms/use-post-terms.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/post-terms/use-post-terms.js b/packages/block-library/src/post-terms/use-post-terms.js index 10fdb3ecfea558..c5477703cfb7d3 100644 --- a/packages/block-library/src/post-terms/use-post-terms.js +++ b/packages/block-library/src/post-terms/use-post-terms.js @@ -30,6 +30,7 @@ export default function usePostTerms( { postId, postType, term } ) { slug, { include: termIds, + per_page: -1, context: 'view', }, ]; From 2c8ac507c1800b1e3a0fa272d65bc2a03a34afb6 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Wed, 24 Aug 2022 20:58:34 +0900 Subject: [PATCH 05/68] Components: Invert tsconfig to be exclude-based (#43534) * Components: Invert tsconfig to be exclude-based * Update contributing guide --- packages/components/CONTRIBUTING.md | 4 +- packages/components/tsconfig.json | 127 +++++++++++----------------- 2 files changed, 53 insertions(+), 78 deletions(-) diff --git a/packages/components/CONTRIBUTING.md b/packages/components/CONTRIBUTING.md index ca8f948b7ee853..989fe32e8f4910 100644 --- a/packages/components/CONTRIBUTING.md +++ b/packages/components/CONTRIBUTING.md @@ -480,7 +480,7 @@ component-family-name/ Given a component folder (e.g. `packages/components/src/unit-control`): -1. Add the folder to `tsconfig.json`, if it isn’t already. +1. Remove the folder from the exclude list in `tsconfig.json`, if it isn’t already. 2. Remove any `// @ts-nocheck` comments in the folder, if any. 3. Rename `*.js{x}` files to `*.ts{x}` (except stories and unit tests). 4. Run `npm run dev` and take note of all the errors (your IDE should also flag them). @@ -504,7 +504,7 @@ Given a component folder (e.g. `packages/components/src/unit-control`): } ``` - 3. Add the folders to the `tsconfig.json` file. + 3. Remove the folders from the exclude list in the `tsconfig.json` file. 4. If you’re still getting errors about a component’s props, the easiest way is to slightly refactor this component and perform the props destructuring inside the component’s body (as opposed as in the function signature) — this is to prevent TypeScript from inferring the types of these props. 5. Continue with the refactor of the current component (and take care of the refactor of the dependent components at a later stage). 6. Create a new `types.ts` file. diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json index 0d63f0483fb495..2b292520a92bed 100644 --- a/packages/components/tsconfig.json +++ b/packages/components/tsconfig.json @@ -30,80 +30,7 @@ { "path": "../react-i18n" }, { "path": "../warning" } ], - "include": [ - "src/__next/**/*", - "src/animate/**/*", - "src/base-control/**/*", - "src/base-field/**/*", - "src/border-box-control/**/*", - "src/border-control/**/*", - "src/button/**/*", - "src/button-group/**/*", - "src/card/**/*", - "src/checkbox-control/**/*", - "src/circular-option-picker/**/*", - "src/color-indicator/**/*", - "src/color-palette/**/*", - "src/color-picker/**/*", - "src/confirm-dialog/**/*", - "src/dashicon/**/*", - "src/date-time/**/*", - "src/disabled/**/*", - "src/divider/**/*", - "src/draggable/**/*", - "src/dropdown/**/*", - "src/dropdown-menu/**/*", - "src/elevation/**/*", - "src/external-link/**/*", - "src/flex/**/*", - "src/form-group/**/*", - "src/form-toggle/**/*", - "src/form-token-field/**/*", - "src/grid/**/*", - "src/h-stack/**/*", - "src/heading/**/*", - "src/higher-order/with-focus-outside/**/*", - "src/icon/**/*", - "src/input-control/**/*", - "src/item-group/**/*", - "src/menu-item/**/*", - "src/menu-group/**/*", - "src/modal/**/*", - "src/navigable-container/**/*", - "src/navigator/**/*", - "src/number-control/**/*", - "src/placeholder/**/*", - "src/popover/**/*", - "src/radio-control/**/*", - "src/range-control/**/*", - "src/resizable-box/**/*", - "src/scroll-lock/**/*", - "src/scrollable/**/*", - "src/select-control/**/*", - "src/shortcut/**/*", - "src/slot-fill/**/*", - "src/style-provider/**/*", - "src/spacer/**/*", - "src/spinner/**/*", - "src/surface/**/*", - "src/text/**/*", - "src/text-control/**/*", - "src/text-highlight/**/*", - "src/textarea-control/**/*", - "src/tip/**/*", - "src/toggle-group-control/**/*", - "src/tools-panel/**/*", - "src/tooltip/**/*", - "src/tree-select/**/*", - "src/truncate/**/*", - "src/ui/**/*", - "src/unit-control/**/*", - "src/utils/**/*", - "src/v-stack/**/*", - "src/view/**/*", - "src/visually-hidden/**/*", - "src/z-stack/**/*" - ], + "include": [ "src/**/*" ], "exclude": [ "src/**/*.android.js", "src/**/*.ios.js", @@ -111,7 +38,55 @@ "src/**/react-native-*", "src/**/stories/**.js", // only exclude js files, tsx files should be checked "src/**/test/**.js", // only exclude js files, ts{x} files should be checked - "src/ui/__storybook-utils", - "src/ui/font-size-control" + "src/index.js", + "src/alignment-matrix-control", + "src/angle-picker-control", + "src/autocomplete", + "src/box-control", + "src/clipboard-button", + "src/color-list-picker", + "src/combobox-control", + "src/custom-gradient-picker", + "src/custom-select-control", + "src/dimension-control", + "src/drop-zone", + "src/duotone-picker", + "src/focal-point-picker", + "src/focusable-iframe", + "src/font-size-picker", + "src/form-file-upload", + "src/gradient-picker", + "src/guide", + "src/higher-order/navigate-regions", + "src/higher-order/with-constrained-tabbing", + "src/higher-order/with-fallback-styles", + "src/higher-order/with-filters", + "src/higher-order/with-focus-return", + "src/higher-order/with-spoken-messages", + "src/higher-order/with-notices", + "src/isolated-event-container", + "src/keyboard-shortcuts", + "src/menu-items-choice", + "src/navigation", + "src/notice", + "src/palette-edit", + "src/panel", + "src/query-controls", + "src/radio", + "src/radio-group", + "src/responsive-wrapper", + "src/sandbox", + "src/search-control", + "src/snackbar", + "src/tab-panel", + "src/toggle-control", + "src/toolbar", + "src/toolbar-button", + "src/toolbar-context", + "src/toolbar-dropdown-menu", + "src/toolbar-group", + "src/toolbar-item", + "src/tree-grid", + "src/ui/__storybook-utils" ] } From ca6f3275fe643d999a228268bb2547a2db9d6100 Mon Sep 17 00:00:00 2001 From: Adam Zielinski Date: Wed, 24 Aug 2022 14:26:38 +0200 Subject: [PATCH 06/68] [data] Add type signature for useDispatch (#43528) * Add type signature for useDispatch * Use human readable names for generics --- packages/data/README.md | 4 ++-- .../components/use-dispatch/use-dispatch.js | 22 +++++++++++++------ packages/data/src/types.ts | 19 ++++++++++++++-- 3 files changed, 34 insertions(+), 11 deletions(-) diff --git a/packages/data/README.md b/packages/data/README.md index bb6a0712c7f8c8..d45a71d3fa6031 100644 --- a/packages/data/README.md +++ b/packages/data/README.md @@ -749,11 +749,11 @@ const SaleButton = ( { children } ) => { _Parameters_ -- _storeNameOrDescriptor_ `[string|StoreDescriptor]`: Optionally provide the name of the store or its descriptor from which to retrieve action creators. If not provided, the registry.dispatch function is returned instead. +- _storeNameOrDescriptor_ `[StoreNameOrDescriptor]`: Optionally provide the name of the store or its descriptor from which to retrieve action creators. If not provided, the registry.dispatch function is returned instead. _Returns_ -- `Function`: A custom react hook. +- `UseDispatchReturn`: A custom react hook. ### useRegistry diff --git a/packages/data/src/components/use-dispatch/use-dispatch.js b/packages/data/src/components/use-dispatch/use-dispatch.js index f60b7f90912456..306939307be8ab 100644 --- a/packages/data/src/components/use-dispatch/use-dispatch.js +++ b/packages/data/src/components/use-dispatch/use-dispatch.js @@ -3,7 +3,14 @@ */ import useRegistry from '../registry-provider/use-registry'; -/** @typedef {import('../../types').StoreDescriptor} StoreDescriptor */ +/** + * @typedef {import('../../types').StoreDescriptor} StoreDescriptor + * @template StoreConfig + */ +/** + * @typedef {import('../../types').UseDispatchReturn} UseDispatchReturn + * @template StoreNameOrDescriptor + */ /** * A custom react hook returning the current registry dispatch actions creators. @@ -11,11 +18,12 @@ import useRegistry from '../registry-provider/use-registry'; * Note: The component using this hook must be within the context of a * RegistryProvider. * - * @param {string|StoreDescriptor} [storeNameOrDescriptor] Optionally provide the name of the - * store or its descriptor from which to - * retrieve action creators. If not - * provided, the registry.dispatch - * function is returned instead. + * @template {undefined | string | StoreDescriptor} [StoreNameOrDescriptor=undefined] + * @param {StoreNameOrDescriptor} [storeNameOrDescriptor] Optionally provide the name of the + * store or its descriptor from which to + * retrieve action creators. If not + * provided, the registry.dispatch + * function is returned instead. * * @example * This illustrates a pattern where you may need to retrieve dynamic data from @@ -48,7 +56,7 @@ import useRegistry from '../registry-provider/use-registry'; * // * // Start Sale! * ``` - * @return {Function} A custom react hook. + * @return {UseDispatchReturn} A custom react hook. */ const useDispatch = ( storeNameOrDescriptor ) => { const { dispatch } = useRegistry(); diff --git a/packages/data/src/types.ts b/packages/data/src/types.ts index 7a7f4cdd41df4e..a200193ab3279e 100644 --- a/packages/data/src/types.ts +++ b/packages/data/src/types.ts @@ -50,6 +50,19 @@ export type UseSelectReturn< F extends MapSelect | StoreDescriptor< any > > = ? CurriedSelectorsOf< F > : never; +export type UseDispatchReturn< StoreNameOrDescriptor > = + StoreNameOrDescriptor extends StoreDescriptor< any > + ? ActionCreatorsOf< ConfigOf< StoreNameOrDescriptor > > + : StoreNameOrDescriptor extends undefined + ? DispatchFunction + : any; + +export type DispatchFunction = < StoreNameOrDescriptor >( + store: StoreNameOrDescriptor +) => StoreNameOrDescriptor extends StoreDescriptor< any > + ? ActionCreatorsOf< ConfigOf< StoreNameOrDescriptor > > + : any; + export type MapSelect = ( select: SelectFunction ) => any; export type SelectFunction = < S >( store: S ) => CurriedSelectorsOf< S >; @@ -91,9 +104,11 @@ export interface DataEmitter { // Type Helpers. -type ActionCreatorsOf< Config extends AnyConfig > = +export type ConfigOf< S > = S extends StoreDescriptor< infer C > ? C : never; + +export type ActionCreatorsOf< Config extends AnyConfig > = Config extends ReduxStoreConfig< any, infer ActionCreators, any > - ? { [ name in keyof ActionCreators ]: Function | Generator } + ? ActionCreators : never; type SelectorsOf< Config extends AnyConfig > = Config extends ReduxStoreConfig< From a55f8809c0aecb7ce781ea51f19f8e388b929b00 Mon Sep 17 00:00:00 2001 From: Joen A <1204802+jasmussen@users.noreply.github.com> Date: Wed, 24 Aug 2022 14:27:57 +0200 Subject: [PATCH 07/68] Button: Try removing hardcoded white. (#43553) --- packages/block-library/src/button/style.scss | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/block-library/src/button/style.scss b/packages/block-library/src/button/style.scss index 984027ddbd93a1..83f8602f81de21 100644 --- a/packages/block-library/src/button/style.scss +++ b/packages/block-library/src/button/style.scss @@ -11,13 +11,6 @@ $blocks-block__margin: 0.5em; word-break: break-word; // overflow-wrap doesn't work well if a link is wrapped in the div, so use word-break here. box-sizing: border-box; - &:hover, - &:focus, - &:active, - &:visited { - color: $white; - } - &.aligncenter { text-align: center; } From 5adba04eb2c9d83ed7195566720cca9e52bef592 Mon Sep 17 00:00:00 2001 From: Andrei Draganescu Date: Wed, 24 Aug 2022 16:14:08 +0300 Subject: [PATCH 08/68] unskips focus test and adds await to a click event (#43507) --- packages/e2e-tests/specs/editor/blocks/navigation.test.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/e2e-tests/specs/editor/blocks/navigation.test.js b/packages/e2e-tests/specs/editor/blocks/navigation.test.js index 78733038ea977d..db8f750281569c 100644 --- a/packages/e2e-tests/specs/editor/blocks/navigation.test.js +++ b/packages/e2e-tests/specs/editor/blocks/navigation.test.js @@ -1682,10 +1682,7 @@ Expected mock function not to be called but it was called with: ["POST", "http:/ ); } ); - // Skip reason: running it in interactive works but selecting and - // checking for focus consistently fails in the test. - // eslint-disable-next-line jest/no-disabled-tests - it.skip( 'should always focus select menu button after item selection', async () => { + it( 'should always focus select menu button after item selection', async () => { // Create some navigation menus to work with. await createNavigationMenu( { title: 'First navigation', @@ -1713,7 +1710,7 @@ Expected mock function not to be called but it was called with: ["POST", "http:/ const theOption = await page.waitForXPath( "//button[@aria-checked='false'][contains(., 'First navigation')]" ); - theOption.click(); + await theOption.click(); // Once the options are closed, does select menu button receive focus? const selectMenuDropdown2 = await page.$( From f5cd9e1285c17af5431b391fe752560af0a95dc2 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Wed, 24 Aug 2022 13:22:52 +0000 Subject: [PATCH 09/68] Update changelog files --- packages/a11y/CHANGELOG.md | 2 ++ packages/a11y/package.json | 2 +- packages/annotations/CHANGELOG.md | 2 ++ packages/annotations/package.json | 2 +- packages/api-fetch/CHANGELOG.md | 2 ++ packages/api-fetch/package.json | 2 +- packages/autop/CHANGELOG.md | 2 ++ packages/autop/package.json | 2 +- packages/babel-plugin-import-jsx-pragma/CHANGELOG.md | 2 ++ packages/babel-plugin-import-jsx-pragma/package.json | 2 +- packages/babel-plugin-makepot/CHANGELOG.md | 2 ++ packages/babel-plugin-makepot/package.json | 2 +- packages/babel-preset-default/CHANGELOG.md | 2 ++ packages/babel-preset-default/package.json | 2 +- packages/blob/CHANGELOG.md | 2 ++ packages/blob/package.json | 2 +- packages/block-directory/CHANGELOG.md | 2 ++ packages/block-directory/package.json | 2 +- packages/block-editor/CHANGELOG.md | 2 ++ packages/block-editor/package.json | 2 +- packages/block-library/CHANGELOG.md | 2 ++ packages/block-library/package.json | 2 +- packages/block-serialization-default-parser/CHANGELOG.md | 2 ++ packages/block-serialization-default-parser/package.json | 2 +- packages/block-serialization-spec-parser/CHANGELOG.md | 2 ++ packages/block-serialization-spec-parser/package.json | 2 +- packages/blocks/CHANGELOG.md | 2 ++ packages/blocks/package.json | 2 +- packages/browserslist-config/CHANGELOG.md | 2 ++ packages/browserslist-config/package.json | 2 +- packages/components/CHANGELOG.md | 2 ++ packages/components/package.json | 2 +- packages/compose/CHANGELOG.md | 2 ++ packages/compose/package.json | 2 +- packages/core-data/CHANGELOG.md | 2 ++ packages/core-data/package.json | 2 +- packages/create-block-tutorial-template/CHANGELOG.md | 2 ++ packages/create-block-tutorial-template/package.json | 2 +- packages/create-block/CHANGELOG.md | 2 ++ packages/create-block/package.json | 2 +- packages/customize-widgets/CHANGELOG.md | 2 ++ packages/customize-widgets/package.json | 2 +- packages/data-controls/CHANGELOG.md | 2 ++ packages/data-controls/package.json | 2 +- packages/data/CHANGELOG.md | 2 ++ packages/data/package.json | 2 +- packages/date/CHANGELOG.md | 2 ++ packages/date/package.json | 2 +- packages/dependency-extraction-webpack-plugin/CHANGELOG.md | 2 ++ packages/dependency-extraction-webpack-plugin/package.json | 2 +- packages/deprecated/CHANGELOG.md | 2 ++ packages/deprecated/package.json | 2 +- packages/dom-ready/CHANGELOG.md | 2 ++ packages/dom-ready/package.json | 2 +- packages/dom/CHANGELOG.md | 2 ++ packages/dom/package.json | 2 +- packages/e2e-test-utils/CHANGELOG.md | 2 ++ packages/e2e-test-utils/package.json | 2 +- packages/e2e-tests/CHANGELOG.md | 2 ++ packages/e2e-tests/package.json | 2 +- packages/edit-post/CHANGELOG.md | 2 ++ packages/edit-post/package.json | 2 +- packages/edit-site/CHANGELOG.md | 2 ++ packages/edit-site/package.json | 2 +- packages/edit-widgets/CHANGELOG.md | 2 ++ packages/edit-widgets/package.json | 2 +- packages/editor/CHANGELOG.md | 2 ++ packages/editor/package.json | 2 +- packages/element/CHANGELOG.md | 2 ++ packages/element/package.json | 2 +- packages/escape-html/CHANGELOG.md | 2 ++ packages/escape-html/package.json | 2 +- packages/eslint-plugin/CHANGELOG.md | 2 ++ packages/eslint-plugin/package.json | 2 +- packages/format-library/CHANGELOG.md | 2 ++ packages/format-library/package.json | 2 +- packages/hooks/CHANGELOG.md | 2 ++ packages/hooks/package.json | 2 +- packages/html-entities/CHANGELOG.md | 2 ++ packages/html-entities/package.json | 2 +- packages/i18n/CHANGELOG.md | 2 ++ packages/i18n/package.json | 2 +- packages/icons/CHANGELOG.md | 2 ++ packages/icons/package.json | 2 +- packages/interface/CHANGELOG.md | 2 ++ packages/interface/package.json | 2 +- packages/is-shallow-equal/CHANGELOG.md | 2 ++ packages/is-shallow-equal/package.json | 2 +- packages/jest-console/CHANGELOG.md | 2 ++ packages/jest-console/package.json | 2 +- packages/jest-preset-default/CHANGELOG.md | 2 ++ packages/jest-preset-default/package.json | 2 +- packages/jest-puppeteer-axe/CHANGELOG.md | 2 ++ packages/jest-puppeteer-axe/package.json | 2 +- packages/keyboard-shortcuts/CHANGELOG.md | 2 ++ packages/keyboard-shortcuts/package.json | 2 +- packages/keycodes/CHANGELOG.md | 2 ++ packages/keycodes/package.json | 2 +- packages/list-reusable-blocks/CHANGELOG.md | 2 ++ packages/list-reusable-blocks/package.json | 2 +- packages/media-utils/CHANGELOG.md | 2 ++ packages/media-utils/package.json | 2 +- packages/notices/CHANGELOG.md | 2 ++ packages/notices/package.json | 2 +- packages/npm-package-json-lint-config/CHANGELOG.md | 2 ++ packages/npm-package-json-lint-config/package.json | 2 +- packages/nux/CHANGELOG.md | 2 ++ packages/nux/package.json | 2 +- packages/plugins/CHANGELOG.md | 2 ++ packages/plugins/package.json | 2 +- packages/postcss-plugins-preset/CHANGELOG.md | 2 ++ packages/postcss-plugins-preset/package.json | 2 +- packages/postcss-themes/CHANGELOG.md | 2 ++ packages/postcss-themes/package.json | 2 +- packages/preferences-persistence/CHANGELOG.md | 2 ++ packages/preferences-persistence/package.json | 2 +- packages/preferences/CHANGELOG.md | 2 ++ packages/preferences/package.json | 2 +- packages/prettier-config/CHANGELOG.md | 2 ++ packages/prettier-config/package.json | 2 +- packages/primitives/CHANGELOG.md | 2 ++ packages/primitives/package.json | 2 +- packages/priority-queue/CHANGELOG.md | 2 ++ packages/priority-queue/package.json | 2 +- packages/react-i18n/CHANGELOG.md | 2 ++ packages/react-i18n/package.json | 2 +- packages/readable-js-assets-webpack-plugin/CHANGELOG.md | 2 ++ packages/readable-js-assets-webpack-plugin/package.json | 2 +- packages/redux-routine/CHANGELOG.md | 2 ++ packages/redux-routine/package.json | 2 +- packages/reusable-blocks/CHANGELOG.md | 2 ++ packages/reusable-blocks/package.json | 2 +- packages/rich-text/CHANGELOG.md | 2 ++ packages/rich-text/package.json | 2 +- packages/scripts/CHANGELOG.md | 2 ++ packages/scripts/package.json | 2 +- packages/server-side-render/CHANGELOG.md | 2 ++ packages/server-side-render/package.json | 2 +- packages/shortcode/CHANGELOG.md | 2 ++ packages/shortcode/package.json | 2 +- packages/style-engine/CHANGELOG.md | 2 ++ packages/style-engine/package.json | 2 +- packages/stylelint-config/CHANGELOG.md | 2 ++ packages/stylelint-config/package.json | 2 +- packages/token-list/CHANGELOG.md | 2 ++ packages/token-list/package.json | 2 +- packages/url/CHANGELOG.md | 2 ++ packages/url/package.json | 2 +- packages/viewport/CHANGELOG.md | 2 ++ packages/viewport/package.json | 2 +- packages/warning/CHANGELOG.md | 2 ++ packages/warning/package.json | 2 +- packages/widgets/CHANGELOG.md | 2 ++ packages/widgets/package.json | 2 +- packages/wordcount/CHANGELOG.md | 2 ++ packages/wordcount/package.json | 2 +- 156 files changed, 234 insertions(+), 78 deletions(-) diff --git a/packages/a11y/CHANGELOG.md b/packages/a11y/CHANGELOG.md index ebeadb135ab3ec..2f8accb0079f44 100644 --- a/packages/a11y/CHANGELOG.md +++ b/packages/a11y/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/a11y/package.json b/packages/a11y/package.json index fc68a30cfba02f..61aad5ae171bd4 100644 --- a/packages/a11y/package.json +++ b/packages/a11y/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/a11y", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "Accessibility (a11y) utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/annotations/CHANGELOG.md b/packages/annotations/CHANGELOG.md index 9ccf226dff40b9..3400f90fb856bf 100644 --- a/packages/annotations/CHANGELOG.md +++ b/packages/annotations/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.16.0 (2022-08-24) + ## 2.15.0 (2022-08-10) ## 2.14.0 (2022-07-27) diff --git a/packages/annotations/package.json b/packages/annotations/package.json index 6a25529708202f..5041ad107586a5 100644 --- a/packages/annotations/package.json +++ b/packages/annotations/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/annotations", - "version": "2.15.0", + "version": "2.16.0-prerelease", "description": "Annotate content in the Gutenberg editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/api-fetch/CHANGELOG.md b/packages/api-fetch/CHANGELOG.md index 577bfa5ee087d9..7e9afb241fbaeb 100644 --- a/packages/api-fetch/CHANGELOG.md +++ b/packages/api-fetch/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.13.0 (2022-08-24) + ## 6.12.0 (2022-08-10) ## 6.11.0 (2022-07-27) diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json index 5416764167bbee..4f2ab165dc9e9d 100644 --- a/packages/api-fetch/package.json +++ b/packages/api-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/api-fetch", - "version": "6.12.0", + "version": "6.13.0-prerelease", "description": "Utility to make WordPress REST API requests.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/autop/CHANGELOG.md b/packages/autop/CHANGELOG.md index 2e3e69ac18abf3..fda951777833f6 100644 --- a/packages/autop/CHANGELOG.md +++ b/packages/autop/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/autop/package.json b/packages/autop/package.json index 88346a7981ed4e..9cdb00fd28a045 100644 --- a/packages/autop/package.json +++ b/packages/autop/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/autop", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "WordPress's automatic paragraph functions `autop` and `removep`.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md index d41d39526b35e0..6419cefb1328c7 100644 --- a/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md +++ b/packages/babel-plugin-import-jsx-pragma/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/babel-plugin-import-jsx-pragma/package.json b/packages/babel-plugin-import-jsx-pragma/package.json index 0bd46e25834d7e..b4fa82c960ec31 100644 --- a/packages/babel-plugin-import-jsx-pragma/package.json +++ b/packages/babel-plugin-import-jsx-pragma/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-plugin-import-jsx-pragma", - "version": "3.2.0", + "version": "4.0.0-prerelease", "description": "Babel transform plugin for automatically injecting an import to be used as the pragma for the React JSX Transform plugin.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-plugin-makepot/CHANGELOG.md b/packages/babel-plugin-makepot/CHANGELOG.md index 8f17ba84ee6ac6..26ea6ae682756c 100644 --- a/packages/babel-plugin-makepot/CHANGELOG.md +++ b/packages/babel-plugin-makepot/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/babel-plugin-makepot/package.json b/packages/babel-plugin-makepot/package.json index ca1eefd8bef8b7..06a5cd9d255d7e 100644 --- a/packages/babel-plugin-makepot/package.json +++ b/packages/babel-plugin-makepot/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-plugin-makepot", - "version": "4.4.0", + "version": "5.0.0-prerelease", "description": "WordPress Babel internationalization (i18n) plugin.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-preset-default/CHANGELOG.md b/packages/babel-preset-default/CHANGELOG.md index fc333efb0e8e02..cc5d8b64dde958 100644 --- a/packages/babel-preset-default/CHANGELOG.md +++ b/packages/babel-preset-default/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json index c8915147593912..1937c3143f2095 100644 --- a/packages/babel-preset-default/package.json +++ b/packages/babel-preset-default/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-preset-default", - "version": "6.17.0", + "version": "7.0.0-prerelease", "description": "Default Babel preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blob/CHANGELOG.md b/packages/blob/CHANGELOG.md index 281562dd1ab680..cf0c2ce540b06f 100644 --- a/packages/blob/CHANGELOG.md +++ b/packages/blob/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/blob/package.json b/packages/blob/package.json index 419fd2ba9c2e5c..e1e408bd2c4c35 100644 --- a/packages/blob/package.json +++ b/packages/blob/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blob", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "Blob utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-directory/CHANGELOG.md b/packages/block-directory/CHANGELOG.md index da24e0ccfe1ea7..d469c8a77759af 100644 --- a/packages/block-directory/CHANGELOG.md +++ b/packages/block-directory/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.14.0 (2022-08-24) + ## 3.13.0 (2022-08-10) ## 3.12.0 (2022-07-27) diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json index a6ab6e74c200c2..bf635fd6571681 100644 --- a/packages/block-directory/package.json +++ b/packages/block-directory/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-directory", - "version": "3.13.0", + "version": "3.14.0-prerelease", "description": "Extend editor with block directory features to search, download and install blocks.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-editor/CHANGELOG.md b/packages/block-editor/CHANGELOG.md index 4005c3e45e7a22..4e261a8a5fba97 100644 --- a/packages/block-editor/CHANGELOG.md +++ b/packages/block-editor/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 9.8.0 (2022-08-24) + ## 9.7.0 (2022-08-10) ## 9.6.0 (2022-07-27) diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index b213162b1453c0..7a60bc3462ce3a 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-editor", - "version": "9.7.0", + "version": "9.8.0-prerelease", "description": "Generic block editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-library/CHANGELOG.md b/packages/block-library/CHANGELOG.md index fe41dc065008a8..13d42304fbc8ea 100644 --- a/packages/block-library/CHANGELOG.md +++ b/packages/block-library/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.13.0 (2022-08-24) + ### Bug Fix - Ensure all dependencies allow version ranges ([#43355](https://github.com/WordPress/gutenberg/pull/43355)). diff --git a/packages/block-library/package.json b/packages/block-library/package.json index 1a22fe7cf0823a..1c96d15578e989 100644 --- a/packages/block-library/package.json +++ b/packages/block-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-library", - "version": "7.12.0", + "version": "7.13.0-prerelease", "description": "Block library for the WordPress editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-serialization-default-parser/CHANGELOG.md b/packages/block-serialization-default-parser/CHANGELOG.md index d46f5406092600..3274baa0faf583 100644 --- a/packages/block-serialization-default-parser/CHANGELOG.md +++ b/packages/block-serialization-default-parser/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.16.0 (2022-08-24) + ## 4.15.0 (2022-08-10) ## 4.14.0 (2022-07-27) diff --git a/packages/block-serialization-default-parser/package.json b/packages/block-serialization-default-parser/package.json index 8bf203ae691a80..89a1c3f401e06c 100644 --- a/packages/block-serialization-default-parser/package.json +++ b/packages/block-serialization-default-parser/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-serialization-default-parser", - "version": "4.15.0", + "version": "4.16.0-prerelease", "description": "Block serialization specification parser for WordPress posts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-serialization-spec-parser/CHANGELOG.md b/packages/block-serialization-spec-parser/CHANGELOG.md index dc062ea17be7b2..818bb758ec15a8 100644 --- a/packages/block-serialization-spec-parser/CHANGELOG.md +++ b/packages/block-serialization-spec-parser/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.16.0 (2022-08-24) + ## 4.15.0 (2022-08-10) ## 4.14.0 (2022-07-27) diff --git a/packages/block-serialization-spec-parser/package.json b/packages/block-serialization-spec-parser/package.json index d7b69dd016cfb8..e52e5c6b4c0a07 100644 --- a/packages/block-serialization-spec-parser/package.json +++ b/packages/block-serialization-spec-parser/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-serialization-spec-parser", - "version": "4.15.0", + "version": "4.16.0-prerelease", "description": "Block serialization specification parser for WordPress posts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blocks/CHANGELOG.md b/packages/blocks/CHANGELOG.md index 3f2426ceb3ed85..d3f7a73cc99ecd 100644 --- a/packages/blocks/CHANGELOG.md +++ b/packages/blocks/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 11.15.0 (2022-08-24) + ### Bug Fix - Packages: Replace `is-plain-obj` with `is-plain-object` ([#43511](https://github.com/WordPress/gutenberg/pull/43511)). diff --git a/packages/blocks/package.json b/packages/blocks/package.json index d937dbe060b71e..150d9c88a6cd58 100644 --- a/packages/blocks/package.json +++ b/packages/blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blocks", - "version": "11.14.0", + "version": "11.15.0-prerelease", "description": "Block API for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/browserslist-config/CHANGELOG.md b/packages/browserslist-config/CHANGELOG.md index 59205696c750cc..dc08f8c72fab63 100644 --- a/packages/browserslist-config/CHANGELOG.md +++ b/packages/browserslist-config/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/browserslist-config/package.json b/packages/browserslist-config/package.json index e7e94ff3d20fb2..e4eae425af1ae5 100644 --- a/packages/browserslist-config/package.json +++ b/packages/browserslist-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/browserslist-config", - "version": "4.1.2", + "version": "5.0.0-prerelease", "description": "WordPress Browserslist shared configuration.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 5bfb10af6c3148..1fbfc07ff817e1 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 20.0.0 (2022-08-24) + ### Breaking Changes - `CustomSelectControl`: Deprecate constrained width style. Add a `__nextUnconstrainedWidth` prop to start opting into the unconstrained width that will become the default in a future version, currently scheduled to be WordPress 6.4 ([#43230](https://github.com/WordPress/gutenberg/pull/43230)). diff --git a/packages/components/package.json b/packages/components/package.json index e9e2c395dbf975..82b6d976f60491 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/components", - "version": "19.17.0", + "version": "20.0.0-prerelease", "description": "UI components for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/compose/CHANGELOG.md b/packages/compose/CHANGELOG.md index 9b293e039478f4..96530b5162c846 100644 --- a/packages/compose/CHANGELOG.md +++ b/packages/compose/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.14.0 (2022-08-24) + ## 5.13.0 (2022-08-10) ## 5.12.0 (2022-07-27) diff --git a/packages/compose/package.json b/packages/compose/package.json index 302db50a587a70..7252e957998f23 100644 --- a/packages/compose/package.json +++ b/packages/compose/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/compose", - "version": "5.13.0", + "version": "5.14.0-prerelease", "description": "WordPress higher-order components (HOCs).", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/core-data/CHANGELOG.md b/packages/core-data/CHANGELOG.md index 2db58200cb35cb..22fc210a046c53 100644 --- a/packages/core-data/CHANGELOG.md +++ b/packages/core-data/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.14.0 (2022-08-24) + ### New Features - Stabilized the `useResourcePermissions` hook ([#43268](https://github.com/WordPress/gutenberg/pull/43268)) diff --git a/packages/core-data/package.json b/packages/core-data/package.json index 43ff485a54415d..13c7e2ec090679 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/core-data", - "version": "4.13.0", + "version": "4.14.0-prerelease", "description": "Access to and manipulation of core WordPress entities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/create-block-tutorial-template/CHANGELOG.md b/packages/create-block-tutorial-template/CHANGELOG.md index 43c02cc221ca07..e99298248b3960 100644 --- a/packages/create-block-tutorial-template/CHANGELOG.md +++ b/packages/create-block-tutorial-template/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.5.0 (2022-08-24) + ### Enhancement - Add support to the `dynamic` variant ([#41289](https://github.com/WordPress/gutenberg/pull/41289), [#43481](https://github.com/WordPress/gutenberg/pull/43481)). diff --git a/packages/create-block-tutorial-template/package.json b/packages/create-block-tutorial-template/package.json index daacfd5d448ec9..0ea7149351a92c 100644 --- a/packages/create-block-tutorial-template/package.json +++ b/packages/create-block-tutorial-template/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/create-block-tutorial-template", - "version": "2.4.0", + "version": "2.5.0-prerelease", "description": "Template for @wordpress/create-block used in the official WordPress tutorial.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/create-block/CHANGELOG.md b/packages/create-block/CHANGELOG.md index ff359861b107d5..ee56c67353b48e 100644 --- a/packages/create-block/CHANGELOG.md +++ b/packages/create-block/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 and minimum npm version to 6.14.4 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/create-block/package.json b/packages/create-block/package.json index fcc5f6083d9ee2..0707acf91ac9cf 100644 --- a/packages/create-block/package.json +++ b/packages/create-block/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/create-block", - "version": "3.8.0", + "version": "4.0.0-prerelease", "description": "Generates PHP, JS and CSS code for registering a block for a WordPress plugin.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/customize-widgets/CHANGELOG.md b/packages/customize-widgets/CHANGELOG.md index 704828483d04df..dd5d888701ed10 100644 --- a/packages/customize-widgets/CHANGELOG.md +++ b/packages/customize-widgets/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.13.0 (2022-08-24) + ## 3.12.0 (2022-08-10) ## 3.11.0 (2022-07-27) diff --git a/packages/customize-widgets/package.json b/packages/customize-widgets/package.json index 7055b82805f688..151406a21b0d44 100644 --- a/packages/customize-widgets/package.json +++ b/packages/customize-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/customize-widgets", - "version": "3.12.0", + "version": "3.13.0-prerelease", "description": "Widgets blocks in Customizer Module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/data-controls/CHANGELOG.md b/packages/data-controls/CHANGELOG.md index 8d4fb48663ef13..7b0f3fccc62d7a 100644 --- a/packages/data-controls/CHANGELOG.md +++ b/packages/data-controls/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.16.0 (2022-08-24) + ## 2.15.0 (2022-08-10) ## 2.14.0 (2022-07-27) diff --git a/packages/data-controls/package.json b/packages/data-controls/package.json index 46e2486842537c..f10edcce51f190 100644 --- a/packages/data-controls/package.json +++ b/packages/data-controls/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data-controls", - "version": "2.15.0", + "version": "2.16.0-prerelease", "description": "A set of common controls for the @wordpress/data api.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/data/CHANGELOG.md b/packages/data/CHANGELOG.md index 1d16765dececcb..4c5c51043e3e6e 100644 --- a/packages/data/CHANGELOG.md +++ b/packages/data/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.0.0 (2022-08-24) + ### Breaking Changes – Add TypeScript types to the built package (via "types": "build-types" in the package.json) diff --git a/packages/data/package.json b/packages/data/package.json index 4623910ecffa8b..7944b69d282dcd 100644 --- a/packages/data/package.json +++ b/packages/data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data", - "version": "6.15.0", + "version": "7.0.0-prerelease", "description": "Data module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/date/CHANGELOG.md b/packages/date/CHANGELOG.md index 06d9cff0e09fbe..4b29aae66ca3b8 100644 --- a/packages/date/CHANGELOG.md +++ b/packages/date/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.16.0 (2022-08-24) + ## 4.15.0 (2022-08-10) ## 4.14.0 (2022-07-27) diff --git a/packages/date/package.json b/packages/date/package.json index d8e40fc0bcaaa4..bdf31579308437 100644 --- a/packages/date/package.json +++ b/packages/date/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/date", - "version": "4.15.0", + "version": "4.16.0-prerelease", "description": "Date module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dependency-extraction-webpack-plugin/CHANGELOG.md b/packages/dependency-extraction-webpack-plugin/CHANGELOG.md index 14e40aa53ff26b..e1624aceb5adee 100644 --- a/packages/dependency-extraction-webpack-plugin/CHANGELOG.md +++ b/packages/dependency-extraction-webpack-plugin/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/dependency-extraction-webpack-plugin/package.json b/packages/dependency-extraction-webpack-plugin/package.json index 9277299aaa760b..3471d7d8e06249 100644 --- a/packages/dependency-extraction-webpack-plugin/package.json +++ b/packages/dependency-extraction-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dependency-extraction-webpack-plugin", - "version": "3.7.0", + "version": "4.0.0-prerelease", "description": "Extract WordPress script dependencies from webpack bundles.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/deprecated/CHANGELOG.md b/packages/deprecated/CHANGELOG.md index 69053f3b07fd81..370cf81b39e0cc 100644 --- a/packages/deprecated/CHANGELOG.md +++ b/packages/deprecated/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/deprecated/package.json b/packages/deprecated/package.json index b4402bcc4e8d82..7b8cb2041021ac 100644 --- a/packages/deprecated/package.json +++ b/packages/deprecated/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/deprecated", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "Deprecation utility for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dom-ready/CHANGELOG.md b/packages/dom-ready/CHANGELOG.md index 2011edceef17cd..b8efa5f4d4b82b 100644 --- a/packages/dom-ready/CHANGELOG.md +++ b/packages/dom-ready/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/dom-ready/package.json b/packages/dom-ready/package.json index 8f3b028f0ff27f..d12f6a1a8fe3e4 100644 --- a/packages/dom-ready/package.json +++ b/packages/dom-ready/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dom-ready", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "Execute callback after the DOM is loaded.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dom/CHANGELOG.md b/packages/dom/CHANGELOG.md index 6a59bf33f7f7a1..4244419ccf3bbf 100644 --- a/packages/dom/CHANGELOG.md +++ b/packages/dom/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/dom/package.json b/packages/dom/package.json index 4616a12808000e..6103cd5be05531 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dom", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "DOM utilities module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/e2e-test-utils/CHANGELOG.md b/packages/e2e-test-utils/CHANGELOG.md index f1be23804765db..aa4cb2afa429cd 100644 --- a/packages/e2e-test-utils/CHANGELOG.md +++ b/packages/e2e-test-utils/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 8.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/e2e-test-utils/package.json b/packages/e2e-test-utils/package.json index f24702d6c6695c..7d53a0e8c23c9a 100644 --- a/packages/e2e-test-utils/package.json +++ b/packages/e2e-test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-test-utils", - "version": "7.11.0", + "version": "8.0.0-prerelease", "description": "End-To-End (E2E) test utils for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/e2e-tests/CHANGELOG.md b/packages/e2e-tests/CHANGELOG.md index 3d2cba05f6db6d..fd9b5eb41775d3 100644 --- a/packages/e2e-tests/CHANGELOG.md +++ b/packages/e2e-tests/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index 1adbd194cca368..1178348d95f344 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-tests", - "version": "4.9.2", + "version": "5.0.0-prerelease", "description": "End-To-End (E2E) tests for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-post/CHANGELOG.md b/packages/edit-post/CHANGELOG.md index aae0955e4d97f4..26ca30b5a833e6 100644 --- a/packages/edit-post/CHANGELOG.md +++ b/packages/edit-post/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.13.0 (2022-08-24) + ## 6.12.0 (2022-08-10) ## 6.11.0 (2022-07-27) diff --git a/packages/edit-post/package.json b/packages/edit-post/package.json index cd6dc6c1092ca5..c1472c7b309448 100644 --- a/packages/edit-post/package.json +++ b/packages/edit-post/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-post", - "version": "6.12.0", + "version": "6.13.0-prerelease", "description": "Edit Post module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-site/CHANGELOG.md b/packages/edit-site/CHANGELOG.md index 1d1d07818d88da..e388f985917bb1 100644 --- a/packages/edit-site/CHANGELOG.md +++ b/packages/edit-site/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.13.0 (2022-08-24) + ## 4.12.0 (2022-08-10) ## 4.11.0 (2022-07-27) diff --git a/packages/edit-site/package.json b/packages/edit-site/package.json index 4d79fd8bb75cc7..2122b42a379870 100644 --- a/packages/edit-site/package.json +++ b/packages/edit-site/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-site", - "version": "4.12.0", + "version": "4.13.0-prerelease", "description": "Edit Site Page module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-widgets/CHANGELOG.md b/packages/edit-widgets/CHANGELOG.md index 2e3e6a42c18e66..922875209c20c2 100644 --- a/packages/edit-widgets/CHANGELOG.md +++ b/packages/edit-widgets/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.13.0 (2022-08-24) + ## 4.12.0 (2022-08-10) ## 4.11.0 (2022-07-27) diff --git a/packages/edit-widgets/package.json b/packages/edit-widgets/package.json index 3ccdeb54781001..2151b44d0e0c26 100644 --- a/packages/edit-widgets/package.json +++ b/packages/edit-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-widgets", - "version": "4.12.0", + "version": "4.13.0-prerelease", "description": "Widgets Page module for WordPress..", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/editor/CHANGELOG.md b/packages/editor/CHANGELOG.md index f1d777ffdf0723..6482bde1bcc9c4 100644 --- a/packages/editor/CHANGELOG.md +++ b/packages/editor/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 12.15.0 (2022-08-24) + ## 12.14.0 (2022-08-10) ## 12.13.0 (2022-07-27) diff --git a/packages/editor/package.json b/packages/editor/package.json index 03f8cfabda8552..ca80ddc7197eac 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/editor", - "version": "12.14.0", + "version": "12.15.0-prerelease", "description": "Enhanced block editor for WordPress posts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/element/CHANGELOG.md b/packages/element/CHANGELOG.md index 02adb98c8c0c1b..0ce6ed7b92b84a 100644 --- a/packages/element/CHANGELOG.md +++ b/packages/element/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.14.0 (2022-08-24) + ### Bug Fix - Packages: Replace `is-plain-obj` with `is-plain-object` ([#43511](https://github.com/WordPress/gutenberg/pull/43511)). diff --git a/packages/element/package.json b/packages/element/package.json index 01b0c9eb36bcfa..24ad8966e69ae9 100644 --- a/packages/element/package.json +++ b/packages/element/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/element", - "version": "4.13.0", + "version": "4.14.0-prerelease", "description": "Element React module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/escape-html/CHANGELOG.md b/packages/escape-html/CHANGELOG.md index 63beda15e68f83..0d72a47282b8c8 100644 --- a/packages/escape-html/CHANGELOG.md +++ b/packages/escape-html/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.16.0 (2022-08-24) + ## 2.15.0 (2022-08-10) ## 2.14.0 (2022-07-27) diff --git a/packages/escape-html/package.json b/packages/escape-html/package.json index 30b99a7bf6bfa7..1a6013b32c8bf1 100644 --- a/packages/escape-html/package.json +++ b/packages/escape-html/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/escape-html", - "version": "2.15.0", + "version": "2.16.0-prerelease", "description": "Escape HTML utils.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 6a027c06974915..87770436979aef 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 13.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 and minimum npm version to 6.14.4 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index e9f997d916f9d0..6a9e6211317b12 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/eslint-plugin", - "version": "12.9.0", + "version": "13.0.0-prerelease", "description": "ESLint plugin for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/format-library/CHANGELOG.md b/packages/format-library/CHANGELOG.md index c5ddd55f159d86..806253aebe0bc8 100644 --- a/packages/format-library/CHANGELOG.md +++ b/packages/format-library/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.14.0 (2022-08-24) + ## 3.13.0 (2022-08-10) ## 3.12.0 (2022-07-27) diff --git a/packages/format-library/package.json b/packages/format-library/package.json index 15d3a377a2063b..2c296a27399210 100644 --- a/packages/format-library/package.json +++ b/packages/format-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/format-library", - "version": "3.13.0", + "version": "3.14.0-prerelease", "description": "Format library for the WordPress editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/hooks/CHANGELOG.md b/packages/hooks/CHANGELOG.md index cb47614d89e20d..423c4230cdb92e 100644 --- a/packages/hooks/CHANGELOG.md +++ b/packages/hooks/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/hooks/package.json b/packages/hooks/package.json index 4cf540711e58a8..c5e379a94a93e0 100644 --- a/packages/hooks/package.json +++ b/packages/hooks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/hooks", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "WordPress hooks library.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/html-entities/CHANGELOG.md b/packages/html-entities/CHANGELOG.md index 33acf1824c87a2..0bc257cf418e1c 100644 --- a/packages/html-entities/CHANGELOG.md +++ b/packages/html-entities/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/html-entities/package.json b/packages/html-entities/package.json index bead8dd81de232..8be06e06f026ce 100644 --- a/packages/html-entities/package.json +++ b/packages/html-entities/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/html-entities", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "HTML entity utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/i18n/CHANGELOG.md b/packages/i18n/CHANGELOG.md index b4b09492ef509e..b1a86c6a5fac92 100644 --- a/packages/i18n/CHANGELOG.md +++ b/packages/i18n/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.16.0 (2022-08-24) + ## 4.15.0 (2022-08-10) ## 4.14.0 (2022-07-27) diff --git a/packages/i18n/package.json b/packages/i18n/package.json index f0821a95f1bd70..e15bb806ffa575 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/i18n", - "version": "4.15.0", + "version": "4.16.0-prerelease", "description": "WordPress internationalization (i18n) library.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/icons/CHANGELOG.md b/packages/icons/CHANGELOG.md index 13ac5b24d8093f..fe9b48a1e8facc 100644 --- a/packages/icons/CHANGELOG.md +++ b/packages/icons/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 9.7.0 (2022-08-24) + ## 9.6.0 (2022-08-10) ## 9.5.0 (2022-07-27) diff --git a/packages/icons/package.json b/packages/icons/package.json index 554398ab518f9b..2f90136d1b4e36 100644 --- a/packages/icons/package.json +++ b/packages/icons/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/icons", - "version": "9.6.0", + "version": "9.7.0-prerelease", "description": "WordPress Icons package, based on dashicon.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/interface/CHANGELOG.md b/packages/interface/CHANGELOG.md index cc63cbb5649744..f367a15d9c0f03 100644 --- a/packages/interface/CHANGELOG.md +++ b/packages/interface/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.15.0 (2022-08-24) + ## 4.14.0 (2022-08-10) ## 4.13.0 (2022-07-27) diff --git a/packages/interface/package.json b/packages/interface/package.json index ffef3739650692..23c74cdabe6f6a 100644 --- a/packages/interface/package.json +++ b/packages/interface/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/interface", - "version": "4.14.0", + "version": "4.15.0-prerelease", "description": "Interface module for WordPress. The package contains shared functionality across the modern JavaScript-based WordPress screens.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/is-shallow-equal/CHANGELOG.md b/packages/is-shallow-equal/CHANGELOG.md index d668f516bc9c1b..bd6abfbc2f9c78 100644 --- a/packages/is-shallow-equal/CHANGELOG.md +++ b/packages/is-shallow-equal/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.16.0 (2022-08-24) + ## 4.15.0 (2022-08-10) ## 4.14.0 (2022-07-27) diff --git a/packages/is-shallow-equal/package.json b/packages/is-shallow-equal/package.json index 6a608ccb37a78d..242691e21ac65e 100644 --- a/packages/is-shallow-equal/package.json +++ b/packages/is-shallow-equal/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/is-shallow-equal", - "version": "4.15.0", + "version": "4.16.0-prerelease", "description": "Test for shallow equality between two objects or arrays.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/jest-console/CHANGELOG.md b/packages/jest-console/CHANGELOG.md index 1027c16d02cf53..d22cc9ab14276c 100644 --- a/packages/jest-console/CHANGELOG.md +++ b/packages/jest-console/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/jest-console/package.json b/packages/jest-console/package.json index 3caa6cb49a8441..39dfdebd1d6657 100644 --- a/packages/jest-console/package.json +++ b/packages/jest-console/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/jest-console", - "version": "5.4.0", + "version": "6.0.0-prerelease", "description": "Custom Jest matchers for the Console object.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/jest-preset-default/CHANGELOG.md b/packages/jest-preset-default/CHANGELOG.md index 1c1cff29f24d27..a0217557e8a08e 100644 --- a/packages/jest-preset-default/CHANGELOG.md +++ b/packages/jest-preset-default/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 9.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/jest-preset-default/package.json b/packages/jest-preset-default/package.json index 8753c1d2b717c0..7354426a99d857 100644 --- a/packages/jest-preset-default/package.json +++ b/packages/jest-preset-default/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/jest-preset-default", - "version": "8.5.2", + "version": "9.0.0-prerelease", "description": "Default Jest preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/jest-puppeteer-axe/CHANGELOG.md b/packages/jest-puppeteer-axe/CHANGELOG.md index b91c907699510b..3d8b814273e333 100644 --- a/packages/jest-puppeteer-axe/CHANGELOG.md +++ b/packages/jest-puppeteer-axe/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/jest-puppeteer-axe/package.json b/packages/jest-puppeteer-axe/package.json index be42c146cdda7b..67a6e4ac79ef85 100644 --- a/packages/jest-puppeteer-axe/package.json +++ b/packages/jest-puppeteer-axe/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/jest-puppeteer-axe", - "version": "4.1.0", + "version": "5.0.0-prerelease", "description": "Axe API integration with Jest and Puppeteer.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/keyboard-shortcuts/CHANGELOG.md b/packages/keyboard-shortcuts/CHANGELOG.md index 8b2a9b6664640b..fa5fc93bccda5c 100644 --- a/packages/keyboard-shortcuts/CHANGELOG.md +++ b/packages/keyboard-shortcuts/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.14.0 (2022-08-24) + ## 3.13.0 (2022-08-10) ## 3.12.0 (2022-07-27) diff --git a/packages/keyboard-shortcuts/package.json b/packages/keyboard-shortcuts/package.json index e41ba0033d3f64..5d8ae75ab9d18b 100644 --- a/packages/keyboard-shortcuts/package.json +++ b/packages/keyboard-shortcuts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/keyboard-shortcuts", - "version": "3.13.0", + "version": "3.14.0-prerelease", "description": "Handling keyboard shortcuts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/keycodes/CHANGELOG.md b/packages/keycodes/CHANGELOG.md index a35990345a44d7..4aaffca790e048 100644 --- a/packages/keycodes/CHANGELOG.md +++ b/packages/keycodes/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/keycodes/package.json b/packages/keycodes/package.json index f3a6eef94e45e8..e008125bf80eb7 100644 --- a/packages/keycodes/package.json +++ b/packages/keycodes/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/keycodes", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "Keycodes utilities for WordPress. Used to check for keyboard events across browsers/operating systems.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/list-reusable-blocks/CHANGELOG.md b/packages/list-reusable-blocks/CHANGELOG.md index be015563dde90c..71978275b56abd 100644 --- a/packages/list-reusable-blocks/CHANGELOG.md +++ b/packages/list-reusable-blocks/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.14.0 (2022-08-24) + ## 3.13.0 (2022-08-10) ## 3.12.0 (2022-07-27) diff --git a/packages/list-reusable-blocks/package.json b/packages/list-reusable-blocks/package.json index 8c92115e1ef22b..2d6ec8a3ea3569 100644 --- a/packages/list-reusable-blocks/package.json +++ b/packages/list-reusable-blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/list-reusable-blocks", - "version": "3.13.0", + "version": "3.14.0-prerelease", "description": "Adding Export/Import support to the reusable blocks listing.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/media-utils/CHANGELOG.md b/packages/media-utils/CHANGELOG.md index 61d24f80f2654a..85e45ffba47bcf 100644 --- a/packages/media-utils/CHANGELOG.md +++ b/packages/media-utils/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.7.0 (2022-08-24) + ## 4.6.0 (2022-08-10) ## 4.5.0 (2022-07-27) diff --git a/packages/media-utils/package.json b/packages/media-utils/package.json index 8344a3f5590094..49549d7242a057 100644 --- a/packages/media-utils/package.json +++ b/packages/media-utils/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/media-utils", - "version": "4.6.0", + "version": "4.7.0-prerelease", "description": "WordPress Media Upload Utils.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/notices/CHANGELOG.md b/packages/notices/CHANGELOG.md index d6514d58d61cbc..bf9fac13ac0d70 100644 --- a/packages/notices/CHANGELOG.md +++ b/packages/notices/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/notices/package.json b/packages/notices/package.json index d88132f7775020..7ed278cdc2adf0 100644 --- a/packages/notices/package.json +++ b/packages/notices/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/notices", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "State management for notices.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/npm-package-json-lint-config/CHANGELOG.md b/packages/npm-package-json-lint-config/CHANGELOG.md index 19b53ea547fa65..313d66cb7c1fa5 100644 --- a/packages/npm-package-json-lint-config/CHANGELOG.md +++ b/packages/npm-package-json-lint-config/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.2.0 (2022-08-24) + ### Bug Fix - Packages: Replace `is-plain-obj` with native functionality ([#43511](https://github.com/WordPress/gutenberg/pull/43511)). diff --git a/packages/npm-package-json-lint-config/package.json b/packages/npm-package-json-lint-config/package.json index bc42b2c1126fdd..d3d05e338c07c1 100644 --- a/packages/npm-package-json-lint-config/package.json +++ b/packages/npm-package-json-lint-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/npm-package-json-lint-config", - "version": "4.1.2", + "version": "4.2.0-prerelease", "description": "WordPress npm-package-json-lint shareable configuration.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/nux/CHANGELOG.md b/packages/nux/CHANGELOG.md index 2d45a63fd493bc..50590d1f670485 100644 --- a/packages/nux/CHANGELOG.md +++ b/packages/nux/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.14.0 (2022-08-24) + ## 5.13.0 (2022-08-10) ## 5.12.0 (2022-07-27) diff --git a/packages/nux/package.json b/packages/nux/package.json index 3fae5e5de78cab..696ed9b1e0bbcb 100644 --- a/packages/nux/package.json +++ b/packages/nux/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/nux", - "version": "5.13.0", + "version": "5.14.0-prerelease", "description": "NUX (New User eXperience) module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/plugins/CHANGELOG.md b/packages/plugins/CHANGELOG.md index 75531526b517a7..6b4d91a7204c4c 100644 --- a/packages/plugins/CHANGELOG.md +++ b/packages/plugins/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.14.0 (2022-08-24) + ## 4.13.0 (2022-08-10) ## 4.12.0 (2022-07-27) diff --git a/packages/plugins/package.json b/packages/plugins/package.json index 853b3a3845c024..e8ab0e95b49c26 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/plugins", - "version": "4.13.0", + "version": "4.14.0-prerelease", "description": "Plugins module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/postcss-plugins-preset/CHANGELOG.md b/packages/postcss-plugins-preset/CHANGELOG.md index 6a3cd74fb8c302..42d0aca6352b5f 100644 --- a/packages/postcss-plugins-preset/CHANGELOG.md +++ b/packages/postcss-plugins-preset/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/postcss-plugins-preset/package.json b/packages/postcss-plugins-preset/package.json index 0adf3be7a78a04..cede4e47cdf4af 100644 --- a/packages/postcss-plugins-preset/package.json +++ b/packages/postcss-plugins-preset/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/postcss-plugins-preset", - "version": "3.10.0", + "version": "4.0.0-prerelease", "description": "PostCSS sharable plugins preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/postcss-themes/CHANGELOG.md b/packages/postcss-themes/CHANGELOG.md index 8d6b6c67b70e6f..4c89b1fdc001db 100644 --- a/packages/postcss-themes/CHANGELOG.md +++ b/packages/postcss-themes/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/postcss-themes/package.json b/packages/postcss-themes/package.json index da880370885b2a..210195eb6c1fb0 100644 --- a/packages/postcss-themes/package.json +++ b/packages/postcss-themes/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/postcss-themes", - "version": "4.2.2", + "version": "5.0.0-prerelease", "description": "PostCSS plugin to generate theme colors.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/preferences-persistence/CHANGELOG.md b/packages/preferences-persistence/CHANGELOG.md index a17f5a8292c7c7..207f80ff336bfd 100644 --- a/packages/preferences-persistence/CHANGELOG.md +++ b/packages/preferences-persistence/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 1.8.0 (2022-08-24) + ## 1.7.0 (2022-08-10) ## 1.6.0 (2022-07-27) diff --git a/packages/preferences-persistence/package.json b/packages/preferences-persistence/package.json index ee6dddd51ea9e8..62234efeea2f08 100644 --- a/packages/preferences-persistence/package.json +++ b/packages/preferences-persistence/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/preferences-persistence", - "version": "1.7.0", + "version": "1.8.0-prerelease", "description": "Persistence utilities for `wordpress/preferences`.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/preferences/CHANGELOG.md b/packages/preferences/CHANGELOG.md index 908377f1172a2b..f6cc4b9929bf72 100644 --- a/packages/preferences/CHANGELOG.md +++ b/packages/preferences/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.8.0 (2022-08-24) + ## 2.7.0 (2022-08-10) ## 2.6.0 (2022-07-27) diff --git a/packages/preferences/package.json b/packages/preferences/package.json index a02557ab6dfcd9..6c1da4d0b05c91 100644 --- a/packages/preferences/package.json +++ b/packages/preferences/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/preferences", - "version": "2.7.0", + "version": "2.8.0-prerelease", "description": "Utilities for managing WordPress preferences.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/prettier-config/CHANGELOG.md b/packages/prettier-config/CHANGELOG.md index af8b4390749370..9a9ef32b40ec27 100644 --- a/packages/prettier-config/CHANGELOG.md +++ b/packages/prettier-config/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/prettier-config/package.json b/packages/prettier-config/package.json index 5ba2ede04f04f4..14b41384e31af2 100644 --- a/packages/prettier-config/package.json +++ b/packages/prettier-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/prettier-config", - "version": "1.4.0", + "version": "2.0.0-prerelease", "description": "WordPress Prettier shared configuration.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/primitives/CHANGELOG.md b/packages/primitives/CHANGELOG.md index 1977947fda2b30..65df4eabad88c9 100644 --- a/packages/primitives/CHANGELOG.md +++ b/packages/primitives/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.14.0 (2022-08-24) + ## 3.13.0 (2022-08-10) ## 3.12.0 (2022-07-27) diff --git a/packages/primitives/package.json b/packages/primitives/package.json index d6e751ab6bdc13..867ff980be78be 100644 --- a/packages/primitives/package.json +++ b/packages/primitives/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/primitives", - "version": "3.13.0", + "version": "3.14.0-prerelease", "description": "WordPress cross-platform primitives.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/priority-queue/CHANGELOG.md b/packages/priority-queue/CHANGELOG.md index a3860cffcc31f1..05902e27944e6d 100644 --- a/packages/priority-queue/CHANGELOG.md +++ b/packages/priority-queue/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.16.0 (2022-08-24) + ## 2.15.0 (2022-08-10) ## 2.14.0 (2022-07-27) diff --git a/packages/priority-queue/package.json b/packages/priority-queue/package.json index 18ec34ef5ce50b..8ea490177b4b52 100644 --- a/packages/priority-queue/package.json +++ b/packages/priority-queue/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/priority-queue", - "version": "2.15.0", + "version": "2.16.0-prerelease", "description": "Generic browser priority queue.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/react-i18n/CHANGELOG.md b/packages/react-i18n/CHANGELOG.md index 54d7bd73409d68..91fac5ff80b8bb 100644 --- a/packages/react-i18n/CHANGELOG.md +++ b/packages/react-i18n/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.14.0 (2022-08-24) + ## 3.13.0 (2022-08-10) ## 3.12.0 (2022-07-27) diff --git a/packages/react-i18n/package.json b/packages/react-i18n/package.json index 9fa5dedd15afe3..0ad41fcb412eac 100644 --- a/packages/react-i18n/package.json +++ b/packages/react-i18n/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/react-i18n", - "version": "3.13.0", + "version": "3.14.0-prerelease", "description": "React bindings for @wordpress/i18n.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/readable-js-assets-webpack-plugin/CHANGELOG.md b/packages/readable-js-assets-webpack-plugin/CHANGELOG.md index f2c86a534cfc63..144fee2a9c9c2b 100644 --- a/packages/readable-js-assets-webpack-plugin/CHANGELOG.md +++ b/packages/readable-js-assets-webpack-plugin/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/readable-js-assets-webpack-plugin/package.json b/packages/readable-js-assets-webpack-plugin/package.json index da58d7292a721c..cbd484f1df42e5 100644 --- a/packages/readable-js-assets-webpack-plugin/package.json +++ b/packages/readable-js-assets-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/readable-js-assets-webpack-plugin", - "version": "1.0.4", + "version": "2.0.0-prerelease", "description": "Generate a readable JS file for each JS asset.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/redux-routine/CHANGELOG.md b/packages/redux-routine/CHANGELOG.md index 834542af1693b2..5250851c4742a7 100644 --- a/packages/redux-routine/CHANGELOG.md +++ b/packages/redux-routine/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.16.0 (2022-08-24) + ### Bug Fix - Packages: Replace `is-plain-obj` with `is-plain-object` ([#43511](https://github.com/WordPress/gutenberg/pull/43511)). diff --git a/packages/redux-routine/package.json b/packages/redux-routine/package.json index 5ae8b4acef39a0..9d720745a55c58 100644 --- a/packages/redux-routine/package.json +++ b/packages/redux-routine/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/redux-routine", - "version": "4.15.0", + "version": "4.16.0-prerelease", "description": "Redux middleware for generator coroutines.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/reusable-blocks/CHANGELOG.md b/packages/reusable-blocks/CHANGELOG.md index 5f8c7c954c6ad3..682f55615a5fed 100644 --- a/packages/reusable-blocks/CHANGELOG.md +++ b/packages/reusable-blocks/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.14.0 (2022-08-24) + ## 3.13.0 (2022-08-10) ## 3.12.0 (2022-07-27) diff --git a/packages/reusable-blocks/package.json b/packages/reusable-blocks/package.json index 8ad0d3b549adda..4b6cd355edc062 100644 --- a/packages/reusable-blocks/package.json +++ b/packages/reusable-blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/reusable-blocks", - "version": "3.13.0", + "version": "3.14.0-prerelease", "description": "Reusable blocks utilities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/rich-text/CHANGELOG.md b/packages/rich-text/CHANGELOG.md index bf1c27ad84fb3f..697b3a2b477e44 100644 --- a/packages/rich-text/CHANGELOG.md +++ b/packages/rich-text/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.14.0 (2022-08-24) + ## 5.13.0 (2022-08-10) ## 5.12.0 (2022-07-27) diff --git a/packages/rich-text/package.json b/packages/rich-text/package.json index 73056e88c9ade0..9bbee3fc023bd6 100644 --- a/packages/rich-text/package.json +++ b/packages/rich-text/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/rich-text", - "version": "5.13.0", + "version": "5.14.0-prerelease", "description": "Rich text value and manipulation API.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/scripts/CHANGELOG.md b/packages/scripts/CHANGELOG.md index a94edc1ce08833..f3ffc0818d2d09 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 24.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 and minimum npm version to 6.14.4 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 98fdea9c7f9233..e9b9e2a4deb653 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/scripts", - "version": "23.7.2", + "version": "24.0.0-prerelease", "description": "Collection of reusable scripts for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/server-side-render/CHANGELOG.md b/packages/server-side-render/CHANGELOG.md index daf05103623e79..3ccbf93bf00e0f 100644 --- a/packages/server-side-render/CHANGELOG.md +++ b/packages/server-side-render/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.14.0 (2022-08-24) + ## 3.13.0 (2022-08-10) ## 3.12.0 (2022-07-27) diff --git a/packages/server-side-render/package.json b/packages/server-side-render/package.json index 80242c747b2c1b..701bdd551fc6b9 100644 --- a/packages/server-side-render/package.json +++ b/packages/server-side-render/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/server-side-render", - "version": "3.13.0", + "version": "3.14.0-prerelease", "description": "The component used with WordPress to server-side render a preview of dynamic blocks to display in the editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/shortcode/CHANGELOG.md b/packages/shortcode/CHANGELOG.md index de646a685516b9..16138b4a69d407 100644 --- a/packages/shortcode/CHANGELOG.md +++ b/packages/shortcode/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/shortcode/package.json b/packages/shortcode/package.json index 5fb9b9015b3af2..03695f2a6098a9 100644 --- a/packages/shortcode/package.json +++ b/packages/shortcode/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/shortcode", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "Shortcode module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/style-engine/CHANGELOG.md b/packages/style-engine/CHANGELOG.md index e2face48c99c9a..ef0565707d5ff3 100644 --- a/packages/style-engine/CHANGELOG.md +++ b/packages/style-engine/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 0.15.0 (2022-08-24) + ## 0.14.0 (2022-08-10) ## 0.13.0 (2022-07-27) diff --git a/packages/style-engine/package.json b/packages/style-engine/package.json index 4742e0de4dd2a4..5ea690238ca149 100644 --- a/packages/style-engine/package.json +++ b/packages/style-engine/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/style-engine", - "version": "0.14.0", + "version": "0.15.0-prerelease", "description": "WordPress Style engine.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/stylelint-config/CHANGELOG.md b/packages/stylelint-config/CHANGELOG.md index 28dc5d41b442aa..c169e19406b9b5 100644 --- a/packages/stylelint-config/CHANGELOG.md +++ b/packages/stylelint-config/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 21.0.0 (2022-08-24) + ### Breaking Change - Increase the minimum Node.js version to 14 ([#43141](https://github.com/WordPress/gutenberg/pull/43141)). diff --git a/packages/stylelint-config/package.json b/packages/stylelint-config/package.json index 0dfc07bf208ed1..c5c9d92573b600 100644 --- a/packages/stylelint-config/package.json +++ b/packages/stylelint-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/stylelint-config", - "version": "20.0.2", + "version": "21.0.0-prerelease", "description": "stylelint config for WordPress development.", "author": "The WordPress Contributors", "license": "MIT", diff --git a/packages/token-list/CHANGELOG.md b/packages/token-list/CHANGELOG.md index e0b38a929ad4d3..c21ee49eeb2e89 100644 --- a/packages/token-list/CHANGELOG.md +++ b/packages/token-list/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.16.0 (2022-08-24) + ## 2.15.0 (2022-08-10) ## 2.14.0 (2022-07-27) diff --git a/packages/token-list/package.json b/packages/token-list/package.json index fbafb939eebb24..79e02de831bd33 100644 --- a/packages/token-list/package.json +++ b/packages/token-list/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/token-list", - "version": "2.15.0", + "version": "2.16.0-prerelease", "description": "Constructable, plain JavaScript DOMTokenList implementation, supporting non-browser runtimes.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/url/CHANGELOG.md b/packages/url/CHANGELOG.md index 0b2486f9ae813d..1ba0500c6c5717 100644 --- a/packages/url/CHANGELOG.md +++ b/packages/url/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.17.0 (2022-08-24) + ## 3.16.0 (2022-08-10) ## 3.15.0 (2022-07-27) diff --git a/packages/url/package.json b/packages/url/package.json index 95e17eb494a9f4..b865c6250298be 100644 --- a/packages/url/package.json +++ b/packages/url/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/url", - "version": "3.16.0", + "version": "3.17.0-prerelease", "description": "WordPress URL utilities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/viewport/CHANGELOG.md b/packages/viewport/CHANGELOG.md index fad34f77739d5f..760b3201bfd1cf 100644 --- a/packages/viewport/CHANGELOG.md +++ b/packages/viewport/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.14.0 (2022-08-24) + ## 4.13.0 (2022-08-10) ## 4.12.0 (2022-07-27) diff --git a/packages/viewport/package.json b/packages/viewport/package.json index 471134fd347dc7..578ccf4536d58d 100644 --- a/packages/viewport/package.json +++ b/packages/viewport/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/viewport", - "version": "4.13.0", + "version": "4.14.0-prerelease", "description": "Viewport module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/warning/CHANGELOG.md b/packages/warning/CHANGELOG.md index 710ed3a94efe3c..abd7245227b048 100644 --- a/packages/warning/CHANGELOG.md +++ b/packages/warning/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.16.0 (2022-08-24) + ## 2.15.0 (2022-08-10) ## 2.14.0 (2022-07-27) diff --git a/packages/warning/package.json b/packages/warning/package.json index 3206b6ba979165..863a86b58e4b02 100644 --- a/packages/warning/package.json +++ b/packages/warning/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/warning", - "version": "2.15.0", + "version": "2.16.0-prerelease", "description": "Warning utility for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/widgets/CHANGELOG.md b/packages/widgets/CHANGELOG.md index 0b0eb061657db9..4515a2effe85b7 100644 --- a/packages/widgets/CHANGELOG.md +++ b/packages/widgets/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.14.0 (2022-08-24) + ## 2.13.0 (2022-08-10) ## 2.12.0 (2022-07-27) diff --git a/packages/widgets/package.json b/packages/widgets/package.json index aef5ef9d4a3803..4435f9e60e6770 100644 --- a/packages/widgets/package.json +++ b/packages/widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/widgets", - "version": "2.13.0", + "version": "2.14.0-prerelease", "description": "Functionality used by the widgets block editor in the Widgets screen and the Customizer.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/wordcount/CHANGELOG.md b/packages/wordcount/CHANGELOG.md index f4c0887912e97e..ecd679efce9e62 100644 --- a/packages/wordcount/CHANGELOG.md +++ b/packages/wordcount/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.16.0 (2022-08-24) + ## 3.15.0 (2022-08-10) ## 3.14.0 (2022-07-27) diff --git a/packages/wordcount/package.json b/packages/wordcount/package.json index e621307f517b1d..139bfc6b3d3e04 100644 --- a/packages/wordcount/package.json +++ b/packages/wordcount/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/wordcount", - "version": "3.15.0", + "version": "3.16.0-prerelease", "description": "WordPress word count utility.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", From 3a905a558f495deb6e00dc3a96801f99e4340418 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Wed, 24 Aug 2022 13:24:28 +0000 Subject: [PATCH 10/68] chore(release): publish - @wordpress/a11y@3.16.0 - @wordpress/annotations@2.16.0 - @wordpress/api-fetch@6.13.0 - @wordpress/autop@3.16.0 - @wordpress/babel-plugin-import-jsx-pragma@4.0.0 - @wordpress/babel-plugin-makepot@5.0.0 - @wordpress/babel-preset-default@7.0.0 - @wordpress/blob@3.16.0 - @wordpress/block-directory@3.14.0 - @wordpress/block-editor@9.8.0 - @wordpress/block-library@7.13.0 - @wordpress/block-serialization-default-parser@4.16.0 - @wordpress/block-serialization-spec-parser@4.16.0 - @wordpress/blocks@11.15.0 - @wordpress/browserslist-config@5.0.0 - @wordpress/components@20.0.0 - @wordpress/compose@5.14.0 - @wordpress/core-data@4.14.0 - @wordpress/create-block-tutorial-template@2.5.0 - @wordpress/create-block@4.0.0 - @wordpress/customize-widgets@3.13.0 - @wordpress/data-controls@2.16.0 - @wordpress/data@7.0.0 - @wordpress/date@4.16.0 - @wordpress/dependency-extraction-webpack-plugin@4.0.0 - @wordpress/deprecated@3.16.0 - @wordpress/docgen@1.25.0 - @wordpress/dom-ready@3.16.0 - @wordpress/dom@3.16.0 - @wordpress/e2e-test-utils@8.0.0 - @wordpress/e2e-tests@5.0.0 - @wordpress/edit-post@6.13.0 - @wordpress/edit-site@4.13.0 - @wordpress/edit-widgets@4.13.0 - @wordpress/editor@12.15.0 - @wordpress/element@4.14.0 - @wordpress/escape-html@2.16.0 - @wordpress/eslint-plugin@13.0.0 - @wordpress/format-library@3.14.0 - @wordpress/hooks@3.16.0 - @wordpress/html-entities@3.16.0 - @wordpress/i18n@4.16.0 - @wordpress/icons@9.7.0 - @wordpress/interface@4.15.0 - @wordpress/is-shallow-equal@4.16.0 - @wordpress/jest-console@6.0.0 - @wordpress/jest-preset-default@9.0.0 - @wordpress/jest-puppeteer-axe@5.0.0 - @wordpress/keyboard-shortcuts@3.14.0 - @wordpress/keycodes@3.16.0 - @wordpress/list-reusable-blocks@3.14.0 - @wordpress/media-utils@4.7.0 - @wordpress/notices@3.16.0 - @wordpress/npm-package-json-lint-config@4.2.0 - @wordpress/nux@5.14.0 - @wordpress/plugins@4.14.0 - @wordpress/postcss-plugins-preset@4.0.0 - @wordpress/postcss-themes@5.0.0 - @wordpress/preferences-persistence@1.8.0 - @wordpress/preferences@2.8.0 - @wordpress/prettier-config@2.0.0 - @wordpress/primitives@3.14.0 - @wordpress/priority-queue@2.16.0 - @wordpress/react-i18n@3.14.0 - @wordpress/readable-js-assets-webpack-plugin@2.0.0 - @wordpress/redux-routine@4.16.0 - @wordpress/reusable-blocks@3.14.0 - @wordpress/rich-text@5.14.0 - @wordpress/scripts@24.0.0 - @wordpress/server-side-render@3.14.0 - @wordpress/shortcode@3.16.0 - @wordpress/style-engine@0.15.0 - @wordpress/stylelint-config@21.0.0 - @wordpress/token-list@2.16.0 - @wordpress/url@3.17.0 - @wordpress/viewport@4.14.0 - @wordpress/warning@2.16.0 - @wordpress/widgets@2.14.0 - @wordpress/wordcount@3.16.0 --- packages/a11y/package.json | 2 +- packages/annotations/package.json | 2 +- packages/api-fetch/package.json | 2 +- packages/autop/package.json | 2 +- packages/babel-plugin-import-jsx-pragma/package.json | 2 +- packages/babel-plugin-makepot/package.json | 2 +- packages/babel-preset-default/package.json | 2 +- packages/blob/package.json | 2 +- packages/block-directory/package.json | 2 +- packages/block-editor/package.json | 2 +- packages/block-library/package.json | 2 +- packages/block-serialization-default-parser/package.json | 2 +- packages/block-serialization-spec-parser/package.json | 2 +- packages/blocks/package.json | 2 +- packages/browserslist-config/package.json | 2 +- packages/components/package.json | 2 +- packages/compose/package.json | 2 +- packages/core-data/package.json | 2 +- packages/create-block-tutorial-template/package.json | 2 +- packages/create-block/package.json | 2 +- packages/customize-widgets/package.json | 2 +- packages/data-controls/package.json | 2 +- packages/data/package.json | 2 +- packages/date/package.json | 2 +- packages/dependency-extraction-webpack-plugin/package.json | 2 +- packages/deprecated/package.json | 2 +- packages/docgen/package.json | 2 +- packages/dom-ready/package.json | 2 +- packages/dom/package.json | 2 +- packages/e2e-test-utils/package.json | 2 +- packages/e2e-tests/package.json | 2 +- packages/edit-post/package.json | 2 +- packages/edit-site/package.json | 2 +- packages/edit-widgets/package.json | 2 +- packages/editor/package.json | 2 +- packages/element/package.json | 2 +- packages/escape-html/package.json | 2 +- packages/eslint-plugin/package.json | 2 +- packages/format-library/package.json | 2 +- packages/hooks/package.json | 2 +- packages/html-entities/package.json | 2 +- packages/i18n/package.json | 2 +- packages/icons/package.json | 2 +- packages/interface/package.json | 2 +- packages/is-shallow-equal/package.json | 2 +- packages/jest-console/package.json | 2 +- packages/jest-preset-default/package.json | 2 +- packages/jest-puppeteer-axe/package.json | 2 +- packages/keyboard-shortcuts/package.json | 2 +- packages/keycodes/package.json | 2 +- packages/list-reusable-blocks/package.json | 2 +- packages/media-utils/package.json | 2 +- packages/notices/package.json | 2 +- packages/npm-package-json-lint-config/package.json | 2 +- packages/nux/package.json | 2 +- packages/plugins/package.json | 2 +- packages/postcss-plugins-preset/package.json | 2 +- packages/postcss-themes/package.json | 2 +- packages/preferences-persistence/package.json | 2 +- packages/preferences/package.json | 2 +- packages/prettier-config/package.json | 2 +- packages/primitives/package.json | 2 +- packages/priority-queue/package.json | 2 +- packages/react-i18n/package.json | 2 +- packages/readable-js-assets-webpack-plugin/package.json | 2 +- packages/redux-routine/package.json | 2 +- packages/reusable-blocks/package.json | 2 +- packages/rich-text/package.json | 2 +- packages/scripts/package.json | 2 +- packages/server-side-render/package.json | 2 +- packages/shortcode/package.json | 2 +- packages/style-engine/package.json | 2 +- packages/stylelint-config/package.json | 2 +- packages/token-list/package.json | 2 +- packages/url/package.json | 2 +- packages/viewport/package.json | 2 +- packages/warning/package.json | 2 +- packages/widgets/package.json | 2 +- packages/wordcount/package.json | 2 +- 79 files changed, 79 insertions(+), 79 deletions(-) diff --git a/packages/a11y/package.json b/packages/a11y/package.json index 61aad5ae171bd4..7b46ac2902c86a 100644 --- a/packages/a11y/package.json +++ b/packages/a11y/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/a11y", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "Accessibility (a11y) utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/annotations/package.json b/packages/annotations/package.json index 5041ad107586a5..8efe29f06a659e 100644 --- a/packages/annotations/package.json +++ b/packages/annotations/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/annotations", - "version": "2.16.0-prerelease", + "version": "2.16.0", "description": "Annotate content in the Gutenberg editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json index 4f2ab165dc9e9d..4b6ea159c897e1 100644 --- a/packages/api-fetch/package.json +++ b/packages/api-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/api-fetch", - "version": "6.13.0-prerelease", + "version": "6.13.0", "description": "Utility to make WordPress REST API requests.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/autop/package.json b/packages/autop/package.json index 9cdb00fd28a045..4813462cd26c34 100644 --- a/packages/autop/package.json +++ b/packages/autop/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/autop", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "WordPress's automatic paragraph functions `autop` and `removep`.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-plugin-import-jsx-pragma/package.json b/packages/babel-plugin-import-jsx-pragma/package.json index b4fa82c960ec31..297378e3a8707f 100644 --- a/packages/babel-plugin-import-jsx-pragma/package.json +++ b/packages/babel-plugin-import-jsx-pragma/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-plugin-import-jsx-pragma", - "version": "4.0.0-prerelease", + "version": "4.0.0", "description": "Babel transform plugin for automatically injecting an import to be used as the pragma for the React JSX Transform plugin.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-plugin-makepot/package.json b/packages/babel-plugin-makepot/package.json index 06a5cd9d255d7e..869b7778a0f846 100644 --- a/packages/babel-plugin-makepot/package.json +++ b/packages/babel-plugin-makepot/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-plugin-makepot", - "version": "5.0.0-prerelease", + "version": "5.0.0", "description": "WordPress Babel internationalization (i18n) plugin.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json index 1937c3143f2095..fa16d9df66de51 100644 --- a/packages/babel-preset-default/package.json +++ b/packages/babel-preset-default/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/babel-preset-default", - "version": "7.0.0-prerelease", + "version": "7.0.0", "description": "Default Babel preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blob/package.json b/packages/blob/package.json index e1e408bd2c4c35..630e06d10ed001 100644 --- a/packages/blob/package.json +++ b/packages/blob/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blob", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "Blob utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json index bf635fd6571681..b1783a8029e0a9 100644 --- a/packages/block-directory/package.json +++ b/packages/block-directory/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-directory", - "version": "3.14.0-prerelease", + "version": "3.14.0", "description": "Extend editor with block directory features to search, download and install blocks.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index 7a60bc3462ce3a..3f312a4543ac73 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-editor", - "version": "9.8.0-prerelease", + "version": "9.8.0", "description": "Generic block editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-library/package.json b/packages/block-library/package.json index 1c96d15578e989..38bea5efd407bc 100644 --- a/packages/block-library/package.json +++ b/packages/block-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-library", - "version": "7.13.0-prerelease", + "version": "7.13.0", "description": "Block library for the WordPress editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-serialization-default-parser/package.json b/packages/block-serialization-default-parser/package.json index 89a1c3f401e06c..9788971fa26706 100644 --- a/packages/block-serialization-default-parser/package.json +++ b/packages/block-serialization-default-parser/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-serialization-default-parser", - "version": "4.16.0-prerelease", + "version": "4.16.0", "description": "Block serialization specification parser for WordPress posts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/block-serialization-spec-parser/package.json b/packages/block-serialization-spec-parser/package.json index e52e5c6b4c0a07..cb7b275c64a637 100644 --- a/packages/block-serialization-spec-parser/package.json +++ b/packages/block-serialization-spec-parser/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-serialization-spec-parser", - "version": "4.16.0-prerelease", + "version": "4.16.0", "description": "Block serialization specification parser for WordPress posts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blocks/package.json b/packages/blocks/package.json index 150d9c88a6cd58..e7562b9158a8bf 100644 --- a/packages/blocks/package.json +++ b/packages/blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blocks", - "version": "11.15.0-prerelease", + "version": "11.15.0", "description": "Block API for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/browserslist-config/package.json b/packages/browserslist-config/package.json index e4eae425af1ae5..658907e49dd995 100644 --- a/packages/browserslist-config/package.json +++ b/packages/browserslist-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/browserslist-config", - "version": "5.0.0-prerelease", + "version": "5.0.0", "description": "WordPress Browserslist shared configuration.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/components/package.json b/packages/components/package.json index 82b6d976f60491..975295b9e6e413 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/components", - "version": "20.0.0-prerelease", + "version": "20.0.0", "description": "UI components for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/compose/package.json b/packages/compose/package.json index 7252e957998f23..66657f7032b2f0 100644 --- a/packages/compose/package.json +++ b/packages/compose/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/compose", - "version": "5.14.0-prerelease", + "version": "5.14.0", "description": "WordPress higher-order components (HOCs).", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/core-data/package.json b/packages/core-data/package.json index 13c7e2ec090679..2ed128063b2b97 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/core-data", - "version": "4.14.0-prerelease", + "version": "4.14.0", "description": "Access to and manipulation of core WordPress entities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/create-block-tutorial-template/package.json b/packages/create-block-tutorial-template/package.json index 0ea7149351a92c..91a0ef7504e917 100644 --- a/packages/create-block-tutorial-template/package.json +++ b/packages/create-block-tutorial-template/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/create-block-tutorial-template", - "version": "2.5.0-prerelease", + "version": "2.5.0", "description": "Template for @wordpress/create-block used in the official WordPress tutorial.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/create-block/package.json b/packages/create-block/package.json index 0707acf91ac9cf..befe18b22eedf8 100644 --- a/packages/create-block/package.json +++ b/packages/create-block/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/create-block", - "version": "4.0.0-prerelease", + "version": "4.0.0", "description": "Generates PHP, JS and CSS code for registering a block for a WordPress plugin.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/customize-widgets/package.json b/packages/customize-widgets/package.json index 151406a21b0d44..8fe956324058c9 100644 --- a/packages/customize-widgets/package.json +++ b/packages/customize-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/customize-widgets", - "version": "3.13.0-prerelease", + "version": "3.13.0", "description": "Widgets blocks in Customizer Module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/data-controls/package.json b/packages/data-controls/package.json index f10edcce51f190..d65613a9eecae6 100644 --- a/packages/data-controls/package.json +++ b/packages/data-controls/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data-controls", - "version": "2.16.0-prerelease", + "version": "2.16.0", "description": "A set of common controls for the @wordpress/data api.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/data/package.json b/packages/data/package.json index 7944b69d282dcd..b6613e8b635d2f 100644 --- a/packages/data/package.json +++ b/packages/data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data", - "version": "7.0.0-prerelease", + "version": "7.0.0", "description": "Data module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/date/package.json b/packages/date/package.json index bdf31579308437..675addc69d0c60 100644 --- a/packages/date/package.json +++ b/packages/date/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/date", - "version": "4.16.0-prerelease", + "version": "4.16.0", "description": "Date module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dependency-extraction-webpack-plugin/package.json b/packages/dependency-extraction-webpack-plugin/package.json index 3471d7d8e06249..c32e7e1092a722 100644 --- a/packages/dependency-extraction-webpack-plugin/package.json +++ b/packages/dependency-extraction-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dependency-extraction-webpack-plugin", - "version": "4.0.0-prerelease", + "version": "4.0.0", "description": "Extract WordPress script dependencies from webpack bundles.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/deprecated/package.json b/packages/deprecated/package.json index 7b8cb2041021ac..fae32eac4e8fe8 100644 --- a/packages/deprecated/package.json +++ b/packages/deprecated/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/deprecated", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "Deprecation utility for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/docgen/package.json b/packages/docgen/package.json index 73844baa723c14..53ab1f3c407858 100644 --- a/packages/docgen/package.json +++ b/packages/docgen/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/docgen", - "version": "1.24.0", + "version": "1.25.0", "description": "Autogenerate public API documentation from exports and JSDoc comments.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dom-ready/package.json b/packages/dom-ready/package.json index d12f6a1a8fe3e4..c17236d7d637ce 100644 --- a/packages/dom-ready/package.json +++ b/packages/dom-ready/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dom-ready", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "Execute callback after the DOM is loaded.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/dom/package.json b/packages/dom/package.json index 6103cd5be05531..1637faa0578127 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dom", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "DOM utilities module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/e2e-test-utils/package.json b/packages/e2e-test-utils/package.json index 7d53a0e8c23c9a..b90e7697a19905 100644 --- a/packages/e2e-test-utils/package.json +++ b/packages/e2e-test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-test-utils", - "version": "8.0.0-prerelease", + "version": "8.0.0", "description": "End-To-End (E2E) test utils for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index 1178348d95f344..94f524ea44c020 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-tests", - "version": "5.0.0-prerelease", + "version": "5.0.0", "description": "End-To-End (E2E) tests for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-post/package.json b/packages/edit-post/package.json index c1472c7b309448..f74f2abb8aa750 100644 --- a/packages/edit-post/package.json +++ b/packages/edit-post/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-post", - "version": "6.13.0-prerelease", + "version": "6.13.0", "description": "Edit Post module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-site/package.json b/packages/edit-site/package.json index 2122b42a379870..3de873024ba28d 100644 --- a/packages/edit-site/package.json +++ b/packages/edit-site/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-site", - "version": "4.13.0-prerelease", + "version": "4.13.0", "description": "Edit Site Page module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/edit-widgets/package.json b/packages/edit-widgets/package.json index 2151b44d0e0c26..32cdf9ea5af975 100644 --- a/packages/edit-widgets/package.json +++ b/packages/edit-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-widgets", - "version": "4.13.0-prerelease", + "version": "4.13.0", "description": "Widgets Page module for WordPress..", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/editor/package.json b/packages/editor/package.json index ca80ddc7197eac..d9bcc4d2c0a696 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/editor", - "version": "12.15.0-prerelease", + "version": "12.15.0", "description": "Enhanced block editor for WordPress posts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/element/package.json b/packages/element/package.json index 24ad8966e69ae9..6c58e7dae87567 100644 --- a/packages/element/package.json +++ b/packages/element/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/element", - "version": "4.14.0-prerelease", + "version": "4.14.0", "description": "Element React module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/escape-html/package.json b/packages/escape-html/package.json index 1a6013b32c8bf1..9d806abd61ba9f 100644 --- a/packages/escape-html/package.json +++ b/packages/escape-html/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/escape-html", - "version": "2.16.0-prerelease", + "version": "2.16.0", "description": "Escape HTML utils.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 6a9e6211317b12..885fa54aa6ae1d 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/eslint-plugin", - "version": "13.0.0-prerelease", + "version": "13.0.0", "description": "ESLint plugin for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/format-library/package.json b/packages/format-library/package.json index 2c296a27399210..272ffa0462e3b0 100644 --- a/packages/format-library/package.json +++ b/packages/format-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/format-library", - "version": "3.14.0-prerelease", + "version": "3.14.0", "description": "Format library for the WordPress editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/hooks/package.json b/packages/hooks/package.json index c5e379a94a93e0..3b3e6aaeb6b01c 100644 --- a/packages/hooks/package.json +++ b/packages/hooks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/hooks", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "WordPress hooks library.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/html-entities/package.json b/packages/html-entities/package.json index 8be06e06f026ce..934eb02e9a256f 100644 --- a/packages/html-entities/package.json +++ b/packages/html-entities/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/html-entities", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "HTML entity utilities for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/i18n/package.json b/packages/i18n/package.json index e15bb806ffa575..cb7bb9d4002700 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/i18n", - "version": "4.16.0-prerelease", + "version": "4.16.0", "description": "WordPress internationalization (i18n) library.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/icons/package.json b/packages/icons/package.json index 2f90136d1b4e36..d853b0831c55fe 100644 --- a/packages/icons/package.json +++ b/packages/icons/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/icons", - "version": "9.7.0-prerelease", + "version": "9.7.0", "description": "WordPress Icons package, based on dashicon.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/interface/package.json b/packages/interface/package.json index 23c74cdabe6f6a..8326b1f7828e6c 100644 --- a/packages/interface/package.json +++ b/packages/interface/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/interface", - "version": "4.15.0-prerelease", + "version": "4.15.0", "description": "Interface module for WordPress. The package contains shared functionality across the modern JavaScript-based WordPress screens.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/is-shallow-equal/package.json b/packages/is-shallow-equal/package.json index 242691e21ac65e..b0709ab4cf48f7 100644 --- a/packages/is-shallow-equal/package.json +++ b/packages/is-shallow-equal/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/is-shallow-equal", - "version": "4.16.0-prerelease", + "version": "4.16.0", "description": "Test for shallow equality between two objects or arrays.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/jest-console/package.json b/packages/jest-console/package.json index 39dfdebd1d6657..01e1a0dfd93213 100644 --- a/packages/jest-console/package.json +++ b/packages/jest-console/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/jest-console", - "version": "6.0.0-prerelease", + "version": "6.0.0", "description": "Custom Jest matchers for the Console object.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/jest-preset-default/package.json b/packages/jest-preset-default/package.json index 7354426a99d857..0d8a482ff73051 100644 --- a/packages/jest-preset-default/package.json +++ b/packages/jest-preset-default/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/jest-preset-default", - "version": "9.0.0-prerelease", + "version": "9.0.0", "description": "Default Jest preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/jest-puppeteer-axe/package.json b/packages/jest-puppeteer-axe/package.json index 67a6e4ac79ef85..411f13a058b16f 100644 --- a/packages/jest-puppeteer-axe/package.json +++ b/packages/jest-puppeteer-axe/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/jest-puppeteer-axe", - "version": "5.0.0-prerelease", + "version": "5.0.0", "description": "Axe API integration with Jest and Puppeteer.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/keyboard-shortcuts/package.json b/packages/keyboard-shortcuts/package.json index 5d8ae75ab9d18b..c4a9d8323d00ac 100644 --- a/packages/keyboard-shortcuts/package.json +++ b/packages/keyboard-shortcuts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/keyboard-shortcuts", - "version": "3.14.0-prerelease", + "version": "3.14.0", "description": "Handling keyboard shortcuts.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/keycodes/package.json b/packages/keycodes/package.json index e008125bf80eb7..af8e251caf9259 100644 --- a/packages/keycodes/package.json +++ b/packages/keycodes/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/keycodes", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "Keycodes utilities for WordPress. Used to check for keyboard events across browsers/operating systems.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/list-reusable-blocks/package.json b/packages/list-reusable-blocks/package.json index 2d6ec8a3ea3569..cef060685a9d9f 100644 --- a/packages/list-reusable-blocks/package.json +++ b/packages/list-reusable-blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/list-reusable-blocks", - "version": "3.14.0-prerelease", + "version": "3.14.0", "description": "Adding Export/Import support to the reusable blocks listing.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/media-utils/package.json b/packages/media-utils/package.json index 49549d7242a057..07ea5d45850f99 100644 --- a/packages/media-utils/package.json +++ b/packages/media-utils/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/media-utils", - "version": "4.7.0-prerelease", + "version": "4.7.0", "description": "WordPress Media Upload Utils.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/notices/package.json b/packages/notices/package.json index 7ed278cdc2adf0..54ff65c0db2f48 100644 --- a/packages/notices/package.json +++ b/packages/notices/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/notices", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "State management for notices.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/npm-package-json-lint-config/package.json b/packages/npm-package-json-lint-config/package.json index d3d05e338c07c1..994e5b29d00c1d 100644 --- a/packages/npm-package-json-lint-config/package.json +++ b/packages/npm-package-json-lint-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/npm-package-json-lint-config", - "version": "4.2.0-prerelease", + "version": "4.2.0", "description": "WordPress npm-package-json-lint shareable configuration.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/nux/package.json b/packages/nux/package.json index 696ed9b1e0bbcb..b1be17e5138046 100644 --- a/packages/nux/package.json +++ b/packages/nux/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/nux", - "version": "5.14.0-prerelease", + "version": "5.14.0", "description": "NUX (New User eXperience) module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/plugins/package.json b/packages/plugins/package.json index e8ab0e95b49c26..cb40780ed2f230 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/plugins", - "version": "4.14.0-prerelease", + "version": "4.14.0", "description": "Plugins module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/postcss-plugins-preset/package.json b/packages/postcss-plugins-preset/package.json index cede4e47cdf4af..e1daf5ccfe1284 100644 --- a/packages/postcss-plugins-preset/package.json +++ b/packages/postcss-plugins-preset/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/postcss-plugins-preset", - "version": "4.0.0-prerelease", + "version": "4.0.0", "description": "PostCSS sharable plugins preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/postcss-themes/package.json b/packages/postcss-themes/package.json index 210195eb6c1fb0..53dc5ecbeaa2ce 100644 --- a/packages/postcss-themes/package.json +++ b/packages/postcss-themes/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/postcss-themes", - "version": "5.0.0-prerelease", + "version": "5.0.0", "description": "PostCSS plugin to generate theme colors.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/preferences-persistence/package.json b/packages/preferences-persistence/package.json index 62234efeea2f08..df09e3f895a515 100644 --- a/packages/preferences-persistence/package.json +++ b/packages/preferences-persistence/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/preferences-persistence", - "version": "1.8.0-prerelease", + "version": "1.8.0", "description": "Persistence utilities for `wordpress/preferences`.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/preferences/package.json b/packages/preferences/package.json index 6c1da4d0b05c91..18cbb66496ebc7 100644 --- a/packages/preferences/package.json +++ b/packages/preferences/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/preferences", - "version": "2.8.0-prerelease", + "version": "2.8.0", "description": "Utilities for managing WordPress preferences.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/prettier-config/package.json b/packages/prettier-config/package.json index 14b41384e31af2..c263ded4511b80 100644 --- a/packages/prettier-config/package.json +++ b/packages/prettier-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/prettier-config", - "version": "2.0.0-prerelease", + "version": "2.0.0", "description": "WordPress Prettier shared configuration.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/primitives/package.json b/packages/primitives/package.json index 867ff980be78be..ccc71341564fbf 100644 --- a/packages/primitives/package.json +++ b/packages/primitives/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/primitives", - "version": "3.14.0-prerelease", + "version": "3.14.0", "description": "WordPress cross-platform primitives.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/priority-queue/package.json b/packages/priority-queue/package.json index 8ea490177b4b52..16228e723378ec 100644 --- a/packages/priority-queue/package.json +++ b/packages/priority-queue/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/priority-queue", - "version": "2.16.0-prerelease", + "version": "2.16.0", "description": "Generic browser priority queue.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/react-i18n/package.json b/packages/react-i18n/package.json index 0ad41fcb412eac..169cd7a04a4cb5 100644 --- a/packages/react-i18n/package.json +++ b/packages/react-i18n/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/react-i18n", - "version": "3.14.0-prerelease", + "version": "3.14.0", "description": "React bindings for @wordpress/i18n.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/readable-js-assets-webpack-plugin/package.json b/packages/readable-js-assets-webpack-plugin/package.json index cbd484f1df42e5..b162b2c7b76cb3 100644 --- a/packages/readable-js-assets-webpack-plugin/package.json +++ b/packages/readable-js-assets-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/readable-js-assets-webpack-plugin", - "version": "2.0.0-prerelease", + "version": "2.0.0", "description": "Generate a readable JS file for each JS asset.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/redux-routine/package.json b/packages/redux-routine/package.json index 9d720745a55c58..db8071ca3c10d5 100644 --- a/packages/redux-routine/package.json +++ b/packages/redux-routine/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/redux-routine", - "version": "4.16.0-prerelease", + "version": "4.16.0", "description": "Redux middleware for generator coroutines.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/reusable-blocks/package.json b/packages/reusable-blocks/package.json index 4b6cd355edc062..39c7c26ece02e0 100644 --- a/packages/reusable-blocks/package.json +++ b/packages/reusable-blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/reusable-blocks", - "version": "3.14.0-prerelease", + "version": "3.14.0", "description": "Reusable blocks utilities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/rich-text/package.json b/packages/rich-text/package.json index 9bbee3fc023bd6..50254d7b637e07 100644 --- a/packages/rich-text/package.json +++ b/packages/rich-text/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/rich-text", - "version": "5.14.0-prerelease", + "version": "5.14.0", "description": "Rich text value and manipulation API.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/scripts/package.json b/packages/scripts/package.json index e9b9e2a4deb653..3140fee5ed367a 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/scripts", - "version": "24.0.0-prerelease", + "version": "24.0.0", "description": "Collection of reusable scripts for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/server-side-render/package.json b/packages/server-side-render/package.json index 701bdd551fc6b9..92dbed499243a5 100644 --- a/packages/server-side-render/package.json +++ b/packages/server-side-render/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/server-side-render", - "version": "3.14.0-prerelease", + "version": "3.14.0", "description": "The component used with WordPress to server-side render a preview of dynamic blocks to display in the editor.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/shortcode/package.json b/packages/shortcode/package.json index 03695f2a6098a9..9a4c9b474402ca 100644 --- a/packages/shortcode/package.json +++ b/packages/shortcode/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/shortcode", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "Shortcode module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/style-engine/package.json b/packages/style-engine/package.json index 5ea690238ca149..8d91cfc45183ed 100644 --- a/packages/style-engine/package.json +++ b/packages/style-engine/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/style-engine", - "version": "0.15.0-prerelease", + "version": "0.15.0", "description": "WordPress Style engine.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/stylelint-config/package.json b/packages/stylelint-config/package.json index c5c9d92573b600..6b1cbd71f48bd7 100644 --- a/packages/stylelint-config/package.json +++ b/packages/stylelint-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/stylelint-config", - "version": "21.0.0-prerelease", + "version": "21.0.0", "description": "stylelint config for WordPress development.", "author": "The WordPress Contributors", "license": "MIT", diff --git a/packages/token-list/package.json b/packages/token-list/package.json index 79e02de831bd33..dccb9227554ebd 100644 --- a/packages/token-list/package.json +++ b/packages/token-list/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/token-list", - "version": "2.16.0-prerelease", + "version": "2.16.0", "description": "Constructable, plain JavaScript DOMTokenList implementation, supporting non-browser runtimes.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/url/package.json b/packages/url/package.json index b865c6250298be..c46f3dd8a098c5 100644 --- a/packages/url/package.json +++ b/packages/url/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/url", - "version": "3.17.0-prerelease", + "version": "3.17.0", "description": "WordPress URL utilities.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/viewport/package.json b/packages/viewport/package.json index 578ccf4536d58d..0e6ec42f572504 100644 --- a/packages/viewport/package.json +++ b/packages/viewport/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/viewport", - "version": "4.14.0-prerelease", + "version": "4.14.0", "description": "Viewport module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/warning/package.json b/packages/warning/package.json index 863a86b58e4b02..97655b79384ddb 100644 --- a/packages/warning/package.json +++ b/packages/warning/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/warning", - "version": "2.16.0-prerelease", + "version": "2.16.0", "description": "Warning utility for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/widgets/package.json b/packages/widgets/package.json index 4435f9e60e6770..588322d3bcd5c8 100644 --- a/packages/widgets/package.json +++ b/packages/widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/widgets", - "version": "2.14.0-prerelease", + "version": "2.14.0", "description": "Functionality used by the widgets block editor in the Widgets screen and the Customizer.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/wordcount/package.json b/packages/wordcount/package.json index 139bfc6b3d3e04..26cf0dcc7ac57a 100644 --- a/packages/wordcount/package.json +++ b/packages/wordcount/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/wordcount", - "version": "3.16.0-prerelease", + "version": "3.16.0", "description": "WordPress word count utility.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", From 8fbd1375ee2a2d1fdb39a8588a968e22616bc50d Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Wed, 24 Aug 2022 21:31:04 +0800 Subject: [PATCH 11/68] Fix playwright's `openDocumentSettingsSidebar` util not opening the sidebar (#43506) --- .../editor/open-document-settings-sidebar.ts | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/packages/e2e-test-utils-playwright/src/editor/open-document-settings-sidebar.ts b/packages/e2e-test-utils-playwright/src/editor/open-document-settings-sidebar.ts index 11bf6774a6da18..0cb27c33c6c882 100644 --- a/packages/e2e-test-utils-playwright/src/editor/open-document-settings-sidebar.ts +++ b/packages/e2e-test-utils-playwright/src/editor/open-document-settings-sidebar.ts @@ -2,7 +2,7 @@ * Internal dependencies */ import type { Editor } from './index'; -const { expect } = require( '../test' ); +import { expect } from '../test'; /** * Clicks on the button in the header which opens Document Settings sidebar when it is closed. @@ -10,15 +10,21 @@ const { expect } = require( '../test' ); * @param {Editor} this */ export async function openDocumentSettingsSidebar( this: Editor ) { - const editorSettings = this.page.locator( - 'role=region[name="Editor settings"i]' + const editorSettingsButton = this.page.locator( + 'role=region[name="Editor top bar"i] >> role=button[name="Settings"i]' ); - if ( ! ( await editorSettings.isVisible() ) ) { - await this.page.click( - 'role=region[name="Editor top bar"i] >> role=button[name="Settings"i]' - ); + const isEditorSettingsOpened = + ( await editorSettingsButton.getAttribute( 'aria-expanded' ) ) === + 'true'; - await expect( editorSettings ).toBeVisible(); + if ( ! isEditorSettingsOpened ) { + await editorSettingsButton.click(); + + await expect( + this.page.locator( + 'role=region[name="Editor settings"i] >> role=button[name^="Close settings"i]' + ) + ).toBeVisible(); } } From a12570783725136cb37f1838e2186b6eef5e04c9 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Wed, 24 Aug 2022 15:39:48 +0000 Subject: [PATCH 12/68] Update Changelog for 14.0.0-rc.1 --- changelog.txt | 390 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 390 insertions(+) diff --git a/changelog.txt b/changelog.txt index e10d9c84a402d2..8418f7d6765610 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,395 @@ == Changelog == += 14.0.0-rc.1 = + + + +## Changelog + +### Enhancements + +- Add optional capture group to URL regex in wp-env. ([43200](https://github.com/WordPress/gutenberg/pull/43200)) +- Core Data: Add canRead to useResourcePermissions. ([43484](https://github.com/WordPress/gutenberg/pull/43484)) +- Element: Remove `enzyme` from `platform` test. ([43531](https://github.com/WordPress/gutenberg/pull/43531)) +- [Create-block] Add `--variant` flag to allow creation of different block type variants. ([41289](https://github.com/WordPress/gutenberg/pull/41289)) +- Remove duplicated 'import' comments. ([43478](https://github.com/WordPress/gutenberg/pull/43478)) +- Use str_starts_with. ([43371](https://github.com/WordPress/gutenberg/pull/43371)) +- [Create Block] Adding a `--no-plugin` flag to scaffold only block files. ([41642](https://github.com/WordPress/gutenberg/pull/41642)) +- Customize widgets: Fix top contents cutoff in keyboard shortcuts. ([43391](https://github.com/WordPress/gutenberg/pull/43391)) + +#### Design Tools +- Add font family and text-decoration typography supports to paragraph blocks. ([39642](https://github.com/WordPress/gutenberg/pull/39642)) +- BlockGap: Add support for spacing presets. ([43296](https://github.com/WordPress/gutenberg/pull/43296)) +- Categories List: Add typography support. ([43254](https://github.com/WordPress/gutenberg/pull/43254)) +- Code Block: Add missing typography supports to code block. ([43255](https://github.com/WordPress/gutenberg/pull/43255)) +- Column Block: Adopt typography supports. ([43252](https://github.com/WordPress/gutenberg/pull/43252)) +- Columns Block: Add typography supports. ([43253](https://github.com/WordPress/gutenberg/pull/43253)) +- Comment Author Name: Add missing typography support. ([43256](https://github.com/WordPress/gutenberg/pull/43256)) +- Comment Date: Add missing typography support. ([43262](https://github.com/WordPress/gutenberg/pull/43262)) +- Comment Edit Link: Add missing typography support. ([43263](https://github.com/WordPress/gutenberg/pull/43263)) +- Comment Template: Adopt typography supports. ([43266](https://github.com/WordPress/gutenberg/pull/43266)) +- Comments Content: Add missing typography support. ([43257](https://github.com/WordPress/gutenberg/pull/43257)) +- Comments Pagination Next: Add missing typography supports. ([43288](https://github.com/WordPress/gutenberg/pull/43288)) +- Comments Pagination Numbers: Add typography support. ([43289](https://github.com/WordPress/gutenberg/pull/43289)) +- Comments Pagination Previous: Add missing typography supports. ([43290](https://github.com/WordPress/gutenberg/pull/43290)) +- Comments Pagination: Add typography support. ([43287](https://github.com/WordPress/gutenberg/pull/43287)) +- Comments Reply Link: Add missing typography support. ([43264](https://github.com/WordPress/gutenberg/pull/43264)) +- Comments Title: Add missing typography supports. ([43291](https://github.com/WordPress/gutenberg/pull/43291)) +- Comments: Add typography support. ([43286](https://github.com/WordPress/gutenberg/pull/43286)) +- Cover: Add typography supports. ([43298](https://github.com/WordPress/gutenberg/pull/43298)) +- Gallery: Add background color block supports. ([43294](https://github.com/WordPress/gutenberg/pull/43294)) +- Group: Add missing typography supports. ([43308](https://github.com/WordPress/gutenberg/pull/43308)) +- Heading: Add padding support. ([43454](https://github.com/WordPress/gutenberg/pull/43454)) +- List: Add spacing block supports. ([43402](https://github.com/WordPress/gutenberg/pull/43402)) +- Media & Text: Add spacing block supports. ([43456](https://github.com/WordPress/gutenberg/pull/43456)) +- Media & Text: Add typography support. ([43314](https://github.com/WordPress/gutenberg/pull/43314)) +- Navigation: Add missing typography support. ([43542](https://github.com/WordPress/gutenberg/pull/43542)) +- Paragraph: Add spacing block supports. ([43455](https://github.com/WordPress/gutenberg/pull/43455)) +- Post Author Biography: Add missing typography support. ([43318](https://github.com/WordPress/gutenberg/pull/43318)) +- Post Author Name: Add missing typography supports. ([43319](https://github.com/WordPress/gutenberg/pull/43319)) +- Post Author: Add missing typography supports. ([43317](https://github.com/WordPress/gutenberg/pull/43317)) +- Post Comments Count: Add missing typography supports. ([43321](https://github.com/WordPress/gutenberg/pull/43321)) +- Post Comments Link: Add missing typography supports. ([43338](https://github.com/WordPress/gutenberg/pull/43338)) +- Post Date: Add missing typography supports. ([43340](https://github.com/WordPress/gutenberg/pull/43340)) +- Post Date: Add spacing support. ([43406](https://github.com/WordPress/gutenberg/pull/43406)) +- Post Featured Image: Add border support applied to inner img. ([42847](https://github.com/WordPress/gutenberg/pull/42847)) +- Post Navigation Link: Add missing typography supports. ([43344](https://github.com/WordPress/gutenberg/pull/43344)) +- Post Template: Add typography supports. ([43342](https://github.com/WordPress/gutenberg/pull/43342)) +- Post Terms: Add missing typography supports. ([43343](https://github.com/WordPress/gutenberg/pull/43343)) +- Post Title: Add padding support. ([43457](https://github.com/WordPress/gutenberg/pull/43457)) +- Preformatted: Add missing typography supports. ([43345](https://github.com/WordPress/gutenberg/pull/43345)) +- Pullquote: Add missing typography supports. ([43346](https://github.com/WordPress/gutenberg/pull/43346)) +- Query Title: Add padding support. ([43458](https://github.com/WordPress/gutenberg/pull/43458)) +- Social Links: Enable alpha on color pickers. ([43453](https://github.com/WordPress/gutenberg/pull/43453)) +- Social links: Add background color block supports. ([43293](https://github.com/WordPress/gutenberg/pull/43293)) +- Spacer: Add spacing block supports. ([43366](https://github.com/WordPress/gutenberg/pull/43366)) +- Table of Contents: Add typography support. ([43509](https://github.com/WordPress/gutenberg/pull/43509)) +- Table of contents block: Add color block supports. ([43363](https://github.com/WordPress/gutenberg/pull/43363)) +- Table of contents: Add spacing supports. ([43368](https://github.com/WordPress/gutenberg/pull/43368)) +- Table: Add spacing block supports. ([43370](https://github.com/WordPress/gutenberg/pull/43370)) +- Tag cloud: Add spacing block supports. ([43367](https://github.com/WordPress/gutenberg/pull/43367)) +- Term description: Add spacing block supports. ([43372](https://github.com/WordPress/gutenberg/pull/43372)) +- Verse: Add margin support. ([43461](https://github.com/WordPress/gutenberg/pull/43461)) +- Video: Add spacing block supports. ([43365](https://github.com/WordPress/gutenberg/pull/43365)) + +#### Components +- (Custom)SelectControl: Refresh and refactor chevron. ([42962](https://github.com/WordPress/gutenberg/pull/42962)) +- Always use `screen` for `testing-library` queries. ([43152](https://github.com/WordPress/gutenberg/pull/43152)) +- Autocomplete: Use KeyboardEvent.code instead of KeyboardEvent.keyCode. ([43432](https://github.com/WordPress/gutenberg/pull/43432)) +- Card: Migrate to TypeScript. ([42941](https://github.com/WordPress/gutenberg/pull/42941)) +- ComboboxControl: Normalize hyphen-like Unicode characters to ASCII hyphens when matching search queries. ([42942](https://github.com/WordPress/gutenberg/pull/42942)) +- CustomGradientPicker: Use KeyboardEvent.code instead of KeyboardEvent.keyCode. ([43437](https://github.com/WordPress/gutenberg/pull/43437)) +- DateTimePicker: Replace react-dates and moment with useLilius and date-fns. ([43005](https://github.com/WordPress/gutenberg/pull/43005)) +- Disabled: Migrate to TypeScript. ([42708](https://github.com/WordPress/gutenberg/pull/42708)) +- FocalPointPicker: Use KeyboardEvent.code, partially refactor tests to modern RTL and user-event. ([43441](https://github.com/WordPress/gutenberg/pull/43441)) +- FontSizePicker: Add a flag to remove bottom margin. ([43062](https://github.com/WordPress/gutenberg/pull/43062)) +- FormTokenField: Add the ability to auto-select first matching suggestion for incomplete token. ([42527](https://github.com/WordPress/gutenberg/pull/42527)) +- FormTokenField: Use KeyboardEvent.code, refactor tests to model RTL and user-event. ([43442](https://github.com/WordPress/gutenberg/pull/43442)) +- Modal: Use code instead of keyCode for keyboard events. ([43429](https://github.com/WordPress/gutenberg/pull/43429)) +- Popover: Move eslint-disable comment to the correct deps array. ([43320](https://github.com/WordPress/gutenberg/pull/43320)) +- Refactor `Button` tests to `@testing-library/react`. ([42981](https://github.com/WordPress/gutenberg/pull/42981)) +- Refactor `Guide` `PageControl` tests to @testing-library/react. ([43148](https://github.com/WordPress/gutenberg/pull/43148)) +- Refactor `MenuGroup` tests to `@testing-library/react`. ([43275](https://github.com/WordPress/gutenberg/pull/43275)) +- Refactor `withSpokenMessages` tests to `@testing-library`. ([43273](https://github.com/WordPress/gutenberg/pull/43273)) +- ToggleGroupControl: Improve styling for icon options. ([43060](https://github.com/WordPress/gutenberg/pull/43060)) + +#### Block Library +- Add a setting to hide the prefix in the archive title. ([42594](https://github.com/WordPress/gutenberg/pull/42594)) +- Embed: Update Reddit icon. ([43326](https://github.com/WordPress/gutenberg/pull/43326)) +- Post date: Add option to display as the last modified date. ([42312](https://github.com/WordPress/gutenberg/pull/42312)) +- Reset focalPoint after replacing the cover image. ([42859](https://github.com/WordPress/gutenberg/pull/42859)) +- Social Link: Update Reddit icon and color to match brand guidelines. ([43325](https://github.com/WordPress/gutenberg/pull/43325)) +- Try "constrained" content width as new layout type. ([42763](https://github.com/WordPress/gutenberg/pull/42763)) +- Try: Add a clickable Group setup state. ([40664](https://github.com/WordPress/gutenberg/pull/40664)) +- Use page list instead of placeholder as fallback. ([42735](https://github.com/WordPress/gutenberg/pull/42735)) +- [Query Loop]: Honour intended post type when previewing patterns and when replacing them with patterns. ([43285](https://github.com/WordPress/gutenberg/pull/43285)) + +#### Global Styles +- BlockGap: Add axial gap option to global styles where available. ([42490](https://github.com/WordPress/gutenberg/pull/42490)) +- Pseudo-elements supports on button elements. ([43088](https://github.com/WordPress/gutenberg/pull/43088)) +- Spacing presets: Add check for 0 spacing steps. ([43105](https://github.com/WordPress/gutenberg/pull/43105)) +- Spacing presets: Add support for margins. ([43246](https://github.com/WordPress/gutenberg/pull/43246)) +- Spacing presets: Implement disabling of custom space sizes. ([43216](https://github.com/WordPress/gutenberg/pull/43216)) + +#### Post Editor +- Editor: Refactor `PostAuthorCheck` tests to `@testing-library`. ([43176](https://github.com/WordPress/gutenberg/pull/43176)) +- Editor: Refactor `ThemeSupportCheck` tests to `@testing-library/react`. ([43532](https://github.com/WordPress/gutenberg/pull/43532)) +- Editor: Refactor a few component tests to `@testing-library/react`. ([43376](https://github.com/WordPress/gutenberg/pull/43376)) + +#### Accessibility +- Block Editor: Remove `aria-selected` from `LinkPreview`. ([43279](https://github.com/WordPress/gutenberg/pull/43279)) +- Block Editor: Replace `aria-owns` with `aria-controls` in `URLInput`. ([43278](https://github.com/WordPress/gutenberg/pull/43278)) +- Separator: Disable the contrastChecker via block.json. ([43357](https://github.com/WordPress/gutenberg/pull/43357)) + +#### CSS & Styling +- Placeholder: Add blurred background to work in nested cases. ([43379](https://github.com/WordPress/gutenberg/pull/43379)) +- Placeholder: Refactor and simplify dashed placeholders used for Featured Image & Site Logo. ([43228](https://github.com/WordPress/gutenberg/pull/43228)) + +#### Testing +- Components: Refactor Placeholder tests to @testing-library/react. ([43069](https://github.com/WordPress/gutenberg/pull/43069)) +- Components: Refactor `Tooltip` tests to `@testing-library/react`. ([43061](https://github.com/WordPress/gutenberg/pull/43061)) + +#### Data Layer +- [data] Export the type for the combineReducers export. ([43516](https://github.com/WordPress/gutenberg/pull/43516)) + +#### Site Editor +- Template Part: Allow changing properties in focus mode. ([43151](https://github.com/WordPress/gutenberg/pull/43151)) + +#### Block Editor +- Refactor `LinkControl` tests to `@testing-library`. ([43147](https://github.com/WordPress/gutenberg/pull/43147)) + + +### Bug Fixes + +- Create Block: Refactor handling for template variants. ([43481](https://github.com/WordPress/gutenberg/pull/43481)) +- Docs: Fix some typos. ([43175](https://github.com/WordPress/gutenberg/pull/43175)) +- Fix no-results grammar. ([43168](https://github.com/WordPress/gutenberg/pull/43168)) +- Fix spinner causing a flash when loading site editor. ([43226](https://github.com/WordPress/gutenberg/pull/43226)) +- Image: Fix unclickable buttons. ([43361](https://github.com/WordPress/gutenberg/pull/43361)) +- Keycodes: Fix display of symbols in keyboard shortcut modal. ([43137](https://github.com/WordPress/gutenberg/pull/43137)) +- MediaReplaceFlow: Reset default LinkControl margins. ([43156](https://github.com/WordPress/gutenberg/pull/43156)) +- Post title: Fix pasting into existing content. ([43123](https://github.com/WordPress/gutenberg/pull/43123)) +- [Block Editor]: Fix block switcher label to take into account block variations. ([43309](https://github.com/WordPress/gutenberg/pull/43309)) +- [useEntityRecord] Pass the correct kind, name, and recordId to getEditedEntityRecord. ([43517](https://github.com/WordPress/gutenberg/pull/43517)) +- wp-env: Set core source to latest when null. ([43133](https://github.com/WordPress/gutenberg/pull/43133)) + +#### Block Library +- Ensure the block toolbar doesn't overlap block by modifying forcePosition and shift popover props. ([42887](https://github.com/WordPress/gutenberg/pull/42887)) +- Ensure pagination numbers have an href in block edit function. ([43354](https://github.com/WordPress/gutenberg/pull/43354)) +- Fix Post Featured Image border attributes. ([43426](https://github.com/WordPress/gutenberg/pull/43426)) +- Fix classic block converted to regular blocks when clicking new 'Edit visually' button. ([43219](https://github.com/WordPress/gutenberg/pull/43219)) +- Fix featured image being unselectable using arrow keys. ([43323](https://github.com/WordPress/gutenberg/pull/43323)) +- Fix navigation block undefined index error on frontend. ([43302](https://github.com/WordPress/gutenberg/pull/43302)) +- Gallery block: Ensure image attributes copy correctly between transforms. ([42796](https://github.com/WordPress/gutenberg/pull/42796)) +- Home Link: Fix undo trap. ([43112](https://github.com/WordPress/gutenberg/pull/43112)) +- List v2: Copy list wrapper when copying list items. ([42860](https://github.com/WordPress/gutenberg/pull/42860)) +- Navigation: Page List fix missing padding. ([43358](https://github.com/WordPress/gutenberg/pull/43358)) +- Prevent query block from looping in classic themes. ([43221](https://github.com/WordPress/gutenberg/pull/43221)) +- Pullquote block: Avoid text-align settings affecting block width and font size. ([43188](https://github.com/WordPress/gutenberg/pull/43188)) +- Pullquote block: Remove font definition from the default block styles. ([43195](https://github.com/WordPress/gutenberg/pull/43195)) +- taxonomy-controls.js: Change REST context to "view" when fetching taxonomy terms. ([43274](https://github.com/WordPress/gutenberg/pull/43274)) + +#### Components +- (Custom)SelectControl: Truncate long options. ([43301](https://github.com/WordPress/gutenberg/pull/43301)) +- AlignmentMatrixControl: Fix `width` bug. ([43482](https://github.com/WordPress/gutenberg/pull/43482)) +- ColorPalette, GradientPicker: Fix color picker popover positioning. ([42989](https://github.com/WordPress/gutenberg/pull/42989)) +- ColorPalette: Make sure "key" is unique when iterating over color entries with the same value. ([43096](https://github.com/WordPress/gutenberg/pull/43096)) +- Dropdown: Anchor popover to the dropdown wrapper (instead of the toggle). ([43377](https://github.com/WordPress/gutenberg/pull/43377)) +- Fix block toolbar offset in site editor when toggling sidebars. ([43172](https://github.com/WordPress/gutenberg/pull/43172)) +- Fix popover glitch that results in incorrect toolbar positioning in site editor. ([43267](https://github.com/WordPress/gutenberg/pull/43267)) +- Improve appearance of controls in the Global Styles Typography panel. ([43304](https://github.com/WordPress/gutenberg/pull/43304)) +- Popover: Fix and improve opening animation, use framer motion. ([43186](https://github.com/WordPress/gutenberg/pull/43186)) +- Popover: Make sure offset middleware always applies the latest frame offset values. ([43329](https://github.com/WordPress/gutenberg/pull/43329)) +- Refactor `Guide` tests to `@testing-library/react`. ([43380](https://github.com/WordPress/gutenberg/pull/43380)) + +#### Global Styles +- Check for recursive dynamic reference in the site editor. ([43166](https://github.com/WordPress/gutenberg/pull/43166)) +- Duotone: Prevent early return blocking other style generation. ([43300](https://github.com/WordPress/gutenberg/pull/43300)) +- Fix dynamic references on the site editor. ([42976](https://github.com/WordPress/gutenberg/pull/42976)) +- Fix error in handling spacing preset slugs. ([43237](https://github.com/WordPress/gutenberg/pull/43237)) +- Layout: Re-instate alignwide and alignfull in flow layout get alignments. ([43502](https://github.com/WordPress/gutenberg/pull/43502)) +- Spacing presets: Fix/minor issues noted in initial UI PR. ([43214](https://github.com/WordPress/gutenberg/pull/43214)) + +#### Block Editor +- Fix Cmd+A issue in Storybook. ([43145](https://github.com/WordPress/gutenberg/pull/43145)) +- Fix drag and drop indicator before first block and after last block. ([43135](https://github.com/WordPress/gutenberg/pull/43135)) +- Fix spinner position in URLInput component. ([43472](https://github.com/WordPress/gutenberg/pull/43472)) +- Partial select: Fix selecting into image. ([42983](https://github.com/WordPress/gutenberg/pull/42983)) + +#### Design Tools +- Border Radius: Prevent invalid css unit only styles or empty radii style attribute. ([42409](https://github.com/WordPress/gutenberg/pull/42409)) +- Border Support: Fix disabling of border style control. ([43109](https://github.com/WordPress/gutenberg/pull/43109)) +- Post Comments Count: Prevent text-decoration from affecting warning. ([43497](https://github.com/WordPress/gutenberg/pull/43497)) + +#### Site Editor +- Do not show scrollbar when toolbar overflows the editor wrapper. ([43332](https://github.com/WordPress/gutenberg/pull/43332)) +- Fix template part focus mode resizable editor height. ([43408](https://github.com/WordPress/gutenberg/pull/43408)) + +#### npm Packages +- Jest Preset: Ignore `is-plain-obj` transformation. ([43179](https://github.com/WordPress/gutenberg/pull/43179)) +- Jest Preset: Improve `is-plain-obj` transformation ignore. ([43271](https://github.com/WordPress/gutenberg/pull/43271)) + +#### Widgets Editor +- Fix legacy widget form positioning in customizer. ([43297](https://github.com/WordPress/gutenberg/pull/43297)) + +#### CSS & Styling +- Group/Stack/Row: Scope the dashed placeholder rules. ([43169](https://github.com/WordPress/gutenberg/pull/43169)) + +#### List View +- Ensure long anchors don't cause the List View to extend. ([43134](https://github.com/WordPress/gutenberg/pull/43134)) + +#### Post Editor +- Post Template: Don't fetch settings and templates for non-admin users. ([42845](https://github.com/WordPress/gutenberg/pull/42845)) + +#### Accessibility +- Fix Top toolbar buttons tooltips and style when 'Show button text labels' is enabled. ([42815](https://github.com/WordPress/gutenberg/pull/42815)) + +#### Patterns +- Fix custom placeholder not displaying on subsequent Paragraph blocks. ([42519](https://github.com/WordPress/gutenberg/pull/42519)) + + +### Performance + +Lodash is known to unnecessarily inflate the bundle size of packages, and in most cases, it can be replaced with native language functionality. See these for more information and rationale ([16938](https://github.com/WordPress/gutenberg/issues/16938#issuecomment-602837246), [17025](https://github.com/WordPress/gutenberg/issues/17025), [39495](https://github.com/WordPress/gutenberg/issues/39495)) + +- Lodash: Refactor away from `_.deburr()`. ([43118](https://github.com/WordPress/gutenberg/pull/43118)) +- Lodash: Refactor away from `_.upperFirst()`. ([43306](https://github.com/WordPress/gutenberg/pull/43306)) +- Lodash: Refactor away from `_.xor()`. ([43389](https://github.com/WordPress/gutenberg/pull/43389)) +- Lodash: Refactor pascal case usages away from Lodash. ([42466](https://github.com/WordPress/gutenberg/pull/42466)) +- Lodash: Remove completely from `@wordpress/create-block` package. ([43362](https://github.com/WordPress/gutenberg/pull/43362)) +- Lodash: Remove completely from `@wordpress/docgen` package. ([43100](https://github.com/WordPress/gutenberg/pull/43100)) +- Lodash: Remove completely from `eslint-plugin` package. ([43420](https://github.com/WordPress/gutenberg/pull/43420)) +- Lodash: Remove from `core-data` resolvers. ([43117](https://github.com/WordPress/gutenberg/pull/43117)) +- Lodash: Refactor away from `_.words()`. ([42467](https://github.com/WordPress/gutenberg/pull/42467)) +- Editor: Remove Lodash from store code. ([42502](https://github.com/WordPress/gutenberg/pull/42502)) +- Lodash: Refactor away from `_.camelCase()`. ([43220](https://github.com/WordPress/gutenberg/pull/43220)) +- Lodash: Refactor away from `_.difference()`. ([43224](https://github.com/WordPress/gutenberg/pull/43224)) +- Lodash: Refactor away from `_.mapKeys()`. ([43258](https://github.com/WordPress/gutenberg/pull/43258)) +- Lodash: Refactor away from `_.times()`. ([43374](https://github.com/WordPress/gutenberg/pull/43374)) +- Lodash: Refactor components away from `_.includes()`. ([43518](https://github.com/WordPress/gutenberg/pull/43518)) +- Lodash: Remove `_.omit()` usage from components. ([43474](https://github.com/WordPress/gutenberg/pull/43474)) +- Lodash: Refactor away from `_.startCase()`. ([43229](https://github.com/WordPress/gutenberg/pull/43229)) +- Lodash: Remove `_.omit()` from deprecated blocks. ([43411](https://github.com/WordPress/gutenberg/pull/43411)) +- Lodash: Refactor away from `_.capitalize()`. ([42465](https://github.com/WordPress/gutenberg/pull/42465)) +- Lodash: Remove completely from `@wordpress/e2e-test-utils` package. ([43231](https://github.com/WordPress/gutenberg/pull/43231)) +- Lodash: Refactor away from `_.sortBy()`. ([43479](https://github.com/WordPress/gutenberg/pull/43479)) +- Lodash: Refactor away from `_.uniq()`. ([43330](https://github.com/WordPress/gutenberg/pull/43330)) +- Lodash: Refactor away from `_.uniqBy()`. ([43182](https://github.com/WordPress/gutenberg/pull/43182)) +- Lodash: Remove completely from `e2e-test-utils-playwright` package. ([43419](https://github.com/WordPress/gutenberg/pull/43419)) + +### Experiments + +#### Components +- Font size picker: Use t-shirt sizes for the ToggleGroupControl component. ([43074](https://github.com/WordPress/gutenberg/pull/43074)) + + +### Documentation + +- Add documentation for useRootPaddingAwareAlignments in theme.json. ([43463](https://github.com/WordPress/gutenberg/pull/43463)) +- Comma is missing. ([43446](https://github.com/WordPress/gutenberg/pull/43446)) +- Convert HTML to Markdown in changelog for 13.9. ([43324](https://github.com/WordPress/gutenberg/pull/43324)) +- Handbook: Fix format API example link. ([43477](https://github.com/WordPress/gutenberg/pull/43477)) +- Stabilize the useResourcePermissions hook. ([43268](https://github.com/WordPress/gutenberg/pull/43268)) +- [Docs] Replace useState with edit in useEntityRecord usage examples. ([43270](https://github.com/WordPress/gutenberg/pull/43270)) +- Block Editor Handbook: Added missing codetabs end marker. ([43185](https://github.com/WordPress/gutenberg/pull/43185)) + + +### Code Quality + +- PHP: Use str_contains(). ([43382](https://github.com/WordPress/gutenberg/pull/43382)) +- PHP: Use str_starts_with. ([43410](https://github.com/WordPress/gutenberg/pull/43410)) +- Style engine: Pass options to CSS static methods. ([43399](https://github.com/WordPress/gutenberg/pull/43399)) +- Style engine tweaks. ([43303](https://github.com/WordPress/gutenberg/pull/43303)) +- Navigation block - minor refactor to classic menu conversion code. ([43081](https://github.com/WordPress/gutenberg/pull/43081)) +- Data: Bundle TypeScript types with the data package. ([43315](https://github.com/WordPress/gutenberg/pull/43315)) +- getTemplateInfo: Return stable reference to an empty object. ([43155](https://github.com/WordPress/gutenberg/pull/43155)) + +#### Components +- Clean up unused and duplicate `COLORS` values. ([43445](https://github.com/WordPress/gutenberg/pull/43445)) +- Packages: Ensure dependencies use version ranges. ([43355](https://github.com/WordPress/gutenberg/pull/43355)) +- Swatch: Remove component in favor of ColorIndicator. ([43068](https://github.com/WordPress/gutenberg/pull/43068)) +- Update/floating UI version. ([43206](https://github.com/WordPress/gutenberg/pull/43206)) + +#### List View +- Block list: Update block list view preferences name for consistency. ([43494](https://github.com/WordPress/gutenberg/pull/43494)) + +#### Widgets Editor +- Use useResourcePermissions in block-library and the widgets editor. ([43305](https://github.com/WordPress/gutenberg/pull/43305)) + +#### Block Editor +- Rich Text: Eliminate second scan when getting text content. ([43207](https://github.com/WordPress/gutenberg/pull/43207)) + +#### Global Styles +- Theme_JSON: Use existing append_to_selector for pseudo-elements. ([43167](https://github.com/WordPress/gutenberg/pull/43167)) +- Enable appearance tools via theme_support. ([43337](https://github.com/WordPress/gutenberg/pull/43337)) + + +### Tools + +- ESLint Plugin: Remove all rules targeting test files from recommended presets. ([43272](https://github.com/WordPress/gutenberg/pull/43272)) +- Fix 'Mark issues stale after needs testing for 30 days' workflow. ([43545](https://github.com/WordPress/gutenberg/pull/43545)) +- Ignore library CSS and built CSS in stylelint. ([42027](https://github.com/WordPress/gutenberg/pull/42027)) + +#### Testing +- Migrate wp editor meta box test to Playwright. ([41519](https://github.com/WordPress/gutenberg/pull/41519)) +- PHPCS: Exclude PHPUnit tests from file and class name sniffs (for Core parity). ([43131](https://github.com/WordPress/gutenberg/pull/43131)) +- PHPUnit: Let PHPUnit Polyfills match PHPUnit version. ([43334](https://github.com/WordPress/gutenberg/pull/43334)) +- PHPUnit: Turns on PHP notices and deprecations. ([43102](https://github.com/WordPress/gutenberg/pull/43102)) +- Update incorrect quote end-to-end test snapshot. ([43407](https://github.com/WordPress/gutenberg/pull/43407)) +- Update test fixture for performance test. ([43359](https://github.com/WordPress/gutenberg/pull/43359)) +- Quote: Stabilise flaky end-to-end test. ([43460](https://github.com/WordPress/gutenberg/pull/43460)) + +#### Build Tooling +- Build Tools: Fix typo in performance tests workflow. ([43153](https://github.com/WordPress/gutenberg/pull/43153)) +- Packages: Update the minimum required Node.js version to 14 for tools. ([43141](https://github.com/WordPress/gutenberg/pull/43141)) + +#### npm Packages +- Packages: Replace `is-plain-obj` with `is-plain-object`. ([43511](https://github.com/WordPress/gutenberg/pull/43511)) + + +#### Components +- (Custom)GradientPicker: Add flag to remove margins. ([43387](https://github.com/WordPress/gutenberg/pull/43387)) +- AlignmentMatrixControl: Improve stories. ([43438](https://github.com/WordPress/gutenberg/pull/43438)) +- AnglePickerControl: Add flag to remove bottom margin. ([43160](https://github.com/WordPress/gutenberg/pull/43160)) +- ComboboxControl: Add flag to remove bottom margin. ([43165](https://github.com/WordPress/gutenberg/pull/43165)) +- CustomSelectControl: Deprecate constrained width style. ([43230](https://github.com/WordPress/gutenberg/pull/43230)) +- DuotonePicker/DuotoneSwatch: Add stories. ([43225](https://github.com/WordPress/gutenberg/pull/43225)) +- Storybook: Add margin checker tool. ([43223](https://github.com/WordPress/gutenberg/pull/43223)) +- ToggleGroupControl: Improve stories for documentation view. ([43265](https://github.com/WordPress/gutenberg/pull/43265)) +- ToolsPanel: Tighten grid gaps. ([43424](https://github.com/WordPress/gutenberg/pull/43424)) + +#### Block Library +- Buttons: Update selectors to work better with button elements. ([43022](https://github.com/WordPress/gutenberg/pull/43022)) +- Comments block: Remove empty block wrapper. ([43383](https://github.com/WordPress/gutenberg/pull/43383)) +- Group block: Update description to remove "layout." ([43498](https://github.com/WordPress/gutenberg/pull/43498)) +- Image: Try different resting state for placeholder, alternate version. ([43180](https://github.com/WordPress/gutenberg/pull/43180)) +- Navigation: Try to improve the appender in an empty block. ([43115](https://github.com/WordPress/gutenberg/pull/43115)) +- Polish placeholder radius and enable duotone on image setup state. ([43425](https://github.com/WordPress/gutenberg/pull/43425)) +- Pullquote: Use inline rich text instead of multiline. ([43210](https://github.com/WordPress/gutenberg/pull/43210)) +- [Blocks] Paragraph and Heading: Add gradient support. ([43119](https://github.com/WordPress/gutenberg/pull/43119)) + +#### Patterns +- Bundle new collection of Header and Footer block patterns. ([43157](https://github.com/WordPress/gutenberg/pull/43157)) +- Mark which attributes of the image should be considered content. ([43280](https://github.com/WordPress/gutenberg/pull/43280)) +- Prefer _x() for i18n context in core patterns. ([43409](https://github.com/WordPress/gutenberg/pull/43409)) + +#### Design Tools +- Add margin and padding supports to Audio block. ([43351](https://github.com/WordPress/gutenberg/pull/43351)) +- Add margin/padding support to Archives block. ([43350](https://github.com/WordPress/gutenberg/pull/43350)) + +#### Global Styles +- Add documentation about spacing presets. ([43349](https://github.com/WordPress/gutenberg/pull/43349)) +- Spacing presets: Add editor UI support. ([42173](https://github.com/WordPress/gutenberg/pull/42173)) + +#### Site Editor +- [Site Editor]: Add success notice upon template creation. ([43430](https://github.com/WordPress/gutenberg/pull/43430)) + +#### CSS & Styling +- Style engine: Use style engine for block supports CSS in editor. ([43055](https://github.com/WordPress/gutenberg/pull/43055)) +- Style engine: Remove `enqueue` flag. ([43103](https://github.com/WordPress/gutenberg/pull/43103)) + +#### Block Editor +- Merging blocks: Allow x to be merged into wrapper blocks (quote, list, group...). ([42780](https://github.com/WordPress/gutenberg/pull/42780)) + + +## First time contributors + +The following PRs were merged by first time contributors: + +- @drzraf: taxonomy-controls.js: Change REST context to "view" when fetching taxonomy terms. ([43274](https://github.com/WordPress/gutenberg/pull/43274)) +- @markbiek: ComboboxControl: Normalize hyphen-like Unicode characters to ASCII hyphens when matching search queries. ([42942](https://github.com/WordPress/gutenberg/pull/42942)) +- @randhirexpresstech: Add font family and text-decoration typography supports to paragraph blocks. ([39642](https://github.com/WordPress/gutenberg/pull/39642)) +- @Rink9: Migrate wp editor meta box test to Playwright. ([41519](https://github.com/WordPress/gutenberg/pull/41519)) +- @titusdmoore: Add optional capture group to URL regex in wp-env. ([43200](https://github.com/WordPress/gutenberg/pull/43200)) + + +## Contributors + +The following contributors merged PRs in this release: + +@aaronrobertshaw @adamziel @afercia @andrewserong @aristath @awps @carolinan @ciampo @derekblank @dinhtungdu @dmsnell @draganescu @drzraf @ellatrix @geriux @glendaviesnz @gziolo @hellofromtonya @hz-tyfoon @jasmussen @jostnes @kdevnel @MaggieCabrera @Mamaduka @markbiek @matiasbenedetto @mcsf @mirka @ndiego @noahtallen @noisysocks @ntsekouras @oandregal @ockham @paulopmt1 @pbking @ramonjd @randhirexpresstech @Rink9 @ryanwelcher @scruffian @SiobhyB @Soean @t-hamano @talldan @tellthemachines @titusdmoore @torounit @tyxla @walbo + + = 13.9.0 = ## Changelog From c170c182b0cb92badbc647bf341428e003870296 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 24 Aug 2022 21:58:28 +0400 Subject: [PATCH 13/68] Post Terms: Refactor the usePostTerms hook (#43503) --- packages/block-library/src/post-terms/edit.js | 1 - .../src/post-terms/use-post-terms.js | 24 +++++++------------ 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/packages/block-library/src/post-terms/edit.js b/packages/block-library/src/post-terms/edit.js index 7e7d70ec2b8f18..a85e32ff4a9df6 100644 --- a/packages/block-library/src/post-terms/edit.js +++ b/packages/block-library/src/post-terms/edit.js @@ -58,7 +58,6 @@ export default function PostTermsEdit( { ); const { postTerms, hasPostTerms, isLoading } = usePostTerms( { postId, - postType, term: selectedTerm, } ); const hasPost = postId && postType; diff --git a/packages/block-library/src/post-terms/use-post-terms.js b/packages/block-library/src/post-terms/use-post-terms.js index c5477703cfb7d3..99c9ddcfbfb463 100644 --- a/packages/block-library/src/post-terms/use-post-terms.js +++ b/packages/block-library/src/post-terms/use-post-terms.js @@ -1,12 +1,12 @@ /** * WordPress dependencies */ -import { useEntityProp, store as coreStore } from '@wordpress/core-data'; +import { store as coreStore } from '@wordpress/core-data'; import { useSelect } from '@wordpress/data'; -export default function usePostTerms( { postId, postType, term } ) { - const { rest_base: restBase, slug } = term; - const [ termIds ] = useEntityProp( 'postType', postType, restBase, postId ); +export default function usePostTerms( { postId, term } ) { + const { slug } = term; + return useSelect( ( select ) => { const visible = term?.visibility?.publicly_queryable; @@ -17,31 +17,25 @@ export default function usePostTerms( { postId, postType, term } ) { hasPostTerms: false, }; } - if ( ! termIds ) { - // Waiting for post terms to be fetched. - return { isLoading: term?.postTerms?.includes( postType ) }; - } - if ( ! termIds.length ) { - return { isLoading: false }; - } + const { getEntityRecords, isResolving } = select( coreStore ); const taxonomyArgs = [ 'taxonomy', slug, { - include: termIds, + post: postId, per_page: -1, context: 'view', }, ]; const terms = getEntityRecords( ...taxonomyArgs ); - const _isLoading = isResolving( 'getEntityRecords', taxonomyArgs ); + return { postTerms: terms, - isLoading: _isLoading, + isLoading: isResolving( 'getEntityRecords', taxonomyArgs ), hasPostTerms: !! terms?.length, }; }, - [ termIds, term?.visibility?.publicly_queryable ] + [ postId, term?.visibility?.publicly_queryable ] ); } From 17223f5fc8f82397e3e306bf0f218af211435524 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ella=20van=C2=A0Durpe?= <4710635+ellatrix@users.noreply.github.com> Date: Wed, 24 Aug 2022 20:15:23 +0200 Subject: [PATCH 14/68] List: use nested blocks (#42711) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: André <583546+oandregal@users.noreply.github.com> --- .../block-editor-settings-mobile.php | 4 +- lib/experimental/blocks.php | 27 -- lib/experiments-page.php | 12 - lib/load.php | 1 - .../use-focus-first-element.js | 2 +- .../components/writing-flow/use-select-all.js | 23 +- packages/block-library/src/index.js | 5 +- packages/block-library/src/index.native.js | 15 +- .../block-library/src/list-item/block.json | 1 - .../src/list-item/hooks/use-space.js | 12 +- packages/block-library/src/list/deprecated.js | 72 ++- packages/block-library/src/list/edit.js | 278 ++++++------ packages/block-library/src/list/index.js | 49 +- packages/block-library/src/list/save.js | 7 +- .../src/list/{v2 => }/tag-name.js | 0 .../src/list/{v2 => }/tag-name.native.js | 0 .../test/__snapshots__/edit.native.js.snap | 16 +- .../block-library/src/list/test/migrate.js | 158 ------- packages/block-library/src/list/transforms.js | 168 +++---- .../src/list/{v2/migrate.js => utils.js} | 4 +- .../block-library/src/list/v2/deprecated.js | 89 ---- packages/block-library/src/list/v2/edit.js | 192 -------- packages/block-library/src/list/v2/index.js | 22 - packages/block-library/src/list/v2/save.js | 18 - .../block-library/src/list/v2/transforms.js | 120 ----- .../src/api/raw-handling/paste-handler.js | 5 +- .../__snapshots__/cpt-locking.test.js.snap | 4 +- .../inner-blocks-allowed-blocks.test.js | 3 + .../__snapshots__/block-deletion.test.js.snap | 4 +- ...ep-styles-on-block-transforms.test.js.snap | 6 - .../multi-block-selection.test.js.snap | 26 +- .../__snapshots__/rich-text.test.js.snap | 24 +- .../__snapshots__/writing-flow.test.js.snap | 14 +- .../editor/various/block-switcher.test.js | 14 +- .../keep-styles-on-block-transforms.test.js | 17 - .../various/multi-block-selection.test.js | 8 + .../specs/editor/various/rich-text.test.js | 15 +- .../editor/various/splitting-merging.test.js | 9 +- .../various/toolbar-roving-tabindex.test.js | 3 +- .../specs/editor/various/writing-flow.test.js | 12 +- packages/react-native-editor/src/setup.js | 9 +- test/e2e/specs/editor/blocks/list.spec.js | 424 +++++++++++++++--- .../blocks-raw-handling.test.js.snap | 16 +- test/integration/blocks-raw-handling.test.js | 32 +- .../fixtures/blocks/core__list-item.html | 3 + .../fixtures/blocks/core__list-item.json | 10 + .../blocks/core__list-item.parsed.json | 9 + .../blocks/core__list-item.serialized.html | 3 + .../blocks/core__list__deprecated-v0.html | 3 + .../blocks/core__list__deprecated-v0.json | 37 ++ .../core__list__deprecated-v0.parsed.json | 17 + .../core__list__deprecated-v0.serialized.html | 13 + .../blocks/core__list__deprecated-v1.html | 6 +- .../blocks/core__list__deprecated-v1.json | 54 ++- .../core__list__deprecated-v1.parsed.json | 12 +- .../core__list__deprecated-v1.serialized.html | 26 +- .../fixtures/blocks/core__list__ul.html | 28 +- .../fixtures/blocks/core__list__ul.json | 53 ++- .../blocks/core__list__ul.parsed.json | 67 ++- .../blocks/core__list__ul.serialized.html | 24 +- .../fixtures/documents/apple-out.html | 28 +- .../fixtures/documents/evernote-out.html | 34 +- .../fixtures/documents/google-docs-out.html | 28 +- .../google-docs-with-comments-out.html | 28 +- .../fixtures/documents/markdown-out.html | 28 +- .../documents/ms-word-online-out.html | 30 +- .../fixtures/documents/ms-word-out.html | 28 +- 67 files changed, 1364 insertions(+), 1145 deletions(-) delete mode 100644 lib/experimental/blocks.php rename packages/block-library/src/list/{v2 => }/tag-name.js (100%) rename packages/block-library/src/list/{v2 => }/tag-name.native.js (100%) delete mode 100644 packages/block-library/src/list/test/migrate.js rename packages/block-library/src/list/{v2/migrate.js => utils.js} (94%) delete mode 100644 packages/block-library/src/list/v2/deprecated.js delete mode 100644 packages/block-library/src/list/v2/edit.js delete mode 100644 packages/block-library/src/list/v2/index.js delete mode 100644 packages/block-library/src/list/v2/save.js delete mode 100644 packages/block-library/src/list/v2/transforms.js create mode 100644 test/integration/fixtures/blocks/core__list-item.html create mode 100644 test/integration/fixtures/blocks/core__list-item.json create mode 100644 test/integration/fixtures/blocks/core__list-item.parsed.json create mode 100644 test/integration/fixtures/blocks/core__list-item.serialized.html create mode 100644 test/integration/fixtures/blocks/core__list__deprecated-v0.html create mode 100644 test/integration/fixtures/blocks/core__list__deprecated-v0.json create mode 100644 test/integration/fixtures/blocks/core__list__deprecated-v0.parsed.json create mode 100644 test/integration/fixtures/blocks/core__list__deprecated-v0.serialized.html diff --git a/lib/experimental/block-editor-settings-mobile.php b/lib/experimental/block-editor-settings-mobile.php index 4319f8766352cb..b0da17e9296671 100644 --- a/lib/experimental/block-editor-settings-mobile.php +++ b/lib/experimental/block-editor-settings-mobile.php @@ -29,8 +29,8 @@ function gutenberg_get_block_editor_settings_mobile( $settings ) { // To tell mobile that the site uses quote v2 (inner blocks). // See https://github.com/WordPress/gutenberg/pull/25892. $settings['__experimentalEnableQuoteBlockV2'] = true; - // To be set to true when the web makes quote v2 (inner blocks) the default. - $settings['__experimentalEnableListBlockV2'] = gutenberg_is_list_v2_enabled(); + // To tell mobile that the site uses list v2 (inner blocks). + $settings['__experimentalEnableListBlockV2'] = true; } return $settings; diff --git a/lib/experimental/blocks.php b/lib/experimental/blocks.php deleted file mode 100644 index 80691e5d917ab9..00000000000000 --- a/lib/experimental/blocks.php +++ /dev/null @@ -1,27 +0,0 @@ - __( 'Test a new list block that uses nested list item blocks (Warning: The new block is not ready. You may experience content loss, avoid using it on production sites)', 'gutenberg' ), - 'id' => 'gutenberg-list-v2', - ) - ); register_setting( 'gutenberg-experiments', 'gutenberg-experiments' diff --git a/lib/load.php b/lib/load.php index 9600d3100d3b7e..cb2ad7721c3200 100644 --- a/lib/load.php +++ b/lib/load.php @@ -103,7 +103,6 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/experimental/class-wp-webfonts-provider.php'; require __DIR__ . '/experimental/class-wp-webfonts-provider-local.php'; require __DIR__ . '/experimental/webfonts.php'; -require __DIR__ . '/experimental/blocks.php'; require __DIR__ . '/experimental/navigation-theme-opt-in.php'; require __DIR__ . '/experimental/navigation-page.php'; diff --git a/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js b/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js index 8b95f19f3c9ff2..492555935dadf1 100644 --- a/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js +++ b/packages/block-editor/src/components/block-list/use-block-props/use-focus-first-element.js @@ -85,7 +85,7 @@ export function useFocusFirstElement( clientId ) { const { ownerDocument } = ref.current; // Do not focus the block if it already contains the active element. - if ( ref.current.contains( ownerDocument.activeElement ) ) { + if ( isInsideRootBlock( ref.current, ownerDocument.activeElement ) ) { return; } diff --git a/packages/block-editor/src/components/writing-flow/use-select-all.js b/packages/block-editor/src/components/writing-flow/use-select-all.js index 15473e3a201c78..93c55c185b8c76 100644 --- a/packages/block-editor/src/components/writing-flow/use-select-all.js +++ b/packages/block-editor/src/components/writing-flow/use-select-all.js @@ -37,28 +37,25 @@ export default function useSelectAll() { return; } + event.preventDefault(); + const [ firstSelectedClientId ] = selectedClientIds; const rootClientId = getBlockRootClientId( firstSelectedClientId ); - let blockClientIds = getBlockOrder( rootClientId ); + const blockClientIds = getBlockOrder( rootClientId ); // If we have selected all sibling nested blocks, try selecting up a // level. See: https://github.com/WordPress/gutenberg/pull/31859/ if ( selectedClientIds.length === blockClientIds.length ) { - blockClientIds = getBlockOrder( - getBlockRootClientId( rootClientId ) - ); - } - - const firstClientId = first( blockClientIds ); - const lastClientId = last( blockClientIds ); - - if ( firstClientId === lastClientId ) { - selectBlock( firstClientId ); + if ( rootClientId ) { + node.ownerDocument.defaultView + .getSelection() + .removeAllRanges(); + selectBlock( rootClientId ); + } return; } - multiSelect( firstClientId, lastClientId ); - event.preventDefault(); + multiSelect( first( blockClientIds ), last( blockClientIds ) ); } node.addEventListener( 'keydown', onKeyDown ); diff --git a/packages/block-library/src/index.js b/packages/block-library/src/index.js index f0d5924d7248d8..e71ee9326a4b86 100644 --- a/packages/block-library/src/index.js +++ b/packages/block-library/src/index.js @@ -290,10 +290,7 @@ export const registerCoreBlocks = ( export const __experimentalRegisterExperimentalCoreBlocks = process.env .IS_GUTENBERG_PLUGIN ? ( { enableFSEBlocks } = {} ) => { - const enabledExperiments = [ - window.__experimentalEnableListBlockV2 ? 'list-v2' : null, - enableFSEBlocks ? 'fse' : null, - ]; + const enabledExperiments = [ enableFSEBlocks ? 'fse' : null ]; getAllBlocks() .filter( ( { metadata } ) => isBlockMetadataExperimental( metadata ) diff --git a/packages/block-library/src/index.native.js b/packages/block-library/src/index.native.js index 6285ad2f91377a..1acc90c0116c60 100644 --- a/packages/block-library/src/index.native.js +++ b/packages/block-library/src/index.native.js @@ -186,14 +186,6 @@ const devOnly = ( block ) => ( !! __DEV__ ? block : null ); const iOSOnly = ( block ) => Platform.OS === 'ios' ? block : devOnly( block ); -// To be removed once List V2 is released on the web editor. -function listCheck( listBlock, blocksFlags ) { - if ( blocksFlags?.__experimentalEnableListBlockV2 ) { - listBlock.settings = listBlock?.settingsV2; - } - return listBlock; -} - // Hide the Classic block and SocialLink block addFilter( 'blocks.registerBlockType', @@ -245,11 +237,8 @@ addFilter( * * registerCoreBlocks(); * ``` - * @param {Object} [blocksFlags] Experimental flags - * - * */ -export const registerCoreBlocks = ( blocksFlags ) => { +export const registerCoreBlocks = () => { // When adding new blocks to this list please also consider updating /src/block-support/supported-blocks.json in the Gutenberg-Mobile repo [ paragraph, @@ -261,7 +250,7 @@ export const registerCoreBlocks = ( blocksFlags ) => { video, nextpage, separator, - listCheck( list, blocksFlags ), + list, listItem, quote, mediaText, diff --git a/packages/block-library/src/list-item/block.json b/packages/block-library/src/list-item/block.json index 5b8ad8456944f3..674cf381aa99c8 100644 --- a/packages/block-library/src/list-item/block.json +++ b/packages/block-library/src/list-item/block.json @@ -1,7 +1,6 @@ { "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 2, - "__experimental": "list-v2", "name": "core/list-item", "title": "List item", "category": "text", diff --git a/packages/block-library/src/list-item/hooks/use-space.js b/packages/block-library/src/list-item/hooks/use-space.js index 3fc6d1157eb2e6..6079b2c5edb281 100644 --- a/packages/block-library/src/list-item/hooks/use-space.js +++ b/packages/block-library/src/list-item/hooks/use-space.js @@ -19,13 +19,21 @@ export default function useSpace( clientId ) { return useRefEffect( ( element ) => { function onKeyDown( event ) { + const { keyCode, shiftKey, altKey, metaKey, ctrlKey } = event; + if ( event.defaultPrevented || - event.keyCode !== SPACE || - ! canIndent + ! canIndent || + keyCode !== SPACE || + // Only override when no modifiers are pressed. + shiftKey || + altKey || + metaKey || + ctrlKey ) { return; } + const selectionStart = getSelectionStart(); const selectionEnd = getSelectionEnd(); if ( diff --git a/packages/block-library/src/list/deprecated.js b/packages/block-library/src/list/deprecated.js index a3454f5ae050c5..cfd7e3039cee87 100644 --- a/packages/block-library/src/list/deprecated.js +++ b/packages/block-library/src/list/deprecated.js @@ -7,6 +7,7 @@ import { RichText, useBlockProps } from '@wordpress/block-editor'; * Internal dependencies */ import migrateFontFamily from '../utils/migrate-font-family'; +import { migrateToListV2 } from './utils'; const v0 = { attributes: { @@ -68,6 +69,75 @@ const v0 = { }, }; +const v1 = { + attributes: { + ordered: { + type: 'boolean', + default: false, + __experimentalRole: 'content', + }, + values: { + type: 'string', + source: 'html', + selector: 'ol,ul', + multiline: 'li', + __unstableMultilineWrapperTags: [ 'ol', 'ul' ], + default: '', + __experimentalRole: 'content', + }, + type: { + type: 'string', + }, + start: { + type: 'number', + }, + reversed: { + type: 'boolean', + }, + placeholder: { + type: 'string', + }, + }, + supports: { + anchor: true, + className: false, + typography: { + fontSize: true, + __experimentalFontFamily: true, + lineHeight: true, + __experimentalFontStyle: true, + __experimentalFontWeight: true, + __experimentalLetterSpacing: true, + __experimentalTextTransform: true, + __experimentalDefaultControls: { + fontSize: true, + }, + }, + color: { + gradients: true, + link: true, + __experimentalDefaultControls: { + background: true, + text: true, + }, + }, + __unstablePasteTextInline: true, + __experimentalSelector: 'ol,ul', + __experimentalSlashInserter: true, + }, + save( { attributes } ) { + const { ordered, values, type, reversed, start } = attributes; + const TagName = ordered ? 'ol' : 'ul'; + + return ( + + + + ); + }, + migrate: migrateToListV2, +}; + /** * New deprecations need to be placed first * for them to have higher priority. @@ -76,4 +146,4 @@ const v0 = { * * See block-deprecation.md */ -export default [ v0 ]; +export default [ v1, v0 ]; diff --git a/packages/block-library/src/list/edit.js b/packages/block-library/src/list/edit.js index 8d39252aee128b..41b1376b51492a 100644 --- a/packages/block-library/src/list/edit.js +++ b/packages/block-library/src/list/edit.js @@ -1,177 +1,189 @@ +/** + * External dependencies + */ +import { last } from 'lodash'; + /** * WordPress dependencies */ -import { __, _x, isRTL } from '@wordpress/i18n'; -import { createBlock } from '@wordpress/blocks'; import { - RichText, BlockControls, - RichTextShortcut, useBlockProps, + useInnerBlocksProps, + store as blockEditorStore, } from '@wordpress/block-editor'; import { ToolbarButton } from '@wordpress/components'; -import { - __unstableCanIndentListItems as canIndentListItems, - __unstableCanOutdentListItems as canOutdentListItems, - __unstableIndentListItems as indentListItems, - __unstableOutdentListItems as outdentListItems, - __unstableChangeListType as changeListType, - __unstableIsListRootSelected as isListRootSelected, - __unstableIsActiveListType as isActiveListType, -} from '@wordpress/rich-text'; +import { useDispatch, useSelect, useRegistry } from '@wordpress/data'; +import { isRTL, __ } from '@wordpress/i18n'; import { formatListBullets, formatListBulletsRTL, formatListNumbered, formatListNumberedRTL, - formatIndent, - formatIndentRTL, formatOutdent, formatOutdentRTL, } from '@wordpress/icons'; +import { createBlock } from '@wordpress/blocks'; +import { useCallback, useEffect, Platform } from '@wordpress/element'; +import deprecated from '@wordpress/deprecated'; /** * Internal dependencies */ -import { name } from './'; import OrderedListSettings from './ordered-list-settings'; +import { migrateToListV2 } from './utils'; +import TagName from './tag-name'; -export default function ListEdit( { - attributes, - setAttributes, - mergeBlocks, - onReplace, - style, -} ) { - const { ordered, values, type, reversed, start, placeholder } = attributes; - const tagName = ordered ? 'ol' : 'ul'; +const TEMPLATE = [ [ 'core/list-item' ] ]; +const NATIVE_MARGIN_SPACING = 8; - const controls = ( { value, onChange, onFocus } ) => ( - <> - { - onChange( outdentListItems( value ) ); - } } - /> - { - onChange( indentListItems( value, { type: tagName } ) ); - } } - /> - { - onChange( indentListItems( value, { type: tagName } ) ); - } } - /> - { - onChange( outdentListItems( value ) ); - } } - /> - - { - onChange( changeListType( value, { type: 'ul' } ) ); - onFocus(); +/** + * At the moment, deprecations don't handle create blocks from attributes + * (like when using CPT templates). For this reason, this hook is necessary + * to avoid breaking templates using the old list block format. + * + * @param {Object} attributes Block attributes. + * @param {string} clientId Block client ID. + */ +function useMigrateOnLoad( attributes, clientId ) { + const registry = useRegistry(); + const { updateBlockAttributes, replaceInnerBlocks } = + useDispatch( blockEditorStore ); - if ( isListRootSelected( value ) ) { - setAttributes( { ordered: false } ); - } - } } - /> - { - onChange( changeListType( value, { type: 'ol' } ) ); - onFocus(); + useEffect( () => { + // As soon as the block is loaded, migrate it to the new version. - if ( isListRootSelected( value ) ) { - setAttributes( { ordered: true } ); - } - } } - /> - { - onChange( outdentListItems( value ) ); - onFocus(); - } } - /> - { - onChange( indentListItems( value, { type: tagName } ) ); - onFocus(); - } } - /> - + if ( ! attributes.values ) { + return; + } + + const [ newAttributes, newInnerBlocks ] = migrateToListV2( attributes ); + + deprecated( 'Value attribute on the list block', { + since: '6.0', + version: '6.5', + alternative: 'inner blocks', + } ); + + registry.batch( () => { + updateBlockAttributes( clientId, newAttributes ); + replaceInnerBlocks( clientId, newInnerBlocks ); + } ); + }, [ attributes.values ] ); +} + +function useOutdentList( clientId ) { + const { canOutdent } = useSelect( + ( innerSelect ) => { + const { getBlockRootClientId, getBlock } = + innerSelect( blockEditorStore ); + const parentId = getBlockRootClientId( clientId ); + return { + canOutdent: + !! parentId && + getBlock( parentId ).name === 'core/list-item', + }; + }, + [ clientId ] + ); + const { replaceBlocks, selectionChange } = useDispatch( blockEditorStore ); + const { getBlockRootClientId, getBlockAttributes, getBlock } = + useSelect( blockEditorStore ); + + return [ + canOutdent, + useCallback( () => { + const parentBlockId = getBlockRootClientId( clientId ); + const parentBlockAttributes = getBlockAttributes( parentBlockId ); + // Create a new parent block without the inner blocks. + const newParentBlock = createBlock( + 'core/list-item', + parentBlockAttributes + ); + const { innerBlocks } = getBlock( clientId ); + // Replace the parent block with a new parent block without inner blocks, + // and make the inner blocks siblings of the parent. + replaceBlocks( + [ parentBlockId ], + [ newParentBlock, ...innerBlocks ] + ); + // Select the last child of the list being outdent. + selectionChange( last( innerBlocks ).clientId ); + }, [ clientId ] ), + ]; +} + +function IndentUI( { clientId } ) { + const [ canOutdent, outdentList ] = useOutdentList( clientId ); + return ( + <> + ); +} +export default function Edit( { attributes, setAttributes, clientId, style } ) { const blockProps = useBlockProps( { - style, + ...( Platform.isNative && { style } ), + } ); + const innerBlocksProps = useInnerBlocksProps( blockProps, { + allowedBlocks: [ 'core/list-item' ], + template: TEMPLATE, + templateInsertUpdatesSelection: true, + ...( Platform.isNative && { + marginVertical: NATIVE_MARGIN_SPACING, + marginHorizontal: NATIVE_MARGIN_SPACING, + } ), } ); + useMigrateOnLoad( attributes, clientId ); + const { ordered, type, reversed, start } = attributes; + + const controls = ( + + { + setAttributes( { ordered: false } ); + } } + /> + { + setAttributes( { ordered: true } ); + } } + /> + + + ); return ( <> - - setAttributes( { values: nextValues } ) - } - value={ values } - aria-label={ __( 'List text' ) } - placeholder={ placeholder || __( 'List' ) } - onMerge={ mergeBlocks } - onSplit={ ( value ) => - createBlock( name, { ...attributes, values: value } ) - } - __unstableOnSplitMiddle={ () => - createBlock( 'core/paragraph' ) - } - onReplace={ onReplace } - onRemove={ () => onReplace( [] ) } - start={ start } + - { controls } - + { ...innerBlocksProps } + /> + { controls } { ordered && ( ) } diff --git a/packages/block-library/src/list/index.js b/packages/block-library/src/list/index.js index a401d75eb14581..6df2d4ef403337 100644 --- a/packages/block-library/src/list/index.js +++ b/packages/block-library/src/list/index.js @@ -2,6 +2,7 @@ * WordPress dependencies */ import { list as icon } from '@wordpress/icons'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies @@ -11,41 +12,41 @@ import edit from './edit'; import metadata from './block.json'; import save from './save'; import transforms from './transforms'; -import settingsV2 from './v2'; const { name } = metadata; -export { metadata, name, settingsV2 }; +export { metadata, name }; -const settingsV1 = { +const settings = { icon, example: { - attributes: { - values: '
  • Alice.
  • The White Rabbit.
  • The Cheshire Cat.
  • The Mad Hatter.
  • The Queen of Hearts.
  • ', - }, + innerBlocks: [ + { + name: 'core/list-item', + attributes: { content: __( 'Alice.' ) }, + }, + { + name: 'core/list-item', + attributes: { content: __( 'The White Rabbit.' ) }, + }, + { + name: 'core/list-item', + attributes: { content: __( 'The Cheshire Cat.' ) }, + }, + { + name: 'core/list-item', + attributes: { content: __( 'The Mad Hatter.' ) }, + }, + { + name: 'core/list-item', + attributes: { content: __( 'The Queen of Hearts.' ) }, + }, + ], }, transforms, - merge( attributes, attributesToMerge ) { - const { values } = attributesToMerge; - - if ( ! values || values === '
  • ' ) { - return attributes; - } - - return { - ...attributes, - values: attributes.values + values, - }; - }, edit, save, deprecated, }; -let settings = settingsV1; -if ( process.env.IS_GUTENBERG_PLUGIN ) { - settings = window?.__experimentalEnableListBlockV2 - ? settingsV2 - : settingsV1; -} export { settings }; diff --git a/packages/block-library/src/list/save.js b/packages/block-library/src/list/save.js index 7d4f8a37fc86a5..c74893f38b67b2 100644 --- a/packages/block-library/src/list/save.js +++ b/packages/block-library/src/list/save.js @@ -1,15 +1,14 @@ /** * WordPress dependencies */ -import { RichText, useBlockProps } from '@wordpress/block-editor'; +import { InnerBlocks, useBlockProps } from '@wordpress/block-editor'; export default function save( { attributes } ) { - const { ordered, values, type, reversed, start } = attributes; + const { ordered, type, reversed, start } = attributes; const TagName = ordered ? 'ol' : 'ul'; - return ( - + ); } diff --git a/packages/block-library/src/list/v2/tag-name.js b/packages/block-library/src/list/tag-name.js similarity index 100% rename from packages/block-library/src/list/v2/tag-name.js rename to packages/block-library/src/list/tag-name.js diff --git a/packages/block-library/src/list/v2/tag-name.native.js b/packages/block-library/src/list/tag-name.native.js similarity index 100% rename from packages/block-library/src/list/v2/tag-name.native.js rename to packages/block-library/src/list/tag-name.native.js diff --git a/packages/block-library/src/list/test/__snapshots__/edit.native.js.snap b/packages/block-library/src/list/test/__snapshots__/edit.native.js.snap index 3fe53069b1775b..a573276840bb6d 100644 --- a/packages/block-library/src/list/test/__snapshots__/edit.native.js.snap +++ b/packages/block-library/src/list/test/__snapshots__/edit.native.js.snap @@ -122,12 +122,24 @@ exports[`List V2 block shows different indentation levels 1`] = ` exports[`List block inserts block 1`] = ` " -
    +
      +
    • +
    " `; exports[`List block renders a list with a few items 1`] = ` " -
    • Item 1
    • Item 2
    • Item 3
    +
      +
    • Item 1
    • + + + +
    • Item 2
    • + + + +
    • Item 3
    • +
    " `; diff --git a/packages/block-library/src/list/test/migrate.js b/packages/block-library/src/list/test/migrate.js deleted file mode 100644 index a57693d341bd57..00000000000000 --- a/packages/block-library/src/list/test/migrate.js +++ /dev/null @@ -1,158 +0,0 @@ -/** - * WordPress dependencies - */ -import { registerBlockType, serialize } from '@wordpress/blocks'; - -/** - * Internal dependencies - */ -import { migrateToListV2 } from '../v2/migrate'; -import * as listItem from '../../list-item'; -import * as list from '../../list'; -import listV2 from '../../list/v2'; - -describe( 'Migrate list block', () => { - beforeAll( () => { - const prev = window.__experimentalEnableListBlockV2; - - // force list and list item block registration. - registerBlockType( - { name: listItem.name, ...listItem.metadata }, - listItem.settings - ); - registerBlockType( { name: list.name, ...list.metadata }, listV2 ); - - window.__experimentalEnableListBlockV2 = prev; - } ); - - it( 'should migrate the values attribute to inner blocks', () => { - const [ updatedAttributes, updatedInnerBlocks ] = migrateToListV2( { - values: '
  • test
  • test
  • test
    1. test test
    2. test est eesssss
  • ', - ordered: false, - } ); - - expect( updatedAttributes ).toEqual( { - ordered: false, - // Ideally the values attributes shouldn't be here - // but since we didn't enable v2 by default yet, - // we're keeping the old default value in block.json - values: '', - } ); - expect( serialize( updatedInnerBlocks ) ) - .toEqual( ` -
  • test
  • - - - -
  • test
  • - - - -
  • test -
      -
    1. test test
    2. - - - -
    3. test est eesssss
    4. -
    -
  • -` ); - } ); - - it( 'should handle empty space properly', () => { - const [ updatedAttributes, updatedInnerBlocks ] = migrateToListV2( { - values: `
  • Europe
  • -
  • - \tAfrica -
      -
    1. Algeria
    2. -
    - \t -
  • `, - ordered: false, - } ); - - expect( updatedAttributes ).toEqual( { - ordered: false, - // Ideally the values attributes shouldn't be here - // but since we didn't enable v2 by default yet, - // we're keeping the old default value in block.json - values: '', - } ); - expect( serialize( updatedInnerBlocks ) ) - .toEqual( ` -
  • Europe
  • - - - -
  • Africa -
      -
    1. Algeria
    2. -
    -
  • -` ); - } ); - - it( 'should handle formats properly', () => { - const [ updatedAttributes, updatedInnerBlocks ] = migrateToListV2( { - values: `
  • Europe
    • France
      • Lyon Rhones
      • Paris Ile de france
        • 1er
  • `, - ordered: false, - } ); - - expect( updatedAttributes ).toEqual( { - ordered: false, - // Ideally the values attributes shouldn't be here - // but since we didn't enable v2 by default yet, - // we're keeping the old default value in block.json - values: '', - } ); - expect( serialize( updatedInnerBlocks ) ) - .toEqual( ` -
  • Europe -
      -
    • France -
        -
      • Lyon Rhones
      • - - - -
      • Paris Ile de france -
          -
        • 1er
        • -
        -
      • -
      -
    • -
    -
  • -` ); - } ); - - it( 'should not add random space', () => { - const [ updatedAttributes, updatedInnerBlocks ] = migrateToListV2( { - values: `
  • Europe
    • France
      • Paris
  • `, - ordered: false, - } ); - - expect( updatedAttributes ).toEqual( { - ordered: false, - // Ideally the values attributes shouldn't be here - // but since we didn't enable v2 by default yet, - // we're keeping the old default value in block.json - values: '', - } ); - expect( serialize( updatedInnerBlocks ) ) - .toEqual( ` -
  • Europe -
      -
    • France -
        -
      • Paris
      • -
      -
    • -
    -
  • -` ); - } ); -} ); diff --git a/packages/block-library/src/list/transforms.js b/packages/block-library/src/list/transforms.js index 8f2c768a343b77..a6263d7ad639c7 100644 --- a/packages/block-library/src/list/transforms.js +++ b/packages/block-library/src/list/transforms.js @@ -1,15 +1,13 @@ /** * WordPress dependencies */ -import { createBlock, getBlockAttributes } from '@wordpress/blocks'; -import { - __UNSTABLE_LINE_SEPARATOR, - create, - join, - replace, - split, - toHTMLString, -} from '@wordpress/rich-text'; +import { createBlock } from '@wordpress/blocks'; +import { create, split, toHTMLString } from '@wordpress/rich-text'; + +/** + * Internal dependencies + */ +import { createListBlockFromDOMElement } from './utils'; function getListContentSchema( { phrasingContentSchema } ) { const listContentSchema = { @@ -32,6 +30,15 @@ function getListContentSchema( { phrasingContentSchema } ) { return listContentSchema; } +function getListContentFlat( blocks ) { + return blocks.flatMap( ( { name, attributes, innerBlocks = [] } ) => { + if ( name === 'core/list-item' ) { + return [ attributes.content, ...getListContentFlat( innerBlocks ) ]; + } + return getListContentFlat( innerBlocks ); + } ); +} + const transforms = { from: [ { @@ -39,30 +46,28 @@ const transforms = { isMultiBlock: true, blocks: [ 'core/paragraph', 'core/heading' ], transform: ( blockAttributes ) => { - return createBlock( 'core/list', { - values: toHTMLString( { - value: join( - blockAttributes.map( ( { content } ) => { - const value = create( { html: content } ); - - if ( blockAttributes.length > 1 ) { - return value; - } - - // When converting only one block, transform - // every line to a list item. - return replace( - value, - /\n/g, - __UNSTABLE_LINE_SEPARATOR - ); - } ), - __UNSTABLE_LINE_SEPARATOR - ), - multilineTag: 'li', - } ), - anchor: blockAttributes.anchor, - } ); + let childBlocks = []; + if ( blockAttributes.length > 1 ) { + childBlocks = blockAttributes.map( ( { content } ) => { + return createBlock( 'core/list-item', { content } ); + } ); + } else if ( blockAttributes.length === 1 ) { + const value = create( { + html: blockAttributes[ 0 ].content, + } ); + childBlocks = split( value, '\n' ).map( ( result ) => { + return createBlock( 'core/list-item', { + content: toHTMLString( { value: result } ), + } ); + } ); + } + return createBlock( + 'core/list', + { + anchor: blockAttributes.anchor, + }, + childBlocks + ); }, }, { @@ -72,102 +77,43 @@ const transforms = { ol: getListContentSchema( args ).ol, ul: getListContentSchema( args ).ul, } ), - transform( node ) { - const attributes = { - ordered: node.nodeName === 'OL', - anchor: node.id === '' ? undefined : node.id, - }; - - if ( attributes.ordered ) { - const type = node.getAttribute( 'type' ); - - if ( type ) { - attributes.type = type; - } - - if ( node.getAttribute( 'reversed' ) !== null ) { - attributes.reversed = true; - } - - const start = parseInt( node.getAttribute( 'start' ), 10 ); - - if ( - ! isNaN( start ) && - // start=1 only makes sense if the list is reversed. - ( start !== 1 || attributes.reversed ) - ) { - attributes.start = start; - } - } - - return createBlock( 'core/list', { - ...getBlockAttributes( 'core/list', node.outerHTML ), - ...attributes, - } ); - }, + transform: createListBlockFromDOMElement, }, ...[ '*', '-' ].map( ( prefix ) => ( { type: 'prefix', prefix, transform( content ) { - return createBlock( 'core/list', { - values: `
  • ${ content }
  • `, - } ); + return createBlock( 'core/list', {}, [ + createBlock( 'core/list-item', { content } ), + ] ); }, } ) ), ...[ '1.', '1)' ].map( ( prefix ) => ( { type: 'prefix', prefix, transform( content ) { - return createBlock( 'core/list', { - ordered: true, - values: `
  • ${ content }
  • `, - } ); + return createBlock( + 'core/list', + { + ordered: true, + }, + [ createBlock( 'core/list-item', { content } ) ] + ); }, } ) ), ], to: [ - { + ...[ 'core/paragraph', 'core/heading' ].map( ( block ) => ( { type: 'block', - blocks: [ 'core/paragraph' ], - transform: ( { values } ) => - split( - create( { - html: values, - multilineTag: 'li', - multilineWrapperTags: [ 'ul', 'ol' ], - } ), - __UNSTABLE_LINE_SEPARATOR - ).map( ( piece ) => - createBlock( 'core/paragraph', { - content: toHTMLString( { value: piece } ), + blocks: [ block ], + transform: ( _attributes, childBlocks ) => { + return getListContentFlat( childBlocks ).map( ( content ) => + createBlock( block, { + content, } ) - ), - }, - { - type: 'block', - blocks: [ 'core/heading' ], - transform: ( { values } ) => - split( - create( { - html: values, - multilineTag: 'li', - multilineWrapperTags: [ 'ul', 'ol' ], - } ), - __UNSTABLE_LINE_SEPARATOR - ).map( ( piece ) => - createBlock( 'core/heading', { - content: toHTMLString( { value: piece } ), - } ) - ), - }, - { - type: 'block', - blocks: [ 'core/table-of-contents' ], - transform: () => { - return createBlock( 'core/table-of-contents' ); + ); }, - }, + } ) ), ], }; diff --git a/packages/block-library/src/list/v2/migrate.js b/packages/block-library/src/list/utils.js similarity index 94% rename from packages/block-library/src/list/v2/migrate.js rename to packages/block-library/src/list/utils.js index d0ed33e8f3c440..61d1cbef892345 100644 --- a/packages/block-library/src/list/v2/migrate.js +++ b/packages/block-library/src/list/utils.js @@ -11,11 +11,11 @@ import { createBlock } from '@wordpress/blocks'; export function createListBlockFromDOMElement( listElement ) { const listAttributes = { ordered: 'OL' === listElement.tagName, + anchor: listElement.id === '' ? undefined : listElement.id, start: listElement.getAttribute( 'start' ) ? parseInt( listElement.getAttribute( 'start' ), 10 ) : undefined, - reversed: - listElement.getAttribute( 'reversed' ) === true ? true : undefined, + reversed: listElement.hasAttribute( 'reversed' ) ? true : undefined, type: listElement.getAttribute( 'type' ) ?? undefined, }; diff --git a/packages/block-library/src/list/v2/deprecated.js b/packages/block-library/src/list/v2/deprecated.js deleted file mode 100644 index f177e68bcff80a..00000000000000 --- a/packages/block-library/src/list/v2/deprecated.js +++ /dev/null @@ -1,89 +0,0 @@ -/** - * WordPress dependencies - */ -import { RichText, useBlockProps } from '@wordpress/block-editor'; - -/** - * Internal dependencies - */ -import initialDeprecations from '../deprecated'; -import { migrateToListV2 } from './migrate'; - -const v1 = { - attributes: { - ordered: { - type: 'boolean', - default: false, - __experimentalRole: 'content', - }, - values: { - type: 'string', - source: 'html', - selector: 'ol,ul', - multiline: 'li', - __unstableMultilineWrapperTags: [ 'ol', 'ul' ], - default: '', - __experimentalRole: 'content', - }, - type: { - type: 'string', - }, - start: { - type: 'number', - }, - reversed: { - type: 'boolean', - }, - placeholder: { - type: 'string', - }, - }, - supports: { - anchor: true, - className: false, - typography: { - fontSize: true, - __experimentalFontFamily: true, - lineHeight: true, - __experimentalFontStyle: true, - __experimentalFontWeight: true, - __experimentalLetterSpacing: true, - __experimentalTextTransform: true, - __experimentalDefaultControls: { - fontSize: true, - }, - }, - color: { - gradients: true, - link: true, - __experimentalDefaultControls: { - background: true, - text: true, - }, - }, - __unstablePasteTextInline: true, - __experimentalSelector: 'ol,ul', - __experimentalSlashInserter: true, - }, - save( { attributes } ) { - const { ordered, values, type, reversed, start } = attributes; - const TagName = ordered ? 'ol' : 'ul'; - - return ( - - - - ); - }, - migrate: migrateToListV2, -}; - -/** - * New deprecations need to be placed first - * for them to have higher priority. - * - * Old deprecations may need to be updated as well. - * - * See block-deprecation.md - */ -export default [ v1, ...initialDeprecations ]; diff --git a/packages/block-library/src/list/v2/edit.js b/packages/block-library/src/list/v2/edit.js deleted file mode 100644 index 9ef320b53b001f..00000000000000 --- a/packages/block-library/src/list/v2/edit.js +++ /dev/null @@ -1,192 +0,0 @@ -/** - * External dependencies - */ -import { last } from 'lodash'; - -/** - * WordPress dependencies - */ -import { - BlockControls, - useBlockProps, - useInnerBlocksProps, - store as blockEditorStore, -} from '@wordpress/block-editor'; -import { ToolbarButton } from '@wordpress/components'; -import { useDispatch, useSelect, useRegistry } from '@wordpress/data'; -import { isRTL, __ } from '@wordpress/i18n'; -import { - formatListBullets, - formatListBulletsRTL, - formatListNumbered, - formatListNumberedRTL, - formatOutdent, - formatOutdentRTL, -} from '@wordpress/icons'; -import { createBlock } from '@wordpress/blocks'; -import { useCallback, useEffect, Platform } from '@wordpress/element'; -import deprecated from '@wordpress/deprecated'; - -/** - * Internal dependencies - */ -import OrderedListSettings from '../ordered-list-settings'; -import { migrateToListV2 } from './migrate'; -import TagName from './tag-name'; - -const TEMPLATE = [ [ 'core/list-item' ] ]; -const NATIVE_MARGIN_SPACING = 8; - -/** - * At the moment, deprecations don't handle create blocks from attributes - * (like when using CPT templates). For this reason, this hook is necessary - * to avoid breaking templates using the old list block format. - * - * @param {Object} attributes Block attributes. - * @param {string} clientId Block client ID. - */ -function useMigrateOnLoad( attributes, clientId ) { - const registry = useRegistry(); - const { updateBlockAttributes, replaceInnerBlocks } = - useDispatch( blockEditorStore ); - - useEffect( () => { - // As soon as the block is loaded, migrate it to the new version. - - if ( ! attributes.values ) { - return; - } - - const [ newAttributes, newInnerBlocks ] = migrateToListV2( attributes ); - - deprecated( 'Value attribute on the list block', { - since: '6.0', - version: '6.5', - alternative: 'inner blocks', - } ); - - registry.batch( () => { - updateBlockAttributes( clientId, newAttributes ); - replaceInnerBlocks( clientId, newInnerBlocks ); - } ); - }, [ attributes.values ] ); -} - -function useOutdentList( clientId ) { - const { canOutdent } = useSelect( - ( innerSelect ) => { - const { getBlockRootClientId, getBlock } = - innerSelect( blockEditorStore ); - const parentId = getBlockRootClientId( clientId ); - return { - canOutdent: - !! parentId && - getBlock( parentId ).name === 'core/list-item', - }; - }, - [ clientId ] - ); - const { replaceBlocks, selectionChange } = useDispatch( blockEditorStore ); - const { getBlockRootClientId, getBlockAttributes, getBlock } = - useSelect( blockEditorStore ); - - return [ - canOutdent, - useCallback( () => { - const parentBlockId = getBlockRootClientId( clientId ); - const parentBlockAttributes = getBlockAttributes( parentBlockId ); - // Create a new parent block without the inner blocks. - const newParentBlock = createBlock( - 'core/list-item', - parentBlockAttributes - ); - const { innerBlocks } = getBlock( clientId ); - // Replace the parent block with a new parent block without inner blocks, - // and make the inner blocks siblings of the parent. - replaceBlocks( - [ parentBlockId ], - [ newParentBlock, ...innerBlocks ] - ); - // Select the last child of the list being outdent. - selectionChange( last( innerBlocks ).clientId ); - }, [ clientId ] ), - ]; -} - -function IndentUI( { clientId } ) { - const [ canOutdent, outdentList ] = useOutdentList( clientId ); - return ( - <> - - - ); -} - -function Edit( { attributes, setAttributes, clientId, style } ) { - const blockProps = useBlockProps( { - ...( Platform.isNative && { style } ), - } ); - const innerBlocksProps = useInnerBlocksProps( blockProps, { - allowedBlocks: [ 'core/list-item' ], - template: TEMPLATE, - templateInsertUpdatesSelection: true, - ...( Platform.isNative && { - marginVertical: NATIVE_MARGIN_SPACING, - marginHorizontal: NATIVE_MARGIN_SPACING, - } ), - } ); - useMigrateOnLoad( attributes, clientId ); - const { ordered, reversed, start } = attributes; - - const controls = ( - - { - setAttributes( { ordered: false } ); - } } - /> - { - setAttributes( { ordered: true } ); - } } - /> - - - ); - - return ( - <> - - { controls } - { ordered && ( - - ) } - - ); -} - -export default Edit; diff --git a/packages/block-library/src/list/v2/index.js b/packages/block-library/src/list/v2/index.js deleted file mode 100644 index 33107a72ff1bfb..00000000000000 --- a/packages/block-library/src/list/v2/index.js +++ /dev/null @@ -1,22 +0,0 @@ -/** - * WordPress dependencies - */ -import { list as icon } from '@wordpress/icons'; - -/** - * Internal dependencies - */ -import edit from './edit'; -import save from './save'; -import transforms from './transforms'; -import deprecated from './deprecated'; - -const settings = { - icon, - edit, - save, - transforms, - deprecated, -}; - -export default settings; diff --git a/packages/block-library/src/list/v2/save.js b/packages/block-library/src/list/v2/save.js deleted file mode 100644 index 8d187a93f38b5f..00000000000000 --- a/packages/block-library/src/list/v2/save.js +++ /dev/null @@ -1,18 +0,0 @@ -/** - * WordPress dependencies - */ -import { InnerBlocks, useBlockProps } from '@wordpress/block-editor'; - -export default function save( { attributes } ) { - const { ordered, reversed, start } = attributes; - const TagName = ordered ? 'ol' : 'ul'; - return ( - - - - ); -} diff --git a/packages/block-library/src/list/v2/transforms.js b/packages/block-library/src/list/v2/transforms.js deleted file mode 100644 index ba5514815fc72d..00000000000000 --- a/packages/block-library/src/list/v2/transforms.js +++ /dev/null @@ -1,120 +0,0 @@ -/** - * WordPress dependencies - */ -import { createBlock } from '@wordpress/blocks'; -import { create, split, toHTMLString } from '@wordpress/rich-text'; - -/** - * Internal dependencies - */ -import { createListBlockFromDOMElement } from './migrate'; - -function getListContentSchema( { phrasingContentSchema } ) { - const listContentSchema = { - ...phrasingContentSchema, - ul: {}, - ol: { attributes: [ 'type', 'start', 'reversed' ] }, - }; - - // Recursion is needed. - // Possible: ul > li > ul. - // Impossible: ul > ul. - [ 'ul', 'ol' ].forEach( ( tag ) => { - listContentSchema[ tag ].children = { - li: { - children: listContentSchema, - }, - }; - } ); - - return listContentSchema; -} - -function getListContentFlat( blocks ) { - return blocks.flatMap( ( { name, attributes, innerBlocks = [] } ) => { - if ( name === 'core/list-item' ) { - return [ attributes.content, ...getListContentFlat( innerBlocks ) ]; - } - return getListContentFlat( innerBlocks ); - } ); -} - -const transforms = { - from: [ - { - type: 'block', - isMultiBlock: true, - blocks: [ 'core/paragraph', 'core/heading' ], - transform: ( blockAttributes ) => { - let childBlocks = []; - if ( blockAttributes.length > 1 ) { - childBlocks = blockAttributes.map( ( { content } ) => { - return createBlock( 'core/list-item', { content } ); - } ); - } else if ( blockAttributes.length === 1 ) { - const value = create( { - html: blockAttributes[ 0 ].content, - } ); - childBlocks = split( value, '\n' ).map( ( result ) => { - return createBlock( 'core/list-item', { - content: toHTMLString( { value: result } ), - } ); - } ); - } - return createBlock( - 'core/list', - { - anchor: blockAttributes.anchor, - }, - childBlocks - ); - }, - }, - ...[ '*', '-' ].map( ( prefix ) => ( { - type: 'prefix', - prefix, - transform( content ) { - return createBlock( 'core/list', {}, [ - createBlock( 'core/list-item', { content } ), - ] ); - }, - } ) ), - ...[ '1.', '1)' ].map( ( prefix ) => ( { - type: 'prefix', - prefix, - transform( content ) { - return createBlock( - 'core/list', - { - ordered: true, - }, - [ createBlock( 'core/list-item', { content } ) ] - ); - }, - } ) ), - { - type: 'raw', - selector: 'ol,ul', - schema: ( args ) => ( { - ol: getListContentSchema( args ).ol, - ul: getListContentSchema( args ).ul, - } ), - transform: createListBlockFromDOMElement, - }, - ], - to: [ - ...[ 'core/paragraph', 'core/heading' ].map( ( block ) => ( { - type: 'block', - blocks: [ block ], - transform: ( _attributes, childBlocks ) => { - return getListContentFlat( childBlocks ).map( ( content ) => - createBlock( block, { - content, - } ) - ); - }, - } ) ), - ], -}; - -export default transforms; diff --git a/packages/blocks/src/api/raw-handling/paste-handler.js b/packages/blocks/src/api/raw-handling/paste-handler.js index a8edd9347d7b9c..d0193bc87eb74c 100644 --- a/packages/blocks/src/api/raw-handling/paste-handler.js +++ b/packages/blocks/src/api/raw-handling/paste-handler.js @@ -226,8 +226,9 @@ export function pasteHandler( { blocks.length === 1 && hasBlockSupport( blocks[ 0 ].name, '__unstablePasteTextInline', false ) ) { + const trimRegex = /^[\n]+|[\n]+$/g; // Don't catch line breaks at the start or end. - const trimmedPlainText = plainText.replace( /^[\n]+|[\n]+$/g, '' ); + const trimmedPlainText = plainText.replace( trimRegex, '' ); if ( trimmedPlainText !== '' && @@ -236,7 +237,7 @@ export function pasteHandler( { return removeInvalidHTML( getBlockInnerHTML( blocks[ 0 ] ), phrasingContentSchema - ); + ).replace( trimRegex, '' ); } } diff --git a/packages/e2e-tests/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap b/packages/e2e-tests/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap index fcacbe069610c4..f12d66f3f2f335 100644 --- a/packages/e2e-tests/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap +++ b/packages/e2e-tests/specs/editor/plugins/__snapshots__/cpt-locking.test.js.snap @@ -84,7 +84,9 @@ exports[`cpt locking template_lock false should allow blocks to be inserted 1`] -
    • List content
    +
      +
    • List content
    • +
    " `; diff --git a/packages/e2e-tests/specs/editor/plugins/inner-blocks-allowed-blocks.test.js b/packages/e2e-tests/specs/editor/plugins/inner-blocks-allowed-blocks.test.js index 3cbb2312ad946d..e5e1854cc1708b 100644 --- a/packages/e2e-tests/specs/editor/plugins/inner-blocks-allowed-blocks.test.js +++ b/packages/e2e-tests/specs/editor/plugins/inner-blocks-allowed-blocks.test.js @@ -75,6 +75,9 @@ describe( 'Allowed Blocks Setting on InnerBlocks', () => { await page.$x( `//button//span[contains(text(), 'List')]` ) )[ 0 ]; await insertButton.click(); + // Select the list wrapper so the image is inserable. + await page.keyboard.press( 'ArrowUp' ); + await page.keyboard.press( 'ArrowUp' ); await insertBlock( 'Image' ); await closeGlobalBlockInserter(); await page.waitForSelector( '.product[data-number-of-children="2"]' ); diff --git a/packages/e2e-tests/specs/editor/various/__snapshots__/block-deletion.test.js.snap b/packages/e2e-tests/specs/editor/various/__snapshots__/block-deletion.test.js.snap index a433a325d2a92e..8b0dcaec4067f7 100644 --- a/packages/e2e-tests/specs/editor/various/__snapshots__/block-deletion.test.js.snap +++ b/packages/e2e-tests/specs/editor/various/__snapshots__/block-deletion.test.js.snap @@ -24,7 +24,9 @@ exports[`block deletion - deleting the third and fourth blocks using backspace w -
    • caret was here
    +
      +
    • caret was here
    • +
    " `; diff --git a/packages/e2e-tests/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap b/packages/e2e-tests/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap index c8ec4b42cb3468..126fda3cc96e30 100644 --- a/packages/e2e-tests/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap +++ b/packages/e2e-tests/specs/editor/various/__snapshots__/keep-styles-on-block-transforms.test.js.snap @@ -6,12 +6,6 @@ exports[`Keep styles on block transforms Should keep colors during a transform 1 " `; -exports[`Keep styles on block transforms Should keep the font size during a transform from multiple blocks into a single one 1`] = ` -" -
    • Line 1 to be made large
    • Line 2 to be made large
    • Line 3 to be made large
    -" -`; - exports[`Keep styles on block transforms Should keep the font size during a transform from multiple blocks into multiple blocks 1`] = ` "

    Line 1 to be made large

    diff --git a/packages/e2e-tests/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap b/packages/e2e-tests/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap index de86d82627bf04..51e7f452082d87 100644 --- a/packages/e2e-tests/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap +++ b/packages/e2e-tests/specs/editor/various/__snapshots__/multi-block-selection.test.js.snap @@ -152,7 +152,9 @@ exports[`Multi-block selection should multi-select from within the list block 1` -
    • 1
    +
      +
    • 1
    • +
    " `; @@ -248,6 +250,28 @@ exports[`Multi-block selection should preserve dragged selection on move 1`] = ` " `; +exports[`Multi-block selection should properly select multiple blocks if selected nested blocks belong to different parent 1`] = ` +" +
    +

    first

    + + + +

    group

    +
    + + + +
    +

    second

    + + + +

    group

    +
    +" +`; + exports[`Multi-block selection should return original focus after failed multi selection attempt 1`] = ` "

    2

    diff --git a/packages/e2e-tests/specs/editor/various/__snapshots__/rich-text.test.js.snap b/packages/e2e-tests/specs/editor/various/__snapshots__/rich-text.test.js.snap index 92baa3662c13e3..074158c55f0968 100644 --- a/packages/e2e-tests/specs/editor/various/__snapshots__/rich-text.test.js.snap +++ b/packages/e2e-tests/specs/editor/various/__snapshots__/rich-text.test.js.snap @@ -102,12 +102,24 @@ exports[`RichText should only mutate text data on input 1`] = ` exports[`RichText should paste list contents into paragraph 1`] = ` " -
    • 1
      • 2
    +
      +
    • 1 +
        +
      • 2
      • +
      +
    • +
    - -

    1
    2

    -" + +
      +
    • 1 +
        +
      • 2
      • +
      +
    • +
    +" `; exports[`RichText should paste paragraph contents into list 1`] = ` @@ -116,7 +128,9 @@ exports[`RichText should paste paragraph contents into list 1`] = ` -
    • 1
    • 2
    +
      +
    • 1
      2
    • +
    " `; diff --git a/packages/e2e-tests/specs/editor/various/__snapshots__/writing-flow.test.js.snap b/packages/e2e-tests/specs/editor/various/__snapshots__/writing-flow.test.js.snap index 37328170c07e11..e0425d7d46d746 100644 --- a/packages/e2e-tests/specs/editor/various/__snapshots__/writing-flow.test.js.snap +++ b/packages/e2e-tests/specs/editor/various/__snapshots__/writing-flow.test.js.snap @@ -24,16 +24,6 @@ exports[`Writing Flow Should navigate inner blocks with arrow keys 1`] = ` " `; -exports[`Writing Flow should allow selecting entire list with longer last item 1`] = ` -" -

    a

    - - - -
    -" -`; - exports[`Writing Flow should create valid paragraph blocks when rapidly pressing Enter 1`] = ` "

    @@ -208,7 +198,9 @@ exports[`Writing Flow should navigate empty paragraphs 1`] = ` exports[`Writing Flow should not create extra line breaks in multiline value 1`] = ` " -
    +
      +
    • +
    " `; diff --git a/packages/e2e-tests/specs/editor/various/block-switcher.test.js b/packages/e2e-tests/specs/editor/various/block-switcher.test.js index 1b82f1f23ad025..d4029557e51207 100644 --- a/packages/e2e-tests/specs/editor/various/block-switcher.test.js +++ b/packages/e2e-tests/specs/editor/various/block-switcher.test.js @@ -18,6 +18,8 @@ describe( 'Block Switcher', () => { // Insert a list block. await insertBlock( 'List' ); await page.keyboard.type( 'List content' ); + await page.keyboard.press( 'ArrowUp' ); + await page.keyboard.press( 'ArrowUp' ); await pressKeyWithModifier( 'alt', 'F10' ); // Verify the block switcher exists. @@ -31,7 +33,6 @@ describe( 'Block Switcher', () => { 'Heading', 'Quote', 'Columns', - 'Table of Contents', ] ) ); } ); @@ -45,6 +46,8 @@ describe( 'Block Switcher', () => { // Insert a list block. await insertBlock( 'List' ); await page.keyboard.type( 'List content' ); + await page.keyboard.press( 'ArrowUp' ); + await page.keyboard.press( 'ArrowUp' ); await pressKeyWithModifier( 'alt', 'F10' ); // Verify the block switcher exists. @@ -56,7 +59,7 @@ describe( 'Block Switcher', () => { 'Group', 'Paragraph', 'Heading', - 'Table of Contents', + 'Columns', ] ) ); } ); @@ -71,13 +74,14 @@ describe( 'Block Switcher', () => { 'core/group', 'core/heading', 'core/columns', - 'core/table-of-contents', ].map( ( block ) => wp.blocks.unregisterBlockType( block ) ); } ); // Insert a list block. await insertBlock( 'List' ); await page.keyboard.type( 'List content' ); + await page.keyboard.press( 'ArrowUp' ); + await page.keyboard.press( 'ArrowUp' ); await pressKeyWithModifier( 'alt', 'F10' ); // Verify the block switcher exists. @@ -91,6 +95,8 @@ describe( 'Block Switcher', () => { it( 'Should show Columns block only if selected blocks are between limits (1-6)', async () => { await insertBlock( 'List' ); await page.keyboard.type( 'List content' ); + await page.keyboard.press( 'ArrowUp' ); + await page.keyboard.press( 'ArrowUp' ); await insertBlock( 'Heading' ); await page.keyboard.type( 'I am a header' ); await page.keyboard.down( 'Shift' ); @@ -103,6 +109,8 @@ describe( 'Block Switcher', () => { it( 'Should NOT show Columns transform only if selected blocks are more than max limit(6)', async () => { await insertBlock( 'List' ); await page.keyboard.type( 'List content' ); + await page.keyboard.press( 'ArrowUp' ); + await page.keyboard.press( 'ArrowUp' ); await insertBlock( 'Heading' ); await page.keyboard.type( 'I am a header' ); await page.keyboard.press( 'Enter' ); diff --git a/packages/e2e-tests/specs/editor/various/keep-styles-on-block-transforms.test.js b/packages/e2e-tests/specs/editor/various/keep-styles-on-block-transforms.test.js index 1443b49e5131b7..56b2ea6263d92c 100644 --- a/packages/e2e-tests/specs/editor/various/keep-styles-on-block-transforms.test.js +++ b/packages/e2e-tests/specs/editor/various/keep-styles-on-block-transforms.test.js @@ -34,23 +34,6 @@ describe( 'Keep styles on block transforms', () => { expect( await getEditedPostContent() ).toMatchSnapshot(); } ); - it( 'Should keep the font size during a transform from multiple blocks into a single one', async () => { - // Create a paragraph block with some content. - await clickBlockAppender(); - await page.keyboard.type( 'Line 1 to be made large' ); - await page.keyboard.press( 'Enter' ); - await page.keyboard.type( 'Line 2 to be made large' ); - await page.keyboard.press( 'Enter' ); - await page.keyboard.type( 'Line 3 to be made large' ); - await pressKeyWithModifier( 'shift', 'ArrowUp' ); - await pressKeyWithModifier( 'shift', 'ArrowUp' ); - await page.click( - '[role="radiogroup"][aria-label="Font size"] [aria-label="Large"]' - ); - await transformBlockTo( 'List' ); - expect( await getEditedPostContent() ).toMatchSnapshot(); - } ); - it( 'Should keep the font size during a transform from multiple blocks into multiple blocks', async () => { // Create a paragraph block with some content. await clickBlockAppender(); diff --git a/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js b/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js index 33d7295a4ab46e..a5954796bff9e8 100644 --- a/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js +++ b/packages/e2e-tests/specs/editor/various/multi-block-selection.test.js @@ -331,6 +331,9 @@ describe( 'Multi-block selection', () => { await page.keyboard.up( 'Shift' ); await transformBlockTo( 'Group' ); + // Confirm setup. + expect( await getEditedPostContent() ).toMatchSnapshot(); + // Click the first paragraph in the first Group block while pressing `shift` key. const firstParagraph = await page.waitForXPath( "//p[text()='first']" ); await page.keyboard.down( 'Shift' ); @@ -676,6 +679,10 @@ describe( 'Multi-block selection', () => { await pressKeyWithModifier( 'primary', 'a' ); + await page.waitForSelector( '[data-type="core/column"].is-selected' ); + + await pressKeyWithModifier( 'primary', 'a' ); + await page.waitForSelector( '[data-type="core/column"].is-multi-selected' ); @@ -699,6 +706,7 @@ describe( 'Multi-block selection', () => { // Confirm correct setup: a paragraph and a list. expect( await getEditedPostContent() ).toMatchSnapshot(); + await pressKeyWithModifier( 'primary', 'a' ); await pressKeyWithModifier( 'primary', 'a' ); await pressKeyWithModifier( 'primary', 'a' ); diff --git a/packages/e2e-tests/specs/editor/various/rich-text.test.js b/packages/e2e-tests/specs/editor/various/rich-text.test.js index 4d8b899eafbadc..f4d8e0d391721a 100644 --- a/packages/e2e-tests/specs/editor/various/rich-text.test.js +++ b/packages/e2e-tests/specs/editor/various/rich-text.test.js @@ -473,15 +473,18 @@ describe( 'RichText', () => { await page.keyboard.press( 'Enter' ); await page.keyboard.type( ' 2' ); - // Select all and copy. + // Select all text. + await pressKeyWithModifier( 'primary', 'a' ); + // Select the nested list. + await pressKeyWithModifier( 'primary', 'a' ); + // Select the parent list item. + await pressKeyWithModifier( 'primary', 'a' ); + // Select all the parent list item text. + await pressKeyWithModifier( 'primary', 'a' ); + // Select the entire list. await pressKeyWithModifier( 'primary', 'a' ); await pressKeyWithModifier( 'primary', 'c' ); - // Collapse the selection to the end. - await page.keyboard.press( 'ArrowRight' ); - - // Create a paragraph. - await page.keyboard.press( 'Enter' ); await page.keyboard.press( 'Enter' ); // Paste paragraph contents. diff --git a/packages/e2e-tests/specs/editor/various/splitting-merging.test.js b/packages/e2e-tests/specs/editor/various/splitting-merging.test.js index 8ff33dfcc233b7..c3c47706af9c27 100644 --- a/packages/e2e-tests/specs/editor/various/splitting-merging.test.js +++ b/packages/e2e-tests/specs/editor/various/splitting-merging.test.js @@ -235,7 +235,7 @@ describe( 'splitting and merging blocks', () => { await page.keyboard.type( 'item 1' ); await page.keyboard.press( 'Enter' ); await page.keyboard.type( 'item 2' ); - await pressKeyTimes( 'ArrowUp', 2 ); + await pressKeyTimes( 'ArrowUp', 5 ); await page.keyboard.press( 'Delete' ); // Carret should be in the first block and at the proper position. await page.keyboard.type( '-' ); @@ -257,13 +257,18 @@ describe( 'splitting and merging blocks', () => { await page.keyboard.press( 'Enter' ); await page.keyboard.type( 'item 2' ); await page.keyboard.press( 'ArrowUp' ); + await page.keyboard.press( 'ArrowUp' ); await pressKeyTimes( 'ArrowLeft', 6 ); await page.keyboard.press( 'Backspace' ); // Carret should be in the first block and at the proper position. await page.keyboard.type( '-' ); expect( await getEditedPostContent() ).toMatchInlineSnapshot( ` " -

    hi-item 1

    +

    hi

    + + + +

    -item 1

    diff --git a/packages/e2e-tests/specs/editor/various/toolbar-roving-tabindex.test.js b/packages/e2e-tests/specs/editor/various/toolbar-roving-tabindex.test.js index 87869b33544096..d131ddbbe07425 100644 --- a/packages/e2e-tests/specs/editor/various/toolbar-roving-tabindex.test.js +++ b/packages/e2e-tests/specs/editor/various/toolbar-roving-tabindex.test.js @@ -86,7 +86,8 @@ describe( 'Toolbar roving tabindex', () => { it( 'ensures list block toolbar uses roving tabindex', async () => { await insertBlock( 'List' ); await page.keyboard.type( 'List' ); - await testBlockToolbarKeyboardNavigation( 'Block: List', 'List' ); + await testBlockToolbarKeyboardNavigation( 'List text', 'Select List' ); + await page.click( `[aria-label="Select List"]` ); await wrapCurrentBlockWithGroup( 'List' ); await testGroupKeyboardNavigation( 'Block: List', 'List' ); } ); diff --git a/packages/e2e-tests/specs/editor/various/writing-flow.test.js b/packages/e2e-tests/specs/editor/various/writing-flow.test.js index 322f64f0fcffed..2a918c4d2a1db4 100644 --- a/packages/e2e-tests/specs/editor/various/writing-flow.test.js +++ b/packages/e2e-tests/specs/editor/various/writing-flow.test.js @@ -570,21 +570,25 @@ describe( 'Writing Flow', () => { expect( await getEditedPostContent() ).toMatchSnapshot(); } ); - it( 'should allow selecting entire list with longer last item', async () => { + it( 'should extend selection into paragraph for list with longer last item', async () => { await page.keyboard.press( 'Enter' ); await page.keyboard.type( 'a' ); await page.keyboard.press( 'Enter' ); await page.keyboard.type( '* b' ); await page.keyboard.press( 'Enter' ); await page.keyboard.type( 'cd' ); + + // Selects part of the first list item, although invisible. await pressKeyWithModifier( 'shift', 'ArrowUp' ); + await page.evaluate( () => new Promise( window.requestIdleCallback ) ); + // Extends selection into the first paragraph await pressKeyWithModifier( 'shift', 'ArrowUp' ); + await page.evaluate( () => new Promise( window.requestIdleCallback ) ); - // Ensure multi selection is not triggered and selection stays within - // the list. + // Mixed selection, so all content will be removed. await page.keyboard.press( 'Backspace' ); - expect( await getEditedPostContent() ).toMatchSnapshot(); + expect( await getEditedPostContent() ).toBe( '' ); } ); it( 'should not have a dead zone between blocks (lower)', async () => { diff --git a/packages/react-native-editor/src/setup.js b/packages/react-native-editor/src/setup.js index 47c9bd501386f5..912efeaee94b97 100644 --- a/packages/react-native-editor/src/setup.js +++ b/packages/react-native-editor/src/setup.js @@ -59,11 +59,8 @@ const gutenbergSetup = () => { const setupInitHooks = () => { addAction( 'native.pre-render', 'core/react-native-editor', ( props ) => { const capabilities = props.capabilities ?? {}; - const blocksFlags = { - __experimentalEnableListBlockV2: props?.listBlockV2, - }; - registerBlocks( blocksFlags ); + registerBlocks(); // Unregister non-supported blocks by capabilities if ( @@ -121,12 +118,12 @@ const setupInitHooks = () => { }; let blocksRegistered = false; -const registerBlocks = ( blocksFlags ) => { +const registerBlocks = () => { if ( blocksRegistered ) { return; } - registerCoreBlocks( blocksFlags ); + registerCoreBlocks(); blocksRegistered = true; }; diff --git a/test/e2e/specs/editor/blocks/list.spec.js b/test/e2e/specs/editor/blocks/list.spec.js index 99f60ae49693bc..7545056812614a 100644 --- a/test/e2e/specs/editor/blocks/list.spec.js +++ b/test/e2e/specs/editor/blocks/list.spec.js @@ -21,7 +21,13 @@ test.describe( 'List', () => { await page.keyboard.type( 'Another list item' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • A list item
    • Another list item
    +
      +
    • A list item
    • + + + +
    • Another list item
    • +
    ` ); } ); @@ -38,7 +44,9 @@ test.describe( 'List', () => { await page.keyboard.type( '* ' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • test
    +
      +
    • test
    • +
    ` ); } ); @@ -53,7 +61,9 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    1. A list item
    +
      +
    1. A list item
    2. +
    ` ); } ); @@ -170,7 +180,6 @@ test.describe( 'List', () => { page, } ) => { await page.click( 'role=button[name="Add default block"i]' ); - await page.keyboard.press( 'Enter' ); await page.keyboard.type( '* ' ); await expect( page.locator( '[data-type="core/list"]' ) ).toBeVisible(); await page.keyboard.press( 'ArrowUp' ); @@ -192,7 +201,9 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • I’m a list
    +
      +
    • I’m a list
    • +
    ` ); } ); @@ -207,7 +218,9 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • test
    +
      +
    • test
    • +
    ` ); } ); @@ -227,7 +240,13 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • one
    • two
    +
      +
    • one
    • + + + +
    • two
    • +
    ` ); } ); @@ -245,7 +264,13 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • one
    • two
    +
      +
    • one
    • + + + +
    • two
    • +
    ` ); } ); @@ -268,7 +293,13 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • one
      ...
    • two
    +
      +
    • one
      ...
    • + + + +
    • two
    • +
    ` ); } ); @@ -278,6 +309,7 @@ test.describe( 'List', () => { await page.keyboard.type( 'one' ); await page.keyboard.press( 'Enter' ); await page.keyboard.type( 'two' ); + await editor.clickBlockToolbarButton( 'Select List' ); await editor.transformBlockTo( 'core/paragraph' ); await expect.poll( editor.getEditedPostContent ).toBe( @@ -294,12 +326,14 @@ test.describe( 'List', () => { test( 'can be converted when nested to paragraphs', async ( { editor, page, + pageUtils, } ) => { await editor.insertBlock( { name: 'core/list' } ); await page.keyboard.type( 'one' ); await page.keyboard.press( 'Enter' ); await editor.clickBlockToolbarButton( 'Indent' ); await page.keyboard.type( 'two' ); + await pageUtils.pressKeyTimes( 'ArrowUp', 5 ); await editor.transformBlockTo( 'core/paragraph' ); await expect.poll( editor.getEditedPostContent ).toBe( @@ -318,12 +352,19 @@ test.describe( 'List', () => { await page.keyboard.type( 'one' ); await page.keyboard.press( 'Enter' ); await page.keyboard.type( 'two' ); + await editor.clickBlockToolbarButton( 'Select List' ); await editor.transformBlockTo( 'core/quote' ); await expect.poll( editor.getEditedPostContent ).toBe( `
    -
    • one
    • two
    +
      +
    • one
    • + + + +
    • two
    • +
    ` ); @@ -341,7 +382,9 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • one
    +
      +
    • one
    • +
    @@ -355,7 +398,13 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • one
    • two
    +
      +
    • one
    • + + + +
    • two
    • +
    ` ); } ); @@ -370,11 +419,22 @@ test.describe( 'List', () => { await page.keyboard.press( 'Enter' ); await page.keyboard.type( 'two' ); await page.keyboard.press( 'ArrowUp' ); + await page.keyboard.press( 'ArrowUp' ); await page.keyboard.press( 'Enter' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • one
    • two
    +
      +
    • one
    • + + + +
    • + + + +
    • two
    • +
    ` ); @@ -382,7 +442,9 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • one
    +
      +
    • one
    • +
    @@ -390,7 +452,9 @@ test.describe( 'List', () => { -
    • two
    +
      +
    • two
    • +
    ` ); @@ -403,11 +467,19 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • one
    +
      +
    • one
    • + + + +
    • +
    -
    • two
    +
      +
    • two
    • +
    ` ); } ); @@ -421,12 +493,15 @@ test.describe( 'List', () => { await page.keyboard.press( 'Enter' ); await page.keyboard.type( 'two' ); await page.keyboard.press( 'ArrowUp' ); + await page.keyboard.press( 'ArrowUp' ); await page.keyboard.press( 'Enter' ); await page.keyboard.press( 'Enter' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    1. one
    +
      +
    1. one
    2. +
    @@ -434,7 +509,9 @@ test.describe( 'List', () => { -
    1. two
    +
      +
    1. two
    2. +
    ` ); } ); @@ -450,7 +527,17 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • one
      • two
      • three
    +
      +
    • one +
        +
      • two
      • + + + +
      • three
      • +
      +
    • +
    ` ); } ); @@ -458,26 +545,34 @@ test.describe( 'List', () => { test( 'should be immeadiately saved on indentation', async ( { editor, page, - pageUtils, } ) => { await editor.insertBlock( { name: 'core/list' } ); await page.keyboard.type( 'one' ); await page.keyboard.press( 'Enter' ); - await pageUtils.pressKeyWithModifier( 'primary', 'm' ); + await editor.clickBlockToolbarButton( 'Indent' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • one
    +
      +
    • one +
        +
      • +
      +
    • +
    ` ); } ); test( 'should change the base list type', async ( { editor } ) => { await editor.insertBlock( { name: 'core/list' } ); + await editor.clickBlockToolbarButton( 'Select List' ); await editor.clickBlockToolbarButton( 'Ordered' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    +
      +
    1. +
    ` ); } ); @@ -485,82 +580,124 @@ test.describe( 'List', () => { test( 'should change the indented list type', async ( { editor, page, - pageUtils, } ) => { await editor.insertBlock( { name: 'core/list' } ); await page.keyboard.type( 'a' ); await page.keyboard.press( 'Enter' ); - await pageUtils.pressKeyWithModifier( 'primary', 'm' ); + await editor.clickBlockToolbarButton( 'Indent' ); await page.keyboard.type( '1' ); - + await editor.clickBlockToolbarButton( 'Select List' ); await editor.clickBlockToolbarButton( 'Ordered' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • a
      1. 1
    +
      +
    • a +
        +
      1. 1
      2. +
      +
    • +
    ` ); } ); - test( 'should indent and outdent level 1', async ( { - editor, - page, - pageUtils, - } ) => { + test( 'should indent and outdent level 1', async ( { editor, page } ) => { await editor.insertBlock( { name: 'core/list' } ); await page.keyboard.type( 'a' ); await page.keyboard.press( 'Enter' ); - await pageUtils.pressKeyWithModifier( 'primary', 'm' ); + await editor.clickBlockToolbarButton( 'Indent' ); await page.keyboard.type( '1' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • a
      • 1
    +
      +
    • a +
        +
      • 1
      • +
      +
    • +
    ` ); - await pageUtils.pressKeyWithModifier( 'primaryShift', 'm' ); + await editor.clickBlockToolbarButton( 'Outdent' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • a
    • 1
    +
      +
    • a
    • + + + +
    • 1
    • +
    ` ); } ); - test( 'should indent and outdent level 2', async ( { - editor, - page, - pageUtils, - } ) => { + test( 'should indent and outdent level 2', async ( { editor, page } ) => { await editor.insertBlock( { name: 'core/list' } ); await page.keyboard.type( 'a' ); await page.keyboard.press( 'Enter' ); - await pageUtils.pressKeyWithModifier( 'primary', 'm' ); + await editor.clickBlockToolbarButton( 'Indent' ); await page.keyboard.type( '1' ); await page.keyboard.press( 'Enter' ); - await pageUtils.pressKeyWithModifier( 'primary', 'm' ); + await editor.clickBlockToolbarButton( 'Indent' ); await page.keyboard.type( 'i' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • a
      • 1
        • i
    +
      +
    • a +
        +
      • 1 +
          +
        • i
        • +
        +
      • +
      +
    • +
    ` ); - await pageUtils.pressKeyWithModifier( 'primaryShift', 'm' ); + await editor.clickBlockToolbarButton( 'Outdent' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • a
      • 1
      • i
    +
      +
    • a +
        +
      • 1
      • + + + +
      • i
      • +
      +
    • +
    ` ); - await pageUtils.pressKeyWithModifier( 'primaryShift', 'm' ); + // To do: investigate why the toolbar is not showing up right after + // outdenting. + await page.keyboard.press( 'ArrowUp' ); + await editor.clickBlockToolbarButton( 'Outdent' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • a
      • 1
    • i
    +
      +
    • a +
        +
      • 1
      • +
      +
    • + + + +
    • i
    • +
    ` ); } ); @@ -573,24 +710,44 @@ test.describe( 'List', () => { await editor.insertBlock( { name: 'core/list' } ); await page.keyboard.type( 'a' ); await page.keyboard.press( 'Enter' ); - await pageUtils.pressKeyWithModifier( 'primary', 'm' ); + await editor.clickBlockToolbarButton( 'Indent' ); await page.keyboard.type( 'b' ); await page.keyboard.press( 'Enter' ); - await pageUtils.pressKeyWithModifier( 'primary', 'm' ); + await editor.clickBlockToolbarButton( 'Indent' ); await page.keyboard.type( 'c' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • a
      • b
        • c
    +
      +
    • a +
        +
      • b +
          +
        • c
        • +
        +
      • +
      +
    • +
    ` ); - await page.keyboard.press( 'ArrowUp' ); - await pageUtils.pressKeyWithModifier( 'primaryShift', 'm' ); + await pageUtils.pressKeyTimes( 'ArrowUp', 3 ); + await editor.clickBlockToolbarButton( 'Outdent' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • a
    • b
      • c
    +
      +
    • a
    • + + + +
    • b +
        +
      • c
      • +
      +
    • +
    ` ); } ); @@ -606,7 +763,9 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • a
    +
      +
    • a
    • +
    ` ); } ); @@ -623,11 +782,22 @@ test.describe( 'List', () => { await page.keyboard.press( 'Enter' ); await page.keyboard.type( 'c' ); await page.keyboard.press( 'ArrowUp' ); + await page.keyboard.press( 'ArrowUp' ); await pageUtils.pressKeyWithModifier( 'shift', 'Enter' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • a
    • b
    • c
    +
      +
    • a
    • + + + +
    • b
    • + + + +
    • c
    • +
    ` ); } ); @@ -646,7 +816,17 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • 1
      • a
        • i
    +
      +
    • 1 +
        +
      • a +
          +
        • i
        • +
        +
      • +
      +
    • +
    ` ); @@ -655,7 +835,17 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • 1
      • a
    +
      +
    • 1 +
        +
      • a
      • + + + +
      • +
      +
    • +
    ` ); @@ -663,7 +853,17 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • 1
      • a
    +
      +
    • 1 +
        +
      • a
      • +
      +
    • + + + +
    • +
    ` ); @@ -671,7 +871,13 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • 1
      • a
    +
      +
    • 1 +
        +
      • a
      • +
      +
    • +
    ` ); @@ -680,7 +886,13 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • 1
    +
      +
    • 1
    • + + + +
    • +
    ` ); @@ -688,7 +900,9 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • 1
    +
      +
    • 1
    • +
    ` ); @@ -704,19 +918,30 @@ test.describe( 'List', () => { test( 'should place the caret in the right place with nested list', async ( { editor, page, + pageUtils, } ) => { await page.click( 'role=button[name="Add default block"i]' ); await page.keyboard.type( '* 1' ); await page.keyboard.press( 'Enter' ); await page.keyboard.type( ' a' ); - await page.keyboard.press( 'ArrowUp' ); + await pageUtils.pressKeyTimes( 'ArrowUp', 3 ); await page.keyboard.press( 'Enter' ); // The caret should land in the second item. await page.keyboard.type( '2' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • 1
    • 2
      • a
    +
      +
    • 1
    • + + + +
    • 2 +
        +
      • a
      • +
      +
    • +
    ` ); } ); @@ -734,7 +959,13 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • 1
    +
      +
    • 1
    • + + + +
    • +
    ` ); } ); @@ -778,7 +1009,17 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • 1
      • 2
      • 3
    +
      +
    • 1 +
        +
      • 2
      • + + + +
      • 3
      • +
      +
    • +
    ` ); @@ -793,7 +1034,17 @@ test.describe( 'List', () => { await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • 1
      • 2
      • 3
    +
      +
    • 1 +
        +
      • 2
      • + + + +
      • 3
      • +
      +
    • +
    ` ); } ); @@ -807,13 +1058,18 @@ test.describe( 'List', () => { await page.keyboard.press( 'Enter' ); await page.keyboard.type( '2' ); await page.keyboard.press( 'ArrowUp' ); + await page.keyboard.press( 'ArrowUp' ); await page.keyboard.press( 'Backspace' ); await page.keyboard.press( 'Backspace' ); await expect.poll( editor.getEditedPostContent ).toBe( - ` -
    • 2
    -` + ` +

    + + + +

    2

    +` ); } ); @@ -827,11 +1083,22 @@ test.describe( 'List', () => { await page.keyboard.type( '2' ); await page.keyboard.press( 'Enter' ); await page.keyboard.type( '3' ); + await editor.clickBlockToolbarButton( 'Select List' ); await editor.clickBlockToolbarButton( 'Ordered' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    1. 1
    2. 2
    3. 3
    +
      +
    1. 1
    2. + + + +
    3. 2
    4. + + + +
    5. 3
    6. +
    ` ); } ); @@ -846,11 +1113,22 @@ test.describe( 'List', () => { await page.keyboard.type( 'b' ); await page.keyboard.press( 'Enter' ); await page.keyboard.type( 'c' ); + await editor.clickBlockToolbarButton( 'Select List' ); await editor.clickBlockToolbarButton( 'Unordered' ); await expect.poll( editor.getEditedPostContent ).toBe( ` -
    • a
    • b
    • c
    +
      +
    • a
    • + + + +
    • b
    • + + + +
    • c
    • +
    ` ); } ); diff --git a/test/integration/__snapshots__/blocks-raw-handling.test.js.snap b/test/integration/__snapshots__/blocks-raw-handling.test.js.snap index 06f7a8d80716bb..6c341c815e035b 100644 --- a/test/integration/__snapshots__/blocks-raw-handling.test.js.snap +++ b/test/integration/__snapshots__/blocks-raw-handling.test.js.snap @@ -85,7 +85,9 @@ exports[`rawHandler should convert HTML post to blocks with minimal content chan -
    1. Item
    +
      +
    1. Item
    2. +
    @@ -125,11 +127,13 @@ exports[`rawHandler should convert a caption shortcode with link 1`] = ` exports[`rawHandler should convert a list with attributes 1`] = ` " -
    1. 1 -
        -
      1. 1
      2. -
      -
    +
      +
    1. 1 +
        +
      1. 1
      2. +
      +
    2. +
    " `; diff --git a/test/integration/blocks-raw-handling.test.js b/test/integration/blocks-raw-handling.test.js index 1586b858c227e2..4a5d7bd584c85e 100644 --- a/test/integration/blocks-raw-handling.test.js +++ b/test/integration/blocks-raw-handling.test.js @@ -176,9 +176,19 @@ describe( 'Blocks raw handling', () => { .map( getBlockContent ) .join( '' ); - expect( filtered ).toBe( - '
    • one
    • two
    • three
    ' - ); + expect( filtered ).toMatchInlineSnapshot( ` + "
      +
    • one
    • + + + +
    • two
    • + + + +
    • three
    • +
    " + ` ); expect( console ).toHaveLogged(); } ); @@ -282,9 +292,19 @@ describe( 'Blocks raw handling', () => { .map( getBlockContent ) .join( '' ); - expect( filtered ).toBe( - '
    • One
    • Two
    • Three
    ' - ); + expect( filtered ).toMatchInlineSnapshot( ` + "
      +
    • One
    • + + + +
    • Two
    • + + + +
    • Three
    • +
    " + ` ); expect( console ).toHaveLogged(); } ); diff --git a/test/integration/fixtures/blocks/core__list-item.html b/test/integration/fixtures/blocks/core__list-item.html new file mode 100644 index 00000000000000..abeec57ef91988 --- /dev/null +++ b/test/integration/fixtures/blocks/core__list-item.html @@ -0,0 +1,3 @@ + +
  • Text & Headings
  • + diff --git a/test/integration/fixtures/blocks/core__list-item.json b/test/integration/fixtures/blocks/core__list-item.json new file mode 100644 index 00000000000000..5110b465157a3d --- /dev/null +++ b/test/integration/fixtures/blocks/core__list-item.json @@ -0,0 +1,10 @@ +[ + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "Text & Headings" + }, + "innerBlocks": [] + } +] diff --git a/test/integration/fixtures/blocks/core__list-item.parsed.json b/test/integration/fixtures/blocks/core__list-item.parsed.json new file mode 100644 index 00000000000000..29966c6490c59d --- /dev/null +++ b/test/integration/fixtures/blocks/core__list-item.parsed.json @@ -0,0 +1,9 @@ +[ + { + "blockName": "core/list-item", + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n
  • Text & Headings
  • \n", + "innerContent": [ "\n
  • Text & Headings
  • \n" ] + } +] diff --git a/test/integration/fixtures/blocks/core__list-item.serialized.html b/test/integration/fixtures/blocks/core__list-item.serialized.html new file mode 100644 index 00000000000000..abeec57ef91988 --- /dev/null +++ b/test/integration/fixtures/blocks/core__list-item.serialized.html @@ -0,0 +1,3 @@ + +
  • Text & Headings
  • + diff --git a/test/integration/fixtures/blocks/core__list__deprecated-v0.html b/test/integration/fixtures/blocks/core__list__deprecated-v0.html new file mode 100644 index 00000000000000..eb8ea358a2ef62 --- /dev/null +++ b/test/integration/fixtures/blocks/core__list__deprecated-v0.html @@ -0,0 +1,3 @@ + +
    • one
    • two
    • three
    + \ No newline at end of file diff --git a/test/integration/fixtures/blocks/core__list__deprecated-v0.json b/test/integration/fixtures/blocks/core__list__deprecated-v0.json new file mode 100644 index 00000000000000..80712db768d4c7 --- /dev/null +++ b/test/integration/fixtures/blocks/core__list__deprecated-v0.json @@ -0,0 +1,37 @@ +[ + { + "name": "core/list", + "isValid": true, + "attributes": { + "ordered": false, + "values": "
  • one
  • two
  • three
  • ", + "fontFamily": "cambria-georgia" + }, + "innerBlocks": [ + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "one" + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "two" + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "three" + }, + "innerBlocks": [] + } + ] + } +] diff --git a/test/integration/fixtures/blocks/core__list__deprecated-v0.parsed.json b/test/integration/fixtures/blocks/core__list__deprecated-v0.parsed.json new file mode 100644 index 00000000000000..d76f8e369efe4e --- /dev/null +++ b/test/integration/fixtures/blocks/core__list__deprecated-v0.parsed.json @@ -0,0 +1,17 @@ +[ + { + "blockName": "core/list", + "attrs": { + "style": { + "typography": { + "fontFamily": "var:preset|font-family|cambria-georgia" + } + } + }, + "innerBlocks": [], + "innerHTML": "\n
    • one
    • two
    • three
    \n", + "innerContent": [ + "\n
    • one
    • two
    • three
    \n" + ] + } +] diff --git a/test/integration/fixtures/blocks/core__list__deprecated-v0.serialized.html b/test/integration/fixtures/blocks/core__list__deprecated-v0.serialized.html new file mode 100644 index 00000000000000..fa50fb5db17e7b --- /dev/null +++ b/test/integration/fixtures/blocks/core__list__deprecated-v0.serialized.html @@ -0,0 +1,13 @@ + +
      +
    • one
    • + + + +
    • two
    • + + + +
    • three
    • +
    + diff --git a/test/integration/fixtures/blocks/core__list__deprecated-v1.html b/test/integration/fixtures/blocks/core__list__deprecated-v1.html index eb8ea358a2ef62..aef6bf669f2c98 100644 --- a/test/integration/fixtures/blocks/core__list__deprecated-v1.html +++ b/test/integration/fixtures/blocks/core__list__deprecated-v1.html @@ -1,3 +1,3 @@ - -
    • one
    • two
    • three
    - \ No newline at end of file + +
    • Text & Headings
    • Images & Videos
    • Galleries
    • Embeds, like YouTube, Tweets, or other WordPress posts.
    • Layout blocks, like Buttons, Hero Images, Separators, etc.
    • And Lists like this one of course :)
    + diff --git a/test/integration/fixtures/blocks/core__list__deprecated-v1.json b/test/integration/fixtures/blocks/core__list__deprecated-v1.json index ca57dca6e80219..80cd87e4eb69e8 100644 --- a/test/integration/fixtures/blocks/core__list__deprecated-v1.json +++ b/test/integration/fixtures/blocks/core__list__deprecated-v1.json @@ -4,9 +4,57 @@ "isValid": true, "attributes": { "ordered": false, - "values": "
  • one
  • two
  • three
  • ", - "fontFamily": "cambria-georgia" + "values": "" }, - "innerBlocks": [] + "innerBlocks": [ + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "Text & Headings" + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "Images & Videos" + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "Galleries" + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "Embeds, like YouTube, Tweets, or other WordPress posts." + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "Layout blocks, like Buttons, Hero Images, Separators, etc." + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "And Lists like this one of course :)" + }, + "innerBlocks": [] + } + ] } ] diff --git a/test/integration/fixtures/blocks/core__list__deprecated-v1.parsed.json b/test/integration/fixtures/blocks/core__list__deprecated-v1.parsed.json index d76f8e369efe4e..427f4c3a975cfd 100644 --- a/test/integration/fixtures/blocks/core__list__deprecated-v1.parsed.json +++ b/test/integration/fixtures/blocks/core__list__deprecated-v1.parsed.json @@ -1,17 +1,11 @@ [ { "blockName": "core/list", - "attrs": { - "style": { - "typography": { - "fontFamily": "var:preset|font-family|cambria-georgia" - } - } - }, + "attrs": {}, "innerBlocks": [], - "innerHTML": "\n
    • one
    • two
    • three
    \n", + "innerHTML": "\n
    • Text & Headings
    • Images & Videos
    • Galleries
    • Embeds, like YouTube, Tweets, or other WordPress posts.
    • Layout blocks, like Buttons, Hero Images, Separators, etc.
    • And Lists like this one of course :)
    \n", "innerContent": [ - "\n
    • one
    • two
    • three
    \n" + "\n
    • Text & Headings
    • Images & Videos
    • Galleries
    • Embeds, like YouTube, Tweets, or other WordPress posts.
    • Layout blocks, like Buttons, Hero Images, Separators, etc.
    • And Lists like this one of course :)
    \n" ] } ] diff --git a/test/integration/fixtures/blocks/core__list__deprecated-v1.serialized.html b/test/integration/fixtures/blocks/core__list__deprecated-v1.serialized.html index 0eb7670601542e..c09708d51db0bb 100644 --- a/test/integration/fixtures/blocks/core__list__deprecated-v1.serialized.html +++ b/test/integration/fixtures/blocks/core__list__deprecated-v1.serialized.html @@ -1,3 +1,25 @@ - -
    • one
    • two
    • three
    + +
      +
    • Text & Headings
    • + + + +
    • Images & Videos
    • + + + +
    • Galleries
    • + + + +
    • Embeds, like YouTube, Tweets, or other WordPress posts.
    • + + + +
    • Layout blocks, like Buttons, Hero Images, Separators, etc.
    • + + + +
    • And Lists like this one of course :)
    • +
    diff --git a/test/integration/fixtures/blocks/core__list__ul.html b/test/integration/fixtures/blocks/core__list__ul.html index aef6bf669f2c98..c09708d51db0bb 100644 --- a/test/integration/fixtures/blocks/core__list__ul.html +++ b/test/integration/fixtures/blocks/core__list__ul.html @@ -1,3 +1,25 @@ - -
    • Text & Headings
    • Images & Videos
    • Galleries
    • Embeds, like YouTube, Tweets, or other WordPress posts.
    • Layout blocks, like Buttons, Hero Images, Separators, etc.
    • And Lists like this one of course :)
    - + +
      +
    • Text & Headings
    • + + + +
    • Images & Videos
    • + + + +
    • Galleries
    • + + + +
    • Embeds, like YouTube, Tweets, or other WordPress posts.
    • + + + +
    • Layout blocks, like Buttons, Hero Images, Separators, etc.
    • + + + +
    • And Lists like this one of course :)
    • +
    + diff --git a/test/integration/fixtures/blocks/core__list__ul.json b/test/integration/fixtures/blocks/core__list__ul.json index 841a5c5fd27ebf..80cd87e4eb69e8 100644 --- a/test/integration/fixtures/blocks/core__list__ul.json +++ b/test/integration/fixtures/blocks/core__list__ul.json @@ -4,8 +4,57 @@ "isValid": true, "attributes": { "ordered": false, - "values": "
  • Text & Headings
  • Images & Videos
  • Galleries
  • Embeds, like YouTube, Tweets, or other WordPress posts.
  • Layout blocks, like Buttons, Hero Images, Separators, etc.
  • And Lists like this one of course :)
  • " + "values": "" }, - "innerBlocks": [] + "innerBlocks": [ + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "Text & Headings" + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "Images & Videos" + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "Galleries" + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "Embeds, like YouTube, Tweets, or other WordPress posts." + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "Layout blocks, like Buttons, Hero Images, Separators, etc." + }, + "innerBlocks": [] + }, + { + "name": "core/list-item", + "isValid": true, + "attributes": { + "content": "And Lists like this one of course :)" + }, + "innerBlocks": [] + } + ] } ] diff --git a/test/integration/fixtures/blocks/core__list__ul.parsed.json b/test/integration/fixtures/blocks/core__list__ul.parsed.json index 427f4c3a975cfd..2853bc5558ebe3 100644 --- a/test/integration/fixtures/blocks/core__list__ul.parsed.json +++ b/test/integration/fixtures/blocks/core__list__ul.parsed.json @@ -2,10 +2,71 @@ { "blockName": "core/list", "attrs": {}, - "innerBlocks": [], - "innerHTML": "\n
    • Text & Headings
    • Images & Videos
    • Galleries
    • Embeds, like YouTube, Tweets, or other WordPress posts.
    • Layout blocks, like Buttons, Hero Images, Separators, etc.
    • And Lists like this one of course :)
    \n", + "innerBlocks": [ + { + "blockName": "core/list-item", + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n
  • Text & Headings
  • \n", + "innerContent": [ "\n
  • Text & Headings
  • \n" ] + }, + { + "blockName": "core/list-item", + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n
  • Images & Videos
  • \n", + "innerContent": [ "\n
  • Images & Videos
  • \n" ] + }, + { + "blockName": "core/list-item", + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n
  • Galleries
  • \n", + "innerContent": [ "\n
  • Galleries
  • \n" ] + }, + { + "blockName": "core/list-item", + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n
  • Embeds, like YouTube, Tweets, or other WordPress posts.
  • \n", + "innerContent": [ + "\n
  • Embeds, like YouTube, Tweets, or other WordPress posts.
  • \n" + ] + }, + { + "blockName": "core/list-item", + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n
  • Layout blocks, like Buttons, Hero Images, Separators, etc.
  • \n", + "innerContent": [ + "\n
  • Layout blocks, like Buttons, Hero Images, Separators, etc.
  • \n" + ] + }, + { + "blockName": "core/list-item", + "attrs": {}, + "innerBlocks": [], + "innerHTML": "\n
  • And Lists like this one of course :)
  • \n", + "innerContent": [ + "\n
  • And Lists like this one of course :)
  • \n" + ] + } + ], + "innerHTML": "\n
      \n\n\n\n\n\n\n\n\n\n
    \n", "innerContent": [ - "\n
    • Text & Headings
    • Images & Videos
    • Galleries
    • Embeds, like YouTube, Tweets, or other WordPress posts.
    • Layout blocks, like Buttons, Hero Images, Separators, etc.
    • And Lists like this one of course :)
    \n" + "\n
      ", + null, + "\n\n", + null, + "\n\n", + null, + "\n\n", + null, + "\n\n", + null, + "\n\n", + null, + "
    \n" ] } ] diff --git a/test/integration/fixtures/blocks/core__list__ul.serialized.html b/test/integration/fixtures/blocks/core__list__ul.serialized.html index 6b83b73a47ea1d..c09708d51db0bb 100644 --- a/test/integration/fixtures/blocks/core__list__ul.serialized.html +++ b/test/integration/fixtures/blocks/core__list__ul.serialized.html @@ -1,3 +1,25 @@ -
    • Text & Headings
    • Images & Videos
    • Galleries
    • Embeds, like YouTube, Tweets, or other WordPress posts.
    • Layout blocks, like Buttons, Hero Images, Separators, etc.
    • And Lists like this one of course :)
    +
      +
    • Text & Headings
    • + + + +
    • Images & Videos
    • + + + +
    • Galleries
    • + + + +
    • Embeds, like YouTube, Tweets, or other WordPress posts.
    • + + + +
    • Layout blocks, like Buttons, Hero Images, Separators, etc.
    • + + + +
    • And Lists like this one of course :)
    • +
    diff --git a/test/integration/fixtures/documents/apple-out.html b/test/integration/fixtures/documents/apple-out.html index f10d4d526e6b36..d873c942ea9ce1 100644 --- a/test/integration/fixtures/documents/apple-out.html +++ b/test/integration/fixtures/documents/apple-out.html @@ -11,11 +11,35 @@ -
    • A
    • Bulleted
      • Indented
    • List
    +
      +
    • A
    • + + + +
    • Bulleted +
        +
      • Indented
      • +
      +
    • + + + +
    • List
    • +
    -
    1. One
    2. Two
    3. Three
    +
      +
    1. One
    2. + + + +
    3. Two
    4. + + + +
    5. Three
    6. +
    diff --git a/test/integration/fixtures/documents/evernote-out.html b/test/integration/fixtures/documents/evernote-out.html index dec057d999ef11..19102ab70dc487 100644 --- a/test/integration/fixtures/documents/evernote-out.html +++ b/test/integration/fixtures/documents/evernote-out.html @@ -7,11 +7,39 @@ -
    • An
    • Unordered
      • Indented
    • List
    +
      +
    • An
    • + + + +
    • Unordered +
        +
      • Indented
      • +
      +
    • + + + +
    • List
    • +
    - -
    1. One
    2. Two
      1. Indented
    3. Three
    + +
      +
    1. One
    2. + + + +
    3. Two +
        +
      1. Indented
      2. +
      +
    4. + + + +
    5. Three
    6. +
    diff --git a/test/integration/fixtures/documents/google-docs-out.html b/test/integration/fixtures/documents/google-docs-out.html index 42b98c65532470..db8bc81948fcca 100644 --- a/test/integration/fixtures/documents/google-docs-out.html +++ b/test/integration/fixtures/documents/google-docs-out.html @@ -11,11 +11,35 @@

    This is a heading

    -
    • A
    • Bulleted
      • Indented
    • List
    +
      +
    • A
    • + + + +
    • Bulleted +
        +
      • Indented
      • +
      +
    • + + + +
    • List
    • +
    -
    1. One
    2. Two
    3. Three
    +
      +
    1. One
    2. + + + +
    3. Two
    4. + + + +
    5. Three
    6. +
    diff --git a/test/integration/fixtures/documents/google-docs-with-comments-out.html b/test/integration/fixtures/documents/google-docs-with-comments-out.html index 42b98c65532470..db8bc81948fcca 100644 --- a/test/integration/fixtures/documents/google-docs-with-comments-out.html +++ b/test/integration/fixtures/documents/google-docs-with-comments-out.html @@ -11,11 +11,35 @@

    This is a heading

    -
    • A
    • Bulleted
      • Indented
    • List
    +
      +
    • A
    • + + + +
    • Bulleted +
        +
      • Indented
      • +
      +
    • + + + +
    • List
    • +
    -
    1. One
    2. Two
    3. Three
    +
      +
    1. One
    2. + + + +
    3. Two
    4. + + + +
    5. Three
    6. +
    diff --git a/test/integration/fixtures/documents/markdown-out.html b/test/integration/fixtures/documents/markdown-out.html index 104996580b223e..c1237925a750bd 100644 --- a/test/integration/fixtures/documents/markdown-out.html +++ b/test/integration/fixtures/documents/markdown-out.html @@ -15,11 +15,35 @@

    Lists

    -
    • A
    • Bulleted
      • Indented
    • List
    +
      +
    • A
    • + + + +
    • Bulleted +
        +
      • Indented
      • +
      +
    • + + + +
    • List
    • +
    -
    1. One
    2. Two
    3. Three
    +
      +
    1. One
    2. + + + +
    3. Two
    4. + + + +
    5. Three
    6. +
    diff --git a/test/integration/fixtures/documents/ms-word-online-out.html b/test/integration/fixtures/documents/ms-word-online-out.html index d3aaeb98e302fa..398281520f2542 100644 --- a/test/integration/fixtures/documents/ms-word-online-out.html +++ b/test/integration/fixtures/documents/ms-word-online-out.html @@ -7,11 +7,35 @@ -
    • Bulleted 
    • Indented 
    • List 
    +
      +
    • + + + +
    • Bulleted 
    • + + + +
    • Indented 
    • + + + +
    • List 
    • +
    - -
    1. One 
    2. Two 
    3. Three 
    + +
      +
    1. One 
    2. + + + +
    3. Two 
    4. + + + +
    5. Three 
    6. +
    diff --git a/test/integration/fixtures/documents/ms-word-out.html b/test/integration/fixtures/documents/ms-word-out.html index faae96541aa5f2..9a5d5fdf557a46 100644 --- a/test/integration/fixtures/documents/ms-word-out.html +++ b/test/integration/fixtures/documents/ms-word-out.html @@ -19,11 +19,35 @@

    This is a heading level 2

    -
    • A
    • Bulleted
      • Indented
    • List
    +
      +
    • A
    • + + + +
    • Bulleted +
        +
      • Indented
      • +
      +
    • + + + +
    • List
    • +
    -
    1. One
    2. Two
    3. Three
    +
      +
    1. One
    2. + + + +
    3. Two
    4. + + + +
    5. Three
    6. +
    From 7762948dd604dba0f50161115961044399ca0d26 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 24 Aug 2022 22:21:14 +0400 Subject: [PATCH 15/68] Add stale issue workflow for flaky test reports (#43547) * Add stale issue workflow for flaky test reports * Change workflow name * Whoops, wrong file * Don't skip message --- .github/workflows/stale-issue-flaky-test.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .github/workflows/stale-issue-flaky-test.yml diff --git a/.github/workflows/stale-issue-flaky-test.yml b/.github/workflows/stale-issue-flaky-test.yml new file mode 100644 index 00000000000000..c17935e2eb144b --- /dev/null +++ b/.github/workflows/stale-issue-flaky-test.yml @@ -0,0 +1,19 @@ +name: 'Mark old flaky tests issues as stale' +on: + schedule: + - cron: '20 1 * * *' + +jobs: + stale: + runs-on: ubuntu-latest + if: ${{ github.repository == 'WordPress/gutenberg' }} + + steps: + - uses: actions/stale@996798eb71ef485dc4c7b4d3285842d714040c4a # v3.0.17 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This issue has gone 30 days without any activity.' + days-before-stale: 30 + days-before-close: 1 + only-labels: '[Type] Flaky Test' + stale-issue-label: '[Status] Stale' From 154a8b876a754e0ee678549687afe3d49baa58d7 Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Wed, 24 Aug 2022 22:17:52 +0300 Subject: [PATCH 16/68] Lodash: Remove from block registration API (#43558) --- packages/blocks/src/api/registration.js | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/blocks/src/api/registration.js b/packages/blocks/src/api/registration.js index 9f93b993880be4..903d9e7e00e32a 100644 --- a/packages/blocks/src/api/registration.js +++ b/packages/blocks/src/api/registration.js @@ -4,7 +4,6 @@ * External dependencies */ import { camelCase } from 'change-case'; -import { isEmpty, pick, pickBy } from 'lodash'; /** * WordPress dependencies @@ -174,12 +173,11 @@ export function unstable__bootstrapServerSideBlockDefinitions( definitions ) { } serverSideBlockDefinitions[ blockName ] = Object.fromEntries( - Object.entries( - pickBy( - definitions[ blockName ], - ( value ) => value !== null && value !== undefined + Object.entries( definitions[ blockName ] ) + .filter( + ( [ , value ] ) => value !== null && value !== undefined ) - ).map( ( [ key, value ] ) => [ camelCase( key ), value ] ) + .map( ( [ key, value ] ) => [ camelCase( key ), value ] ) ); } } @@ -211,7 +209,11 @@ function getBlockSettingsFromMetadata( { textdomain, ...metadata } ) { 'variations', ]; - const settings = pick( metadata, allowedFields ); + const settings = Object.fromEntries( + Object.entries( metadata ).filter( ( [ key ] ) => + allowedFields.includes( key ) + ) + ); if ( textdomain ) { Object.keys( i18nBlockSchema ).forEach( ( key ) => { @@ -321,7 +323,7 @@ function translateBlockSettingUsingI18nSchema( } if ( Array.isArray( i18nSchema ) && - ! isEmpty( i18nSchema ) && + i18nSchema.length && Array.isArray( settingValue ) ) { return settingValue.map( ( value ) => @@ -334,7 +336,7 @@ function translateBlockSettingUsingI18nSchema( } if ( isObject( i18nSchema ) && - ! isEmpty( i18nSchema ) && + Object.entries( i18nSchema ).length && isObject( settingValue ) ) { return Object.keys( settingValue ).reduce( ( accumulator, key ) => { From c3e6c3716a7d2cd9f3ba25e640765c08abb9832a Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Wed, 24 Aug 2022 22:18:07 +0300 Subject: [PATCH 17/68] Lodash: Remove from block factory API (#43560) --- packages/blocks/src/api/factory.js | 52 ++++++++++++------------------ 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/packages/blocks/src/api/factory.js b/packages/blocks/src/api/factory.js index e7e8e9f114a10a..fed5071e47bd2e 100644 --- a/packages/blocks/src/api/factory.js +++ b/packages/blocks/src/api/factory.js @@ -2,16 +2,6 @@ * External dependencies */ import { v4 as uuid } from 'uuid'; -import { - every, - castArray, - some, - filter, - first, - has, - isEmpty, - map, -} from 'lodash'; /** * WordPress dependencies @@ -163,14 +153,14 @@ export function cloneBlock( block, mergeAttributes = {}, newInnerBlocks ) { * @return {boolean} Is the transform possible? */ const isPossibleTransformForSource = ( transform, direction, blocks ) => { - if ( isEmpty( blocks ) ) { + if ( ! blocks.length ) { return false; } // If multiple blocks are selected, only multi block transforms // or wildcard transforms are allowed. const isMultiBlock = blocks.length > 1; - const firstBlockName = first( blocks ).name; + const firstBlockName = blocks[ 0 ].name; const isValidForMultiBlocks = isWildcardBlockTransform( transform ) || ! isMultiBlock || @@ -183,7 +173,7 @@ const isPossibleTransformForSource = ( transform, direction, blocks ) => { // for a block selection of multiple blocks of different types. if ( ! isWildcardBlockTransform( transform ) && - ! every( blocks, { name: firstBlockName } ) + ! blocks.every( ( block ) => block.name === firstBlockName ) ) { return false; } @@ -196,7 +186,7 @@ const isPossibleTransformForSource = ( transform, direction, blocks ) => { // Check if the transform's block name matches the source block (or is a wildcard) // only if this is a transform 'from'. - const sourceBlock = first( blocks ); + const sourceBlock = blocks[ 0 ]; const hasMatchingName = direction !== 'from' || transform.blocks.indexOf( sourceBlock.name ) !== -1 || @@ -241,15 +231,14 @@ const isPossibleTransformForSource = ( transform, direction, blocks ) => { * @return {Array} Block types that the blocks can be transformed into. */ const getBlockTypesForPossibleFromTransforms = ( blocks ) => { - if ( isEmpty( blocks ) ) { + if ( ! blocks.length ) { return []; } const allBlockTypes = getBlockTypes(); // filter all blocks to find those with a 'from' transform. - const blockTypesWithPossibleFromTransforms = filter( - allBlockTypes, + const blockTypesWithPossibleFromTransforms = allBlockTypes.filter( ( blockType ) => { const fromTransforms = getBlockTransforms( 'from', blockType.name ); return !! findTransform( fromTransforms, ( transform ) => { @@ -274,18 +263,18 @@ const getBlockTypesForPossibleFromTransforms = ( blocks ) => { * @return {Array} Block types that the source can be transformed into. */ const getBlockTypesForPossibleToTransforms = ( blocks ) => { - if ( isEmpty( blocks ) ) { + if ( ! blocks.length ) { return []; } - const sourceBlock = first( blocks ); + const sourceBlock = blocks[ 0 ]; const blockType = getBlockType( sourceBlock.name ); const transformsTo = blockType ? getBlockTransforms( 'to', blockType.name ) : []; // filter all 'to' transforms to find those that are possible. - const possibleTransforms = filter( transformsTo, ( transform ) => { + const possibleTransforms = transformsTo.filter( ( transform ) => { return ( transform && isPossibleTransformForSource( transform, 'to', blocks ) ); @@ -338,7 +327,7 @@ export const isContainerGroupBlock = ( name ) => * @return {Array} Block types that the blocks argument can be transformed to. */ export function getPossibleBlockTransformations( blocks ) { - if ( isEmpty( blocks ) ) { + if ( ! blocks.length ) { return []; } @@ -418,7 +407,7 @@ export function getBlockTransforms( direction, blockTypeOrName ) { transforms.supportedMobileTransforms && Array.isArray( transforms.supportedMobileTransforms ); const filteredTransforms = usingMobileTransformations - ? filter( transforms[ direction ], ( t ) => { + ? transforms[ direction ].filter( ( t ) => { if ( t.type === 'raw' ) { return true; } @@ -431,7 +420,7 @@ export function getBlockTransforms( direction, blockTypeOrName ) { return true; } - return every( t.blocks, ( transformBlockName ) => + return t.blocks.every( ( transformBlockName ) => transforms.supportedMobileTransforms.includes( transformBlockName ) @@ -459,7 +448,7 @@ function maybeCheckTransformIsMatch( transform, blocks ) { if ( typeof transform.isMatch !== 'function' ) { return true; } - const sourceBlock = first( blocks ); + const sourceBlock = blocks[ 0 ]; const attributes = transform.isMultiBlock ? blocks.map( ( block ) => block.attributes ) : sourceBlock.attributes; @@ -477,7 +466,7 @@ function maybeCheckTransformIsMatch( transform, blocks ) { * @return {?Array} Array of blocks or null. */ export function switchToBlockType( blocks, name ) { - const blocksArray = castArray( blocks ); + const blocksArray = Array.isArray( blocks ) ? blocks : [ blocks ]; const isMultiBlock = blocksArray.length > 1; const firstBlock = blocksArray[ 0 ]; const sourceName = firstBlock.name; @@ -514,7 +503,7 @@ export function switchToBlockType( blocks, name ) { let transformationResults; if ( transformation.isMultiBlock ) { - if ( has( transformation, '__experimentalConvert' ) ) { + if ( '__experimentalConvert' in transformation ) { transformationResults = transformation.__experimentalConvert( blocksArray ); } else { @@ -523,7 +512,7 @@ export function switchToBlockType( blocks, name ) { blocksArray.map( ( currentBlock ) => currentBlock.innerBlocks ) ); } - } else if ( has( transformation, '__experimentalConvert' ) ) { + } else if ( '__experimentalConvert' in transformation ) { transformationResults = transformation.__experimentalConvert( firstBlock ); } else { @@ -544,7 +533,9 @@ export function switchToBlockType( blocks, name ) { // If the transformation function returned a single object, we want to work // with an array instead. - transformationResults = castArray( transformationResults ); + transformationResults = Array.isArray( transformationResults ) + ? transformationResults + : [ transformationResults ]; // Ensure that every block object returned by the transformation has a // valid block type. @@ -562,8 +553,7 @@ export function switchToBlockType( blocks, name ) { return transformationResults; } - const hasSwitchedBlock = some( - transformationResults, + const hasSwitchedBlock = transformationResults.some( ( result ) => result.name === name ); @@ -608,7 +598,7 @@ export const getBlockFromExample = ( name, example ) => { return createBlock( name, example.attributes, - map( example.innerBlocks, ( innerBlock ) => + ( example.innerBlocks ?? [] ).map( ( innerBlock ) => getBlockFromExample( innerBlock.name, innerBlock ) ) ); From 1582c723f31ce0f728cd4dcc1af37821342eeaaa Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Wed, 24 Aug 2022 22:18:17 +0300 Subject: [PATCH 18/68] Lodash: Remove from block serializer API (#43561) --- packages/blocks/src/api/serializer.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/packages/blocks/src/api/serializer.js b/packages/blocks/src/api/serializer.js index 09553966be587a..3300e0893d2459 100644 --- a/packages/blocks/src/api/serializer.js +++ b/packages/blocks/src/api/serializer.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { isEmpty, reduce, castArray } from 'lodash'; - /** * WordPress dependencies */ @@ -216,9 +211,8 @@ export function getSaveContent( blockTypeOrName, attributes, innerBlocks ) { * @return {Object} Subset of attributes for comment serialization. */ export function getCommentAttributes( blockType, attributes ) { - return reduce( - blockType.attributes, - ( accumulator, attributeSchema, key ) => { + return Object.entries( blockType.attributes ?? {} ).reduce( + ( accumulator, [ key, attributeSchema ] ) => { const value = attributes[ key ]; // Ignore undefined values. if ( undefined === value ) { @@ -315,9 +309,10 @@ export function getCommentDelimitedContent( attributes, content ) { - const serializedAttributes = ! isEmpty( attributes ) - ? serializeAttributes( attributes ) + ' ' - : ''; + const serializedAttributes = + attributes && Object.entries( attributes ).length + ? serializeAttributes( attributes ) + ' ' + : ''; // Strip core blocks of their namespace prefix. const blockName = rawBlockName?.startsWith( 'core/' ) @@ -401,7 +396,8 @@ export function __unstableSerializeAndClean( blocks ) { * @return {string} The post content. */ export default function serialize( blocks, options ) { - return castArray( blocks ) + const blocksArray = Array.isArray( blocks ) ? blocks : [ blocks ]; + return blocksArray .map( ( block ) => serializeBlock( block, options ) ) .join( '\n\n' ); } From ec588b48861ac86a8f96589d3da3c50cacb406e5 Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Wed, 24 Aug 2022 22:18:29 +0300 Subject: [PATCH 19/68] Lodash: Remove from block templates API (#43563) --- packages/blocks/src/api/templates.js | 29 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/packages/blocks/src/api/templates.js b/packages/blocks/src/api/templates.js index b4ee9fac6a588d..bc76218892688a 100644 --- a/packages/blocks/src/api/templates.js +++ b/packages/blocks/src/api/templates.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { every, map, get, mapValues } from 'lodash'; - /** * WordPress dependencies */ @@ -26,7 +21,7 @@ import { getBlockType } from './registration'; export function doBlocksMatchTemplate( blocks = [], template = [] ) { return ( blocks.length === template.length && - every( template, ( [ name, , innerBlocksTemplate ], index ) => { + template.every( ( [ name, , innerBlocksTemplate ], index ) => { const block = blocks[ index ]; return ( name === block.name && @@ -55,8 +50,7 @@ export function synchronizeBlocksWithTemplate( blocks = [], template ) { return blocks; } - return map( - template, + return template.map( ( [ name, attributes, innerBlocksTemplate ], index ) => { const block = blocks[ index ]; @@ -74,14 +68,21 @@ export function synchronizeBlocksWithTemplate( blocks = [], template ) { const blockType = getBlockType( name ); const isHTMLAttribute = ( attributeDefinition ) => - get( attributeDefinition, [ 'source' ] ) === 'html'; + attributeDefinition?.source === 'html'; const isQueryAttribute = ( attributeDefinition ) => - get( attributeDefinition, [ 'source' ] ) === 'query'; + attributeDefinition?.source === 'query'; const normalizeAttributes = ( schema, values ) => { - return mapValues( values, ( value, key ) => { - return normalizeAttribute( schema[ key ], value ); - } ); + if ( ! values ) { + return {}; + } + + return Object.fromEntries( + Object.entries( values ).map( ( [ key, value ] ) => [ + key, + normalizeAttribute( schema[ key ], value ), + ] ) + ); }; const normalizeAttribute = ( definition, value ) => { if ( isHTMLAttribute( definition ) && Array.isArray( value ) ) { @@ -104,7 +105,7 @@ export function synchronizeBlocksWithTemplate( blocks = [], template ) { }; const normalizedAttributes = normalizeAttributes( - get( blockType, [ 'attributes' ], {} ), + blockType?.attributes ?? {}, attributes ); From e3e79e1e9410c6577b59d18c5626783470ca8a20 Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Wed, 24 Aug 2022 22:18:53 +0300 Subject: [PATCH 20/68] Lodash: Remove from blocks API raw handling (#43575) * Lodash: Remove from blocks API raw handling * Simplify key in obj expressions --- .../raw-handling/figure-content-reducer.js | 9 ++--- .../api/raw-handling/get-raw-transforms.js | 13 +++---- .../raw-handling/phrasing-content-reducer.js | 7 +--- .../api/raw-handling/shortcode-converter.js | 35 +++++++++---------- 4 files changed, 24 insertions(+), 40 deletions(-) diff --git a/packages/blocks/src/api/raw-handling/figure-content-reducer.js b/packages/blocks/src/api/raw-handling/figure-content-reducer.js index 47144bc9b4311a..4dfb24f2c97816 100644 --- a/packages/blocks/src/api/raw-handling/figure-content-reducer.js +++ b/packages/blocks/src/api/raw-handling/figure-content-reducer.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { has } from 'lodash'; - /** * WordPress dependencies */ @@ -25,7 +20,7 @@ function isFigureContent( node, schema ) { return false; } - return has( schema, [ 'figure', 'children', tag ] ); + return tag in ( schema?.figure?.children ?? {} ); } /** @@ -39,7 +34,7 @@ function isFigureContent( node, schema ) { function canHaveAnchor( node, schema ) { const tag = node.nodeName.toLowerCase(); - return has( schema, [ 'figure', 'children', 'a', 'children', tag ] ); + return tag in ( schema?.figure?.children?.a?.children ?? {} ); } /** diff --git a/packages/blocks/src/api/raw-handling/get-raw-transforms.js b/packages/blocks/src/api/raw-handling/get-raw-transforms.js index cc7d77053a9101..060c72d00f847d 100644 --- a/packages/blocks/src/api/raw-handling/get-raw-transforms.js +++ b/packages/blocks/src/api/raw-handling/get-raw-transforms.js @@ -1,16 +1,12 @@ -/** - * External dependencies - */ -import { filter } from 'lodash'; - /** * Internal dependencies */ import { getBlockTransforms } from '../factory'; export function getRawTransforms() { - return filter( getBlockTransforms( 'from' ), { type: 'raw' } ).map( - ( transform ) => { + return getBlockTransforms( 'from' ) + .filter( ( { type } ) => type === 'raw' ) + .map( ( transform ) => { return transform.isMatch ? transform : { @@ -19,6 +15,5 @@ export function getRawTransforms() { transform.selector && node.matches( transform.selector ), }; - } - ); + } ); } diff --git a/packages/blocks/src/api/raw-handling/phrasing-content-reducer.js b/packages/blocks/src/api/raw-handling/phrasing-content-reducer.js index d1e3a3e43439ac..c72a5ffaf6771c 100644 --- a/packages/blocks/src/api/raw-handling/phrasing-content-reducer.js +++ b/packages/blocks/src/api/raw-handling/phrasing-content-reducer.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { includes } from 'lodash'; - /** * WordPress dependencies */ @@ -33,7 +28,7 @@ export default function phrasingContentReducer( node, doc ) { // fallback. if ( textDecorationLine === 'line-through' || - includes( textDecoration, 'line-through' ) + textDecoration.includes( 'line-through' ) ) { wrap( doc.createElement( 's' ), node ); } diff --git a/packages/blocks/src/api/raw-handling/shortcode-converter.js b/packages/blocks/src/api/raw-handling/shortcode-converter.js index aedbd055248e50..3434717553a985 100644 --- a/packages/blocks/src/api/raw-handling/shortcode-converter.js +++ b/packages/blocks/src/api/raw-handling/shortcode-converter.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { some, castArray, find, mapValues, pickBy, includes } from 'lodash'; - /** * WordPress dependencies */ @@ -16,6 +11,9 @@ import { getBlockType } from '../registration'; import { getBlockAttributes } from '../parser/get-block-attributes'; import { applyBuiltInValidationFixes } from '../parser/apply-built-in-validation-fixes'; +const castArray = ( maybeArray ) => + Array.isArray( maybeArray ) ? maybeArray : [ maybeArray ]; + function segmentHTMLToShortcodeBlock( HTML, lastIndex = 0, @@ -29,7 +27,7 @@ function segmentHTMLToShortcodeBlock( ( transform ) => excludedBlockNames.indexOf( transform.blockName ) === -1 && transform.type === 'shortcode' && - some( castArray( transform.tag ), ( tag ) => + castArray( transform.tag ).some( ( tag ) => regexp( tag ).test( HTML ) ) ); @@ -39,7 +37,7 @@ function segmentHTMLToShortcodeBlock( } const transformTags = castArray( transformation.tag ); - const transformTag = find( transformTags, ( tag ) => + const transformTag = transformTags.find( ( tag ) => regexp( tag ).test( HTML ) ); @@ -56,7 +54,7 @@ function segmentHTMLToShortcodeBlock( // consider the shortcode as inline text, and thus skip conversion for // this segment. if ( - ! includes( match.shortcode.content || '', '<' ) && + ! match.shortcode.content?.includes( '<' ) && ! ( /(\n|

    )\s*$/.test( beforeHTML ) && /^\s*(\n|<\/p>)/.test( afterHTML ) @@ -102,16 +100,17 @@ function segmentHTMLToShortcodeBlock( ); } ); } else { - const attributes = mapValues( - pickBy( - transformation.attributes, - ( schema ) => schema.shortcode - ), - // Passing all of `match` as second argument is intentionally broad - // but shouldn't be too relied upon. - // - // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926 - ( schema ) => schema.shortcode( match.shortcode.attrs, match ) + const attributes = Object.fromEntries( + Object.entries( transformation.attributes ) + .filter( ( [ , schema ] ) => schema.shortcode ) + // Passing all of `match` as second argument is intentionally broad + // but shouldn't be too relied upon. + // + // See: https://github.com/WordPress/gutenberg/pull/3610#discussion_r152546926 + .map( ( [ key, schema ] ) => [ + key, + schema.shortcode( match.shortcode.attrs, match ), + ] ) ); const blockType = getBlockType( transformation.blockName ); From 1b21f86cb6518d0f3fab240a777f4fb5c29c9c2d Mon Sep 17 00:00:00 2001 From: Gerardo Pacheco Date: Wed, 24 Aug 2022 23:52:03 +0200 Subject: [PATCH 21/68] Mobile - AztecView - Adds code values to add support to the recent changes on the web editor using KeyboardEvent.code since codeKey is now deprecated. (#43521) --- packages/react-native-aztec/src/AztecView.js | 34 ++++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/packages/react-native-aztec/src/AztecView.js b/packages/react-native-aztec/src/AztecView.js index 857571ab7ecef3..dda3633c4c2e77 100644 --- a/packages/react-native-aztec/src/AztecView.js +++ b/packages/react-native-aztec/src/AztecView.js @@ -12,7 +12,17 @@ import { * WordPress dependencies */ import { Component, createRef } from '@wordpress/element'; -import { ENTER, BACKSPACE } from '@wordpress/keycodes'; +import { + BACKSPACE, + DELETE, + DOWN, + ENTER, + ESCAPE, + LEFT, + RIGHT, + SPACE, + UP, +} from '@wordpress/keycodes'; /** * Internal dependencies @@ -21,6 +31,19 @@ import * as AztecInputState from './AztecInputState'; const AztecManager = UIManager.getViewManagerConfig( 'RCTAztecView' ); +// Used to match KeyboardEvent.code values (from the Web API) with native keycodes. +const KEYCODES = { + [ BACKSPACE ]: 'Backspace', + [ DELETE ]: 'Delete', + [ DOWN ]: 'ArrowDown', + [ ENTER ]: 'Enter', + [ ESCAPE ]: 'Escape', + [ LEFT ]: 'ArrowLeft', + [ RIGHT ]: 'ArrowRight', + [ SPACE ]: 'Space', + [ UP ]: 'ArrowUp', +}; + class AztecView extends Component { constructor() { super( ...arguments ); @@ -75,7 +98,7 @@ class AztecView extends Component { const { onKeyDown } = this.props; - const newEvent = { ...event, keyCode: ENTER }; + const newEvent = { ...event, keyCode: ENTER, code: KEYCODES[ ENTER ] }; onKeyDown( newEvent ); } @@ -89,6 +112,7 @@ class AztecView extends Component { const newEvent = { ...event, keyCode: BACKSPACE, + code: KEYCODES[ BACKSPACE ], preventDefault: () => {}, }; onKeyDown( newEvent ); @@ -100,9 +124,13 @@ class AztecView extends Component { } const { onKeyDown } = this.props; + const { keyCode } = event.nativeEvent; const newEvent = { ...event, - keyCode: event.nativeEvent.keyCode, + keyCode, + ...( KEYCODES[ keyCode ] && { + code: KEYCODES[ keyCode ], + } ), preventDefault: () => {}, }; onKeyDown( newEvent ); From f129ed1fed4013872219b440ffba6eacf00bd4b5 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Thu, 25 Aug 2022 12:15:46 +0900 Subject: [PATCH 22/68] Components: Remove unused Storybook utils (#43578) --- .../src/ui/__storybook-utils/example-grid.js | 61 ------------------- .../src/ui/__storybook-utils/index.js | 1 - .../src/ui/__storybook-utils/page.js | 29 --------- packages/components/tsconfig.json | 3 +- 4 files changed, 1 insertion(+), 93 deletions(-) delete mode 100644 packages/components/src/ui/__storybook-utils/example-grid.js delete mode 100644 packages/components/src/ui/__storybook-utils/index.js delete mode 100644 packages/components/src/ui/__storybook-utils/page.js diff --git a/packages/components/src/ui/__storybook-utils/example-grid.js b/packages/components/src/ui/__storybook-utils/example-grid.js deleted file mode 100644 index 4695fb7e5e1e0a..00000000000000 --- a/packages/components/src/ui/__storybook-utils/example-grid.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Internal dependencies - */ -import { Grid } from '../../grid'; -import { Surface } from '../../surface'; -import { Text } from '../../text'; -import { View } from '../../view'; -import { VStack } from '../../v-stack'; - -const Container = ( { children } ) => ( -

    - { children } -
    -); - -export const ExampleGrid = ( { children } ) => ( - - - { children } - - -); - -export const ExampleGridItem = ( { children } ) => ( - - { children } - -); - -export const ExampleMetaContent = ( { title, items = [] } ) => { - return ( - - - - { title } - - - - { items.map( ( item, index ) => ( - - - { item } - - - ) ) } - - - ); -}; diff --git a/packages/components/src/ui/__storybook-utils/index.js b/packages/components/src/ui/__storybook-utils/index.js deleted file mode 100644 index 54a95be9a0b0d0..00000000000000 --- a/packages/components/src/ui/__storybook-utils/index.js +++ /dev/null @@ -1 +0,0 @@ -export * from './example-grid'; diff --git a/packages/components/src/ui/__storybook-utils/page.js b/packages/components/src/ui/__storybook-utils/page.js deleted file mode 100644 index 58892dbb57155c..00000000000000 --- a/packages/components/src/ui/__storybook-utils/page.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Internal dependencies - */ -import { VStack } from '../../v-stack'; -import { View } from '../../view'; -import { Heading } from '../../heading'; -import { Divider } from '../../divider'; - -function Page( { title = 'Component', children } ) { - return ( -
    - - { title } - - { children } - -
    - ); -} - -export default Page; diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json index 2b292520a92bed..461926ecc0de6d 100644 --- a/packages/components/tsconfig.json +++ b/packages/components/tsconfig.json @@ -86,7 +86,6 @@ "src/toolbar-dropdown-menu", "src/toolbar-group", "src/toolbar-item", - "src/tree-grid", - "src/ui/__storybook-utils" + "src/tree-grid" ] } From 0c1508546ff61f73e76ee9ec70278a07ae901eb3 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 25 Aug 2022 07:24:24 +0400 Subject: [PATCH 23/68] Block Library: Fix error in useClientWidth (#43585) --- packages/block-library/src/image/use-client-width.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/image/use-client-width.js b/packages/block-library/src/image/use-client-width.js index 738bfb0373f880..ddbc53536bbffa 100644 --- a/packages/block-library/src/image/use-client-width.js +++ b/packages/block-library/src/image/use-client-width.js @@ -7,7 +7,7 @@ export default function useClientWidth( ref, dependencies ) { const [ clientWidth, setClientWidth ] = useState(); function calculateClientWidth() { - setClientWidth( ref.current.clientWidth ); + setClientWidth( ref.current?.clientWidth ); } useEffect( calculateClientWidth, dependencies ); From 2e276d1d76f48ce508d108425833d9ea6791d939 Mon Sep 17 00:00:00 2001 From: Edwin Cromley Date: Thu, 25 Aug 2022 00:21:51 -0400 Subject: [PATCH 24/68] E2E Tests: Add test for avatar block to ensure that user image updates when user switched (#42657) * E2E Tests: Add test for avatar block to ensure that user avatar switches when set to a new user. * e2e tests: Change UserData interface type to have optional fields. * e2e tests: Only export deleteAllUsers and createUser. * e2e tests: Make selector case insensitive for avatar block. * e2e tests: Remove uneccessary visible check. * e2e tests: Avatar block, remove uneccessary visible check for elements that are clicked. * e2e tests: Avatar block, remove uneccessary visible check for final assertion. * e2e tests: Avatar Block: Clean up test case to remove unneeded visible checks. Only use accessible selectors. * e2e tests: Move root user check into deleteAllUsers instead of deleteUser. * e2e tests: Make createUser only conditionally add optional fields. --- .../src/request-utils/index.ts | 3 + .../src/request-utils/users.ts | 121 ++++++++++++++++++ test/e2e/specs/editor/blocks/avatar.spec.js | 71 ++++++++++ 3 files changed, 195 insertions(+) create mode 100644 packages/e2e-test-utils-playwright/src/request-utils/users.ts create mode 100644 test/e2e/specs/editor/blocks/avatar.spec.js diff --git a/packages/e2e-test-utils-playwright/src/request-utils/index.ts b/packages/e2e-test-utils-playwright/src/request-utils/index.ts index 322aa48e850f86..bd6ed7035561ee 100644 --- a/packages/e2e-test-utils-playwright/src/request-utils/index.ts +++ b/packages/e2e-test-utils-playwright/src/request-utils/index.ts @@ -13,6 +13,7 @@ import { WP_ADMIN_USER, WP_BASE_URL } from '../config'; import type { User } from './login'; import { login } from './login'; import { listMedia, uploadMedia, deleteMedia, deleteAllMedia } from './media'; +import { createUser, deleteAllUsers } from './users'; import { setupRest, rest, getMaxBatchSize, batchRest } from './rest'; import { getPluginsMap, activatePlugin, deactivatePlugin } from './plugins'; import { deleteAllTemplates } from './templates'; @@ -133,6 +134,8 @@ class RequestUtils { uploadMedia = uploadMedia.bind( this ); deleteMedia = deleteMedia.bind( this ); deleteAllMedia = deleteAllMedia.bind( this ); + createUser = createUser.bind( this ); + deleteAllUsers = deleteAllUsers.bind( this ); } export type { StorageState }; diff --git a/packages/e2e-test-utils-playwright/src/request-utils/users.ts b/packages/e2e-test-utils-playwright/src/request-utils/users.ts new file mode 100644 index 00000000000000..c790ec9e3a9897 --- /dev/null +++ b/packages/e2e-test-utils-playwright/src/request-utils/users.ts @@ -0,0 +1,121 @@ +/** + * Internal dependencies + */ +import type { RequestUtils } from './index'; + +export interface User { + id: number; + email: string; +} + +export interface UserData { + username: string; + email: string; + firstName?: string; + lastName?: string; + password?: string; + roles?: string[]; +} + +export interface UserRequestData { + username: string; + email: string; + first_name?: string; + last_name?: string; + password?: string; + roles?: string[]; +} + +/** + * List all users. + * + * @see https://developer.wordpress.org/rest-api/reference/users/#list-users + * @param this + */ +async function listUsers( this: RequestUtils ) { + const response = await this.rest< User[] >( { + method: 'GET', + path: '/wp/v2/users', + params: { + per_page: 100, + }, + } ); + + return response; +} + +/** + * Add a test user. + * + * @see https://developer.wordpress.org/rest-api/reference/users/#create-a-user + * @param this + * @param user User data to create. + */ +async function createUser( this: RequestUtils, user: UserData ) { + const userData: UserRequestData = { + username: user.username, + email: user.email, + }; + + if ( user.firstName ) { + userData.first_name = user.firstName; + } + + if ( user.lastName ) { + userData.last_name = user.lastName; + } + + if ( user.password ) { + userData.password = user.password; + } + + if ( user.roles ) { + userData.roles = user.roles; + } + + const response = await this.rest< User >( { + method: 'POST', + path: '/wp/v2/users', + data: userData, + } ); + + return response; +} + +/** + * Delete a user. + * + * @see https://developer.wordpress.org/rest-api/reference/users/#delete-a-user + * @param this + * @param userId The ID of the user. + */ +async function deleteUser( this: RequestUtils, userId: number ) { + const response = await this.rest( { + method: 'DELETE', + path: `/wp/v2/users/${ userId }`, + params: { force: true, reassign: 1 }, + } ); + + return response; +} + +/** + * Delete all users except main root user. + * + * @param this + */ +async function deleteAllUsers( this: RequestUtils ) { + const users = await listUsers.bind( this )(); + + // The users endpoint doesn't support batch request yet. + const responses = await Promise.all( + users + // Do not delete root user. + .filter( ( user: User ) => user.id !== 1 ) + .map( ( user: User ) => deleteUser.bind( this )( user.id ) ) + ); + + return responses; +} + +export { createUser, deleteAllUsers }; diff --git a/test/e2e/specs/editor/blocks/avatar.spec.js b/test/e2e/specs/editor/blocks/avatar.spec.js new file mode 100644 index 00000000000000..70c7f7bd681936 --- /dev/null +++ b/test/e2e/specs/editor/blocks/avatar.spec.js @@ -0,0 +1,71 @@ +/** + * WordPress dependencies + */ + +const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); + +test.describe( 'Avatar', () => { + test.beforeAll( async ( { requestUtils } ) => { + await requestUtils.deleteAllUsers(); + } ); + + test.beforeEach( async ( { admin, requestUtils } ) => { + await requestUtils.createUser( { + username: 'user', + email: 'gravatartest@gmail.com', + firstName: 'Gravatar', + lastName: 'Gravatar', + roles: [ 'author' ], + password: 'gravatargravatar123magic', + } ); + + await admin.createNewPost(); + } ); + + test.afterEach( async ( { requestUtils } ) => { + await requestUtils.deleteAllUsers(); + } ); + + test( 'should change image when user is changed', async ( { + editor, + page, + } ) => { + // Inserting a quote block + await editor.insertBlock( { + name: 'core/avatar', + } ); + + const username = 'Gravatar Gravatar'; + + const avatarBlock = page.locator( + 'role=document[name="Block: Avatar"i]' + ); + + const avatarImage = avatarBlock.locator( 'img' ); + + await expect( avatarImage ).toBeVisible(); + + const originalSrc = await avatarImage.getAttribute( 'src' ); + + const blockInspectorControls = page.locator( + '.block-editor-block-inspector' + ); + + await expect( blockInspectorControls ).toBeVisible(); + + const userInput = page.locator( + 'role=region[name="Editor settings"i] >> role=combobox[name="User"i]' + ); + + // Set new user. + await userInput.click(); + + const newUser = page.locator( 'role=option[name="' + username + '"]' ); + + await newUser.click(); + + const newSrc = await avatarImage.getAttribute( 'src' ); + + expect( newSrc ).not.toBe( originalSrc ); + } ); +} ); From 33fa163e729b91863f338db4dd95241bdd3d9e2e Mon Sep 17 00:00:00 2001 From: Pooja Killekar <41000648+pooja-muchandikar@users.noreply.github.com> Date: Thu, 25 Aug 2022 09:53:34 +0530 Subject: [PATCH 25/68] Migrate duplicating block test to playwright (#43171) --- .../duplicating-blocks.test.js.snap | 21 ------ .../editor/various/duplicating-blocks.test.js | 47 -------------- .../editor/various/duplicating-blocks.spec.js | 64 +++++++++++++++++++ 3 files changed, 64 insertions(+), 68 deletions(-) delete mode 100644 packages/e2e-tests/specs/editor/various/__snapshots__/duplicating-blocks.test.js.snap delete mode 100644 packages/e2e-tests/specs/editor/various/duplicating-blocks.test.js create mode 100644 test/e2e/specs/editor/various/duplicating-blocks.spec.js diff --git a/packages/e2e-tests/specs/editor/various/__snapshots__/duplicating-blocks.test.js.snap b/packages/e2e-tests/specs/editor/various/__snapshots__/duplicating-blocks.test.js.snap deleted file mode 100644 index bb8192de22cb94..00000000000000 --- a/packages/e2e-tests/specs/editor/various/__snapshots__/duplicating-blocks.test.js.snap +++ /dev/null @@ -1,21 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`Duplicating blocks should duplicate blocks using the block settings menu 1`] = ` -" -

    Clone me

    - - - -

    Clone me

    -" -`; - -exports[`Duplicating blocks should duplicate blocks using the keyboard shortcut 1`] = ` -" -

    Clone me

    - - - -

    Clone me

    -" -`; diff --git a/packages/e2e-tests/specs/editor/various/duplicating-blocks.test.js b/packages/e2e-tests/specs/editor/various/duplicating-blocks.test.js deleted file mode 100644 index 6916fdd6852aa5..00000000000000 --- a/packages/e2e-tests/specs/editor/various/duplicating-blocks.test.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * WordPress dependencies - */ -import { - clickMenuItem, - createNewPost, - insertBlock, - getEditedPostContent, - clickBlockToolbarButton, - pressKeyWithModifier, -} from '@wordpress/e2e-test-utils'; - -describe( 'Duplicating blocks', () => { - beforeEach( async () => { - await createNewPost(); - } ); - - it( 'should duplicate blocks using the block settings menu', async () => { - await insertBlock( 'Paragraph' ); - await page.keyboard.type( 'Clone me' ); - - // Select the test we just typed - // This doesn't do anything but we previously had a duplicationi bug - // When the selection was not collapsed. - await pressKeyWithModifier( 'primary', 'a' ); - - await clickBlockToolbarButton( 'Options' ); - await clickMenuItem( 'Duplicate' ); - - expect( await getEditedPostContent() ).toMatchSnapshot(); - } ); - - it( 'should duplicate blocks using the keyboard shortcut', async () => { - await insertBlock( 'Paragraph' ); - await page.keyboard.type( 'Clone me' ); - - // Select the test we just typed - // This doesn't do anything but we previously had a duplicationi bug - // When the selection was not collapsed. - await pressKeyWithModifier( 'primary', 'a' ); - - // Duplicate using the keyboard shortccut. - await pressKeyWithModifier( 'primaryShift', 'd' ); - - expect( await getEditedPostContent() ).toMatchSnapshot(); - } ); -} ); diff --git a/test/e2e/specs/editor/various/duplicating-blocks.spec.js b/test/e2e/specs/editor/various/duplicating-blocks.spec.js new file mode 100644 index 00000000000000..1878db2013dc44 --- /dev/null +++ b/test/e2e/specs/editor/various/duplicating-blocks.spec.js @@ -0,0 +1,64 @@ +/** + * WordPress dependencies + */ +const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); + +test.describe( 'Duplicating blocks', () => { + test.beforeEach( async ( { admin } ) => { + await admin.createNewPost(); + } ); + + test( 'should duplicate blocks using the block settings menu', async ( { + page, + pageUtils, + editor, + } ) => { + await editor.insertBlock( { name: 'core/paragraph' } ); + await page.keyboard.type( 'Clone me' ); + + // Select the test we just typed + // This doesn't do anything but we previously had a duplicationi bug + // When the selection was not collapsed. + await pageUtils.pressKeyWithModifier( 'primary', 'a' ); + + await editor.clickBlockToolbarButton( 'Options' ); + await page.click( 'role=menuitem[name=/Duplicate/i]' ); + + expect( await editor.getEditedPostContent() ).toBe( + ` +

    Clone me

    + + + +

    Clone me

    +` + ); + } ); + + test( 'should duplicate blocks using the keyboard shortcut', async ( { + page, + pageUtils, + editor, + } ) => { + await editor.insertBlock( { name: 'core/paragraph' } ); + await page.keyboard.type( 'Clone me' ); + + // Select the test we just typed + // This doesn't do anything but we previously had a duplicationi bug + // When the selection was not collapsed. + await pageUtils.pressKeyWithModifier( 'primary', 'a' ); + + // Duplicate using the keyboard shortccut. + await pageUtils.pressKeyWithModifier( 'primaryShift', 'd' ); + + expect( await editor.getEditedPostContent() ).toBe( + ` +

    Clone me

    + + + +

    Clone me

    +` + ); + } ); +} ); From 281347096f83be9468f5627a2762c3177c1eb435 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Thu, 25 Aug 2022 14:07:40 +0900 Subject: [PATCH 26/68] Make more components pass type checks (#43579) * Make more components pass type checks * Add changelog --- packages/components/CHANGELOG.md | 1 + packages/components/src/clipboard-button/index.js | 13 +++++++++++++ packages/components/src/focusable-iframe/index.js | 5 +++++ .../higher-order/with-constrained-tabbing/index.js | 2 +- .../src/higher-order/with-spoken-messages/index.js | 2 ++ .../src/isolated-event-container/index.js | 3 +++ packages/components/tsconfig.json | 5 ----- 7 files changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 1fbfc07ff817e1..3aceea9955d780 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -33,6 +33,7 @@ ### Internal - `Tooltip`: Refactor tests to `@testing-library/react` ([#43061](https://github.com/WordPress/gutenberg/pull/43061)). +- `ClipboardButton`, `FocusableIframe`, `IsolatedEventContainer`, `withConstrainedTabbing`, `withSpokenMessages`: Improve TypeScript types ([#43579](https://github.com/WordPress/gutenberg/pull/43579)). - Clean up unused and duplicate `COLORS` values ([#43445](https://github.com/WordPress/gutenberg/pull/43445)). - Update `floating-ui` to the latest version ([#43206](https://github.com/WordPress/gutenberg/pull/43206)). - `DateTimePicker`, `TimePicker`, `DatePicker`: Switch from `moment` to `date-fns` ([#43005](https://github.com/WordPress/gutenberg/pull/43005)). diff --git a/packages/components/src/clipboard-button/index.js b/packages/components/src/clipboard-button/index.js index abea826c36f3d1..9cce2dbefa9a79 100644 --- a/packages/components/src/clipboard-button/index.js +++ b/packages/components/src/clipboard-button/index.js @@ -17,6 +17,14 @@ import Button from '../button'; const TIMEOUT = 4000; +/** + * @param {Object} props + * @param {string} [props.className] + * @param {import('react').ReactNode} props.children + * @param {() => void} props.onCopy + * @param {() => void} [props.onFinishCopy] + * @param {string} props.text + */ export default function ClipboardButton( { className, children, @@ -30,9 +38,11 @@ export default function ClipboardButton( { alternative: 'wp.compose.useCopyToClipboard', } ); + /** @type {import('react').MutableRefObject | undefined>} */ const timeoutId = useRef(); const ref = useCopyToClipboard( text, () => { onCopy(); + // @ts-expect-error: Should check if .current is defined, but not changing because this component is deprecated. clearTimeout( timeoutId.current ); if ( onFinishCopy ) { @@ -41,6 +51,7 @@ export default function ClipboardButton( { } ); useEffect( () => { + // @ts-expect-error: Should check if .current is defined, but not changing because this component is deprecated. clearTimeout( timeoutId.current ); }, [] ); @@ -51,7 +62,9 @@ export default function ClipboardButton( { // This causes documentHasSelection() in the copy-handler component to // mistakenly override the ClipboardButton, and copy a serialized string // of the current block instead. + /** @type {import('react').ClipboardEventHandler} */ const focusOnCopyEventTarget = ( event ) => { + // @ts-expect-error: Should be currentTarget, but not changing because this component is deprecated. event.target.focus(); }; diff --git a/packages/components/src/focusable-iframe/index.js b/packages/components/src/focusable-iframe/index.js index f9c1da6406320d..0374bebf7eba0c 100644 --- a/packages/components/src/focusable-iframe/index.js +++ b/packages/components/src/focusable-iframe/index.js @@ -4,7 +4,12 @@ import { useMergeRefs, useFocusableIframe } from '@wordpress/compose'; import deprecated from '@wordpress/deprecated'; +/** + * @param {Object} props + * @param {import('react').Ref} props.iframeRef + */ export default function FocusableIframe( { iframeRef, ...props } ) { + // @ts-expect-error: Return type for useFocusableIframe() is incorrect. const ref = useMergeRefs( [ iframeRef, useFocusableIframe() ] ); deprecated( 'wp.components.FocusableIframe', { since: '5.9', diff --git a/packages/components/src/higher-order/with-constrained-tabbing/index.js b/packages/components/src/higher-order/with-constrained-tabbing/index.js index db1dbe27f6908c..506df55550bcc5 100644 --- a/packages/components/src/higher-order/with-constrained-tabbing/index.js +++ b/packages/components/src/higher-order/with-constrained-tabbing/index.js @@ -11,7 +11,7 @@ const withConstrainedTabbing = createHigherOrderComponent( function ComponentWithConstrainedTabbing( props ) { const ref = useConstrainedTabbing(); return ( -
    +
    ); diff --git a/packages/components/src/higher-order/with-spoken-messages/index.js b/packages/components/src/higher-order/with-spoken-messages/index.js index ab84c8869ef1c2..4302c8f252d4f9 100644 --- a/packages/components/src/higher-order/with-spoken-messages/index.js +++ b/packages/components/src/higher-order/with-spoken-messages/index.js @@ -4,6 +4,8 @@ import { createHigherOrderComponent, useDebounce } from '@wordpress/compose'; import { speak } from '@wordpress/a11y'; +/** @typedef {import('@wordpress/element').WPComponent} WPComponent */ + /** * A Higher Order Component used to be provide speak and debounced speak * functions. diff --git a/packages/components/src/isolated-event-container/index.js b/packages/components/src/isolated-event-container/index.js index ec0daad03c63d8..5b24d36d0b1acb 100644 --- a/packages/components/src/isolated-event-container/index.js +++ b/packages/components/src/isolated-event-container/index.js @@ -4,6 +4,9 @@ import { forwardRef } from '@wordpress/element'; import deprecated from '@wordpress/deprecated'; +/** + * @type {import('react').MouseEventHandler} + */ function stopPropagation( event ) { event.stopPropagation(); } diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json index 461926ecc0de6d..61b3f00f12a227 100644 --- a/packages/components/tsconfig.json +++ b/packages/components/tsconfig.json @@ -43,7 +43,6 @@ "src/angle-picker-control", "src/autocomplete", "src/box-control", - "src/clipboard-button", "src/color-list-picker", "src/combobox-control", "src/custom-gradient-picker", @@ -52,19 +51,15 @@ "src/drop-zone", "src/duotone-picker", "src/focal-point-picker", - "src/focusable-iframe", "src/font-size-picker", "src/form-file-upload", "src/gradient-picker", "src/guide", "src/higher-order/navigate-regions", - "src/higher-order/with-constrained-tabbing", "src/higher-order/with-fallback-styles", "src/higher-order/with-filters", "src/higher-order/with-focus-return", - "src/higher-order/with-spoken-messages", "src/higher-order/with-notices", - "src/isolated-event-container", "src/keyboard-shortcuts", "src/menu-items-choice", "src/navigation", From dcfff3a6e693494148e095a98392d8a15aec6669 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Thu, 25 Aug 2022 15:14:23 +1000 Subject: [PATCH 27/68] Post Excerpt: Add missing typography supports (#43341) --- packages/block-library/src/post-excerpt/block.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/post-excerpt/block.json b/packages/block-library/src/post-excerpt/block.json index 2fef4f20cf8af9..03107ff900e068 100644 --- a/packages/block-library/src/post-excerpt/block.json +++ b/packages/block-library/src/post-excerpt/block.json @@ -37,10 +37,12 @@ "typography": { "fontSize": true, "lineHeight": true, - "__experimentalFontStyle": true, + "__experimentalFontFamily": true, "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, + "__experimentalFontStyle": true, "__experimentalTextTransform": true, + "__experimentalTextDecoration": true, + "__experimentalLetterSpacing": true, "__experimentalDefaultControls": { "fontSize": true } From 9bde7eb7f5367fea28ef17cce4d8f0c87f22d66c Mon Sep 17 00:00:00 2001 From: Pavan Patil <44057535+pavanpatil1@users.noreply.github.com> Date: Thu, 25 Aug 2022 10:51:34 +0530 Subject: [PATCH 28/68] Migrate register block test case to playwright (#43170) * Migrate register block test case to playwright * Addressed feedback Co-authored-by: pavanpatil1 <=> --- .../plugins/register-block-type-hooks.test.js | 32 ------------------- .../plugins/register-block-type-hooks.spec.js | 29 +++++++++++++++++ 2 files changed, 29 insertions(+), 32 deletions(-) delete mode 100644 packages/e2e-tests/specs/editor/plugins/register-block-type-hooks.test.js create mode 100644 test/e2e/specs/editor/plugins/register-block-type-hooks.spec.js diff --git a/packages/e2e-tests/specs/editor/plugins/register-block-type-hooks.test.js b/packages/e2e-tests/specs/editor/plugins/register-block-type-hooks.test.js deleted file mode 100644 index d0f2457ec2005d..00000000000000 --- a/packages/e2e-tests/specs/editor/plugins/register-block-type-hooks.test.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * WordPress dependencies - */ -import { - activatePlugin, - createNewPost, - deactivatePlugin, - openGlobalBlockInserter, -} from '@wordpress/e2e-test-utils'; - -describe( 'Register block type hooks', () => { - beforeEach( async () => { - await activatePlugin( 'gutenberg-test-register-block-type-hooks' ); - await createNewPost(); - } ); - - afterEach( async () => { - await deactivatePlugin( 'gutenberg-test-register-block-type-hooks' ); - } ); - - it( 'has a custom category for Paragraph block', async () => { - await openGlobalBlockInserter(); - - const widgetsCategory = await page.waitForSelector( - '.block-editor-block-types-list[aria-label="Widgets"]' - ); - - expect( - await widgetsCategory.$( '.editor-block-list-item-paragraph' ) - ).toBeDefined(); - } ); -} ); diff --git a/test/e2e/specs/editor/plugins/register-block-type-hooks.spec.js b/test/e2e/specs/editor/plugins/register-block-type-hooks.spec.js new file mode 100644 index 00000000000000..2ec62ffd056d31 --- /dev/null +++ b/test/e2e/specs/editor/plugins/register-block-type-hooks.spec.js @@ -0,0 +1,29 @@ +/** + * WordPress dependencies + */ +const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); + +test.describe( 'Register block type hooks', () => { + test.beforeEach( async ( { requestUtils, admin } ) => { + await requestUtils.activatePlugin( + 'gutenberg-test-register-block-type-hooks' + ); + await admin.createNewPost(); + } ); + + test.afterEach( async ( { requestUtils } ) => { + await requestUtils.deactivatePlugin( + 'gutenberg-test-register-block-type-hooks' + ); + } ); + + test( 'has a custom category for Paragraph block', async ( { page } ) => { + await page.click( 'role=button[name="Toggle block inserter"i]' ); + + expect( + page.locator( + 'role=listbox[name="Widgets"i] >> role=option[name="Paragraph"i]' + ) + ).toBeDefined(); + } ); +} ); From 79dcf05b6a93798272b9eed5c778cddb49b5dd32 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Thu, 25 Aug 2022 15:22:21 +1000 Subject: [PATCH 29/68] Query Title: Add missing typography supports (#43565) --- packages/block-library/src/query-title/block.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/query-title/block.json b/packages/block-library/src/query-title/block.json index 318643bae30058..33df75866bce0a 100644 --- a/packages/block-library/src/query-title/block.json +++ b/packages/block-library/src/query-title/block.json @@ -48,6 +48,7 @@ "__experimentalFontWeight": true, "__experimentalLetterSpacing": true, "__experimentalTextTransform": true, + "__experimentalTextDecoration": true, "__experimentalDefaultControls": { "fontSize": true, "fontAppearance": true, From ccc584c0b8a2d312852a7de38b8dec4d53131bf2 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Thu, 25 Aug 2022 16:26:37 +1000 Subject: [PATCH 30/68] Term Description: Add missing typography supports (#43568) --- packages/block-library/src/term-description/block.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/block-library/src/term-description/block.json b/packages/block-library/src/term-description/block.json index 3e6641725940f9..66eb9348a47093 100644 --- a/packages/block-library/src/term-description/block.json +++ b/packages/block-library/src/term-description/block.json @@ -28,6 +28,12 @@ "typography": { "fontSize": true, "lineHeight": true, + "__experimentalFontFamily": true, + "__experimentalFontWeight": true, + "__experimentalFontStyle": true, + "__experimentalTextTransform": true, + "__experimentalTextDecoration": true, + "__experimentalLetterSpacing": true, "__experimentalDefaultControls": { "fontSize": true } From 464e1eb2cbe8924f84169ac7bd1e6f1ae87a8ee9 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Thu, 25 Aug 2022 08:36:25 +0000 Subject: [PATCH 31/68] Bump plugin version to 14.0.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 1d5cd83741484c..b649e3841489ee 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -5,7 +5,7 @@ * Description: Printing since 1440. This is the development plugin for the new block editor in core. * Requires at least: 5.9 * Requires PHP: 5.6 - * Version: 14.0.0-rc.1 + * Version: 14.0.0-rc.2 * Author: Gutenberg Team * Text Domain: gutenberg * diff --git a/package-lock.json b/package-lock.json index e35bd0491294fb..a045a86cd5b49e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "14.0.0-rc.1", + "version": "14.0.0-rc.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 01a1bb132966a7..ee933ef6610c55 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "14.0.0-rc.1", + "version": "14.0.0-rc.2", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", From 4db2d5317df34067f2e62dcd359624f7aad2c169 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Thu, 25 Aug 2022 16:42:05 +0800 Subject: [PATCH 32/68] Fix duplicate navigation block props (#43596) * Fix duplicate block props in unsaved navigation inner blocks * Fix broken layout * Remove unused styles --- .../src/navigation/edit/index.js | 1 - .../navigation/edit/unsaved-inner-blocks.js | 38 +++++++------------ .../block-library/src/navigation/editor.scss | 20 ---------- 3 files changed, 14 insertions(+), 45 deletions(-) diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index a6c66a7a9d5341..bbd632a27e56fe 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -633,7 +633,6 @@ function Navigation( { overlayTextColor={ overlayTextColor } > -
    -
    -
    + <> + { isSaving && } - + ); } diff --git a/packages/block-library/src/navigation/editor.scss b/packages/block-library/src/navigation/editor.scss index b0daf5dd59b15e..abda30d87ce2c9 100644 --- a/packages/block-library/src/navigation/editor.scss +++ b/packages/block-library/src/navigation/editor.scss @@ -568,21 +568,6 @@ body.editor-styles-wrapper padding: $grid-unit-10 $grid-unit-15; } -.wp-block-navigation__unsaved-changes { - position: relative; - - .components-spinner { - position: absolute; - top: calc(50% - #{$spinner-size} / 2); - left: calc(50% - #{$spinner-size} / 2); - - // Delay showing the saving spinner until after 2 seconds. - // This should ensure it only shows for slow connections. - opacity: 0; - animation: 0.5s linear 2s normal forwards fadein; - } -} - @keyframes fadeouthalf { 0% { opacity: 1; @@ -592,11 +577,6 @@ body.editor-styles-wrapper } } -.wp-block-navigation__unsaved-changes-overlay.is-saving { - opacity: 1; - animation: 0.5s linear 2s normal forwards fadeouthalf; -} - .wp-block-navigation-delete-menu-button { width: 100%; justify-content: center; From 8d98737584f2d3e69eb65e9218aa60d0ca1f2544 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Thu, 25 Aug 2022 08:51:41 +0000 Subject: [PATCH 33/68] Update Changelog for 14.0.0-rc.2 --- changelog.txt | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/changelog.txt b/changelog.txt index 8418f7d6765610..094dd5f0b2ec3c 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,30 @@ == Changelog == += 14.0.0-rc.2 = + + + +## Changelog + +### Enhancements + +#### Block Library +- List: Use nested blocks. ([42711](https://github.com/WordPress/gutenberg/pull/42711)) + + +## First time contributors + +The following PRs were merged by first time contributors: + + + +## Contributors + +The following contributors merged PRs in this release: + +@ellatrix + + = 14.0.0-rc.1 = From 9d727398dae16b8a926f30e2ea4d3efa9ea0895b Mon Sep 17 00:00:00 2001 From: Mitchell Austin Date: Thu, 25 Aug 2022 02:09:30 -0700 Subject: [PATCH 34/68] Refactor `FocalPointPicker` to function component (#39168) * pregame cleanup * Rewrite as function component, decruftify, update tests * Keep a ref of point value to obviate effect hook * Simplify media placeholder to obviate layout effect hook * Fix reset on blur * Update bounds unconditionally from single-run layout effect * Update example code in README * Simplify state handling * Control `Grid` visibility from component root Co-authored-by: Marco Ciampini <1083581+ciampo@users.noreply.github.com> * Add changelog entry Co-authored-by: Marco Ciampini <1083581+ciampo@users.noreply.github.com> --- packages/components/CHANGELOG.md | 4 + .../src/focal-point-picker/README.md | 9 +- .../src/focal-point-picker/controls.js | 8 +- .../src/focal-point-picker/focal-point.js | 10 +- .../components/src/focal-point-picker/grid.js | 46 +- .../src/focal-point-picker/index.js | 464 ++++++------------ .../src/focal-point-picker/media.js | 32 +- .../styles/focal-point-picker-style.js | 13 +- .../src/focal-point-picker/test/index.js | 2 +- .../src/focal-point-picker/utils.js | 8 +- 10 files changed, 191 insertions(+), 405 deletions(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 3aceea9955d780..dd236130446a3c 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Internal + +- Refactor `FocalPointPicker` to function component ([#39168](https://github.com/WordPress/gutenberg/pull/39168)). + ## 20.0.0 (2022-08-24) ### Breaking Changes diff --git a/packages/components/src/focal-point-picker/README.md b/packages/components/src/focal-point-picker/README.md index 55a1bb008afa2d..c2483f01e6a4b1 100644 --- a/packages/components/src/focal-point-picker/README.md +++ b/packages/components/src/focal-point-picker/README.md @@ -18,10 +18,6 @@ const Example = () => { } ); const url = '/path/to/image'; - const dimensions = { - width: 400, - height: 100, - }; /* Example function to render the CSS styles based on Focal Point Picker value */ const style = { @@ -33,9 +29,10 @@ const Example = () => { <> setFocalPoint( { focalPoint } ) } + onDragStart={ setFocalPoint } + onDrag={ setFocalPoint } + onChange={ setFocalPoint } />
    diff --git a/packages/components/src/focal-point-picker/controls.js b/packages/components/src/focal-point-picker/controls.js index c001aa866ca130..dc8ea6404029e0 100644 --- a/packages/components/src/focal-point-picker/controls.js +++ b/packages/components/src/focal-point-picker/controls.js @@ -18,19 +18,19 @@ const noop = () => {}; export default function FocalPointPickerControls( { onChange = noop, - percentages = { + point = { x: 0.5, y: 0.5, }, } ) { - const valueX = fractionToPercentage( percentages.x ); - const valueY = fractionToPercentage( percentages.y ); + const valueX = fractionToPercentage( point.x ); + const valueY = fractionToPercentage( point.y ); const handleChange = ( value, axis ) => { const num = parseInt( value, 10 ); if ( ! isNaN( num ) ) { - onChange( { ...percentages, [ axis ]: num / 100 } ); + onChange( { ...point, [ axis ]: num / 100 } ); } }; diff --git a/packages/components/src/focal-point-picker/focal-point.js b/packages/components/src/focal-point-picker/focal-point.js index 75bc53a7306e4d..5809bf81af9f16 100644 --- a/packages/components/src/focal-point-picker/focal-point.js +++ b/packages/components/src/focal-point-picker/focal-point.js @@ -13,18 +13,12 @@ import { */ import classnames from 'classnames'; -export default function FocalPoint( { - coordinates = { left: '50%', top: '50%' }, - ...props -} ) { +export default function FocalPoint( { left = '50%', top = '50%', ...props } ) { const classes = classnames( 'components-focal-point-picker__icon_container' ); - const style = { - left: coordinates.left, - top: coordinates.top, - }; + const style = { left, top }; return ( diff --git a/packages/components/src/focal-point-picker/grid.js b/packages/components/src/focal-point-picker/grid.js index b894e81e946ca2..ed6d8ae51d0316 100644 --- a/packages/components/src/focal-point-picker/grid.js +++ b/packages/components/src/focal-point-picker/grid.js @@ -1,8 +1,3 @@ -/** - * WordPress dependencies - */ -import { useState } from '@wordpress/element'; - /** * Internal dependencies */ @@ -11,25 +6,16 @@ import { GridLineX, GridLineY, } from './styles/focal-point-picker-style'; -import { useUpdateEffect } from '../utils/hooks'; - -export default function FocalPointPickerGrid( { - bounds = {}, - value, - ...props -} ) { - const animationProps = useRevealAnimation( value ); - const style = { - width: bounds.width, - height: bounds.height, - }; +export default function FocalPointPickerGrid( { bounds, ...props } ) { return ( @@ -38,25 +24,3 @@ export default function FocalPointPickerGrid( { ); } - -/** - * Custom hook that renders the "flash" animation whenever the value changes. - * - * @param {string} value Value of (box) side. - */ -function useRevealAnimation( value ) { - const [ isActive, setIsActive ] = useState( false ); - - useUpdateEffect( () => { - setIsActive( true ); - const timeout = window.setTimeout( () => { - setIsActive( false ); - }, 600 ); - - return () => window.clearTimeout( timeout ); - }, [ value ] ); - - return { - isActive, - }; -} diff --git a/packages/components/src/focal-point-picker/index.js b/packages/components/src/focal-point-picker/index.js index 021c2481841cb4..5c1f594641c6e9 100644 --- a/packages/components/src/focal-point-picker/index.js +++ b/packages/components/src/focal-point-picker/index.js @@ -7,8 +7,12 @@ import classnames from 'classnames'; * WordPress dependencies */ import { __ } from '@wordpress/i18n'; -import { Component, createRef } from '@wordpress/element'; -import { withInstanceId } from '@wordpress/compose'; +import { useEffect, useRef, useState } from '@wordpress/element'; +import { + __experimentalUseDragging as useDragging, + useInstanceId, + useIsomorphicLayoutEffect, +} from '@wordpress/compose'; /** * Internal dependencies @@ -22,154 +26,99 @@ import { MediaWrapper, MediaContainer, } from './styles/focal-point-picker-style'; -import { roundClamp } from '../utils/math'; import { INITIAL_BOUNDS } from './utils'; - -export class FocalPointPicker extends Component { - constructor( props ) { - super( ...arguments ); - - this.state = { - isDragging: false, - bounds: INITIAL_BOUNDS, - percentages: props.value, - }; - - this.containerRef = createRef(); - this.mediaRef = createRef(); - - this.onMouseDown = this.startDrag.bind( this ); - this.onMouseUp = this.stopDrag.bind( this ); - this.onKeyDown = this.onKeyDown.bind( this ); - this.onMouseMove = this.doDrag.bind( this ); - this.ifDraggingStop = () => { - if ( this.state.isDragging ) { - this.stopDrag(); - } - }; - this.onChangeAtControls = ( value ) => { - this.updateValue( value, () => { - this.props.onChange( this.state.percentages ); - } ); - }; - - this.updateBounds = this.updateBounds.bind( this ); - this.updateValue = this.updateValue.bind( this ); - } - componentDidMount() { - const { defaultView } = this.containerRef.current.ownerDocument; - defaultView.addEventListener( 'resize', this.updateBounds ); - - /* - * Set initial bound values. - * - * This is necessary for Safari: - * https://github.com/WordPress/gutenberg/issues/25814 - */ - this.updateBounds(); - } - componentDidUpdate( prevProps ) { - if ( prevProps.url !== this.props.url ) { - this.ifDraggingStop(); - } - /* - * Handles cases where the incoming value changes. - * An example is the values resetting based on an UNDO action. - */ - const { - isDragging, - percentages: { x, y }, - } = this.state; - const { value } = this.props; - if ( ! isDragging && ( value.x !== x || value.y !== y ) ) { - this.setState( { percentages: this.props.value } ); - } - } - componentWillUnmount() { - const { defaultView } = this.containerRef.current.ownerDocument; - defaultView.removeEventListener( 'resize', this.updateBounds ); - this.ifDraggingStop(); - } - calculateBounds() { - const bounds = INITIAL_BOUNDS; - - if ( ! this.mediaRef.current ) { - return bounds; - } - - // Prevent division by zero when updateBounds runs in componentDidMount - if ( - this.mediaRef.current.clientWidth === 0 || - this.mediaRef.current.clientHeight === 0 - ) { - return bounds; - } - - const dimensions = { - width: this.mediaRef.current.clientWidth, - height: this.mediaRef.current.clientHeight, - }; - - const pickerDimensions = this.pickerDimensions(); - - const widthRatio = pickerDimensions.width / dimensions.width; - const heightRatio = pickerDimensions.height / dimensions.height; - - if ( heightRatio >= widthRatio ) { - bounds.width = bounds.right = pickerDimensions.width; - bounds.height = dimensions.height * widthRatio; - bounds.top = ( pickerDimensions.height - bounds.height ) / 2; - bounds.bottom = bounds.top + bounds.height; - } else { - bounds.height = bounds.bottom = pickerDimensions.height; - bounds.width = dimensions.width * heightRatio; - bounds.left = ( pickerDimensions.width - bounds.width ) / 2; - bounds.right = bounds.left + bounds.width; +import { useUpdateEffect } from '../utils/hooks'; + +const GRID_OVERLAY_TIMEOUT = 600; + +export default function FocalPointPicker( { + autoPlay = true, + className, + help, + label, + onChange, + onDrag, + onDragEnd, + onDragStart, + resolvePoint, + url, + value: valueProp = { + x: 0.5, + y: 0.5, + }, +} ) { + const [ point, setPoint ] = useState( valueProp ); + const [ showGridOverlay, setShowGridOverlay ] = useState( false ); + + const { startDrag, endDrag, isDragging } = useDragging( { + onDragStart: ( event ) => { + dragAreaRef.current.focus(); + const value = getValueWithinDragArea( event ); + onDragStart?.( value, event ); + setPoint( value ); + }, + onDragMove: ( event ) => { + // Prevents text-selection when dragging. + event.preventDefault(); + const value = getValueWithinDragArea( event ); + onDrag?.( value, event ); + setPoint( value ); + }, + onDragEnd: ( event ) => { + onDragEnd?.( event ); + onChange?.( point ); + }, + } ); + + // Uses the internal point while dragging or else the value from props. + const { x, y } = isDragging ? point : valueProp; + + const dragAreaRef = useRef(); + const [ bounds, setBounds ] = useState( INITIAL_BOUNDS ); + const refUpdateBounds = useRef( () => { + const { clientWidth: width, clientHeight: height } = + dragAreaRef.current; + // Falls back to initial bounds if the ref has no size. Since styles + // give the drag area dimensions even when the media has not loaded + // this should only happen in unit tests (jsdom). + setBounds( + width > 0 && height > 0 ? { width, height } : { ...INITIAL_BOUNDS } + ); + } ); + + useEffect( () => { + const updateBounds = refUpdateBounds.current; + const { defaultView } = dragAreaRef.current.ownerDocument; + defaultView.addEventListener( 'resize', updateBounds ); + return () => defaultView.removeEventListener( 'resize', updateBounds ); + }, [] ); + + // Updates the bounds to cover cases of unspecified media or load failures. + useIsomorphicLayoutEffect( () => void refUpdateBounds.current(), [] ); + + const getValueWithinDragArea = ( { clientX, clientY, shiftKey } ) => { + const { top, left } = dragAreaRef.current.getBoundingClientRect(); + let nextX = ( clientX - left ) / bounds.width; + let nextY = ( clientY - top ) / bounds.height; + // Enables holding shift to jump values by 10%. + if ( shiftKey ) { + nextX = Math.round( nextX / 0.1 ) * 0.1; + nextY = Math.round( nextY / 0.1 ) * 0.1; } - return bounds; - } - updateValue( nextValue = {}, callback ) { - const resolvedValue = - this.props.resolvePoint?.( nextValue ) ?? nextValue; + return getFinalValue( { x: nextX, y: nextY } ); + }; - const { x, y } = resolvedValue; - - const nextPercentage = { - x: parseFloat( x ).toFixed( 2 ), - y: parseFloat( y ).toFixed( 2 ), + const getFinalValue = ( value ) => { + const resolvedValue = resolvePoint?.( value ) ?? value; + resolvedValue.x = Math.max( 0, Math.min( resolvedValue.x, 1 ) ); + resolvedValue.y = Math.max( 0, Math.min( resolvedValue.y, 1 ) ); + return { + x: parseFloat( resolvedValue.x ).toFixed( 2 ), + y: parseFloat( resolvedValue.y ).toFixed( 2 ), }; + }; - this.setState( { percentages: nextPercentage }, callback ); - } - updateBounds() { - this.setState( { - bounds: this.calculateBounds(), - } ); - } - startDrag( event ) { - event.persist(); - this.containerRef.current.focus(); - this.setState( { isDragging: true } ); - const { ownerDocument } = this.containerRef.current; - ownerDocument.addEventListener( 'mouseup', this.onMouseUp ); - ownerDocument.addEventListener( 'mousemove', this.onMouseMove ); - const value = this.getValueFromPoint( - { x: event.pageX, y: event.pageY }, - event.shiftKey - ); - this.updateValue( value ); - this.props.onDragStart?.( value, event ); - } - stopDrag( event ) { - const { ownerDocument } = this.containerRef.current; - ownerDocument.removeEventListener( 'mouseup', this.onMouseUp ); - ownerDocument.removeEventListener( 'mousemove', this.onMouseMove ); - this.setState( { isDragging: false }, () => { - this.props.onChange( this.state.percentages ); - } ); - this.props.onDragEnd?.( event ); - } - onKeyDown( event ) { + const arrowKeyStep = ( event ) => { const { code, shiftKey } = event; if ( ! [ 'ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight' ].includes( @@ -179,166 +128,75 @@ export class FocalPointPicker extends Component { return; event.preventDefault(); - - const next = { ...this.state.percentages }; + const value = { x, y }; const step = shiftKey ? 0.1 : 0.01; const delta = code === 'ArrowUp' || code === 'ArrowLeft' ? -1 * step : step; const axis = code === 'ArrowUp' || code === 'ArrowDown' ? 'y' : 'x'; - const value = parseFloat( next[ axis ] ) + delta; - - next[ axis ] = roundClamp( value, 0, 1, step ); - - this.updateValue( next, () => { - this.props.onChange( this.state.percentages ); - } ); - } - doDrag( event ) { - // Prevents text-selection when dragging. - event.preventDefault(); - const value = this.getValueFromPoint( - { x: event.pageX, y: event.pageY }, - event.shiftKey - ); - this.updateValue( value ); - this.props.onDrag?.( value, event ); - } - getValueFromPoint( point, byTenths ) { - const { bounds } = this.state; - - const pickerDimensions = this.pickerDimensions(); - const relativePoint = { - left: point.x - pickerDimensions.left, - top: point.y - pickerDimensions.top, - }; - - const left = Math.max( - bounds.left, - Math.min( relativePoint.left, bounds.right ) - ); - const top = Math.max( - bounds.top, - Math.min( relativePoint.top, bounds.bottom ) - ); - - let nextX = - ( left - bounds.left ) / - ( pickerDimensions.width - bounds.left * 2 ); - let nextY = - ( top - bounds.top ) / ( pickerDimensions.height - bounds.top * 2 ); - - // Enables holding shift to jump values by 10% - const step = byTenths ? 0.1 : 0.01; - - nextX = roundClamp( nextX, 0, 1, step ); - nextY = roundClamp( nextY, 0, 1, step ); - - return { x: nextX, y: nextY }; - } - pickerDimensions() { - const containerNode = this.containerRef.current; - - if ( ! containerNode ) { - return { - width: 0, - height: 0, - left: 0, - top: 0, - }; - } - - const { clientHeight, clientWidth } = containerNode; - const { top, left } = containerNode.getBoundingClientRect(); - - return { - width: clientWidth, - height: clientHeight, - top: top + document.body.scrollTop, - left, - }; - } - iconCoordinates() { - const { - bounds, - percentages: { x, y }, - } = this.state; - - if ( bounds.left === undefined || bounds.top === undefined ) { - return { - left: '50%', - top: '50%', - }; - } - - const { width, height } = this.pickerDimensions(); - return { - left: x * ( width - bounds.left * 2 ) + bounds.left, - top: y * ( height - bounds.top * 2 ) + bounds.top, - }; - } - render() { - const { autoPlay, className, help, instanceId, label, url } = - this.props; - const { bounds, isDragging, percentages } = this.state; - const iconCoordinates = this.iconCoordinates(); - - const classes = classnames( - 'components-focal-point-picker-control', - className - ); - - const id = `inspector-focal-point-picker-control-${ instanceId }`; - - return ( - - - - - - - - - - - ); - } + value[ axis ] = parseFloat( value[ axis ] ) + delta; + onChange?.( getFinalValue( value ) ); + }; + + const focalPointPosition = { + left: x * bounds.width, + top: y * bounds.height, + }; + + const classes = classnames( + 'components-focal-point-picker-control', + className + ); + + const instanceId = useInstanceId( FocalPointPicker ); + const id = `inspector-focal-point-picker-control-${ instanceId }`; + + useUpdateEffect( () => { + setShowGridOverlay( true ); + const timeout = window.setTimeout( () => { + setShowGridOverlay( false ); + }, GRID_OVERLAY_TIMEOUT ); + + return () => window.clearTimeout( timeout ); + }, [ x, y ] ); + + return ( + + + { + if ( isDragging ) endDrag(); + } } + ref={ dragAreaRef } + role="button" + tabIndex="-1" + > + + + + + + { + onChange?.( getFinalValue( value ) ); + } } + /> + + ); } - -FocalPointPicker.defaultProps = { - autoPlay: true, - value: { - x: 0.5, - y: 0.5, - }, - url: null, -}; - -export default withInstanceId( FocalPointPicker ); diff --git a/packages/components/src/focal-point-picker/media.js b/packages/components/src/focal-point-picker/media.js index fb4c3748e84b16..483cf575e92f8a 100644 --- a/packages/components/src/focal-point-picker/media.js +++ b/packages/components/src/focal-point-picker/media.js @@ -1,21 +1,14 @@ -/** - * WordPress dependencies - */ -import { useRef, useLayoutEffect } from '@wordpress/element'; - /** * Internal dependencies */ import { MediaPlaceholder } from './styles/focal-point-picker-style'; import { isVideoType } from './utils'; -const noop = () => {}; - export default function Media( { alt, autoPlay, src, - onLoad = noop, + onLoad, mediaRef, // Exposing muted prop for test rendering purposes // https://github.com/testing-library/react-testing-library/issues/470 @@ -24,10 +17,10 @@ export default function Media( { } ) { if ( ! src ) { return ( - ); } @@ -56,20 +49,3 @@ export default function Media( { /> ); } - -function MediaPlaceholderElement( { mediaRef, onLoad = noop, ...props } ) { - const onLoadRef = useRef( onLoad ); - - /** - * This async callback mimics the onLoad (img) / onLoadedData (video) callback - * for media elements. It is used in the main component - * to calculate the dimensions + boundaries for positioning. - */ - useLayoutEffect( () => { - window.requestAnimationFrame( () => { - onLoadRef.current(); - } ); - }, [] ); - - return ; -} diff --git a/packages/components/src/focal-point-picker/styles/focal-point-picker-style.js b/packages/components/src/focal-point-picker/styles/focal-point-picker-style.js index 10e265a2bb6de9..58fa3eb5de893b 100644 --- a/packages/components/src/focal-point-picker/styles/focal-point-picker-style.js +++ b/packages/components/src/focal-point-picker/styles/focal-point-picker-style.js @@ -9,6 +9,7 @@ import styled from '@emotion/styled'; import { Flex } from '../../flex'; import BaseUnitControl from '../../unit-control'; import { COLORS } from '../../utils'; +import { INITIAL_BOUNDS } from '../utils'; export const MediaWrapper = styled.div` background-color: transparent; @@ -42,9 +43,10 @@ export const MediaContainer = styled.div` export const MediaPlaceholder = styled.div` background: ${ COLORS.lightGray[ 300 ] }; - height: 170px; + box-sizing: border-box; + height: ${ INITIAL_BOUNDS.height }px; max-width: 280px; - min-width: 200px; + min-width: ${ INITIAL_BOUNDS.width }px; width: 100%; `; @@ -59,7 +61,6 @@ export const ControlWrapper = styled( Flex )` export const GridView = styled.div` left: 50%; - opacity: 0; overflow: hidden; pointer-events: none; position: absolute; @@ -68,11 +69,7 @@ export const GridView = styled.div` transition: opacity 120ms linear; z-index: 1; - ${ ( { isActive } ) => - isActive && - ` - opacity: 1; - ` } + opacity: ${ ( { showOverlay } ) => ( showOverlay ? 1 : 0 ) }; `; export const GridLine = styled.div` diff --git a/packages/components/src/focal-point-picker/test/index.js b/packages/components/src/focal-point-picker/test/index.js index 6999af637e2fde..02ae72e3910133 100644 --- a/packages/components/src/focal-point-picker/test/index.js +++ b/packages/components/src/focal-point-picker/test/index.js @@ -137,7 +137,7 @@ describe( 'FocalPointPicker', () => { render( ); - // Click and press arrow up + // Focus and press arrow up const dragArea = screen.getByRole( 'button' ); await user.click( dragArea ); diff --git a/packages/components/src/focal-point-picker/utils.js b/packages/components/src/focal-point-picker/utils.js index 8366f8a7a9ebd6..2205ae4ad66c99 100644 --- a/packages/components/src/focal-point-picker/utils.js +++ b/packages/components/src/focal-point-picker/utils.js @@ -1,10 +1,6 @@ export const INITIAL_BOUNDS = { - top: 0, - left: 0, - bottom: 0, - right: 0, - width: 0, - height: 0, + width: 200, + height: 170, }; const VIDEO_EXTENSIONS = [ From 3efc0104d9a6645464a98bbf9d608ffbf8c131f7 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Thu, 25 Aug 2022 10:51:02 +0100 Subject: [PATCH 35/68] Add: Archive-PostType template UI (#42746) --- lib/compat/wordpress-6.1/rest-api.php | 32 ++++++ .../add-new-template/new-template.js | 2 + .../src/components/add-new-template/utils.js | 101 ++++++++++++++---- 3 files changed, 115 insertions(+), 20 deletions(-) diff --git a/lib/compat/wordpress-6.1/rest-api.php b/lib/compat/wordpress-6.1/rest-api.php index 88b6d3bbb9a4db..f3391389d9e38a 100644 --- a/lib/compat/wordpress-6.1/rest-api.php +++ b/lib/compat/wordpress-6.1/rest-api.php @@ -61,3 +61,35 @@ function gutenberg_add_site_icon_url_to_index( WP_REST_Response $response ) { return $response; } add_action( 'rest_index', 'gutenberg_add_site_icon_url_to_index' ); + +/** + * Returns the has_archive post type field. + * + * @param array $type The response data. + * @param string $field_name The field name. The function handles field has_archive. + */ +function gutenberg_get_post_type_has_archive_field( $type, $field_name ) { + if ( ! empty( $type ) && ! empty( $type['slug'] ) && 'has_archive' === $field_name ) { + $post_type_object = get_post_type_object( $type['slug'] ); + return $post_type_object->has_archive; + } +} + +/** + * Registers the has_archive post type REST API field. + */ +function gutenberg_register_has_archive_on_post_types_endpoint() { + register_rest_field( + 'type', + 'has_archive', + array( + 'get_callback' => 'gutenberg_get_post_type_has_archive_field', + 'schema' => array( + 'description' => __( 'If the value is a string, the value will be used as the archive slug. If the value is false the post type has no archive.', 'gutenberg' ), + 'type' => array( 'string', 'boolean' ), + 'context' => array( 'view', 'edit' ), + ), + ) + ); +} +add_action( 'rest_api_init', 'gutenberg_register_has_archive_on_post_types_endpoint' ); diff --git a/packages/edit-site/src/components/add-new-template/new-template.js b/packages/edit-site/src/components/add-new-template/new-template.js index 0fdbf8a3c3d1f0..ea7a1a840024e3 100644 --- a/packages/edit-site/src/components/add-new-template/new-template.js +++ b/packages/edit-site/src/components/add-new-template/new-template.js @@ -41,6 +41,7 @@ import { useTaxonomiesMenuItems, usePostTypeMenuItems, useAuthorMenuItem, + usePostTypeArchiveMenuItems, } from './utils'; import AddCustomGenericTemplateModal from './add-custom-generic-template-modal'; import { useHistory } from '../routes'; @@ -301,6 +302,7 @@ function useMissingTemplates( } ); const missingTemplates = [ ...enhancedMissingDefaultTemplateTypes, + ...usePostTypeArchiveMenuItems(), ...postTypesMenuItems, ...taxonomiesMenuItems, ]; diff --git a/packages/edit-site/src/components/add-new-template/utils.js b/packages/edit-site/src/components/add-new-template/utils.js index 607848291bdb16..4fa707ae2e7ce7 100644 --- a/packages/edit-site/src/components/add-new-template/utils.js +++ b/packages/edit-site/src/components/add-new-template/utils.js @@ -12,7 +12,7 @@ import { store as editorStore } from '@wordpress/editor'; import { decodeEntities } from '@wordpress/html-entities'; import { useMemo, useCallback } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; -import { blockMeta, post } from '@wordpress/icons'; +import { blockMeta, post, archive } from '@wordpress/icons'; /** * @typedef IHasNameAndId @@ -86,10 +86,89 @@ const usePublicTaxonomies = () => { }, [ taxonomies ] ); }; +function usePostTypeNeedsUniqueIdentifier( publicPostTypes ) { + const postTypeLabels = useMemo( () => + publicPostTypes?.reduce( ( accumulator, { labels } ) => { + const singularName = labels.singular_name.toLowerCase(); + accumulator[ singularName ] = + ( accumulator[ singularName ] || 0 ) + 1; + return accumulator; + }, {} ) + ); + return useCallback( + ( { labels, slug } ) => { + const singularName = labels.singular_name.toLowerCase(); + return postTypeLabels[ singularName ] > 1 && singularName !== slug; + }, + [ postTypeLabels ] + ); +} + +export function usePostTypeArchiveMenuItems() { + const publicPostTypes = usePublicPostTypes(); + const postTypesWithArchives = useMemo( + () => publicPostTypes?.filter( ( postType ) => postType.has_archive ), + [ publicPostTypes ] + ); + const existingTemplates = useExistingTemplates(); + const needsUniqueIdentifier = usePostTypeNeedsUniqueIdentifier( + postTypesWithArchives + ); + return useMemo( + () => + postTypesWithArchives + ?.filter( + ( postType ) => + ! existingTemplates.some( + ( existingTemplate ) => + existingTemplate.slug === + 'archive-' + postType.slug + ) + ) + .map( ( postType ) => { + let title; + if ( needsUniqueIdentifier( postType ) ) { + title = sprintf( + // translators: %1s: Name of the post type e.g: "Post"; %2s: Slug of the post type e.g: "book". + __( 'Archive: %1$s (%2$s)' ), + postType.labels.singular_name, + postType.slug + ); + } else { + title = sprintf( + // translators: %s: Name of the post type e.g: "Post". + __( 'Archive: %s' ), + postType.labels.singular_name + ); + } + return { + slug: 'archive-' + postType.slug, + description: sprintf( + // translators: %s: Name of the post type e.g: "Post". + __( + 'Displays an archive with the latests posts of type: %s.' + ), + postType.labels.singular_name + ), + title, + // `icon` is the `menu_icon` property of a post type. We + // only handle `dashicons` for now, even if the `menu_icon` + // also supports urls and svg as values. + icon: postType.icon?.startsWith( 'dashicons-' ) + ? postType.icon.slice( 10 ) + : archive, + }; + } ) || [], + [ postTypesWithArchives, existingTemplates, needsUniqueIdentifier ] + ); +} + export const usePostTypeMenuItems = ( onClickMenuItem ) => { const publicPostTypes = usePublicPostTypes(); const existingTemplates = useExistingTemplates(); const defaultTemplateTypes = useDefaultTemplateTypes(); + const needsUniqueIdentifier = + usePostTypeNeedsUniqueIdentifier( publicPostTypes ); // `page`is a special case in template hierarchy. const templatePrefixes = useMemo( () => @@ -103,21 +182,6 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => { }, {} ), [ publicPostTypes ] ); - // We need to keep track of naming conflicts. If a conflict - // occurs, we need to add slug. - const postTypeLabels = publicPostTypes?.reduce( - ( accumulator, { labels } ) => { - const singularName = labels.singular_name.toLowerCase(); - accumulator[ singularName ] = - ( accumulator[ singularName ] || 0 ) + 1; - return accumulator; - }, - {} - ); - const needsUniqueIdentifier = ( labels, slug ) => { - const singularName = labels.singular_name.toLowerCase(); - return postTypeLabels[ singularName ] > 1 && singularName !== slug; - }; const postTypesInfo = useEntitiesInfo( 'postType', templatePrefixes ); const existingTemplateSlugs = ( existingTemplates || [] ).map( ( { slug } ) => slug @@ -134,10 +198,7 @@ export const usePostTypeMenuItems = ( onClickMenuItem ) => { ); const hasGeneralTemplate = existingTemplateSlugs?.includes( generalTemplateSlug ); - const _needsUniqueIdentifier = needsUniqueIdentifier( - labels, - slug - ); + const _needsUniqueIdentifier = needsUniqueIdentifier( postType ); let menuItemTitle = sprintf( // translators: %s: Name of the post type e.g: "Post". __( 'Single item: %s' ), From 1ca536e65199860a48fa7f0ed35d9e656d1f0d7f Mon Sep 17 00:00:00 2001 From: Sarah Norris Date: Thu, 25 Aug 2022 10:56:15 +0100 Subject: [PATCH 36/68] Navigation: Add overlay close button to icon toggle control (#43067) * Handle close button toggle * Allow text labels to inherit text transform * Add hasIcon logic around close button * Align menu preview content * Tweak help wording * Conditionally add aria-label when buttons are icons --- .../src/navigation/edit/index.js | 17 ++++++++++++--- .../src/navigation/edit/responsive-wrapper.js | 11 +++++++--- .../block-library/src/navigation/editor.scss | 1 + .../block-library/src/navigation/index.php | 21 ++++++++++++------- .../block-library/src/navigation/style.scss | 1 + 5 files changed, 37 insertions(+), 14 deletions(-) diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index bbd632a27e56fe..bc3e879632ee75 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -36,6 +36,7 @@ import { import { __, sprintf } from '@wordpress/i18n'; import { speak } from '@wordpress/a11y'; import { createBlock } from '@wordpress/blocks'; +import { close, Icon } from '@wordpress/icons'; /** * Internal dependencies @@ -465,15 +466,25 @@ function Navigation( { setOverlayMenuPreview( ! overlayMenuPreview ); } } > - { hasIcon && } - { ! hasIcon && { __( 'Menu' ) } } + { hasIcon && ( + <> + + + + ) } + { ! hasIcon && ( + <> + { __( 'Menu' ) } + { __( 'Close' ) } + + ) } ) } { overlayMenuPreview && ( setAttributes( { hasIcon: value } ) diff --git a/packages/block-library/src/navigation/edit/responsive-wrapper.js b/packages/block-library/src/navigation/edit/responsive-wrapper.js index 3e6cced93fffce..880dbec8921d34 100644 --- a/packages/block-library/src/navigation/edit/responsive-wrapper.js +++ b/packages/block-library/src/navigation/edit/responsive-wrapper.js @@ -79,7 +79,7 @@ export default function ResponsiveWrapper( { { ! isOpen && (
    %9$s + '
    - +
    %2$s
    @@ -628,13 +632,14 @@ function render_block_core_navigation( $attributes, $content, $block ) {
    ', esc_attr( $modal_unique_id ), $inner_blocks_html, - __( 'Open menu' ), // Open button label. - __( 'Close menu' ), // Close button label. + $toggle_aria_label_open, + $toggle_aria_label_close, esc_attr( implode( ' ', $responsive_container_classes ) ), esc_attr( implode( ' ', $open_button_classes ) ), safecss_filter_attr( $colors['overlay_inline_styles'] ), __( 'Menu' ), - $toggle_button_content + $toggle_button_content, + $toggle_close_button_content ); return sprintf( diff --git a/packages/block-library/src/navigation/style.scss b/packages/block-library/src/navigation/style.scss index 34b930442cd8f6..eb681b97229244 100644 --- a/packages/block-library/src/navigation/style.scss +++ b/packages/block-library/src/navigation/style.scss @@ -613,6 +613,7 @@ button.wp-block-navigation-item__content { border: none; margin: 0; padding: 0; + text-transform: inherit; svg { fill: currentColor; From 99d03335cf8b265efd81ae88510d38016ad39d53 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Thu, 25 Aug 2022 19:32:12 +0900 Subject: [PATCH 37/68] Code Block: Fix duplicate background color (#43599) --- packages/block-library/src/code/editor.scss | 3 +++ packages/block-library/src/editor.scss | 1 + 2 files changed, 4 insertions(+) create mode 100644 packages/block-library/src/code/editor.scss diff --git a/packages/block-library/src/code/editor.scss b/packages/block-library/src/code/editor.scss new file mode 100644 index 00000000000000..3e6d6ba3d80af4 --- /dev/null +++ b/packages/block-library/src/code/editor.scss @@ -0,0 +1,3 @@ +.wp-block-code code { + background: none; +} diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss index 6bb4a8d2d2cb88..edb66416af88c5 100644 --- a/packages/block-library/src/editor.scss +++ b/packages/block-library/src/editor.scss @@ -5,6 +5,7 @@ @import "./button/editor.scss"; @import "./buttons/editor.scss"; @import "./categories/editor.scss"; +@import "./code/editor.scss"; @import "./columns/editor.scss"; @import "./comments/editor.scss"; @import "./comment-author-avatar/editor.scss"; From c6fb90bdc67c49944d4bfa1c32e6ea3891ab9d94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9?= <583546+oandregal@users.noreply.github.com> Date: Thu, 25 Aug 2022 13:21:51 +0200 Subject: [PATCH 38/68] Fix blank screen on templates page (#43602) --- packages/edit-site/src/components/add-new-template/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/add-new-template/utils.js b/packages/edit-site/src/components/add-new-template/utils.js index 4fa707ae2e7ce7..fec211f0d32b20 100644 --- a/packages/edit-site/src/components/add-new-template/utils.js +++ b/packages/edit-site/src/components/add-new-template/utils.js @@ -119,7 +119,7 @@ export function usePostTypeArchiveMenuItems() { postTypesWithArchives ?.filter( ( postType ) => - ! existingTemplates.some( + ! ( existingTemplates || [] ).some( ( existingTemplate ) => existingTemplate.slug === 'archive-' + postType.slug From 993cdc679b8e036385b5690bffe5dbc87e94f0fd Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Thu, 25 Aug 2022 20:34:33 +0900 Subject: [PATCH 39/68] Docs: Add example of BlockControls to Format API how to guide (#43581) * Docs: Add example of BlockControls to Format API how to guide * Add optional text * update some text * Update link --- docs/how-to-guides/format-api.md | 44 +++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/docs/how-to-guides/format-api.md b/docs/how-to-guides/format-api.md index 96793b843a13d2..dc395cbcbf39dc 100644 --- a/docs/how-to-guides/format-api.md +++ b/docs/how-to-guides/format-api.md @@ -78,7 +78,7 @@ registerFormatType( 'my-custom-format/sample-output', { } ); ``` -Let's check that everything is working as expected. Build and reload and then select a text block. Confirm the new button was added to the format toolbar. +Let's check that everything is working as expected. Build and reload and then select any block containing text like for example the paragraph block. Confirm the new button was added to the format toolbar. ![Toolbar with custom button](https://developer.wordpress.org/files/2021/12/format-api-toolbar.png) @@ -125,13 +125,13 @@ registerFormatType( 'my-custom-format/sample-output', { Confirm it is working: first build and reload, then make a text selection and click the button. Your browser will likely display that selection differently than the surrounding text. -You can also confirm by switching to HTML view (Code editor Ctrl+Shift+Alt+M) and see the text selection wrapped with `` HTML tags. +You can also confirm by switching to HTML view (Code editor `Ctrl+Shift+Alt+M`) and see the text selection wrapped with `` HTML tags. Use the `className` option when registering to add your own custom class to the tag. You can use that class and custom CSS to target that element and style as you wish. ### Step 4: Show the button only for specific blocks (Optional) -By default, the button is rendered on every rich text toolbar (image captions, buttons, paragraphs, etc). You can render the button only on blocks of a certain type by using `wp.data.withSelect` together with `wp.compose.ifCondition`. +By default, the button is rendered on every rich text toolbar (image captions, buttons, paragraphs, etc). You can render the button only on blocks of a certain type by using [the data API](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-data). Here is an example that only shows the button for Paragraph blocks: @@ -173,6 +173,44 @@ registerFormatType( 'my-custom-format/sample-output', { } ); ``` +### Step5: Add a button outside of the dropdown (Optional) + +Using the `RichTextToolbarButton` component, the button is added to the default dropdown menu. You can add the button directly to the toolbar by using the `BlockControls` component. + +```js +import { registerFormatType, toggleFormat } from '@wordpress/rich-text'; +import { BlockControls } from '@wordpress/block-editor'; +import { ToolbarGroup, ToolbarButton } from '@wordpress/components'; + +const MyCustomButton = ( { isActive, onChange, value } ) => { + return ( + + + { + onChange( + toggleFormat( value, { + type: 'my-custom-format/sample-output', + } ) + ); + } } + isActive={ isActive } + /> + + + ); +}; + +registerFormatType( 'my-custom-format/sample-output', { + title: 'Sample output', + tagName: 'samp', + className: null, + edit: MyCustomButton, +} ); +``` + ## Troubleshooting If you run into errors: From f73b5c2e674a155625ae244625516033ffdeac15 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Thu, 25 Aug 2022 20:35:39 +0900 Subject: [PATCH 40/68] Global Styles: Remove main content layout padding in preview (#43601) --- packages/edit-site/src/components/global-styles/preview.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/preview.js b/packages/edit-site/src/components/global-styles/preview.js index b06777c656ea93..a424da638da2b5 100644 --- a/packages/edit-site/src/components/global-styles/preview.js +++ b/packages/edit-site/src/components/global-styles/preview.js @@ -79,13 +79,13 @@ const StylesPreview = ( { label, isFocused } ) => { ) .slice( 0, 2 ); - // Reset leaked styles from WP common.css. + // Reset leaked styles from WP common.css and remove main content layout padding. const editorStyles = useMemo( () => { if ( styles ) { return [ ...styles, { - css: 'body{min-width: 0;}', + css: 'body{min-width: 0;padding: 0;}', isGlobalStyles: true, }, ]; From 0332aba82c846e22f91f9e6c5b70c095f5e4d476 Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Thu, 25 Aug 2022 15:14:29 +0300 Subject: [PATCH 41/68] [Site Editor]: New archite-$postType templates get proper fallback content (#43603) --- packages/edit-site/src/components/add-new-template/utils.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/edit-site/src/components/add-new-template/utils.js b/packages/edit-site/src/components/add-new-template/utils.js index fec211f0d32b20..4063509a6ddb56 100644 --- a/packages/edit-site/src/components/add-new-template/utils.js +++ b/packages/edit-site/src/components/add-new-template/utils.js @@ -157,6 +157,7 @@ export function usePostTypeArchiveMenuItems() { icon: postType.icon?.startsWith( 'dashicons-' ) ? postType.icon.slice( 10 ) : archive, + templatePrefix: 'archive', }; } ) || [], [ postTypesWithArchives, existingTemplates, needsUniqueIdentifier ] From 3fdfda3daab3d5bbb835e6b4c11ce6967b85734e Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Thu, 25 Aug 2022 17:15:47 +0400 Subject: [PATCH 42/68] Block Templates: Add the custom templates info for the template posts (#43597) --- lib/compat/wordpress-6.1/block-template-utils.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/compat/wordpress-6.1/block-template-utils.php b/lib/compat/wordpress-6.1/block-template-utils.php index 03b93c83937467..ed1f105c0e5762 100644 --- a/lib/compat/wordpress-6.1/block-template-utils.php +++ b/lib/compat/wordpress-6.1/block-template-utils.php @@ -121,6 +121,13 @@ function gutenberg_get_block_templates( $query = array(), $template_type = 'wp_t continue; } + if ( $post_type && + isset( $template->post_types ) && + ! in_array( $post_type, $template->post_types, true ) + ) { + continue; + } + $query_result[] = $template; } if ( ! isset( $query['wp_id'] ) ) { @@ -264,8 +271,8 @@ function gutenberg_build_block_template_result_from_post( $post ) { $is_wp_suggestion = get_post_meta( $post->ID, 'is_wp_suggestion', true ); $theme = $terms[0]->name; - $has_theme_file = wp_get_theme()->get_stylesheet() === $theme && - null !== _get_block_template_file( $post->post_type, $post->post_name ); + $template_file = _get_block_template_file( $post->post_type, $post->post_name ); + $has_theme_file = wp_get_theme()->get_stylesheet() === $theme && null !== $template_file; $template = new WP_Block_Template(); $template->wp_id = $post->ID; @@ -288,6 +295,10 @@ function gutenberg_build_block_template_result_from_post( $post ) { $template->is_custom = false; } + if ( 'wp_template' === $post->post_type && $has_theme_file && isset( $template_file['postTypes'] ) ) { + $template->post_types = $template_file['postTypes']; + } + if ( 'wp_template_part' === $post->post_type ) { $type_terms = get_the_terms( $post, 'wp_template_part_area' ); if ( ! is_wp_error( $type_terms ) && false !== $type_terms ) { From 53da761c7b3c1a39ec20a80f4bd43636f17fce86 Mon Sep 17 00:00:00 2001 From: Madhu Dollu Date: Thu, 25 Aug 2022 18:47:34 +0530 Subject: [PATCH 43/68] add box-shadow support for blocks via theme.json (#41972) * add box-shadow support to blocks in theme.json reduce specificity for default button shadow update schema for shadow fix lint issues * add shadow support in style-engine * add condition to handle the case of shadow style property --- .../theme-json-reference/theme-json-living.md | 7 +++++++ .../wordpress-6.1/class-wp-theme-json-6-1.php | 10 +++++++--- packages/block-library/src/button/style.scss | 2 +- packages/style-engine/src/styles/index.ts | 2 ++ packages/style-engine/src/styles/shadow/index.ts | 14 ++++++++++++++ schemas/json/theme.json | 8 +++++++- 6 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 packages/style-engine/src/styles/shadow/index.ts diff --git a/docs/reference-guides/theme-json-reference/theme-json-living.md b/docs/reference-guides/theme-json-reference/theme-json-living.md index 7c9b7f75da5d45..4eb6067209f03b 100644 --- a/docs/reference-guides/theme-json-reference/theme-json-living.md +++ b/docs/reference-guides/theme-json-reference/theme-json-living.md @@ -195,6 +195,13 @@ CSS and SVG filter styles. | --- | --- |--- | | duotone | string | | +--- + +### shadow + +Box shadow styles. + + --- diff --git a/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php b/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php index f1371c04cacd35..220ef97d7fcece 100644 --- a/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php +++ b/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php @@ -79,6 +79,7 @@ class WP_Theme_JSON_6_1 extends WP_Theme_JSON_6_0 { 'text-decoration' => array( 'typography', 'textDecoration' ), 'text-transform' => array( 'typography', 'textTransform' ), 'filter' => array( 'filter', 'duotone' ), + 'box-shadow' => array( 'shadow' ), ); /** @@ -153,9 +154,11 @@ protected static function sanitize( $input, $valid_block_names, $valid_element_n // hence, the schema for blocks & elements should not have them. $styles_non_top_level = static::VALID_STYLES; foreach ( array_keys( $styles_non_top_level ) as $section ) { - foreach ( array_keys( $styles_non_top_level[ $section ] ) as $prop ) { - if ( 'top' === $styles_non_top_level[ $section ][ $prop ] ) { - unset( $styles_non_top_level[ $section ][ $prop ] ); + if ( array_key_exists( $section, $styles_non_top_level ) && is_array( $styles_non_top_level[ $section ] ) ) { + foreach ( array_keys( $styles_non_top_level[ $section ] ) as $prop ) { + if ( 'top' === $styles_non_top_level[ $section ][ $prop ] ) { + unset( $styles_non_top_level[ $section ][ $prop ] ); + } } } } @@ -314,6 +317,7 @@ public static function remove_insecure_properties( $theme_json ) { 'gradient' => null, 'text' => null, ), + 'shadow' => null, 'filter' => array( 'duotone' => null, ), diff --git a/packages/block-library/src/button/style.scss b/packages/block-library/src/button/style.scss index 83f8602f81de21..58fe01e12e99f2 100644 --- a/packages/block-library/src/button/style.scss +++ b/packages/block-library/src/button/style.scss @@ -4,7 +4,6 @@ $blocks-block__margin: 0.5em; // Prefer the link selector instead of the regular button classname // to support the previous markup in addition to the new one. .wp-block-button__link { - box-shadow: none; cursor: pointer; display: inline-block; text-align: center; @@ -25,6 +24,7 @@ $blocks-block__margin: 0.5em; // They are needed for backwards compatibility. :where(.wp-block-button__link) { // This needs a low specificity so it won't override the rules from the button element if defined in theme.json. + box-shadow: none; text-decoration: none; // 100% causes an oval, but any explicit but really high value retains the pill shape. diff --git a/packages/style-engine/src/styles/index.ts b/packages/style-engine/src/styles/index.ts index 290c319778e292..90b312c215bbee 100644 --- a/packages/style-engine/src/styles/index.ts +++ b/packages/style-engine/src/styles/index.ts @@ -3,6 +3,7 @@ */ import border from './border'; import color from './color'; +import shadow from './shadow'; import spacing from './spacing'; import typography from './typography'; @@ -11,4 +12,5 @@ export const styleDefinitions = [ ...color, ...spacing, ...typography, + ...shadow, ]; diff --git a/packages/style-engine/src/styles/shadow/index.ts b/packages/style-engine/src/styles/shadow/index.ts new file mode 100644 index 00000000000000..d547b94c3fd7ea --- /dev/null +++ b/packages/style-engine/src/styles/shadow/index.ts @@ -0,0 +1,14 @@ +/** + * Internal dependencies + */ +import type { Style, StyleOptions } from '../../types'; +import { generateRule } from '../utils'; + +const shadow = { + name: 'shadow', + generate: ( style: Style, options: StyleOptions ) => { + return generateRule( style, options, [ 'shadow' ], 'boxShadow' ); + }, +}; + +export default [ shadow ]; diff --git a/schemas/json/theme.json b/schemas/json/theme.json index b177bbf8af3e06..fb8a1f28b5a569 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -1087,6 +1087,10 @@ } }, "additionalProperties": false + }, + "shadow": { + "description": "Box shadow styles.", + "type": "string" } } }, @@ -1101,7 +1105,9 @@ "border": {}, "color": {}, "spacing": {}, - "typography": {} + "typography": {}, + "filter": {}, + "shadow": {} }, "additionalProperties": false } From 032d6546963a49de8dd5ec3cfcc13c43e9e26a03 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Thu, 25 Aug 2022 18:02:17 +0200 Subject: [PATCH 44/68] DropdownMenu: use KeyboardEvent.code, refactor tests to model RTL and user-event (#43439) * DropdownMenu: use KeyboardEvent.code instead of KetboardEvent.keyCode * DropdownMenu: refactor tests to use modern RTl and user-event * CHANGELOG * Fix unit test to also use code instead of keyCode * Update packages/components/CHANGELOG.md Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com> * Make sure menu items are rendered inside the menu element * Remove unused `onKeyDown` from native component Co-authored-by: Marin Atanasov <8436925+tyxla@users.noreply.github.com> --- .../components/block-switcher/test/index.js | 3 +- packages/components/CHANGELOG.md | 1 + .../components/src/dropdown-menu/index.js | 3 +- .../src/dropdown-menu/index.native.js | 13 -- .../src/dropdown-menu/test/index.js | 112 +++++++++--------- 5 files changed, 57 insertions(+), 75 deletions(-) diff --git a/packages/block-editor/src/components/block-switcher/test/index.js b/packages/block-editor/src/components/block-switcher/test/index.js index 3cdb022dc361ff..ae073d74d07a66 100644 --- a/packages/block-editor/src/components/block-switcher/test/index.js +++ b/packages/block-editor/src/components/block-switcher/test/index.js @@ -8,7 +8,6 @@ import { shallow, mount } from 'enzyme'; */ import { useSelect } from '@wordpress/data'; import { registerBlockType, unregisterBlockType } from '@wordpress/blocks'; -import { DOWN } from '@wordpress/keycodes'; import { Button } from '@wordpress/components'; import { copy } from '@wordpress/icons'; @@ -180,7 +179,7 @@ describe( 'BlockSwitcherDropdownMenu', () => { const onToggleStub = jest.fn(); const mockKeyDown = { preventDefault: () => {}, - keyCode: DOWN, + code: 'ArrowDown', }; afterEach( () => { diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index dd236130446a3c..9a7b9cdedf0ab5 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -66,6 +66,7 @@ - `Tooltip`: Refactor away from `_.includes()` ([#43518](https://github.com/WordPress/gutenberg/pull/43518/)). - `TreeGrid`: Refactor away from `_.includes()` ([#43518](https://github.com/WordPress/gutenberg/pull/43518/)). - `FormTokenField`: use `KeyboardEvent.code`, refactor tests to modern RTL and `user-event` ([#43442](https://github.com/WordPress/gutenberg/pull/43442/)). +- `DropdownMenu`: use `KeyboardEvent.code`, refactor tests to model RTL and `user-event` ([#43439](https://github.com/WordPress/gutenberg/pull/43439/)). ### Experimental diff --git a/packages/components/src/dropdown-menu/index.js b/packages/components/src/dropdown-menu/index.js index 9687ecce8ebc7b..481d84a6589f48 100644 --- a/packages/components/src/dropdown-menu/index.js +++ b/packages/components/src/dropdown-menu/index.js @@ -7,7 +7,6 @@ import classnames from 'classnames'; /** * WordPress dependencies */ -import { DOWN } from '@wordpress/keycodes'; import { menu } from '@wordpress/icons'; /** @@ -87,7 +86,7 @@ function DropdownMenu( dropdownMenuProps ) { return; } - if ( ! isOpen && event.keyCode === DOWN ) { + if ( ! isOpen && event.code === 'ArrowDown' ) { event.preventDefault(); onToggle(); } diff --git a/packages/components/src/dropdown-menu/index.native.js b/packages/components/src/dropdown-menu/index.native.js index f75ac157616ade..1f60e0f67cf088 100644 --- a/packages/components/src/dropdown-menu/index.native.js +++ b/packages/components/src/dropdown-menu/index.native.js @@ -6,7 +6,6 @@ import { Platform } from 'react-native'; /** * WordPress dependencies */ -import { DOWN } from '@wordpress/keycodes'; import { BottomSheet, PanelBody } from '@wordpress/components'; import { withPreferredColorScheme } from '@wordpress/compose'; import { menu } from '@wordpress/icons'; @@ -76,12 +75,6 @@ function DropdownMenu( { className={ classnames( 'components-dropdown-menu', className ) } popoverProps={ mergedPopoverProps } renderToggle={ ( { isOpen, onToggle } ) => { - const openOnArrowDown = ( event ) => { - if ( ! isOpen && event.keyCode === DOWN ) { - event.preventDefault(); - onToggle(); - } - }; const mergedToggleProps = mergeProps( { className: classnames( @@ -104,12 +97,6 @@ function DropdownMenu( { mergedToggleProps.onClick( event ); } } } - onKeyDown={ ( event ) => { - openOnArrowDown( event ); - if ( mergedToggleProps.onKeyDown ) { - mergedToggleProps.onKeyDown( event ); - } - } } aria-haspopup="true" aria-expanded={ isOpen } label={ label } diff --git a/packages/components/src/dropdown-menu/test/index.js b/packages/components/src/dropdown-menu/test/index.js index 3a26af1e60313a..2eab09f6c052df 100644 --- a/packages/components/src/dropdown-menu/test/index.js +++ b/packages/components/src/dropdown-menu/test/index.js @@ -1,12 +1,12 @@ /** * External dependencies */ -import { fireEvent, render } from '@testing-library/react'; +import { render, screen, waitFor, within } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; /** * WordPress dependencies */ -import { DOWN } from '@wordpress/keycodes'; import { arrowLeft, arrowRight, arrowUp, arrowDown } from '@wordpress/icons'; /** @@ -15,19 +15,27 @@ import { arrowLeft, arrowRight, arrowUp, arrowDown } from '@wordpress/icons'; import DropdownMenu from '../'; import { MenuItem } from '../../'; -function getMenuToggleButton( container ) { - return container.querySelector( '.components-dropdown-menu__toggle' ); -} -function getNavigableMenu( container ) { - return container.querySelector( '.components-dropdown-menu__menu' ); -} - describe( 'DropdownMenu', () => { - const children = ( { onClose } ) => ; + it( 'should not render when neither controls nor children are assigned', () => { + render( ); + + // The button toggle should not even be rendered + expect( screen.queryByRole( 'button' ) ).not.toBeInTheDocument(); + } ); + + it( 'should not render when controls are empty and children is not specified', () => { + render( ); + + // The button toggle should not even be rendered + expect( screen.queryByRole( 'button' ) ).not.toBeInTheDocument(); + } ); + + it( 'should open menu when pressing arrow down on the toggle and the controls prop is used to define menu items', async () => { + const user = userEvent.setup( { + advanceTimers: jest.advanceTimersByTime, + } ); - let controls; - beforeEach( () => { - controls = [ + const controls = [ { title: 'Up', icon: arrowUp, @@ -49,62 +57,50 @@ describe( 'DropdownMenu', () => { onClick: jest.fn(), }, ]; - } ); - describe( 'basic rendering', () => { - it( 'should render a null element when neither controls nor children are assigned', () => { - const { container } = render( ); + render( ); - expect( container.firstChild ).toBeNull(); - } ); + // Move focus on the toggle button + await user.tab(); - it( 'should render a null element when controls are empty and children is not specified', () => { - const { container } = render( ); + await user.keyboard( '[ArrowDown]' ); - expect( container.firstChild ).toBeNull(); + let menu; + await waitFor( () => { + menu = screen.getByRole( 'menu' ); + return expect( menu ).toBeVisible(); } ); - it( 'should open menu on arrow down (controls)', () => { - const { - container: { firstChild: dropdownMenuContainer }, - } = render( ); - - const button = getMenuToggleButton( dropdownMenuContainer ); - button.focus(); - fireEvent.keyDown( button, { - keyCode: DOWN, - preventDefault: () => {}, - } ); - const menu = getNavigableMenu( dropdownMenuContainer ); - expect( menu ).toBeTruthy(); - - expect( - dropdownMenuContainer.querySelectorAll( - '.components-dropdown-menu__menu-item' - ) - ).toHaveLength( controls.length ); - } ); + expect( within( menu ).getAllByRole( 'menuitem' ) ).toHaveLength( + controls.length + ); + } ); - it( 'should open menu on arrow down (children)', () => { - const { - container: { firstChild: dropdownMenuContainer }, - } = render( ); + it( 'should open menu when pressing arrow down on the toggle and the children prop is used to define menu items', async () => { + const user = userEvent.setup( { + advanceTimers: jest.advanceTimersByTime, + } ); - const button = getMenuToggleButton( dropdownMenuContainer ); - button.focus(); - fireEvent.keyDown( button, { - keyCode: DOWN, - preventDefault: () => {}, - } ); + render( + } + /> + ); - expect( getNavigableMenu( dropdownMenuContainer ) ).toBeTruthy(); + const button = screen.getByRole( 'button' ); + button.focus(); - const menuItem = dropdownMenuContainer.querySelector( - '.components-menu-item__button' - ); - fireEvent.click( menuItem ); + await user.keyboard( '[ArrowDown]' ); - expect( getNavigableMenu( dropdownMenuContainer ) ).toBeNull(); + let menu; + await waitFor( () => { + menu = screen.getByRole( 'menu' ); + return expect( menu ).toBeVisible(); } ); + + // Clicking the menu item will close the dropdown menu + await user.click( within( menu ).getByRole( 'menuitem' ) ); + + expect( screen.queryByRole( 'menu' ) ).not.toBeInTheDocument(); } ); } ); From 28ddeecd73c329caaf09b94413c78723b8d6a5a6 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Fri, 26 Aug 2022 09:49:14 +1000 Subject: [PATCH 45/68] Verse: Add missing typography supports (#43569) --- packages/block-library/src/verse/block.json | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/verse/block.json b/packages/block-library/src/verse/block.json index 359f85ca4a5346..dc0772cc9aa526 100644 --- a/packages/block-library/src/verse/block.json +++ b/packages/block-library/src/verse/block.json @@ -38,6 +38,7 @@ "__experimentalFontWeight": true, "__experimentalLetterSpacing": true, "__experimentalTextTransform": true, + "__experimentalTextDecoration": true, "__experimentalDefaultControls": { "fontSize": true, "fontAppearance": true From 03d6d85f2eab87f87fbba1b74f95337e6570e055 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Fri, 26 Aug 2022 10:02:47 +1000 Subject: [PATCH 46/68] Latest Posts: Add typography supports (#43540) --- docs/reference-guides/core-blocks.md | 2 +- .../block-library/src/latest-posts/block.json | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 7d5c1629761cdf..af4b6b49a25b99 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -329,7 +329,7 @@ Display a list of your most recent posts. ([Source](https://github.com/WordPress - **Name:** core/latest-posts - **Category:** widgets -- **Supports:** align, ~~html~~ +- **Supports:** align, typography (fontSize, lineHeight), ~~html~~ - **Attributes:** addLinkToFeaturedImage, categories, columns, displayAuthor, displayFeaturedImage, displayPostContent, displayPostContentRadio, displayPostDate, excerptLength, featuredImageAlign, featuredImageSizeHeight, featuredImageSizeSlug, featuredImageSizeWidth, order, orderBy, postLayout, postsToShow, selectedAuthor ## List diff --git a/packages/block-library/src/latest-posts/block.json b/packages/block-library/src/latest-posts/block.json index 6dcffe37a6c6ab..b423b09d900cb2 100644 --- a/packages/block-library/src/latest-posts/block.json +++ b/packages/block-library/src/latest-posts/block.json @@ -84,7 +84,20 @@ }, "supports": { "align": true, - "html": false + "html": false, + "typography": { + "fontSize": true, + "lineHeight": true, + "__experimentalFontFamily": true, + "__experimentalFontWeight": true, + "__experimentalFontStyle": true, + "__experimentalTextTransform": true, + "__experimentalTextDecoration": true, + "__experimentalLetterSpacing": true, + "__experimentalDefaultControls": { + "fontSize": true + } + } }, "editorStyle": "wp-block-latest-posts-editor", "style": "wp-block-latest-posts" From 427871e80ee6316d81f93efd4f2f1030ffc34737 Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Fri, 26 Aug 2022 12:43:55 +1000 Subject: [PATCH 47/68] Block Spacing: using spacing controls for block gap values to support presets in the UI (#43466) * Try using spacing controls for block gap values * Hacky attempt to progress the behaviour forward slightly, will be partially reverted * Fix tests * Get labels working properly * Add support for the Gallery block ad-hoc calculations * Add support for global styles, and matching a value against an existing preset value * Fix linting issue * Ensure null values do not crash the component --- .../spacing-input-control.js | 5 ++ .../spacing-sizes-control/test/utils.js | 26 ++++++ .../components/spacing-sizes-control/utils.js | 45 ++++++++-- packages/block-editor/src/hooks/dimensions.js | 15 ++-- packages/block-editor/src/hooks/gap.js | 68 +++++++++------ packages/block-editor/src/hooks/test/gap.js | 38 ++++----- .../block-editor/src/layouts/constrained.js | 21 +++-- packages/block-editor/src/layouts/flow.js | 22 ++--- .../block-library/src/gallery/gap-styles.js | 16 ++-- packages/block-library/src/gallery/index.php | 25 +++++- .../global-styles/dimensions-panel.js | 83 ++++++++++++------- .../src/components/global-styles/utils.js | 2 +- 12 files changed, 243 insertions(+), 123 deletions(-) diff --git a/packages/block-editor/src/components/spacing-sizes-control/spacing-input-control.js b/packages/block-editor/src/components/spacing-sizes-control/spacing-input-control.js index 2a9ed938e043c4..c0d2573b42e807 100644 --- a/packages/block-editor/src/components/spacing-sizes-control/spacing-input-control.js +++ b/packages/block-editor/src/components/spacing-sizes-control/spacing-input-control.js @@ -30,6 +30,7 @@ import { LABELS, getSliderValueFromPreset, getCustomValueFromPreset, + getPresetValueFromCustomValue, isValueSpacingPreset, } from './utils'; @@ -42,6 +43,9 @@ export default function SpacingInputControl( { type, minimumCustomValue, } ) { + // Treat value as a preset value if the passed in value matches the value of one of the spacingSizes. + value = getPresetValueFromCustomValue( value, spacingSizes ); + let selectListSizes = spacingSizes; const showRangeControl = spacingSizes.length <= 8; @@ -216,6 +220,7 @@ export default function SpacingInputControl( { label={ ariaLabel } hideLabelFromVision={ true } className="components-spacing-sizes-control__custom-value-input" + style={ { gridColumn: '1' } } /> { } ); } ); +describe( 'getPresetValueFromCustomValue', () => { + const spacingSizes = [ { name: 'Small', slug: 20, size: '8px' } ]; + it( 'should return original value if a string in spacing presets var format', () => { + expect( + getPresetValueFromCustomValue( + 'var:preset|spacing|80', + spacingSizes + ) + ).toBe( 'var:preset|spacing|80' ); + } ); + it( 'should return value constructed from matching spacingSizes array entry if value matches sizes', () => { + expect( getPresetValueFromCustomValue( '8px', spacingSizes ) ).toBe( + 'var:preset|spacing|20' + ); + } ); + it( 'should return values as-is if no matching preset in spacingSizes array', () => { + expect( + getPresetValueFromCustomValue( '1.125rem', spacingSizes ) + ).toBe( '1.125rem' ); + } ); +} ); + describe( 'getSpacingPresetCssVar', () => { it( 'should return original value if not a string in spacing presets var format', () => { expect( getSpacingPresetCssVar( '20px' ) ).toBe( '20px' ); @@ -144,6 +167,9 @@ describe( 'isValuesDefined', () => { it( 'should return false if values are not defined', () => { expect( isValuesDefined( undefinedValues ) ).toBe( false ); } ); + it( 'should return false if values is passed in as null', () => { + expect( isValuesDefined( null ) ).toBe( false ); + } ); const definedValues = { top: 'var:preset|spacing|30', bottom: 'var:preset|spacing|20', diff --git a/packages/block-editor/src/components/spacing-sizes-control/utils.js b/packages/block-editor/src/components/spacing-sizes-control/utils.js index 2f824e25cacf67..8236d743ab32f2 100644 --- a/packages/block-editor/src/components/spacing-sizes-control/utils.js +++ b/packages/block-editor/src/components/spacing-sizes-control/utils.js @@ -43,6 +43,33 @@ export function getCustomValueFromPreset( value, spacingSizes ) { return spacingSize?.size; } +/** + * Converts a custom value to preset value if one can be found. + * + * Returns value as-is if no match is found. + * + * @param {string} value Value to convert + * @param {Array} spacingSizes Array of the current spacing preset objects + * + * @return {string} The preset value if it can be found. + */ +export function getPresetValueFromCustomValue( value, spacingSizes ) { + // Return value as-is if it is already a preset; + if ( isValueSpacingPreset( value ) ) { + return value; + } + + const spacingMatch = spacingSizes.find( + ( size ) => String( size.size ) === String( value ) + ); + + if ( spacingMatch?.slug ) { + return `var:preset|spacing|${ spacingMatch.slug }`; + } + + return value; +} + /** * Converts a spacing preset into a custom value. * @@ -181,15 +208,15 @@ export function isValuesMixed( values = {}, sides = ALL_SIDES ) { * @return {boolean} Whether values are defined. */ export function isValuesDefined( values ) { - return ( - values !== undefined && - ! isEmpty( - Object.values( values ).filter( - // Switching units when input is empty causes values only - // containing units. This gives false positive on mixed values - // unless filtered. - ( value ) => !! value && /\d/.test( value ) - ) + if ( values === undefined || values === null ) { + return false; + } + return ! isEmpty( + Object.values( values ).filter( + // Switching units when input is empty causes values only + // containing units. This gives false positive on mixed values + // unless filtered. + ( value ) => !! value && /\d/.test( value ) ) ); } diff --git a/packages/block-editor/src/hooks/dimensions.js b/packages/block-editor/src/hooks/dimensions.js index 6140e756c1d799..3eded40fc4a0ae 100644 --- a/packages/block-editor/src/hooks/dimensions.js +++ b/packages/block-editor/src/hooks/dimensions.js @@ -79,15 +79,16 @@ export function DimensionsPanel( props ) { }, } ); + const spacingClassnames = classnames( { + 'tools-panel-item-spacing': spacingSizes && spacingSizes.length > 0, + } ); + return ( <> { ! isPaddingDisabled && ( 0, - } ) } + className={ spacingClassnames } hasValue={ () => hasPaddingValue( props ) } label={ __( 'Padding' ) } onDeselect={ () => resetPadding( props ) } @@ -100,10 +101,7 @@ export function DimensionsPanel( props ) { ) } { ! isMarginDisabled && ( 0, - } ) } + className={ spacingClassnames } hasValue={ () => hasMarginValue( props ) } label={ __( 'Margin' ) } onDeselect={ () => resetMargin( props ) } @@ -116,6 +114,7 @@ export function DimensionsPanel( props ) { ) } { ! isGapDisabled && ( hasGapValue( props ) } label={ __( 'Block spacing' ) } onDeselect={ () => resetGap( props ) } diff --git a/packages/block-editor/src/hooks/gap.js b/packages/block-editor/src/hooks/gap.js index 9bb30261cd3150..018872eb840329 100644 --- a/packages/block-editor/src/hooks/gap.js +++ b/packages/block-editor/src/hooks/gap.js @@ -15,6 +15,7 @@ import { */ import { __unstableUseBlockRef as useBlockRef } from '../components/block-list/use-block-props/use-block-refs'; import { getSpacingPresetCssVar } from '../components/spacing-sizes-control/utils'; +import SpacingSizesControl from '../components/spacing-sizes-control'; import useSetting from '../components/use-setting'; import { AXIAL_SIDES, SPACING_SUPPORT_KEY, useCustomSides } from './dimensions'; import { cleanEmptyObject } from './utils'; @@ -55,12 +56,8 @@ export function getGapBoxControlValueFromStyle( blockGapValue ) { const isValueString = typeof blockGapValue === 'string'; return { - top: isValueString - ? getSpacingPresetCssVar( blockGapValue ) - : getSpacingPresetCssVar( blockGapValue?.top ), - left: isValueString - ? getSpacingPresetCssVar( blockGapValue ) - : getSpacingPresetCssVar( blockGapValue?.left ), + top: isValueString ? blockGapValue : blockGapValue?.top, + left: isValueString ? blockGapValue : blockGapValue?.left, }; } @@ -78,8 +75,10 @@ export function getGapCSSValue( blockGapValue, defaultValue = '0' ) { return null; } - const row = blockGapBoxControlValue?.top || defaultValue; - const column = blockGapBoxControlValue?.left || defaultValue; + const row = + getSpacingPresetCssVar( blockGapBoxControlValue?.top ) || defaultValue; + const column = + getSpacingPresetCssVar( blockGapBoxControlValue?.left ) || defaultValue; return row === column ? row : `${ row } ${ column }`; } @@ -132,6 +131,8 @@ export function GapEdit( props ) { setAttributes, } = props; + const spacingSizes = useSetting( 'spacing.spacingSizes' ); + const units = useCustomUnits( { availableUnits: useSetting( 'spacing.units' ) || [ '%', @@ -157,6 +158,9 @@ export function GapEdit( props ) { // If splitOnAxis activated we need to return a BoxControl object to the BoxControl component. if ( !! next && splitOnAxis ) { blockGap = { ...getGapBoxControlValueFromStyle( next ) }; + } else if ( next?.hasOwnProperty( 'top' ) ) { + // If splitOnAxis is not enabled, treat the 'top' value as the shorthand gap value. + blockGap = next.top; } const newStyle = { @@ -195,32 +199,46 @@ export function GapEdit( props ) { right: gapValue?.left, bottom: gapValue?.top, } - : gapValue?.top; + : { + top: gapValue?.top, + }; return Platform.select( { web: ( <> - { splitOnAxis ? ( - + ) : ( + + ) ) } + { spacingSizes?.length > 0 && ( + - ) : ( - ) } ), diff --git a/packages/block-editor/src/hooks/test/gap.js b/packages/block-editor/src/hooks/test/gap.js index 1e9d76079cb00e..a08e5a6759b2ab 100644 --- a/packages/block-editor/src/hooks/test/gap.js +++ b/packages/block-editor/src/hooks/test/gap.js @@ -27,28 +27,6 @@ describe( 'gap', () => { ...blockGapValue, } ); } ); - it( 'should unwrap var: values from a string into a CSS var() function', () => { - const expectedValue = { - top: 'var(--wp--preset--spacing--60)', - left: 'var(--wp--preset--spacing--60)', - }; - expect( - getGapBoxControlValueFromStyle( 'var:preset|spacing|60' ) - ).toEqual( expectedValue ); - } ); - it( 'should unwrap var: values from an object into a CSS var() function', () => { - const expectedValue = { - top: 'var(--wp--preset--spacing--20)', - left: 'var(--wp--preset--spacing--60)', - }; - const blockGapValue = { - top: 'var:preset|spacing|20', - left: 'var:preset|spacing|60', - }; - expect( getGapBoxControlValueFromStyle( blockGapValue ) ).toEqual( - expectedValue - ); - } ); } ); describe( 'getGapCSSValue()', () => { it( 'should return `null` if argument is falsey', () => { @@ -84,5 +62,21 @@ describe( 'gap', () => { '88px 1px' ); } ); + + it( 'should unwrap var: values from a string into a CSS var() function', () => { + expect( getGapCSSValue( 'var:preset|spacing|60' ) ).toEqual( + 'var(--wp--preset--spacing--60)' + ); + } ); + + it( 'should unwrap var: values from an object into a CSS var() function and return shorthand values', () => { + const blockGapValue = { + top: 'var:preset|spacing|20', + left: 'var:preset|spacing|60', + }; + expect( getGapCSSValue( blockGapValue ) ).toEqual( + 'var(--wp--preset--spacing--20) var(--wp--preset--spacing--60)' + ); + } ); } ); } ); diff --git a/packages/block-editor/src/layouts/constrained.js b/packages/block-editor/src/layouts/constrained.js index 8517382defcf89..8e6e5fd264f3fb 100644 --- a/packages/block-editor/src/layouts/constrained.js +++ b/packages/block-editor/src/layouts/constrained.js @@ -15,7 +15,7 @@ import { getCSSRules } from '@wordpress/style-engine'; */ import useSetting from '../components/use-setting'; import { appendSelectors, getBlockGapCSS, getAlignmentsInfo } from './utils'; -import { getGapBoxControlValueFromStyle } from '../hooks/gap'; +import { getGapCSSValue } from '../hooks/gap'; import { shouldSkipSerialization } from '../hooks/utils'; export default { @@ -117,16 +117,19 @@ export default { layoutDefinitions, } ) { const { contentSize, wideSize } = layout; - const blockGapStyleValue = getGapBoxControlValueFromStyle( - style?.spacing?.blockGap - ); + const blockGapStyleValue = getGapCSSValue( style?.spacing?.blockGap ); + // If a block's block.json skips serialization for spacing or // spacing.blockGap, don't apply the user-defined value to the styles. - const blockGapValue = - blockGapStyleValue?.top && - ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' ) - ? blockGapStyleValue?.top - : ''; + let blockGapValue = ''; + if ( ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' ) ) { + // If an object is provided only use the 'top' value for this kind of gap. + if ( blockGapStyleValue?.top ) { + blockGapValue = getGapCSSValue( blockGapStyleValue?.top ); + } else if ( typeof blockGapStyleValue === 'string' ) { + blockGapValue = getGapCSSValue( blockGapStyleValue ); + } + } let output = !! contentSize || !! wideSize diff --git a/packages/block-editor/src/layouts/flow.js b/packages/block-editor/src/layouts/flow.js index fb0eb5ecde093f..ecc6779b9128dd 100644 --- a/packages/block-editor/src/layouts/flow.js +++ b/packages/block-editor/src/layouts/flow.js @@ -6,9 +6,8 @@ import { __ } from '@wordpress/i18n'; /** * Internal dependencies */ - import { getBlockGapCSS, getAlignmentsInfo } from './utils'; -import { getGapBoxControlValueFromStyle } from '../hooks/gap'; +import { getGapCSSValue } from '../hooks/gap'; import { shouldSkipSerialization } from '../hooks/utils'; export default { @@ -27,16 +26,19 @@ export default { hasBlockGapSupport, layoutDefinitions, } ) { - const blockGapStyleValue = getGapBoxControlValueFromStyle( - style?.spacing?.blockGap - ); + const blockGapStyleValue = getGapCSSValue( style?.spacing?.blockGap ); + // If a block's block.json skips serialization for spacing or // spacing.blockGap, don't apply the user-defined value to the styles. - const blockGapValue = - blockGapStyleValue?.top && - ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' ) - ? blockGapStyleValue?.top - : ''; + let blockGapValue = ''; + if ( ! shouldSkipSerialization( blockName, 'spacing', 'blockGap' ) ) { + // If an object is provided only use the 'top' value for this kind of gap. + if ( blockGapStyleValue?.top ) { + blockGapValue = getGapCSSValue( blockGapStyleValue?.top ); + } else if ( typeof blockGapStyleValue === 'string' ) { + blockGapValue = getGapCSSValue( blockGapStyleValue ); + } + } let output = ''; diff --git a/packages/block-library/src/gallery/gap-styles.js b/packages/block-library/src/gallery/gap-styles.js index 9c5b217d18ba94..7bd0932d62f5b8 100644 --- a/packages/block-library/src/gallery/gap-styles.js +++ b/packages/block-library/src/gallery/gap-styles.js @@ -1,7 +1,10 @@ /** * WordPress dependencies */ -import { BlockList } from '@wordpress/block-editor'; +import { + BlockList, + __experimentalGetGapCSSValue as getGapCSSValue, +} from '@wordpress/block-editor'; import { useContext, createPortal } from '@wordpress/element'; export default function GapStyles( { blockGap, clientId } ) { @@ -17,17 +20,18 @@ export default function GapStyles( { blockGap, clientId } ) { if ( !! blockGap ) { row = typeof blockGap === 'string' - ? blockGap - : blockGap?.top || fallbackValue; + ? getGapCSSValue( blockGap ) + : getGapCSSValue( blockGap?.top ) || fallbackValue; column = typeof blockGap === 'string' - ? blockGap - : blockGap?.left || fallbackValue; + ? getGapCSSValue( blockGap ) + : getGapCSSValue( blockGap?.left ) || fallbackValue; gapValue = row === column ? row : `${ row } ${ column }`; } + // The unstable gallery gap calculation requires a real value (such as `0px`) and not `0`. const gap = `#block-${ clientId } { - --wp--style--unstable-gallery-gap: ${ column }; + --wp--style--unstable-gallery-gap: ${ column === '0' ? '0px' : column }; gap: ${ gapValue } }`; diff --git a/packages/block-library/src/gallery/index.php b/packages/block-library/src/gallery/index.php index e6eecb7dda4122..9f29184ffed07a 100644 --- a/packages/block-library/src/gallery/index.php +++ b/packages/block-library/src/gallery/index.php @@ -51,13 +51,29 @@ function block_core_gallery_render( $attributes, $content ) { if ( is_array( $gap ) ) { foreach ( $gap as $key => $value ) { // Make sure $value is a string to avoid PHP 8.1 deprecation error in preg_match() when the value is null. - $value = is_string( $value ) ? $value : ''; - $gap[ $key ] = $value && preg_match( '%[\\\(&=}]|/\*%', $value ) ? null : $value; + $value = is_string( $value ) ? $value : ''; + $value = $value && preg_match( '%[\\\(&=}]|/\*%', $value ) ? null : $value; + + // Get spacing CSS variable from preset value if provided. + if ( is_string( $value ) && str_contains( $value, 'var:preset|spacing|' ) ) { + $index_to_splice = strrpos( $value, '|' ) + 1; + $slug = _wp_to_kebab_case( substr( $value, $index_to_splice ) ); + $value = "var(--wp--preset--spacing--$slug)"; + } + + $gap[ $key ] = $value; } } else { // Make sure $gap is a string to avoid PHP 8.1 deprecation error in preg_match() when the value is null. $gap = is_string( $gap ) ? $gap : ''; $gap = $gap && preg_match( '%[\\\(&=}]|/\*%', $gap ) ? null : $gap; + + // Get spacing CSS variable from preset value if provided. + if ( is_string( $gap ) && str_contains( $gap, 'var:preset|spacing|' ) ) { + $index_to_splice = strrpos( $gap, '|' ) + 1; + $slug = _wp_to_kebab_case( substr( $gap, $index_to_splice ) ); + $gap = "var(--wp--preset--spacing--$slug)"; + } } $class = wp_unique_id( 'wp-block-gallery-' ); @@ -80,6 +96,11 @@ function block_core_gallery_render( $attributes, $content ) { $gap_value = $gap_row === $gap_column ? $gap_row : $gap_row . ' ' . $gap_column; } + // The unstable gallery gap calculation requires a real value (such as `0px`) and not `0`. + if ( '0' === $gap_column ) { + $gap_column = '0px'; + } + // Set the CSS variable to the column value, and the `gap` property to the combined gap value. $style = '.wp-block-gallery.' . $class . '{ --wp--style--unstable-gallery-gap: ' . $gap_column . '; gap: ' . $gap_value . '}'; diff --git a/packages/edit-site/src/components/global-styles/dimensions-panel.js b/packages/edit-site/src/components/global-styles/dimensions-panel.js index cca4fdd0298282..583a43f3411497 100644 --- a/packages/edit-site/src/components/global-styles/dimensions-panel.js +++ b/packages/edit-site/src/components/global-styles/dimensions-panel.js @@ -121,20 +121,21 @@ function splitStyleValue( value ) { function splitGapValue( value ) { // Check for shorthand value (a string value). if ( value && typeof value === 'string' ) { - // Convert to value for individual sides for BoxControl. + // If the value is a string, treat it as a single side (top) for the spacing controls. return { top: value, - right: value, - bottom: value, - left: value, }; } - return { - ...value, - right: value?.left, - bottom: value?.top, - }; + if ( value ) { + return { + ...value, + right: value?.left, + bottom: value?.top, + }; + } + + return value; } // Props for managing `layout.contentSize`. @@ -238,21 +239,26 @@ function useMarginProps( name ) { function useBlockGapProps( name ) { const [ gapValue, setGapValue ] = useStyle( 'spacing.blockGap', name ); const gapValues = splitGapValue( gapValue ); - const setGapValues = ( nextBoxGapValue ) => { - if ( ! nextBoxGapValue ) { - setGapValue( null ); - } - setGapValue( { - top: nextBoxGapValue?.top, - left: nextBoxGapValue?.left, - } ); - }; const gapSides = useCustomSides( name, 'blockGap' ); const isAxialGap = gapSides && gapSides.some( ( side ) => AXIAL_SIDES.includes( side ) ); const resetGapValue = () => setGapValue( undefined ); const [ userSetGapValue ] = useStyle( 'spacing.blockGap', name, 'user' ); const hasGapValue = () => !! userSetGapValue; + const setGapValues = ( nextBoxGapValue ) => { + if ( ! nextBoxGapValue ) { + setGapValue( null ); + } + // If axial gap is not enabled, treat the 'top' value as the shorthand gap value. + if ( ! isAxialGap && nextBoxGapValue?.hasOwnProperty( 'top' ) ) { + setGapValue( nextBoxGapValue.top ); + } else { + setGapValue( { + top: nextBoxGapValue?.top, + left: nextBoxGapValue?.left, + } ); + } + }; return { gapValue, gapValues, @@ -469,27 +475,42 @@ export default function DimensionsPanel( { name } ) { label={ __( 'Block spacing' ) } onDeselect={ resetGapValue } isShownByDefault={ true } + className={ classnames( { + 'tools-panel-item-spacing': showSpacingPresetsControl, + } ) } > - { isAxialGap ? ( - + ) : ( + + ) ) } + { showSpacingPresetsControl && ( + - ) : ( - ) } ) } diff --git a/packages/edit-site/src/components/global-styles/utils.js b/packages/edit-site/src/components/global-styles/utils.js index 81d39355752735..4c9d7bae19f7a1 100644 --- a/packages/edit-site/src/components/global-styles/utils.js +++ b/packages/edit-site/src/components/global-styles/utils.js @@ -79,7 +79,7 @@ export const PRESET_METADATA = [ }, { path: [ 'spacing', 'spacingSizes' ], - valueKey: 'spacingSizes', + valueKey: 'size', cssVarInfix: 'spacing', valueFunc: ( { size } ) => size, classes: [], From e91cb533ae1ee734340d773a9e5ba31368e56c66 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 26 Aug 2022 08:44:07 +0400 Subject: [PATCH 48/68] Document Settings: Display pretty permalink for draft posts (#43600) --- packages/editor/src/components/post-url/label.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/components/post-url/label.js b/packages/editor/src/components/post-url/label.js index c7498acbf394f4..5c233dfd549467 100644 --- a/packages/editor/src/components/post-url/label.js +++ b/packages/editor/src/components/post-url/label.js @@ -15,7 +15,7 @@ export default function PostURLLabel() { export function usePostURLLabel() { const postLink = useSelect( - ( select ) => select( editorStore ).getCurrentPost().link, + ( select ) => select( editorStore ).getPermalink(), [] ); return filterURLForDisplay( safeDecodeURIComponent( postLink ) ); From ca63ca03c6bd13f9dcc4e8d914967ca6c6972293 Mon Sep 17 00:00:00 2001 From: Joen A <1204802+jasmussen@users.noreply.github.com> Date: Fri, 26 Aug 2022 08:36:16 +0200 Subject: [PATCH 49/68] Group: Fix click-first state (#43513) * Group: Fix click-first state * Try fix for block insertion tests. * Move the code to the Button Block Appender component. Co-authored-by: tellthemachines --- .../button-block-appender/style.scss | 25 +++++++++++++++++++ packages/block-library/src/group/editor.scss | 25 ------------------- .../editor/various/inserting-blocks.test.js | 4 +++ 3 files changed, 29 insertions(+), 25 deletions(-) diff --git a/packages/block-editor/src/components/button-block-appender/style.scss b/packages/block-editor/src/components/button-block-appender/style.scss index 6de8718d855339..a475cb13fb3604 100644 --- a/packages/block-editor/src/components/button-block-appender/style.scss +++ b/packages/block-editor/src/components/button-block-appender/style.scss @@ -31,3 +31,28 @@ color: $black; } } + +// When the appender shows up in empty container blocks, such as Group and Columns, add an extra click state. +.block-list-appender:only-child { + .is-layout-constrained.block-editor-block-list__block:not(.is-selected) > &, + .is-layout-flow.block-editor-block-list__block:not(.is-selected) > & { + pointer-events: none; + + &::after { + content: ""; + position: absolute; + top: 0; + right: 0; + bottom: 0; + left: 0; + border: $border-width dashed currentColor; + opacity: 0.4; + border-radius: $radius-block-ui; + pointer-events: none; + } + + .block-editor-inserter { + visibility: hidden; + } + } +} diff --git a/packages/block-library/src/group/editor.scss b/packages/block-library/src/group/editor.scss index cbc0af62acdd62..c4939d9afe3a9a 100644 --- a/packages/block-library/src/group/editor.scss +++ b/packages/block-library/src/group/editor.scss @@ -53,28 +53,3 @@ pointer-events: all; } } - -// Show an unselected empty group button as a dashed outline instead of the appender button. -// This effectively adds a selectable-to-delete state. -.is-layout-flow.block-editor-block-list__block:not(.is-selected) { - > .block-list-appender:only-child { - pointer-events: none; - - &::after { - content: ""; - position: absolute; - top: 0; - right: 0; - bottom: 0; - left: 0; - border: $border-width dashed currentColor; - opacity: 0.4; - border-radius: $radius-block-ui; - pointer-events: none; - } - - .block-editor-inserter { - visibility: hidden; - } - } -} diff --git a/packages/e2e-tests/specs/editor/various/inserting-blocks.test.js b/packages/e2e-tests/specs/editor/various/inserting-blocks.test.js index f03bd390641969..9056b5b0a62b9f 100644 --- a/packages/e2e-tests/specs/editor/various/inserting-blocks.test.js +++ b/packages/e2e-tests/specs/editor/various/inserting-blocks.test.js @@ -279,6 +279,8 @@ describe( 'Inserting blocks', () => { await insertBlock( 'Group' ); await insertBlock( 'Paragraph' ); await page.keyboard.type( 'Paragraph after group' ); + // Click the Group first to make the appender inside it clickable. + await page.click( '[data-type="core/group"]' ); await page.click( '[data-type="core/group"] [aria-label="Add block"]' ); const browseAll = await page.waitForXPath( '//button[text()="Browse all"]' @@ -295,6 +297,8 @@ describe( 'Inserting blocks', () => { await insertBlock( 'Group' ); await insertBlock( 'Paragraph' ); await page.keyboard.type( 'Text' ); + // Click the Group first to make the appender inside it clickable. + await page.click( '[data-type="core/group"]' ); await page.click( '[data-type="core/group"] [aria-label="Add block"]' ); await page.waitForSelector( INSERTER_SEARCH_SELECTOR ); await page.focus( INSERTER_SEARCH_SELECTOR ); From fc372b5d9a447f37ab12423ddaa6d278e9b0fdf7 Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Fri, 26 Aug 2022 17:47:12 +1000 Subject: [PATCH 50/68] Home Link: Add typography support (#43307) --- docs/reference-guides/core-blocks.md | 2 +- packages/block-library/src/home-link/block.json | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index af4b6b49a25b99..e8d427323fb798 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -293,7 +293,7 @@ Create a link that always points to the homepage of the site. Usually not necess - **Name:** core/home-link - **Category:** design -- **Supports:** ~~html~~, ~~reusable~~ +- **Supports:** typography (fontSize, lineHeight), ~~html~~, ~~reusable~~ - **Attributes:** label ## Custom HTML diff --git a/packages/block-library/src/home-link/block.json b/packages/block-library/src/home-link/block.json index 3597aa9d5554ac..567bdf8c27ba7b 100644 --- a/packages/block-library/src/home-link/block.json +++ b/packages/block-library/src/home-link/block.json @@ -23,7 +23,20 @@ ], "supports": { "reusable": false, - "html": false + "html": false, + "typography": { + "fontSize": true, + "lineHeight": true, + "__experimentalFontFamily": true, + "__experimentalFontWeight": true, + "__experimentalFontStyle": true, + "__experimentalTextTransform": true, + "__experimentalTextDecoration": true, + "__experimentalLetterSpacing": true, + "__experimentalDefaultControls": { + "fontSize": true + } + } }, "editorStyle": "wp-block-home-link-editor", "style": "wp-block-home-link" From b40b5400690737820852c86cdccfda906b2a7578 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Fri, 26 Aug 2022 16:50:57 +0900 Subject: [PATCH 51/68] AlignmentMatrixControl: keep the physical direction in RTL languages (#43126) * AlignmentMatrixControl: Display tooltip labels considering RTL language * USe wrapper function * AlignmentMatrixControl: keep physical direction * Update cover block to match AlignmentMatrixControl specifications * Update changelog --- .../src/cover/edit/block-controls.js | 18 +++++++++++++++--- packages/components/CHANGELOG.md | 1 + .../styles/alignment-matrix-control-styles.js | 1 + packages/data/tsconfig.json | 4 +--- 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/packages/block-library/src/cover/edit/block-controls.js b/packages/block-library/src/cover/edit/block-controls.js index 59aaaaffe77d75..65b6f3765765fd 100644 --- a/packages/block-library/src/cover/edit/block-controls.js +++ b/packages/block-library/src/cover/edit/block-controls.js @@ -9,7 +9,7 @@ import { __experimentalBlockAlignmentMatrixControl as BlockAlignmentMatrixControl, __experimentalBlockFullHeightAligmentControl as FullHeightAlignmentControl, } from '@wordpress/block-editor'; -import { __ } from '@wordpress/i18n'; +import { __, isRTL } from '@wordpress/i18n'; /** * Internal dependencies @@ -58,15 +58,27 @@ export default function CoverBlockControls( { } ); }; + // Flip value horizontally to match the physical direction indicated by + // AlignmentMatrixControl with the logical direction indicated by cover + // block in RTL languages. + const flipHorizontalPosition = ( ltrContentPosition ) => { + return isRTL() + ? ltrContentPosition.replace( /left|right/, ( match ) => + match === 'left' ? 'right' : 'left' + ) + : ltrContentPosition; + }; + return ( <> setAttributes( { - contentPosition: nextPosition, + contentPosition: + flipHorizontalPosition( nextPosition ), } ) } isDisabled={ ! hasInnerBlocks } diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 9a7b9cdedf0ab5..a12b09a153309e 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -14,6 +14,7 @@ ### Bug Fix +- `AlignmentMatrixControl`: keep the physical direction in RTL languages ([#43126](https://github.com/WordPress/gutenberg/pull/43126)). - `AlignmentMatrixControl`: Fix the `width` prop so it works as intended ([#43482](https://github.com/WordPress/gutenberg/pull/43482)). - `SelectControl`, `CustomSelectControl`: Truncate long option strings ([#43301](https://github.com/WordPress/gutenberg/pull/43301)). - `Popover`: fix and improve opening animation ([#43186](https://github.com/WordPress/gutenberg/pull/43186)). diff --git a/packages/components/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js b/packages/components/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js index 88ae648252aae2..9cf55416023087 100644 --- a/packages/components/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js +++ b/packages/components/src/alignment-matrix-control/styles/alignment-matrix-control-styles.js @@ -13,6 +13,7 @@ export const rootBase = () => { return css` border-radius: 2px; box-sizing: border-box; + direction: ltr; display: grid; grid-template-columns: repeat( 3, 1fr ); outline: none; diff --git a/packages/data/tsconfig.json b/packages/data/tsconfig.json index c333776d38da68..c604c1785853c0 100644 --- a/packages/data/tsconfig.json +++ b/packages/data/tsconfig.json @@ -14,7 +14,5 @@ { "path": "../priority-queue" }, { "path": "../redux-routine" } ], - "include": [ - "src/**/*" - ] + "include": [ "src/**/*" ] } From f68ec14f796fff29f62ad022fe538de2dc251f8f Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Fri, 26 Aug 2022 10:18:10 +0200 Subject: [PATCH 52/68] Guide: use `code` instead of `keyCode` for keyboard events (#43604) * Guide: use `code` instead of `keyCode` for keyboard events * Prevent scrolling the page contents when pressing left/right arrows * Add unit tes for arrow navigation, rewrite page control unit tests to modern RTL * CHANGELOG --- packages/components/CHANGELOG.md | 1 + packages/components/src/guide/index.js | 9 +- packages/components/src/guide/test/index.js | 139 +++++++++++++++++- .../components/src/guide/test/page-control.js | 40 ----- 4 files changed, 145 insertions(+), 44 deletions(-) delete mode 100644 packages/components/src/guide/test/page-control.js diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index a12b09a153309e..7d3fd67a4984ff 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -5,6 +5,7 @@ ### Internal - Refactor `FocalPointPicker` to function component ([#39168](https://github.com/WordPress/gutenberg/pull/39168)). +- `Guide`: use `code` instead of `keyCode` for keyboard events ([#43604](https://github.com/WordPress/gutenberg/pull/43604/)). ## 20.0.0 (2022-08-24) diff --git a/packages/components/src/guide/index.js b/packages/components/src/guide/index.js index 91e4b0d147ff18..4669f13471801b 100644 --- a/packages/components/src/guide/index.js +++ b/packages/components/src/guide/index.js @@ -9,7 +9,6 @@ import classnames from 'classnames'; import { useState, useEffect, Children, useRef } from '@wordpress/element'; import deprecated from '@wordpress/deprecated'; import { __ } from '@wordpress/i18n'; -import { LEFT, RIGHT } from '@wordpress/keycodes'; import { focus } from '@wordpress/dom'; /** @@ -76,10 +75,14 @@ export default function Guide( { contentLabel={ contentLabel } onRequestClose={ onFinish } onKeyDown={ ( event ) => { - if ( event.keyCode === LEFT ) { + if ( event.code === 'ArrowLeft' ) { goBack(); - } else if ( event.keyCode === RIGHT ) { + // Do not scroll the modal's contents. + event.preventDefault(); + } else if ( event.code === 'ArrowRight' ) { goForward(); + // Do not scroll the modal's contents. + event.preventDefault(); } } } ref={ guideContainer } diff --git a/packages/components/src/guide/test/index.js b/packages/components/src/guide/test/index.js index bd36752959ff69..852c09ed280887 100644 --- a/packages/components/src/guide/test/index.js +++ b/packages/components/src/guide/test/index.js @@ -1,7 +1,7 @@ /** * External dependencies */ -import { render, screen } from '@testing-library/react'; +import { render, screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; /** @@ -118,4 +118,141 @@ describe( 'Guide', () => { expect( onFinish ).toHaveBeenCalled(); } ); + + describe( 'page navigation', () => { + it( 'renders an empty list when there are no pages', () => { + render( ); + expect( + screen.queryByRole( 'list', { + name: 'Guide controls', + } ) + ).not.toBeInTheDocument(); + expect( + screen.queryByRole( 'button', { + name: /page \d of \d/i, + } ) + ).not.toBeInTheDocument(); + } ); + + it( 'renders a button for each page', () => { + render( + Page 1

    }, + { content:

    Page 2

    }, + { content:

    Page 3

    }, + { content:

    Page 4

    }, + ] } + /> + ); + const listContainer = screen.getByRole( 'list', { + name: 'Guide controls', + } ); + expect( + within( listContainer ).getAllByRole( 'button', { + name: /page \d of \d/i, + } ) + ).toHaveLength( 4 ); + } ); + + it( 'sets the current page when a button is clicked', async () => { + const user = userEvent.setup( { + advanceTimers: jest.advanceTimersByTime, + } ); + + render( + Page 1

    }, + { content:

    Page 2

    }, + { content:

    Page 3

    }, + ] } + /> + ); + + expect( screen.getByText( 'Page 1' ) ).toBeVisible(); + expect( screen.queryByText( 'Page 2' ) ).not.toBeInTheDocument(); + expect( screen.queryByText( 'Page 3' ) ).not.toBeInTheDocument(); + + await user.click( + screen.getByRole( 'button', { name: 'Page 2 of 3' } ) + ); + + expect( screen.getByText( 'Page 2' ) ).toBeVisible(); + expect( screen.queryByText( 'Page 1' ) ).not.toBeInTheDocument(); + expect( screen.queryByText( 'Page 3' ) ).not.toBeInTheDocument(); + + await user.click( + screen.getByRole( 'button', { name: 'Page 3 of 3' } ) + ); + + expect( screen.getByText( 'Page 3' ) ).toBeVisible(); + expect( screen.queryByText( 'Page 1' ) ).not.toBeInTheDocument(); + expect( screen.queryByText( 'Page 2' ) ).not.toBeInTheDocument(); + + await user.click( + screen.getByRole( 'button', { name: 'Page 1 of 3' } ) + ); + + expect( screen.getByText( 'Page 1' ) ).toBeVisible(); + expect( screen.queryByText( 'Page 2' ) ).not.toBeInTheDocument(); + expect( screen.queryByText( 'Page 3' ) ).not.toBeInTheDocument(); + } ); + + it( 'allows navigating through the pages with the left and right arrows', async () => { + const user = userEvent.setup( { + advanceTimers: jest.advanceTimersByTime, + } ); + + render( + Page 1

    }, + { content:

    Page 2

    }, + { content:

    Page 3

    }, + ] } + /> + ); + + expect( screen.getByText( 'Page 1' ) ).toBeVisible(); + expect( screen.queryByText( 'Page 2' ) ).not.toBeInTheDocument(); + expect( screen.queryByText( 'Page 3' ) ).not.toBeInTheDocument(); + + await user.keyboard( '[ArrowLeft]' ); + + expect( screen.getByText( 'Page 1' ) ).toBeVisible(); + expect( screen.queryByText( 'Page 2' ) ).not.toBeInTheDocument(); + expect( screen.queryByText( 'Page 3' ) ).not.toBeInTheDocument(); + + await user.keyboard( '[ArrowRight]' ); + + expect( screen.getByText( 'Page 2' ) ).toBeVisible(); + expect( screen.queryByText( 'Page 1' ) ).not.toBeInTheDocument(); + expect( screen.queryByText( 'Page 3' ) ).not.toBeInTheDocument(); + + await user.keyboard( '[ArrowRight]' ); + + expect( screen.getByText( 'Page 3' ) ).toBeVisible(); + expect( screen.queryByText( 'Page 1' ) ).not.toBeInTheDocument(); + expect( screen.queryByText( 'Page 2' ) ).not.toBeInTheDocument(); + + await user.keyboard( '[ArrowRight]' ); + + expect( screen.getByText( 'Page 3' ) ).toBeVisible(); + expect( screen.queryByText( 'Page 1' ) ).not.toBeInTheDocument(); + expect( screen.queryByText( 'Page 2' ) ).not.toBeInTheDocument(); + + await user.keyboard( '[ArrowLeft]' ); + + expect( screen.getByText( 'Page 2' ) ).toBeVisible(); + expect( screen.queryByText( 'Page 1' ) ).not.toBeInTheDocument(); + expect( screen.queryByText( 'Page 3' ) ).not.toBeInTheDocument(); + + await user.keyboard( '[ArrowLeft]' ); + + expect( screen.getByText( 'Page 1' ) ).toBeVisible(); + expect( screen.queryByText( 'Page 2' ) ).not.toBeInTheDocument(); + expect( screen.queryByText( 'Page 3' ) ).not.toBeInTheDocument(); + } ); + } ); } ); diff --git a/packages/components/src/guide/test/page-control.js b/packages/components/src/guide/test/page-control.js deleted file mode 100644 index caeb3dd005476a..00000000000000 --- a/packages/components/src/guide/test/page-control.js +++ /dev/null @@ -1,40 +0,0 @@ -/** - * External dependencies - */ -import { render, screen } from '@testing-library/react'; -import userEvent from '@testing-library/user-event'; - -/** - * Internal dependencies - */ -import PageControl from '../page-control'; - -describe( 'PageControl', () => { - it( 'renders an empty list when there are no pages', () => { - render( ); - expect( screen.queryByRole( 'button' ) ).not.toBeInTheDocument(); - } ); - - it( 'renders a button for each page', () => { - render( ); - expect( screen.getAllByRole( 'button' ) ).toHaveLength( 5 ); - } ); - - it( 'sets the current page when a button is clicked', async () => { - const user = userEvent.setup( { - advanceTimers: jest.advanceTimersByTime, - } ); - const setCurrentPage = jest.fn(); - render( - - ); - - await user.click( screen.getAllByRole( 'button' )[ 1 ] ); - - expect( setCurrentPage ).toHaveBeenCalledWith( 1 ); - } ); -} ); From f6be6d8d74b03d5671d2b61a46b9b406fe0cca7e Mon Sep 17 00:00:00 2001 From: Carolina Nymark Date: Fri, 26 Aug 2022 11:15:33 +0200 Subject: [PATCH 53/68] Add cite to theme.json elements (#43543) * Add cite to theme.json elements --- lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php | 1 + packages/blocks/src/api/constants.js | 1 + schemas/json/theme.json | 3 +++ 3 files changed, 5 insertions(+) diff --git a/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php b/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php index 220ef97d7fcece..fec35c0d32db28 100644 --- a/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php +++ b/lib/compat/wordpress-6.1/class-wp-theme-json-6-1.php @@ -98,6 +98,7 @@ class WP_Theme_JSON_6_1 extends WP_Theme_JSON_6_0 { 'h6' => 'h6', 'button' => '.wp-element-button, .wp-block-button__link', // We have the .wp-block-button__link class so that this will target older buttons that have been serialized. 'caption' => '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', // The block classes are necessary to target older content that won't use the new class names. + 'cite' => 'cite', ); const __EXPERIMENTAL_ELEMENT_CLASS_NAMES = array( diff --git a/packages/blocks/src/api/constants.js b/packages/blocks/src/api/constants.js index c06243023123fc..90b6fc094276fa 100644 --- a/packages/blocks/src/api/constants.js +++ b/packages/blocks/src/api/constants.js @@ -226,6 +226,7 @@ export const __EXPERIMENTAL_ELEMENTS = { button: '.wp-element-button, .wp-block-button__link', caption: '.wp-element-caption, .wp-block-audio figcaption, .wp-block-embed figcaption, .wp-block-gallery figcaption, .wp-block-image figcaption, .wp-block-table figcaption, .wp-block-video figcaption', + cite: 'cite', }; export const __EXPERIMENTAL_PATHS_WITH_MERGE = { diff --git a/schemas/json/theme.json b/schemas/json/theme.json index fb8a1f28b5a569..faeb2bb09bb6cb 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -1169,6 +1169,9 @@ }, "caption": { "$ref": "#/definitions/stylesPropertiesComplete" + }, + "cite": { + "$ref": "#/definitions/stylesPropertiesComplete" } }, "additionalProperties": false From 75add8d48c9b78b689bf978bd7247fc6c3b03fad Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Fri, 26 Aug 2022 19:15:52 +1000 Subject: [PATCH 54/68] Query Pagination Numbers: Add missing typography supports (#43559) --- .../block-library/src/query-pagination-numbers/block.json | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/query-pagination-numbers/block.json b/packages/block-library/src/query-pagination-numbers/block.json index 6084b6bfe43d45..fd285965819616 100644 --- a/packages/block-library/src/query-pagination-numbers/block.json +++ b/packages/block-library/src/query-pagination-numbers/block.json @@ -21,10 +21,12 @@ "typography": { "fontSize": true, "lineHeight": true, - "__experimentalFontStyle": true, + "__experimentalFontFamily": true, "__experimentalFontWeight": true, - "__experimentalLetterSpacing": true, + "__experimentalFontStyle": true, "__experimentalTextTransform": true, + "__experimentalTextDecoration": true, + "__experimentalLetterSpacing": true, "__experimentalDefaultControls": { "fontSize": true } From bd59e8b4019a7f4213fc00af2daad88fb4080a5a Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 26 Aug 2022 18:36:55 +0900 Subject: [PATCH 55/68] TextTransformControl/TextDecorationControl: Migrate to ToggleGroupControl (#43328) * Add stories * Replace with ToggleGroupControl * Pass through additional className --- .../text-decoration-control/index.js | 71 +++++++++++-------- .../text-decoration-control/stories/index.js | 37 ++++++++++ .../text-decoration-control/style.scss | 18 ----- .../text-transform-control/index.js | 54 +++++++------- .../text-transform-control/stories/index.js | 37 ++++++++++ .../text-transform-control/style.scss | 18 ----- packages/block-editor/src/style.scss | 2 - 7 files changed, 142 insertions(+), 95 deletions(-) create mode 100644 packages/block-editor/src/components/text-decoration-control/stories/index.js delete mode 100644 packages/block-editor/src/components/text-decoration-control/style.scss create mode 100644 packages/block-editor/src/components/text-transform-control/stories/index.js delete mode 100644 packages/block-editor/src/components/text-transform-control/style.scss diff --git a/packages/block-editor/src/components/text-decoration-control/index.js b/packages/block-editor/src/components/text-decoration-control/index.js index 9edfb9b4a0195c..44635602c947a5 100644 --- a/packages/block-editor/src/components/text-decoration-control/index.js +++ b/packages/block-editor/src/components/text-decoration-control/index.js @@ -1,7 +1,15 @@ +/** + * External dependencies + */ +import classnames from 'classnames'; + /** * WordPress dependencies */ -import { BaseControl, Button } from '@wordpress/components'; +import { + __experimentalToggleGroupControl as ToggleGroupControl, + __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, +} from '@wordpress/components'; import { formatStrikethrough, formatUnderline } from '@wordpress/icons'; import { __ } from '@wordpress/i18n'; @@ -21,38 +29,41 @@ const TEXT_DECORATIONS = [ /** * Control to facilitate text decoration selections. * - * @param {Object} props Component props. - * @param {string} props.value Currently selected text decoration. - * @param {Function} props.onChange Handles change in text decoration selection. + * @param {Object} props Component props. + * @param {string} props.value Currently selected text decoration. + * @param {Function} props.onChange Handles change in text decoration selection. + * @param {string} [props.className] Additional class name to apply. * * @return {WPElement} Text decoration control. */ -export default function TextDecorationControl( { value, onChange } ) { +export default function TextDecorationControl( { + value, + onChange, + className, + ...props +} ) { return ( -
    - - { __( 'Decoration' ) } - -
    - { TEXT_DECORATIONS.map( ( textDecoration ) => { - return ( -
    -
    + + { TEXT_DECORATIONS.map( ( textDecoration ) => { + return ( + + ); + } ) } + ); } diff --git a/packages/block-editor/src/components/text-decoration-control/stories/index.js b/packages/block-editor/src/components/text-decoration-control/stories/index.js new file mode 100644 index 00000000000000..cb50e4cd6c6f73 --- /dev/null +++ b/packages/block-editor/src/components/text-decoration-control/stories/index.js @@ -0,0 +1,37 @@ +/** + * WordPress dependencies + */ +import { useState } from '@wordpress/element'; + +/** + * Internal dependencies + */ +import TextDecorationControl from '../'; + +export default { + title: 'BlockEditor/TextDecorationControl', + component: TextDecorationControl, + argTypes: { + onChange: { action: 'onChange' }, + size: { + options: [ 'default', '__unstable-large' ], + control: { type: 'radio' }, + }, + }, +}; + +const Template = ( { onChange, ...args } ) => { + const [ value, setValue ] = useState(); + return ( + { + onChange( ...changeArgs ); + setValue( ...changeArgs ); + } } + value={ value } + /> + ); +}; + +export const Default = Template.bind( {} ); diff --git a/packages/block-editor/src/components/text-decoration-control/style.scss b/packages/block-editor/src/components/text-decoration-control/style.scss deleted file mode 100644 index f5d5848d3d3034..00000000000000 --- a/packages/block-editor/src/components/text-decoration-control/style.scss +++ /dev/null @@ -1,18 +0,0 @@ -.block-editor-text-decoration-control { - flex: 0 0 50%; - - legend { - margin-bottom: 8px; - } - - .block-editor-text-decoration-control__buttons { - display: inline-flex; - margin-bottom: 24px; - - .components-button.has-icon { - min-width: 24px; - padding: 0; - margin-right: 4px; - } - } -} diff --git a/packages/block-editor/src/components/text-transform-control/index.js b/packages/block-editor/src/components/text-transform-control/index.js index 6d85ae7b421b7a..c71c85993f5ac6 100644 --- a/packages/block-editor/src/components/text-transform-control/index.js +++ b/packages/block-editor/src/components/text-transform-control/index.js @@ -1,7 +1,13 @@ +/** + * External dependencies + */ /** * WordPress dependencies */ -import { BaseControl, Button } from '@wordpress/components'; +import { + __experimentalToggleGroupControl as ToggleGroupControl, + __experimentalToggleGroupControlOptionIcon as ToggleGroupControlOptionIcon, +} from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { formatCapitalize, @@ -36,32 +42,26 @@ const TEXT_TRANSFORMS = [ * * @return {WPElement} Text transform control. */ -export default function TextTransformControl( { value, onChange } ) { +export default function TextTransformControl( { value, onChange, ...props } ) { return ( -
    - - { __( 'Letter case' ) } - -
    - { TEXT_TRANSFORMS.map( ( textTransform ) => { - return ( -
    -
    + + { TEXT_TRANSFORMS.map( ( textTransform ) => { + return ( + + ); + } ) } + ); } diff --git a/packages/block-editor/src/components/text-transform-control/stories/index.js b/packages/block-editor/src/components/text-transform-control/stories/index.js new file mode 100644 index 00000000000000..3219d714257e81 --- /dev/null +++ b/packages/block-editor/src/components/text-transform-control/stories/index.js @@ -0,0 +1,37 @@ +/** + * WordPress dependencies + */ +import { useState } from '@wordpress/element'; + +/** + * Internal dependencies + */ +import TextTransformControl from '../'; + +export default { + title: 'BlockEditor/TextTransformControl', + component: TextTransformControl, + argTypes: { + onChange: { action: 'onChange' }, + size: { + options: [ 'default', '__unstable-large' ], + control: { type: 'radio' }, + }, + }, +}; + +const Template = ( { onChange, ...args } ) => { + const [ value, setValue ] = useState(); + return ( + { + onChange( ...changeArgs ); + setValue( ...changeArgs ); + } } + value={ value } + /> + ); +}; + +export const Default = Template.bind( {} ); diff --git a/packages/block-editor/src/components/text-transform-control/style.scss b/packages/block-editor/src/components/text-transform-control/style.scss deleted file mode 100644 index 09280029a971aa..00000000000000 --- a/packages/block-editor/src/components/text-transform-control/style.scss +++ /dev/null @@ -1,18 +0,0 @@ -.block-editor-text-transform-control { - flex: 0 0 50%; - - legend { - margin-bottom: 8px; - } - - .block-editor-text-transform-control__buttons { - display: inline-flex; - margin-bottom: 24px; - - .components-button.has-icon { - min-width: 24px; - padding: 0; - margin-right: 4px; - } - } -} diff --git a/packages/block-editor/src/style.scss b/packages/block-editor/src/style.scss index 614f611cec2aff..b2c08654ebea64 100644 --- a/packages/block-editor/src/style.scss +++ b/packages/block-editor/src/style.scss @@ -46,8 +46,6 @@ @import "./components/responsive-block-control/style.scss"; @import "./components/rich-text/style.scss"; @import "./components/skip-to-selected-block/style.scss"; -@import "./components/text-transform-control/style.scss"; -@import "./components/text-decoration-control/style.scss"; @import "./components/tool-selector/style.scss"; @import "./components/url-input/style.scss"; @import "./components/url-popover/style.scss"; From 9d1d8e3e6ef956a5f2aa9d5863f535c7f55862a6 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 26 Aug 2022 18:43:34 +0900 Subject: [PATCH 56/68] ColorPalette: Make popover style consistent (#43570) * ColorPalette: Make popover style consistent * Update snapshot --- packages/components/CHANGELOG.md | 1 + packages/components/src/color-palette/index.js | 13 ++++++++----- packages/components/src/color-palette/style.scss | 14 -------------- .../test/__snapshots__/index.js.snap | 15 +++++++++++---- 4 files changed, 20 insertions(+), 23 deletions(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 7d3fd67a4984ff..7cf9447186b3e1 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -30,6 +30,7 @@ - `CustomGradientPicker`, `GradientPicker`: Add `__nextHasNoMargin` prop for opting into the new margin-free styles ([#43387](https://github.com/WordPress/gutenberg/pull/43387)). - `ToolsPanel`: Tighten grid gaps ([#43424](https://github.com/WordPress/gutenberg/pull/43424)). +- `ColorPalette`: Make popover style consistent ([#43570](https://github.com/WordPress/gutenberg/pull/43570)). - `ToggleGroupControl`: Improve TypeScript documentation ([#43265](https://github.com/WordPress/gutenberg/pull/43265)). - `ComboboxControl`: Normalize hyphen-like characters to an ASCII hyphen ([#42942](https://github.com/WordPress/gutenberg/pull/42942)). - `FormTokenField`: Refactor away from `_.difference()` ([#43224](https://github.com/WordPress/gutenberg/pull/43224/)). diff --git a/packages/components/src/color-palette/index.js b/packages/components/src/color-palette/index.js index 4d4f3e8bdd5b97..29691a3c63ee94 100644 --- a/packages/components/src/color-palette/index.js +++ b/packages/components/src/color-palette/index.js @@ -22,6 +22,7 @@ import { VStack } from '../v-stack'; import { Flex, FlexItem } from '../flex'; import { Truncate } from '../truncate'; import { ColorHeading } from './styles'; +import DropdownContentWrapper from '../dropdown/dropdown-content-wrapper'; extend( [ namesPlugin, a11yPlugin ] ); @@ -202,11 +203,13 @@ export default function ColorPalette( { const Component = showMultiplePalettes ? MultiplePalettes : SinglePalette; const renderCustomColorPicker = () => ( - onChange( color ) } - enableAlpha={ enableAlpha } - /> + + onChange( color ) } + enableAlpha={ enableAlpha } + /> + ); const colordColor = colord( value ); diff --git a/packages/components/src/color-palette/style.scss b/packages/components/src/color-palette/style.scss index 6e453236b96faa..1ede67de8d6542 100644 --- a/packages/components/src/color-palette/style.scss +++ b/packages/components/src/color-palette/style.scss @@ -31,20 +31,6 @@ } } -.components-dropdown__content.components-color-palette__custom-color-dropdown-content .components-popover__content { - overflow: visible; - box-shadow: 0 4px 4px rgba(0, 0, 0, 0.05); - border: none; - outline: none; - border-radius: $radius-block-ui; - padding: 0; - - .react-colorful__saturation { - border-top-right-radius: $radius-block-ui; - border-top-left-radius: $radius-block-ui; - } -} - .components-color-palette__custom-color-name { text-align: left; } diff --git a/packages/components/src/color-palette/test/__snapshots__/index.js.snap b/packages/components/src/color-palette/test/__snapshots__/index.js.snap index 9c79cdef246d53..30084daf47d7d5 100644 --- a/packages/components/src/color-palette/test/__snapshots__/index.js.snap +++ b/packages/components/src/color-palette/test/__snapshots__/index.js.snap @@ -1,10 +1,17 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`ColorPalette Dropdown .renderContent should render dropdown content 1`] = ` - + + + `; exports[`ColorPalette Dropdown .renderToggle should render dropdown content 1`] = ` From 2bd0e9ecf2248129ecec88fdf85514d74c4d1b8e Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 26 Aug 2022 20:00:17 +0900 Subject: [PATCH 57/68] Upsize typography tools (#43331) * Replace with ToggleGroupControl * Fixup label height * Upsize components in Typography tools * Add changelog * Update snapshot --- .../block-editor/src/hooks/font-appearance.js | 1 + .../block-editor/src/hooks/font-family.js | 2 + packages/block-editor/src/hooks/font-size.js | 2 + .../block-editor/src/hooks/letter-spacing.js | 1 + .../block-editor/src/hooks/line-height.js | 1 + .../block-editor/src/hooks/text-decoration.js | 1 + .../block-editor/src/hooks/text-transform.js | 1 + .../block-editor/src/hooks/typography.scss | 6 - packages/components/CHANGELOG.md | 1 + .../test/__snapshots__/index.tsx.snap | 106 ++++++++++-------- .../toggle-group-control/component.tsx | 5 +- .../toggle-group-control/styles.ts | 5 + 12 files changed, 80 insertions(+), 52 deletions(-) diff --git a/packages/block-editor/src/hooks/font-appearance.js b/packages/block-editor/src/hooks/font-appearance.js index b398ef58dc28c4..af25daed0d30b5 100644 --- a/packages/block-editor/src/hooks/font-appearance.js +++ b/packages/block-editor/src/hooks/font-appearance.js @@ -58,6 +58,7 @@ export function FontAppearanceEdit( props ) { hasFontStyles={ hasFontStyles } hasFontWeights={ hasFontWeights } value={ { fontStyle, fontWeight } } + size="__unstable-large" /> ); } diff --git a/packages/block-editor/src/hooks/font-family.js b/packages/block-editor/src/hooks/font-family.js index 12c36eac6882b0..fe8693f64421bf 100644 --- a/packages/block-editor/src/hooks/font-family.js +++ b/packages/block-editor/src/hooks/font-family.js @@ -132,6 +132,8 @@ export function FontFamilyEdit( { fontFamilies={ fontFamilies } value={ value } onChange={ onChange } + size="__unstable-large" + __nextHasNoMarginBottom /> ); } diff --git a/packages/block-editor/src/hooks/font-size.js b/packages/block-editor/src/hooks/font-size.js index f0b7315d02330e..40abdd8f8eb302 100644 --- a/packages/block-editor/src/hooks/font-size.js +++ b/packages/block-editor/src/hooks/font-size.js @@ -147,6 +147,8 @@ export function FontSizeEdit( props ) { onChange={ onChange } value={ fontSizeValue } withReset={ false } + size="__unstable-large" + __nextHasNoMarginBottom /> ); } diff --git a/packages/block-editor/src/hooks/letter-spacing.js b/packages/block-editor/src/hooks/letter-spacing.js index 3dc0d82b7b9a7a..9e214fd07d792c 100644 --- a/packages/block-editor/src/hooks/letter-spacing.js +++ b/packages/block-editor/src/hooks/letter-spacing.js @@ -46,6 +46,7 @@ export function LetterSpacingEdit( props ) { value={ style?.typography?.letterSpacing } onChange={ onChange } __unstableInputWidth={ '100%' } + size="__unstable-large" /> ); } diff --git a/packages/block-editor/src/hooks/line-height.js b/packages/block-editor/src/hooks/line-height.js index 7f4c2d5a4aa01b..c8397d850a1e55 100644 --- a/packages/block-editor/src/hooks/line-height.js +++ b/packages/block-editor/src/hooks/line-height.js @@ -42,6 +42,7 @@ export function LineHeightEdit( props ) { __nextHasNoMarginBottom={ true } value={ style?.typography?.lineHeight } onChange={ onChange } + size="__unstable-large" /> ); } diff --git a/packages/block-editor/src/hooks/text-decoration.js b/packages/block-editor/src/hooks/text-decoration.js index 65f0aadf77d1e1..17ba9ee73f698f 100644 --- a/packages/block-editor/src/hooks/text-decoration.js +++ b/packages/block-editor/src/hooks/text-decoration.js @@ -46,6 +46,7 @@ export function TextDecorationEdit( props ) { ); } diff --git a/packages/block-editor/src/hooks/text-transform.js b/packages/block-editor/src/hooks/text-transform.js index b2710b5f654b59..588327633ecb8a 100644 --- a/packages/block-editor/src/hooks/text-transform.js +++ b/packages/block-editor/src/hooks/text-transform.js @@ -46,6 +46,7 @@ export function TextTransformEdit( props ) { ); } diff --git a/packages/block-editor/src/hooks/typography.scss b/packages/block-editor/src/hooks/typography.scss index 7d7d44c24b4e2a..ea939116dfba3c 100644 --- a/packages/block-editor/src/hooks/typography.scss +++ b/packages/block-editor/src/hooks/typography.scss @@ -1,10 +1,4 @@ .typography-block-support-panel { - .components-font-size-picker__controls, - .block-editor-text-decoration-control__buttons, - .block-editor-text-transform-control__buttons { - margin-bottom: 0; - } - .single-column { grid-column: span 1; } diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 7cf9447186b3e1..b8000b2772d714 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -18,6 +18,7 @@ - `AlignmentMatrixControl`: keep the physical direction in RTL languages ([#43126](https://github.com/WordPress/gutenberg/pull/43126)). - `AlignmentMatrixControl`: Fix the `width` prop so it works as intended ([#43482](https://github.com/WordPress/gutenberg/pull/43482)). - `SelectControl`, `CustomSelectControl`: Truncate long option strings ([#43301](https://github.com/WordPress/gutenberg/pull/43301)). +- `ToggleGroupControl`: Fix minor inconsistency in label height ([#43331](https://github.com/WordPress/gutenberg/pull/43331)). - `Popover`: fix and improve opening animation ([#43186](https://github.com/WordPress/gutenberg/pull/43186)). - `Popover`: fix incorrect deps in hooks resulting in incorrect positioning after calling `update` ([#43267](https://github.com/WordPress/gutenberg/pull/43267/)). - `FontSizePicker`: Fix excessive margin between label and input ([#43304](https://github.com/WordPress/gutenberg/pull/43304)). diff --git a/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap b/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap index 2ce03affa087fd..519a7702985ce1 100644 --- a/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap +++ b/packages/components/src/toggle-group-control/test/__snapshots__/index.tsx.snap @@ -22,6 +22,13 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` } .emotion-4 { + display: -webkit-box; + display: -webkit-flex; + display: -ms-flexbox; + display: flex; +} + +.emotion-6 { font-size: 11px; font-weight: 500; line-height: 1.4; @@ -31,7 +38,7 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` padding: 0; } -.emotion-6 { +.emotion-8 { background: #fff; border: 1px solid transparent; border-radius: 2px; @@ -49,23 +56,23 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` } @media ( prefers-reduced-motion: reduce ) { - .emotion-6 { + .emotion-8 { transition-duration: 0ms; } } -.emotion-6:focus-within { +.emotion-8:focus-within { border-color: var( --wp-admin-theme-color-darker-10, #006ba1); box-shadow: 0 0 0 0.5px var( --wp-admin-theme-color, #007cba); outline: none; z-index: 1; } -.emotion-6:hover { +.emotion-8:hover { border-color: #757575; } -.emotion-8 { +.emotion-10 { background: #1e1e1e; border-radius: 2px; box-shadow: transparent; @@ -79,12 +86,12 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` } @media ( prefers-reduced-motion: reduce ) { - .emotion-8 { + .emotion-10 { transition-duration: 0ms; } } -.emotion-10 { +.emotion-12 { display: -webkit-inline-box; display: -webkit-inline-flex; display: -ms-inline-flexbox; @@ -97,7 +104,7 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` flex: 1; } -.emotion-12 { +.emotion-14 { -webkit-align-items: center; -webkit-box-align: center; -ms-flex-align: center; @@ -138,34 +145,34 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = ` } @media ( prefers-reduced-motion: reduce ) { - .emotion-12 { + .emotion-14 { transition-duration: 0ms; } } -.emotion-12::-moz-focus-inner { +.emotion-14::-moz-focus-inner { border: 0; } -.emotion-12:active { +.emotion-14:active { background: #fff; } -.emotion-13 { +.emotion-15 { width: 30px; padding-left: 0; padding-right: 0; } -.emotion-14 { +.emotion-16 { color: #fff; } -.emotion-14:active { +.emotion-16:active { background: transparent; } -.emotion-15 { +.emotion-17 { font-size: 13px; line-height: 1; } @@ -176,16 +183,18 @@ exports[`ToggleGroupControl should render correctly with icons 1`] = `
    -
    +
    Test Toggle Group Control