From ff19d8abfea5b4872b46d37feaf1b01a6982b899 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Fri, 10 Feb 2023 14:20:47 +0000 Subject: [PATCH 01/76] Navigation: Add warning test (#45207) * give the test a proper name * use role instead of class name for locating the element * fix syntax error * Update test/e2e/specs/editor/blocks/navigation.spec.js Co-authored-by: Kai Hao --------- Co-authored-by: Kai Hao --- .../specs/editor/blocks/navigation.spec.js | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/test/e2e/specs/editor/blocks/navigation.spec.js b/test/e2e/specs/editor/blocks/navigation.spec.js index c362e23a36b83..9b4ad7123bcbb 100644 --- a/test/e2e/specs/editor/blocks/navigation.spec.js +++ b/test/e2e/specs/editor/blocks/navigation.spec.js @@ -146,3 +146,43 @@ class NavigationBlockUtils { ); } } + +test.describe( 'Navigation block', () => { + test.describe( + 'As a user I want to see a warning if the menu referenced by a navigation block is not available', + () => { + test.beforeEach( async ( { admin } ) => { + await admin.createNewPost(); + } ); + + test( 'warning message shows when given an unknown ref', async ( { + editor, + } ) => { + await editor.insertBlock( { + name: 'core/navigation', + attributes: { + ref: 1, + }, + } ); + + // Check the markup of the block is correct. + await editor.publishPost(); + + await expect.poll( editor.getBlocks ).toMatchObject( [ + { + name: 'core/navigation', + attributes: { ref: 1 }, + }, + ] ); + + // Find the warning message + const warningMessage = editor.canvas + .getByRole( 'document', { name: 'Block: Navigation' } ) + .getByText( + 'Navigation menu has been deleted or is unavailable.' + ); + await expect( warningMessage ).toBeVisible(); + } ); + } + ); +} ); From e43d6500c2768ff7906ffc3d23dd7272e0baf765 Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Fri, 10 Feb 2023 23:27:10 +0800 Subject: [PATCH 02/76] Fix clicking on the toggle button not closing the block inserter (#47926) * Fix unable to close the block inserter when clicking on the toggle button * Fix inserter toggle in site editor --- .../src/editor/get-blocks.ts | 15 ++++++++--- .../components/header/header-toolbar/index.js | 9 ++++--- .../src/components/header-edit-mode/index.js | 9 ++++--- .../editor/various/inserting-blocks.spec.js | 25 +++++++++++++++++ .../site-editor/site-editor-inserter.spec.js | 27 +++++++++++++++++++ 5 files changed, 76 insertions(+), 9 deletions(-) diff --git a/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts b/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts index 59d52e6c151c3..dba597a19c983 100644 --- a/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts +++ b/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts @@ -12,10 +12,19 @@ import type { Editor } from './index'; */ export async function getBlocks( this: Editor ) { return await this.page.evaluate( () => { + const blocks = window.wp.data.select( 'core/block-editor' ).getBlocks(); + // The editor might still contain an unmodified empty block even when it's technically "empty". - if ( window.wp.data.select( 'core/editor' ).isEditedPostEmpty() ) { - return []; + if ( blocks.length === 1 ) { + const blockName = blocks[ 0 ].name; + if ( + blockName === window.wp.blocks.getDefaultBlockName() || + blockName === window.wp.blocks.getFreeformContentHandlerName() + ) { + return []; + } } - return window.wp.data.select( 'core/block-editor' ).getBlocks(); + + return blocks; } ); } diff --git a/packages/edit-post/src/components/header/header-toolbar/index.js b/packages/edit-post/src/components/header/header-toolbar/index.js index b4d30adc20244..55ffd265a96cf 100644 --- a/packages/edit-post/src/components/header/header-toolbar/index.js +++ b/packages/edit-post/src/components/header/header-toolbar/index.js @@ -91,10 +91,13 @@ function HeaderToolbar() { /> ); - const openInserter = useCallback( () => { + const toggleInserter = useCallback( () => { if ( isInserterOpened ) { - // Focusing the inserter button closes the inserter popover. + // Focusing the inserter button should close the inserter popover. + // However, there are some cases it won't close when the focus is lost. + // See https://github.com/WordPress/gutenberg/issues/43090 for more details. inserterButton.current.focus(); + setIsInserterOpened( false ); } else { setIsInserterOpened( true ); } @@ -120,7 +123,7 @@ function HeaderToolbar() { variant="primary" isPressed={ isInserterOpened } onMouseDown={ preventDefault } - onClick={ openInserter } + onClick={ toggleInserter } disabled={ ! isInserterEnabled } icon={ plus } label={ showIconLabels ? shortLabel : longLabel } diff --git a/packages/edit-site/src/components/header-edit-mode/index.js b/packages/edit-site/src/components/header-edit-mode/index.js index 8c104ddd3f9b2..448682100092d 100644 --- a/packages/edit-site/src/components/header-edit-mode/index.js +++ b/packages/edit-site/src/components/header-edit-mode/index.js @@ -100,10 +100,13 @@ export default function HeaderEditMode() { const isLargeViewport = useViewportMatch( 'medium' ); - const openInserter = useCallback( () => { + const toggleInserter = useCallback( () => { if ( isInserterOpen ) { - // Focusing the inserter button closes the inserter popover. + // Focusing the inserter button should close the inserter popover. + // However, there are some cases it won't close when the focus is lost. + // See https://github.com/WordPress/gutenberg/issues/43090 for more details. inserterButton.current.focus(); + setIsInserterOpened( false ); } else { setIsInserterOpened( true ); } @@ -148,7 +151,7 @@ export default function HeaderEditMode() { variant="primary" isPressed={ isInserterOpen } onMouseDown={ preventDefault } - onClick={ openInserter } + onClick={ toggleInserter } disabled={ ! isVisualMode } icon={ plus } label={ showIconLabels ? shortLabel : longLabel } diff --git a/test/e2e/specs/editor/various/inserting-blocks.spec.js b/test/e2e/specs/editor/various/inserting-blocks.spec.js index fdc4615f197aa..a0d042c06d6a0 100644 --- a/test/e2e/specs/editor/various/inserting-blocks.spec.js +++ b/test/e2e/specs/editor/various/inserting-blocks.spec.js @@ -289,6 +289,31 @@ test.describe( 'Inserting blocks (@firefox, @webkit)', () => { await expect.poll( editor.getEditedPostContent ).toBe( beforeContent ); } ); + + // A test for https://github.com/WordPress/gutenberg/issues/43090. + test( 'should close the inserter when clicking on the toggle button', async ( { + page, + editor, + } ) => { + const inserterButton = page.getByRole( 'button', { + name: 'Toggle block inserter', + } ); + const blockLibrary = page.getByRole( 'region', { + name: 'Block Library', + } ); + + await inserterButton.click(); + + await blockLibrary.getByRole( 'option', { name: 'Buttons' } ).click(); + + await expect + .poll( editor.getBlocks ) + .toMatchObject( [ { name: 'core/buttons' } ] ); + + await inserterButton.click(); + + await expect( blockLibrary ).toBeHidden(); + } ); } ); test.describe( 'insert media from inserter', () => { diff --git a/test/e2e/specs/site-editor/site-editor-inserter.spec.js b/test/e2e/specs/site-editor/site-editor-inserter.spec.js index 2dc8002b03089..d3dfedc9bde71 100644 --- a/test/e2e/specs/site-editor/site-editor-inserter.spec.js +++ b/test/e2e/specs/site-editor/site-editor-inserter.spec.js @@ -40,4 +40,31 @@ test.describe( 'Site Editor Inserter', () => { ) ).toBeHidden(); } ); + + // A test for https://github.com/WordPress/gutenberg/issues/43090. + test( 'should close the inserter when clicking on the toggle button', async ( { + page, + editor, + } ) => { + const inserterButton = page.getByRole( 'button', { + name: 'Toggle block inserter', + } ); + const blockLibrary = page.getByRole( 'region', { + name: 'Block Library', + } ); + + const beforeBlocks = await editor.getBlocks(); + + await inserterButton.click(); + await blockLibrary.getByRole( 'tab', { name: 'Blocks' } ).click(); + await blockLibrary.getByRole( 'option', { name: 'Buttons' } ).click(); + + await expect + .poll( editor.getBlocks ) + .toMatchObject( [ ...beforeBlocks, { name: 'core/buttons' } ] ); + + await inserterButton.click(); + + await expect( blockLibrary ).toBeHidden(); + } ); } ); From 91cba54e9620f83ee24944d70b16847af0e204a4 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Sat, 11 Feb 2023 01:01:14 +0900 Subject: [PATCH 03/76] SelectControl: Fix `multiple` prop styling (#47893) * SelectControl: Fix `multiple` prop styling * Update readme * Add changelog * Refactor padding code * Add comment * Allow overflow scrolling when `multiple` * Update snapshot --- packages/components/CHANGELOG.md | 4 ++ .../test/__snapshots__/index.test.js.snap | 8 +-- .../components/src/select-control/README.md | 4 +- .../components/src/select-control/index.tsx | 4 +- .../components/src/select-control/style.scss | 10 ---- .../styles/select-control-styles.ts | 58 ++++++++++++------- .../components/src/select-control/types.ts | 4 +- 7 files changed, 53 insertions(+), 39 deletions(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index cacd30b6d28af..d7e78770b56c0 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Bug Fix + +- `SelectControl`: Fix styling when `multiple` prop is enabled ([#47893](https://github.com/WordPress/gutenberg/pull/43213)). + ### Enhancements - `ColorPalette`, `GradientPicker`, `PaletteEdit`, `ToolsPanel`: add new props to set a custom heading level ([43848](https://github.com/WordPress/gutenberg/pull/43848) and [#47788](https://github.com/WordPress/gutenberg/pull/47788)). diff --git a/packages/components/src/dimension-control/test/__snapshots__/index.test.js.snap b/packages/components/src/dimension-control/test/__snapshots__/index.test.js.snap index 56e9a4ffffe6d..8edf2a4875e52 100644 --- a/packages/components/src/dimension-control/test/__snapshots__/index.test.js.snap +++ b/packages/components/src/dimension-control/test/__snapshots__/index.test.js.snap @@ -116,7 +116,6 @@ exports[`DimensionControl rendering renders with custom sizes 1`] = ` width: 100%; max-width: none; cursor: pointer; - overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 16px; @@ -126,6 +125,7 @@ exports[`DimensionControl rendering renders with custom sizes 1`] = ` padding-bottom: 0; padding-left: 8px; padding-right: 26px; + overflow: hidden; } @media ( min-width: 600px ) { @@ -387,7 +387,6 @@ exports[`DimensionControl rendering renders with defaults 1`] = ` width: 100%; max-width: none; cursor: pointer; - overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 16px; @@ -397,6 +396,7 @@ exports[`DimensionControl rendering renders with defaults 1`] = ` padding-bottom: 0; padding-left: 8px; padding-right: 26px; + overflow: hidden; } @media ( min-width: 600px ) { @@ -668,7 +668,6 @@ exports[`DimensionControl rendering renders with icon and custom icon label 1`] width: 100%; max-width: none; cursor: pointer; - overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 16px; @@ -678,6 +677,7 @@ exports[`DimensionControl rendering renders with icon and custom icon label 1`] padding-bottom: 0; padding-left: 8px; padding-right: 26px; + overflow: hidden; } @media ( min-width: 600px ) { @@ -961,7 +961,6 @@ exports[`DimensionControl rendering renders with icon and default icon label 1`] width: 100%; max-width: none; cursor: pointer; - overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 16px; @@ -971,6 +970,7 @@ exports[`DimensionControl rendering renders with icon and default icon label 1`] padding-bottom: 0; padding-left: 8px; padding-right: 26px; + overflow: hidden; } @media ( min-width: 600px ) { diff --git a/packages/components/src/select-control/README.md b/packages/components/src/select-control/README.md index 1d96f2ba92b76..dc6e884a5e12b 100644 --- a/packages/components/src/select-control/README.md +++ b/packages/components/src/select-control/README.md @@ -187,7 +187,9 @@ If this property is added, a help text will be generated using help property as #### multiple -If this property is added, multiple values can be selected. The value passed should be an array. +If this property is added, multiple values can be selected. The `value` passed should be an array. + +In most cases, it is preferable to use the `FormTokenField` or `CheckboxControl` components instead. - Type: `Boolean` - Required: No diff --git a/packages/components/src/select-control/index.tsx b/packages/components/src/select-control/index.tsx index 2abd647388cf2..75569dac80a16 100644 --- a/packages/components/src/select-control/index.tsx +++ b/packages/components/src/select-control/index.tsx @@ -101,7 +101,9 @@ function UnforwardedSelectControl( isFocused={ isFocused } label={ label } size={ size } - suffix={ suffix || } + suffix={ + suffix || ( ! multiple && ) + } prefix={ prefix } labelPosition={ labelPosition } __next36pxDefaultSize={ __next36pxDefaultSize } diff --git a/packages/components/src/select-control/style.scss b/packages/components/src/select-control/style.scss index b59fa2160b952..1558314af554f 100644 --- a/packages/components/src/select-control/style.scss +++ b/packages/components/src/select-control/style.scss @@ -1,16 +1,6 @@ .components-select-control__input { - background: $white; - height: 36px; - line-height: 36px; - margin: 1px; outline: 0; - width: 100%; -webkit-tap-highlight-color: rgba(0, 0, 0, 0) !important; - - @include break-medium() { - height: 28px; - line-height: 28px; - } } @media (max-width: #{ ($break-medium) }) { diff --git a/packages/components/src/select-control/styles/select-control-styles.ts b/packages/components/src/select-control/styles/select-control-styles.ts index e0976c9f50769..2374015d747fa 100644 --- a/packages/components/src/select-control/styles/select-control-styles.ts +++ b/packages/components/src/select-control/styles/select-control-styles.ts @@ -13,7 +13,10 @@ import type { SelectControlProps } from '../types'; import InputControlSuffixWrapper from '../../input-control/input-suffix-wrapper'; interface SelectProps - extends Pick< SelectControlProps, '__next36pxDefaultSize' | 'disabled' > { + extends Pick< + SelectControlProps, + '__next36pxDefaultSize' | 'disabled' | 'multiple' + > { // Using `selectSize` instead of `size` to avoid a type conflict with the // `size` HTML attribute of the `select` element. selectSize?: SelectControlProps[ 'size' ]; @@ -50,8 +53,15 @@ const fontSizeStyles = ( { selectSize = 'default' }: SelectProps ) => { const sizeStyles = ( { __next36pxDefaultSize, + multiple, selectSize = 'default', }: SelectProps ) => { + if ( multiple ) { + // When `multiple`, just use the native browser styles + // without setting explicit height. + return; + } + const sizes = { default: { height: 36, @@ -91,33 +101,37 @@ export const chevronIconSize = 18; const sizePaddings = ( { __next36pxDefaultSize, + multiple, selectSize = 'default', }: SelectProps ) => { - const iconWidth = chevronIconSize; - - const sizes = { - default: { - paddingLeft: 16, - paddingRight: 16 + iconWidth, - }, - small: { - paddingLeft: 8, - paddingRight: 8 + iconWidth, - }, - '__unstable-large': { - paddingLeft: 16, - paddingRight: 16 + iconWidth, - }, + const padding = { + default: 16, + small: 8, + '__unstable-large': 16, }; if ( ! __next36pxDefaultSize ) { - sizes.default = { - paddingLeft: 8, - paddingRight: 8 + iconWidth, - }; + padding.default = 8; } - return rtl( sizes[ selectSize ] || sizes.default ); + const selectedPadding = padding[ selectSize ] || padding.default; + + return rtl( { + paddingLeft: selectedPadding, + paddingRight: selectedPadding + chevronIconSize, + ...( multiple + ? { + paddingTop: selectedPadding, + paddingBottom: selectedPadding, + } + : {} ), + } ); +}; + +const overflowStyles = ( { multiple }: SelectProps ) => { + return { + overflow: multiple ? 'auto' : 'hidden', + }; }; // TODO: Resolve need to use &&& to increase specificity @@ -137,7 +151,6 @@ export const Select = styled.select< SelectProps >` width: 100%; max-width: none; cursor: pointer; - overflow: hidden; white-space: nowrap; text-overflow: ellipsis; @@ -145,6 +158,7 @@ export const Select = styled.select< SelectProps >` ${ fontSizeStyles }; ${ sizeStyles }; ${ sizePaddings }; + ${ overflowStyles } } `; diff --git a/packages/components/src/select-control/types.ts b/packages/components/src/select-control/types.ts index 6126ba5043d6c..2b8d187d4031e 100644 --- a/packages/components/src/select-control/types.ts +++ b/packages/components/src/select-control/types.ts @@ -23,7 +23,9 @@ export interface SelectControlProps >, Pick< BaseControlProps, 'help' | '__nextHasNoMarginBottom' > { /** - * If this property is added, multiple values can be selected. The value passed should be an array. + * If this property is added, multiple values can be selected. The `value` passed should be an array. + * + * In most cases, it is preferable to use the `FormTokenField` or `CheckboxControl` components instead. * * @default false */ From bb61b4cead996c456a6e4d85e79cc97f52af76f3 Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Fri, 10 Feb 2023 17:26:11 +0000 Subject: [PATCH 04/76] Do not run explode / implode if no comma is in the string. (#47833) --- lib/class-wp-theme-json-gutenberg.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/class-wp-theme-json-gutenberg.php b/lib/class-wp-theme-json-gutenberg.php index 02ace2860990e..1264f2c79c927 100644 --- a/lib/class-wp-theme-json-gutenberg.php +++ b/lib/class-wp-theme-json-gutenberg.php @@ -785,6 +785,9 @@ protected static function sanitize( $input, $valid_block_names, $valid_element_n * @return string The new selector. */ protected static function append_to_selector( $selector, $to_append, $position = 'right' ) { + if ( ! str_contains( ',', $selector ) ) { + return 'right' === $position ? $selector . $to_append : $to_append . $selector; + } $new_selectors = array(); $selectors = explode( ',', $selector ); foreach ( $selectors as $sel ) { From fab70c5058c3462a18f4c3dc72bf3651379295f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Gomes?= Date: Fri, 10 Feb 2023 17:29:18 +0000 Subject: [PATCH 05/76] E2E perf tests: run each test in a separate page (#47889) * E2E perf tests: run each test in a separate page * Throw away 1st measurement to avoid caching quirks * Move page closing to `beforeEach` * Move metric collection inside conditional * Revert "Move page closing to `beforeEach`" This reverts commit 2b092e2179d03c30954c5f5eec1eff74f9ee6840. --- .../config/setup-performance-test.js | 21 ++-- .../specs/performance/post-editor.test.js | 47 +++++--- .../specs/performance/site-editor.test.js | 111 +++++++++++------- 3 files changed, 114 insertions(+), 65 deletions(-) diff --git a/packages/e2e-tests/config/setup-performance-test.js b/packages/e2e-tests/config/setup-performance-test.js index 172699035571e..384a88b8a3f2d 100644 --- a/packages/e2e-tests/config/setup-performance-test.js +++ b/packages/e2e-tests/config/setup-performance-test.js @@ -19,9 +19,11 @@ const PUPPETEER_TIMEOUT = process.env.PUPPETEER_TIMEOUT; // The Jest timeout is increased because these tests are a bit slow. jest.setTimeout( PUPPETEER_TIMEOUT || 100000 ); -async function setupBrowser() { - await clearLocalStorage(); +async function setupPage() { await setBrowserViewport( 'large' ); + await page.emulateMediaFeatures( [ + { name: 'prefers-reduced-motion', value: 'reduce' }, + ] ); } // Before every test suite run, delete all content created by the test. This ensures @@ -32,13 +34,18 @@ beforeAll( async () => { await trashAllPosts(); await trashAllPosts( 'wp_block' ); - await setupBrowser(); + await clearLocalStorage(); + await setupPage(); await activatePlugin( 'gutenberg-test-plugin-disables-the-css-animations' ); - await page.emulateMediaFeatures( [ - { name: 'prefers-reduced-motion', value: 'reduce' }, - ] ); } ); afterEach( async () => { - await setupBrowser(); + // Clear localStorage between tests so that the next test starts clean. + await clearLocalStorage(); + // Close the previous page entirely and create a new page, so that the next test + // isn't affected by page unload work. + await page.close(); + page = await browser.newPage(); + // Set up testing config on new page. + await setupPage(); } ); diff --git a/packages/e2e-tests/specs/performance/post-editor.test.js b/packages/e2e-tests/specs/performance/post-editor.test.js index 10699f921be51..597f4f36cd9a3 100644 --- a/packages/e2e-tests/specs/performance/post-editor.test.js +++ b/packages/e2e-tests/specs/performance/post-editor.test.js @@ -105,28 +105,43 @@ describe( 'Post Editor Performance', () => { readFile( join( __dirname, '../../assets/large-post.html' ) ) ); await saveDraft(); - let i = 5; + const draftURL = await page.url(); + + // Number of sample measurements to take. + const samples = 5; + // Number of throwaway measurements to perform before recording samples. + // Having at least one helps ensure that caching quirks don't manifest in + // the results. + const throwaway = 1; + + let i = throwaway + samples; while ( i-- ) { - await page.reload(); + await page.close(); + page = await browser.newPage(); + + await page.goto( draftURL ); await page.waitForSelector( '.edit-post-layout', { timeout: 120000, } ); await canvas().waitForSelector( '.wp-block', { timeout: 120000 } ); - const { - serverResponse, - firstPaint, - domContentLoaded, - loaded, - firstContentfulPaint, - firstBlock, - } = await getLoadingDurations(); - results.serverResponse.push( serverResponse ); - results.firstPaint.push( firstPaint ); - results.domContentLoaded.push( domContentLoaded ); - results.loaded.push( loaded ); - results.firstContentfulPaint.push( firstContentfulPaint ); - results.firstBlock.push( firstBlock ); + if ( i < samples ) { + const { + serverResponse, + firstPaint, + domContentLoaded, + loaded, + firstContentfulPaint, + firstBlock, + } = await getLoadingDurations(); + + results.serverResponse.push( serverResponse ); + results.firstPaint.push( firstPaint ); + results.domContentLoaded.push( domContentLoaded ); + results.loaded.push( loaded ); + results.firstContentfulPaint.push( firstContentfulPaint ); + results.firstBlock.push( firstBlock ); + } } } ); diff --git a/packages/e2e-tests/specs/performance/site-editor.test.js b/packages/e2e-tests/specs/performance/site-editor.test.js index e3a2ef86c6932..cd071f0be5a85 100644 --- a/packages/e2e-tests/specs/performance/site-editor.test.js +++ b/packages/e2e-tests/specs/performance/site-editor.test.js @@ -30,34 +30,29 @@ import { jest.setTimeout( 1000000 ); +const results = { + serverResponse: [], + firstPaint: [], + domContentLoaded: [], + loaded: [], + firstContentfulPaint: [], + firstBlock: [], + type: [], + typeContainer: [], + focus: [], + inserterOpen: [], + inserterHover: [], + inserterSearch: [], + listViewOpen: [], +}; + +let id; + describe( 'Site Editor Performance', () => { beforeAll( async () => { await activateTheme( 'emptytheme' ); await deleteAllTemplates( 'wp_template' ); await deleteAllTemplates( 'wp_template_part' ); - } ); - afterAll( async () => { - await deleteAllTemplates( 'wp_template' ); - await deleteAllTemplates( 'wp_template_part' ); - await activateTheme( 'twentytwentyone' ); - } ); - - it( 'Loading', async () => { - const results = { - serverResponse: [], - firstPaint: [], - domContentLoaded: [], - loaded: [], - firstContentfulPaint: [], - firstBlock: [], - type: [], - typeContainer: [], - focus: [], - inserterOpen: [], - inserterHover: [], - inserterSearch: [], - listViewOpen: [], - }; const html = readFile( join( __dirname, '../../assets/large-post.html' ) @@ -80,37 +75,69 @@ describe( 'Site Editor Performance', () => { }, html ); await saveDraft(); - const id = await page.evaluate( () => + id = await page.evaluate( () => new URL( document.location ).searchParams.get( 'post' ) ); + } ); + afterAll( async () => { + await deleteAllTemplates( 'wp_template' ); + await deleteAllTemplates( 'wp_template_part' ); + await activateTheme( 'twentytwentyone' ); + } ); + + beforeEach( async () => { await visitSiteEditor( { postId: id, postType: 'page' } ); + } ); + + it( 'Loading', async () => { + const editorURL = await page.url(); - let i = 3; + // Number of sample measurements to take. + const samples = 3; + // Number of throwaway measurements to perform before recording samples. + // Having at least one helps ensure that caching quirks don't manifest in + // the results. + const throwaway = 1; + + let i = throwaway + samples; // Measuring loading time. while ( i-- ) { - await page.reload(); + await page.close(); + page = await browser.newPage(); + + await page.goto( editorURL ); await page.waitForSelector( '.edit-site-visual-editor', { timeout: 120000, } ); await canvas().waitForSelector( '.wp-block', { timeout: 120000 } ); - const { - serverResponse, - firstPaint, - domContentLoaded, - loaded, - firstContentfulPaint, - firstBlock, - } = await getLoadingDurations(); - - results.serverResponse.push( serverResponse ); - results.firstPaint.push( firstPaint ); - results.domContentLoaded.push( domContentLoaded ); - results.loaded.push( loaded ); - results.firstContentfulPaint.push( firstContentfulPaint ); - results.firstBlock.push( firstBlock ); + + if ( i < samples ) { + const { + serverResponse, + firstPaint, + domContentLoaded, + loaded, + firstContentfulPaint, + firstBlock, + } = await getLoadingDurations(); + + results.serverResponse.push( serverResponse ); + results.firstPaint.push( firstPaint ); + results.domContentLoaded.push( domContentLoaded ); + results.loaded.push( loaded ); + results.firstContentfulPaint.push( firstContentfulPaint ); + results.firstBlock.push( firstBlock ); + } } + } ); + + it( 'Typing', async () => { + await page.waitForSelector( '.edit-site-visual-editor', { + timeout: 120000, + } ); + await canvas().waitForSelector( '.wp-block', { timeout: 120000 } ); // Measuring typing performance inside the post content. await canvas().waitForSelector( @@ -121,7 +148,7 @@ describe( 'Site Editor Performance', () => { '[data-type="core/post-content"] [data-type="core/paragraph"]' ); await insertBlock( 'Paragraph' ); - i = 200; + let i = 200; const traceFile = __dirname + '/trace.json'; await page.tracing.start( { path: traceFile, From ca90b31f832bf773b0e35b169e7d0c74d9fdb531 Mon Sep 17 00:00:00 2001 From: Dennis Snell Date: Wed, 11 Jan 2023 15:48:03 -0800 Subject: [PATCH 06/76] Performance: Avoid string-allocation on keypress with inputRule (#47094) While checking for inline code snippets surrounded by the backtick we have been allocating new substrings from input strings when looking for those characters, but we don't need to do this. In this patch we're directly checking for the character on the input string using string indexing and then passing the `position` parameter to the `lastIndexOf` function so that it is able to scan the original input string without copying it. The performance impact of this change should be small and hard to measure, but it should reduce pressure on the garbage collector and be worthwhile even without clear measured results. --- packages/format-library/src/code/index.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/format-library/src/code/index.js b/packages/format-library/src/code/index.js index f3651504d57ce..27a99ebc989e2 100644 --- a/packages/format-library/src/code/index.js +++ b/packages/format-library/src/code/index.js @@ -20,16 +20,18 @@ export const code = { __unstableInputRule( value ) { const BACKTICK = '`'; const { start, text } = value; - const characterBefore = text.slice( start - 1, start ); + const characterBefore = text[ start - 1 ]; // Quick check the text for the necessary character. if ( characterBefore !== BACKTICK ) { return value; } - const textBefore = text.slice( 0, start - 1 ); - const indexBefore = textBefore.lastIndexOf( BACKTICK ); + if ( start - 2 < 0 ) { + return value; + } + const indexBefore = text.lastIndexOf( BACKTICK, start - 2 ); if ( indexBefore === -1 ) { return value; } From 7fbf73d447b211c31d75585c46fb3f08e6267582 Mon Sep 17 00:00:00 2001 From: Adam Zielinski Date: Sat, 11 Feb 2023 14:14:20 +0100 Subject: [PATCH 07/76] Rename the "experiments" export to "privateApis" (#47975) * Rename the "experiments" export to "privateApis" * Fix a typo * minor missing renames --------- Co-authored-by: ntsekouras --- docs/contributors/code/coding-guidelines.md | 7 +- packages/block-editor/README.md | 8 +- .../src/components/url-popover/index.js | 4 +- packages/block-editor/src/hooks/position.js | 4 +- packages/block-editor/src/index.js | 2 +- packages/block-editor/src/private-apis.js | 6 +- .../block-editor/src/private-apis.native.js | 6 +- .../edit/menu-inspector-controls.js | 4 +- packages/components/src/index.js | 4 +- packages/components/src/private-apis.js | 4 +- .../sidebar-editor-provider.js | 4 +- packages/edit-post/src/editor.js | 4 +- .../src/components/block-editor/index.js | 4 +- .../global-styles-renderer/index.js | 4 +- .../components/global-styles/border-panel.js | 4 +- .../global-styles/color-palette-panel.js | 4 +- .../components/global-styles/context-menu.js | 4 +- .../components/global-styles/custom-css.js | 4 +- .../global-styles/dimensions-panel.js | 4 +- .../global-styles/global-styles-provider.js | 4 +- .../global-styles/gradients-palette-panel.js | 4 +- .../src/components/global-styles/hooks.js | 4 +- .../src/components/global-styles/palette.js | 4 +- .../src/components/global-styles/preview.js | 4 +- .../global-styles/screen-background-color.js | 4 +- .../global-styles/screen-block-list.js | 4 +- .../global-styles/screen-button-color.js | 4 +- .../components/global-styles/screen-colors.js | 4 +- .../global-styles/screen-heading-color.js | 4 +- .../global-styles/screen-link-color.js | 4 +- .../components/global-styles/screen-root.js | 4 +- .../global-styles/screen-style-variations.js | 4 +- .../global-styles/screen-text-color.js | 4 +- .../global-styles/screen-typography.js | 4 +- .../components/global-styles/shadow-panel.js | 4 +- .../global-styles/typography-panel.js | 4 +- .../global-styles/typography-preview.js | 4 +- .../src/components/global-styles/ui.js | 4 +- .../navigation-inspector/navigation-menu.js | 4 +- .../src/components/style-book/index.js | 4 +- .../push-changes-to-global-styles/index.js | 4 +- .../index.js | 4 +- .../editor/src/components/provider/index.js | 4 +- packages/editor/src/private-apis.js | 4 +- packages/private-apis/README.md | 8 +- packages/private-apis/src/implementation.js | 52 +++---- packages/private-apis/src/test/index.js | 137 +++++++++--------- 47 files changed, 189 insertions(+), 193 deletions(-) diff --git a/docs/contributors/code/coding-guidelines.md b/docs/contributors/code/coding-guidelines.md index 281ace04b141c..d9d62450c94bf 100644 --- a/docs/contributors/code/coding-guidelines.md +++ b/docs/contributors/code/coding-guidelines.md @@ -293,7 +293,6 @@ You can attach private selectors and actions to a public store: ```js // In packages/package1/store.js: -import { experiments as dataExperiments } from '@wordpress/data'; import { __experimentalHasContentRoleAttribute, ...selectors } from './selectors'; import { __experimentalToggleFeature, ...actions } from './selectors'; // The `lock` function is exported from the internal experiments.js file where @@ -340,9 +339,9 @@ function MyComponent() { // In packages/package1/index.js: import { lock } from './private-apis'; -export const experiments = {}; +export const privateApis = {}; /* Attach private data to the exported object */ -lock( experiments, { +lock( privateApis, { __experimentalCallback: function () {}, __experimentalReactComponent: function ExperimentalComponent() { return
; @@ -352,7 +351,7 @@ lock( experiments, { } ); // In packages/package2/index.js: -import { experiments } from '@wordpress/package1'; +import { privateApis } from '@wordpress/package1'; import { unlock } from './private-apis'; const { diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md index 19433e516f4f5..18c2c2cfbce52 100644 --- a/packages/block-editor/README.md +++ b/packages/block-editor/README.md @@ -348,10 +348,6 @@ _Returns_ Undocumented declaration. -### experiments - -Experimental @wordpress/block-editor APIs. - ### FontSizePicker _Related_ @@ -639,6 +635,10 @@ _Related_ - +### privateApis + +Private @wordpress/block-editor APIs. + ### RichText _Related_ diff --git a/packages/block-editor/src/components/url-popover/index.js b/packages/block-editor/src/components/url-popover/index.js index 8c2bbec69c5de..071d2c7e00b8b 100644 --- a/packages/block-editor/src/components/url-popover/index.js +++ b/packages/block-editor/src/components/url-popover/index.js @@ -6,7 +6,7 @@ import { useState } from '@wordpress/element'; import { Button, Popover, - experiments as componentsExperiments, + privateApis as componentsPrivateApis, } from '@wordpress/components'; import { chevronDown } from '@wordpress/icons'; import deprecated from '@wordpress/deprecated'; @@ -19,7 +19,7 @@ import LinkEditor from './link-editor'; import { unlock } from '../../lock-unlock'; const { __experimentalPopoverLegacyPositionToPlacement } = unlock( - componentsExperiments + componentsPrivateApis ); const DEFAULT_PLACEMENT = 'bottom'; diff --git a/packages/block-editor/src/hooks/position.js b/packages/block-editor/src/hooks/position.js index c5176304fb958..2c5589c1920bb 100644 --- a/packages/block-editor/src/hooks/position.js +++ b/packages/block-editor/src/hooks/position.js @@ -10,7 +10,7 @@ import { __, sprintf } from '@wordpress/i18n'; import { getBlockSupport, hasBlockSupport } from '@wordpress/blocks'; import { BaseControl, - experiments as componentsExperiments, + privateApis as componentsPrivateApis, } from '@wordpress/components'; import { createHigherOrderComponent, useInstanceId } from '@wordpress/compose'; import { useSelect } from '@wordpress/data'; @@ -32,7 +32,7 @@ import { cleanEmptyObject } from './utils'; import { unlock } from '../lock-unlock'; import { store as blockEditorStore } from '../store'; -const { CustomSelectControl } = unlock( componentsExperiments ); +const { CustomSelectControl } = unlock( componentsPrivateApis ); const POSITION_SUPPORT_KEY = 'position'; diff --git a/packages/block-editor/src/index.js b/packages/block-editor/src/index.js index 82ef4f30e5395..e272043c7ebab 100644 --- a/packages/block-editor/src/index.js +++ b/packages/block-editor/src/index.js @@ -20,4 +20,4 @@ export * from './elements'; export * from './utils'; export { storeConfig, store } from './store'; export { SETTINGS_DEFAULTS } from './store/defaults'; -export { experiments } from './private-apis'; +export { privateApis } from './private-apis'; diff --git a/packages/block-editor/src/private-apis.js b/packages/block-editor/src/private-apis.js index a624480bbcce1..b5b6c5d934cd4 100644 --- a/packages/block-editor/src/private-apis.js +++ b/packages/block-editor/src/private-apis.js @@ -8,10 +8,10 @@ import OffCanvasEditor from './components/off-canvas-editor'; import LeafMoreMenu from './components/off-canvas-editor/leaf-more-menu'; /** - * Experimental @wordpress/block-editor APIs. + * Private @wordpress/block-editor APIs. */ -export const experiments = {}; -lock( experiments, { +export const privateApis = {}; +lock( privateApis, { ...globalStyles, ExperimentalBlockEditorProvider, LeafMoreMenu, diff --git a/packages/block-editor/src/private-apis.native.js b/packages/block-editor/src/private-apis.native.js index 39400dbe10593..5555e00477e7b 100644 --- a/packages/block-editor/src/private-apis.native.js +++ b/packages/block-editor/src/private-apis.native.js @@ -6,10 +6,10 @@ import { ExperimentalBlockEditorProvider } from './components/provider'; import { lock } from './lock-unlock'; /** - * Experimental @wordpress/block-editor APIs. + * Private @wordpress/block-editor APIs. */ -export const experiments = {}; -lock( experiments, { +export const privateApis = {}; +lock( privateApis, { ...globalStyles, ExperimentalBlockEditorProvider, } ); diff --git a/packages/block-library/src/navigation/edit/menu-inspector-controls.js b/packages/block-library/src/navigation/edit/menu-inspector-controls.js index 26bf21168ee88..9b6c1456a3726 100644 --- a/packages/block-library/src/navigation/edit/menu-inspector-controls.js +++ b/packages/block-library/src/navigation/edit/menu-inspector-controls.js @@ -2,7 +2,7 @@ * WordPress dependencies */ import { - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, InspectorControls, store as blockEditorStore, } from '@wordpress/block-editor'; @@ -33,7 +33,7 @@ const MainContent = ( { isNavigationMenuMissing, onCreateNew, } ) => { - const { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorExperiments ); + const { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis ); // Provide a hierarchy of clientIds for the given Navigation block (clientId). // This is required else the list view will display the entire block tree. const clientIdsTree = useSelect( diff --git a/packages/components/src/index.js b/packages/components/src/index.js index 203469ccb1be3..a97682c3e4976 100644 --- a/packages/components/src/index.js +++ b/packages/components/src/index.js @@ -212,5 +212,5 @@ export { export { default as withNotices } from './higher-order/with-notices'; export { default as withSpokenMessages } from './higher-order/with-spoken-messages'; -// Experiments. -export { experiments } from './private-apis'; +// Private APIs. +export { privateApis } from './private-apis'; diff --git a/packages/components/src/private-apis.js b/packages/components/src/private-apis.js index 8798ea1078515..07efc6f6a039b 100644 --- a/packages/components/src/private-apis.js +++ b/packages/components/src/private-apis.js @@ -15,8 +15,8 @@ export const { lock, unlock } = '@wordpress/components' ); -export const experiments = {}; -lock( experiments, { +export const privateApis = {}; +lock( privateApis, { CustomSelectControl, __experimentalPopoverLegacyPositionToPlacement, } ); diff --git a/packages/customize-widgets/src/components/sidebar-block-editor/sidebar-editor-provider.js b/packages/customize-widgets/src/components/sidebar-block-editor/sidebar-editor-provider.js index da9a278a42b86..25b541c3d16db 100644 --- a/packages/customize-widgets/src/components/sidebar-block-editor/sidebar-editor-provider.js +++ b/packages/customize-widgets/src/components/sidebar-block-editor/sidebar-editor-provider.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -11,7 +11,7 @@ import useBlocksFocusControl from '../focus-control/use-blocks-focus-control'; import { unlock } from '../../private-apis'; -const { ExperimentalBlockEditorProvider } = unlock( blockEditorExperiments ); +const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis ); export default function SidebarEditorProvider( { sidebar, diff --git a/packages/edit-post/src/editor.js b/packages/edit-post/src/editor.js index ec5b8a531cf60..79bd55317f91f 100644 --- a/packages/edit-post/src/editor.js +++ b/packages/edit-post/src/editor.js @@ -7,7 +7,7 @@ import { ErrorBoundary, PostLockedModal, store as editorStore, - experiments as editorExperiments, + privateApis as editorPrivateApis, } from '@wordpress/editor'; import { useMemo } from '@wordpress/element'; import { SlotFillProvider } from '@wordpress/components'; @@ -23,7 +23,7 @@ import EditorInitialization from './components/editor-initialization'; import { store as editPostStore } from './store'; import { unlock } from './private-apis'; -const { ExperimentalEditorProvider } = unlock( editorExperiments ); +const { ExperimentalEditorProvider } = unlock( editorPrivateApis ); function Editor( { postId, postType, settings, initialEdits, ...props } ) { const { diff --git a/packages/edit-site/src/components/block-editor/index.js b/packages/edit-site/src/components/block-editor/index.js index fe80f3b14ade2..ac6f762ded6c8 100644 --- a/packages/edit-site/src/components/block-editor/index.js +++ b/packages/edit-site/src/components/block-editor/index.js @@ -17,7 +17,7 @@ import { __unstableUseTypingObserver as useTypingObserver, BlockEditorKeyboardShortcuts, store as blockEditorStore, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { useMergeRefs, @@ -39,7 +39,7 @@ import EditorCanvas from './editor-canvas'; import StyleBook from '../style-book'; import { unlock } from '../../private-apis'; -const { ExperimentalBlockEditorProvider } = unlock( blockEditorExperiments ); +const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis ); const LAYOUT = { type: 'default', diff --git a/packages/edit-site/src/components/global-styles-renderer/index.js b/packages/edit-site/src/components/global-styles-renderer/index.js index c9e258a0f4efb..3d0df911685cb 100644 --- a/packages/edit-site/src/components/global-styles-renderer/index.js +++ b/packages/edit-site/src/components/global-styles-renderer/index.js @@ -3,7 +3,7 @@ */ import { useEffect } from '@wordpress/element'; import { useSelect, useDispatch } from '@wordpress/data'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -11,7 +11,7 @@ import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; import { store as editSiteStore } from '../../store'; import { unlock } from '../../private-apis'; -const { useGlobalStylesOutput } = unlock( blockEditorExperiments ); +const { useGlobalStylesOutput } = unlock( blockEditorPrivateApis ); function useGlobalStylesRenderer() { const [ styles, settings, svgFilters ] = useGlobalStylesOutput(); diff --git a/packages/edit-site/src/components/global-styles/border-panel.js b/packages/edit-site/src/components/global-styles/border-panel.js index a59b9bfb58d10..a32ad02429595 100644 --- a/packages/edit-site/src/components/global-styles/border-panel.js +++ b/packages/edit-site/src/components/global-styles/border-panel.js @@ -3,7 +3,7 @@ */ import { __experimentalBorderRadiusControl as BorderRadiusControl, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { __experimentalBorderBoxControl as BorderBoxControl, @@ -21,7 +21,7 @@ import { __ } from '@wordpress/i18n'; import { useSupportedStyles, useColorsPerOrigin } from './hooks'; import { unlock } from '../../private-apis'; -const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis ); export function useHasBorderPanel( name ) { const controls = [ diff --git a/packages/edit-site/src/components/global-styles/color-palette-panel.js b/packages/edit-site/src/components/global-styles/color-palette-panel.js index efe5ccb55b2e7..7bf422b878e01 100644 --- a/packages/edit-site/src/components/global-styles/color-palette-panel.js +++ b/packages/edit-site/src/components/global-styles/color-palette-panel.js @@ -6,14 +6,14 @@ import { __experimentalVStack as VStack, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies */ import { unlock } from '../../private-apis'; -const { useGlobalSetting } = unlock( blockEditorExperiments ); +const { useGlobalSetting } = unlock( blockEditorPrivateApis ); export default function ColorPalettePanel( { name } ) { const [ themeColors, setThemeColors ] = useGlobalSetting( diff --git a/packages/edit-site/src/components/global-styles/context-menu.js b/packages/edit-site/src/components/global-styles/context-menu.js index f1128117e59c8..04ab8e65f403f 100644 --- a/packages/edit-site/src/components/global-styles/context-menu.js +++ b/packages/edit-site/src/components/global-styles/context-menu.js @@ -21,7 +21,7 @@ import { import { isRTL, __ } from '@wordpress/i18n'; import { useSelect } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -37,7 +37,7 @@ import { useHasShadowControl } from './shadow-panel'; import { unlock } from '../../private-apis'; const { useHasTypographyPanel, useGlobalSetting } = unlock( - blockEditorExperiments + blockEditorPrivateApis ); function ContextMenu( { name, parentMenu = '' } ) { diff --git a/packages/edit-site/src/components/global-styles/custom-css.js b/packages/edit-site/src/components/global-styles/custom-css.js index 71fd594e3336f..afc721b81d5e0 100644 --- a/packages/edit-site/src/components/global-styles/custom-css.js +++ b/packages/edit-site/src/components/global-styles/custom-css.js @@ -12,7 +12,7 @@ import { } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, transformStyles, } from '@wordpress/block-editor'; import { info } from '@wordpress/icons'; @@ -23,7 +23,7 @@ import { info } from '@wordpress/icons'; import { unlock } from '../../private-apis'; import Subtitle from './subtitle'; -const { useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalStyle } = unlock( blockEditorPrivateApis ); function CustomCSSControl( { blockName } ) { // If blockName is defined, we are customizing CSS at the block level: // styles.blocks.blockName.css 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 e1e3b8714fefa..c0b4bae554bd6 100644 --- a/packages/edit-site/src/components/global-styles/dimensions-panel.js +++ b/packages/edit-site/src/components/global-styles/dimensions-panel.js @@ -20,7 +20,7 @@ import { __experimentalUseCustomSides as useCustomSides, HeightControl, __experimentalSpacingSizesControl as SpacingSizesControl, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { Icon, positionCenter, stretchWide } from '@wordpress/icons'; @@ -30,7 +30,7 @@ import { Icon, positionCenter, stretchWide } from '@wordpress/icons'; import { useSupportedStyles } from './hooks'; import { unlock } from '../../private-apis'; -const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis ); const AXIAL_SIDES = [ 'horizontal', 'vertical' ]; diff --git a/packages/edit-site/src/components/global-styles/global-styles-provider.js b/packages/edit-site/src/components/global-styles/global-styles-provider.js index 08828e8a53a5a..20e3d03c54d1f 100644 --- a/packages/edit-site/src/components/global-styles/global-styles-provider.js +++ b/packages/edit-site/src/components/global-styles/global-styles-provider.js @@ -9,7 +9,7 @@ import { mergeWith, isEmpty, mapValues } from 'lodash'; import { useMemo, useCallback } from '@wordpress/element'; import { useSelect, useDispatch } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -17,7 +17,7 @@ import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; import CanvasSpinner from '../canvas-spinner'; import { unlock } from '../../private-apis'; -const { GlobalStylesContext } = unlock( blockEditorExperiments ); +const { GlobalStylesContext } = unlock( blockEditorPrivateApis ); function mergeTreesCustomizer( _, srcValue ) { // We only pass as arrays the presets, diff --git a/packages/edit-site/src/components/global-styles/gradients-palette-panel.js b/packages/edit-site/src/components/global-styles/gradients-palette-panel.js index 0169ce56b500f..747534993c593 100644 --- a/packages/edit-site/src/components/global-styles/gradients-palette-panel.js +++ b/packages/edit-site/src/components/global-styles/gradients-palette-panel.js @@ -8,7 +8,7 @@ import { DuotonePicker, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -16,7 +16,7 @@ import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; import Subtitle from './subtitle'; import { unlock } from '../../private-apis'; -const { useGlobalSetting } = unlock( blockEditorExperiments ); +const { useGlobalSetting } = unlock( blockEditorPrivateApis ); const noop = () => {}; diff --git a/packages/edit-site/src/components/global-styles/hooks.js b/packages/edit-site/src/components/global-styles/hooks.js index 00b9fc958e8a4..e1c5370cd630a 100644 --- a/packages/edit-site/src/components/global-styles/hooks.js +++ b/packages/edit-site/src/components/global-styles/hooks.js @@ -10,7 +10,7 @@ import a11yPlugin from 'colord/plugins/a11y'; import { _x } from '@wordpress/i18n'; import { useMemo } from '@wordpress/element'; import { store as blocksStore } from '@wordpress/blocks'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -18,7 +18,7 @@ import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; import { unlock } from '../../private-apis'; import { useSelect } from '@wordpress/data'; -const { useGlobalSetting } = unlock( blockEditorExperiments ); +const { useGlobalSetting } = unlock( blockEditorPrivateApis ); // Enable colord's a11y plugin. extend( [ a11yPlugin ] ); diff --git a/packages/edit-site/src/components/global-styles/palette.js b/packages/edit-site/src/components/global-styles/palette.js index 60a293682e009..c5f71cc987f04 100644 --- a/packages/edit-site/src/components/global-styles/palette.js +++ b/packages/edit-site/src/components/global-styles/palette.js @@ -13,7 +13,7 @@ import { import { __, _n, sprintf } from '@wordpress/i18n'; import { shuffle } from '@wordpress/icons'; import { useMemo } from '@wordpress/element'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -24,7 +24,7 @@ import { useColorRandomizer } from './hooks'; import ColorIndicatorWrapper from './color-indicator-wrapper'; import { unlock } from '../../private-apis'; -const { useGlobalSetting } = unlock( blockEditorExperiments ); +const { useGlobalSetting } = unlock( blockEditorPrivateApis ); const EMPTY_COLORS = []; diff --git a/packages/edit-site/src/components/global-styles/preview.js b/packages/edit-site/src/components/global-styles/preview.js index 7b262a0632f2b..ec8740c345333 100644 --- a/packages/edit-site/src/components/global-styles/preview.js +++ b/packages/edit-site/src/components/global-styles/preview.js @@ -4,7 +4,7 @@ import { __unstableIframe as Iframe, __unstableEditorStyles as EditorStyles, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { __unstableMotion as motion, @@ -20,7 +20,7 @@ import { useState, useMemo } from '@wordpress/element'; import { unlock } from '../../private-apis'; const { useGlobalSetting, useGlobalStyle, useGlobalStylesOutput } = unlock( - blockEditorExperiments + blockEditorPrivateApis ); const firstFrame = { diff --git a/packages/edit-site/src/components/global-styles/screen-background-color.js b/packages/edit-site/src/components/global-styles/screen-background-color.js index b89d9ef41bb32..6a072185b91e2 100644 --- a/packages/edit-site/src/components/global-styles/screen-background-color.js +++ b/packages/edit-site/src/components/global-styles/screen-background-color.js @@ -9,7 +9,7 @@ import classnames from 'classnames'; import { __ } from '@wordpress/i18n'; import { __experimentalColorGradientControl as ColorGradientControl, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; /** @@ -23,7 +23,7 @@ import { } from './hooks'; import { unlock } from '../../private-apis'; -const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis ); function ScreenBackgroundColor( { name, variation = '' } ) { const prefix = variation ? `variations.${ variation }.` : ''; diff --git a/packages/edit-site/src/components/global-styles/screen-block-list.js b/packages/edit-site/src/components/global-styles/screen-block-list.js index 9cdb3fb2a5fc6..cba1455333898 100644 --- a/packages/edit-site/src/components/global-styles/screen-block-list.js +++ b/packages/edit-site/src/components/global-styles/screen-block-list.js @@ -12,7 +12,7 @@ import { useSelect } from '@wordpress/data'; import { useState, useMemo, useEffect, useRef } from '@wordpress/element'; import { BlockIcon, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { useDebounce } from '@wordpress/compose'; import { speak } from '@wordpress/a11y'; @@ -29,7 +29,7 @@ import { NavigationButtonAsItem } from './navigation-button'; import { unlock } from '../../private-apis'; const { useHasTypographyPanel, useGlobalSetting } = unlock( - blockEditorExperiments + blockEditorPrivateApis ); function useSortedBlockTypes() { diff --git a/packages/edit-site/src/components/global-styles/screen-button-color.js b/packages/edit-site/src/components/global-styles/screen-button-color.js index 4b4b2e796b5eb..010095d024c62 100644 --- a/packages/edit-site/src/components/global-styles/screen-button-color.js +++ b/packages/edit-site/src/components/global-styles/screen-button-color.js @@ -4,7 +4,7 @@ import { __ } from '@wordpress/i18n'; import { __experimentalColorGradientControl as ColorGradientControl, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; /** @@ -14,7 +14,7 @@ import ScreenHeader from './header'; import { useSupportedStyles, useColorsPerOrigin } from './hooks'; import { unlock } from '../../private-apis'; -const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis ); function ScreenButtonColor( { name, variation = '' } ) { const prefix = variation ? `variations.${ variation }.` : ''; diff --git a/packages/edit-site/src/components/global-styles/screen-colors.js b/packages/edit-site/src/components/global-styles/screen-colors.js index e88892ac36264..dc40ca155b338 100644 --- a/packages/edit-site/src/components/global-styles/screen-colors.js +++ b/packages/edit-site/src/components/global-styles/screen-colors.js @@ -10,7 +10,7 @@ import { FlexItem, ColorIndicator, } from '@wordpress/components'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -25,7 +25,7 @@ import BlockPreviewPanel from './block-preview-panel'; import { getVariationClassName } from './utils'; import { unlock } from '../../private-apis'; -const { useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalStyle } = unlock( blockEditorPrivateApis ); function BackgroundColorItem( { name, parentMenu, variation = '' } ) { const prefix = variation ? `variations.${ variation }.` : ''; diff --git a/packages/edit-site/src/components/global-styles/screen-heading-color.js b/packages/edit-site/src/components/global-styles/screen-heading-color.js index aa35e74851135..859659092200f 100644 --- a/packages/edit-site/src/components/global-styles/screen-heading-color.js +++ b/packages/edit-site/src/components/global-styles/screen-heading-color.js @@ -8,7 +8,7 @@ import { } from '@wordpress/components'; import { __experimentalColorGradientControl as ColorGradientControl, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { useState } from '@wordpress/element'; @@ -23,7 +23,7 @@ import { } from './hooks'; import { unlock } from '../../private-apis'; -const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis ); function ScreenHeadingColor( { name, variation = '' } ) { const prefix = variation ? `variations.${ variation }.` : ''; diff --git a/packages/edit-site/src/components/global-styles/screen-link-color.js b/packages/edit-site/src/components/global-styles/screen-link-color.js index 50e0c7ee34a4b..fa2759dc0a19e 100644 --- a/packages/edit-site/src/components/global-styles/screen-link-color.js +++ b/packages/edit-site/src/components/global-styles/screen-link-color.js @@ -4,7 +4,7 @@ import { __ } from '@wordpress/i18n'; import { __experimentalColorGradientControl as ColorGradientControl, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { TabPanel } from '@wordpress/components'; @@ -15,7 +15,7 @@ import ScreenHeader from './header'; import { useSupportedStyles, useColorsPerOrigin } from './hooks'; import { unlock } from '../../private-apis'; -const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis ); function ScreenLinkColor( { name, variation = '' } ) { const prefix = variation ? `variations.${ variation }.` : ''; diff --git a/packages/edit-site/src/components/global-styles/screen-root.js b/packages/edit-site/src/components/global-styles/screen-root.js index d015c5a5aff46..3ec02647b6282 100644 --- a/packages/edit-site/src/components/global-styles/screen-root.js +++ b/packages/edit-site/src/components/global-styles/screen-root.js @@ -16,7 +16,7 @@ import { isRTL, __ } from '@wordpress/i18n'; import { chevronLeft, chevronRight } from '@wordpress/icons'; import { useSelect } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -28,7 +28,7 @@ import StylesPreview from './preview'; import { unlock } from '../../private-apis'; function ScreenRoot() { - const { useGlobalStyle } = unlock( blockEditorExperiments ); + const { useGlobalStyle } = unlock( blockEditorPrivateApis ); const [ customCSS ] = useGlobalStyle( 'css' ); const { variations, canEditCSS } = useSelect( ( select ) => { diff --git a/packages/edit-site/src/components/global-styles/screen-style-variations.js b/packages/edit-site/src/components/global-styles/screen-style-variations.js index 7d2347dc77b4c..10a5b66aa27bc 100644 --- a/packages/edit-site/src/components/global-styles/screen-style-variations.js +++ b/packages/edit-site/src/components/global-styles/screen-style-variations.js @@ -25,7 +25,7 @@ import { import { __ } from '@wordpress/i18n'; import { store as blockEditorStore, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; /** @@ -36,7 +36,7 @@ import StylesPreview from './preview'; import ScreenHeader from './header'; import { unlock } from '../../private-apis'; -const { GlobalStylesContext } = unlock( blockEditorExperiments ); +const { GlobalStylesContext } = unlock( blockEditorPrivateApis ); function compareVariations( a, b ) { return ( diff --git a/packages/edit-site/src/components/global-styles/screen-text-color.js b/packages/edit-site/src/components/global-styles/screen-text-color.js index 8ae2689fb8367..72b7e25fa8a3b 100644 --- a/packages/edit-site/src/components/global-styles/screen-text-color.js +++ b/packages/edit-site/src/components/global-styles/screen-text-color.js @@ -4,7 +4,7 @@ import { __ } from '@wordpress/i18n'; import { __experimentalColorGradientControl as ColorGradientControl, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; /** @@ -14,7 +14,7 @@ import ScreenHeader from './header'; import { useSupportedStyles, useColorsPerOrigin } from './hooks'; import { unlock } from '../../private-apis'; -const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis ); function ScreenTextColor( { name, variation = '' } ) { const prefix = variation ? `variations.${ variation }.` : ''; diff --git a/packages/edit-site/src/components/global-styles/screen-typography.js b/packages/edit-site/src/components/global-styles/screen-typography.js index b169206535388..96df1ff9d656e 100644 --- a/packages/edit-site/src/components/global-styles/screen-typography.js +++ b/packages/edit-site/src/components/global-styles/screen-typography.js @@ -8,7 +8,7 @@ import { __experimentalHStack as HStack, FlexItem, } from '@wordpress/components'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -21,7 +21,7 @@ import BlockPreviewPanel from './block-preview-panel'; import { getVariationClassName } from './utils'; import { unlock } from '../../private-apis'; -const { useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalStyle } = unlock( blockEditorPrivateApis ); function Item( { name, parentMenu, element, label } ) { const hasSupport = ! name; diff --git a/packages/edit-site/src/components/global-styles/shadow-panel.js b/packages/edit-site/src/components/global-styles/shadow-panel.js index a0c8251dfa543..8272d90726443 100644 --- a/packages/edit-site/src/components/global-styles/shadow-panel.js +++ b/packages/edit-site/src/components/global-styles/shadow-panel.js @@ -22,7 +22,7 @@ import { import { __ } from '@wordpress/i18n'; import { shadow as shadowIcon, Icon, check } from '@wordpress/icons'; import { useCallback } from '@wordpress/element'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -31,7 +31,7 @@ import { useSupportedStyles } from './hooks'; import { IconWithCurrentColor } from './icon-with-current-color'; import { unlock } from '../../private-apis'; -const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorPrivateApis ); export function useHasShadowControl( name ) { const supports = useSupportedStyles( name ); diff --git a/packages/edit-site/src/components/global-styles/typography-panel.js b/packages/edit-site/src/components/global-styles/typography-panel.js index 10b8b1e1bb6b4..d77594b13663f 100644 --- a/packages/edit-site/src/components/global-styles/typography-panel.js +++ b/packages/edit-site/src/components/global-styles/typography-panel.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies @@ -12,7 +12,7 @@ const { useGlobalStyle, useGlobalSetting, TypographyPanel: StylesTypographyPanel, -} = unlock( blockEditorExperiments ); +} = unlock( blockEditorPrivateApis ); export default function TypographyPanel( { name, diff --git a/packages/edit-site/src/components/global-styles/typography-preview.js b/packages/edit-site/src/components/global-styles/typography-preview.js index 3f394d2c50bd7..34a64e23fc1c7 100644 --- a/packages/edit-site/src/components/global-styles/typography-preview.js +++ b/packages/edit-site/src/components/global-styles/typography-preview.js @@ -1,14 +1,14 @@ /** * WordPress dependencies */ -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; /** * Internal dependencies */ import { unlock } from '../../private-apis'; -const { useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalStyle } = unlock( blockEditorPrivateApis ); export default function TypographyPreview( { name, element, headingLevel } ) { let prefix = ''; diff --git a/packages/edit-site/src/components/global-styles/ui.js b/packages/edit-site/src/components/global-styles/ui.js index c11e3f05923bc..157ed92e2efab 100644 --- a/packages/edit-site/src/components/global-styles/ui.js +++ b/packages/edit-site/src/components/global-styles/ui.js @@ -10,7 +10,7 @@ import { } from '@wordpress/components'; import { getBlockTypes, store as blocksStore } from '@wordpress/blocks'; import { useSelect, useDispatch } from '@wordpress/data'; -import { experiments as blockEditorExperiments } from '@wordpress/block-editor'; +import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; import { __ } from '@wordpress/i18n'; import { store as preferencesStore } from '@wordpress/preferences'; import { moreVertical } from '@wordpress/icons'; @@ -60,7 +60,7 @@ function GlobalStylesActionMenu() { !! globalStyles?._links?.[ 'wp:action-edit-css' ] ?? false, }; }, [] ); - const { useGlobalStylesReset } = unlock( blockEditorExperiments ); + const { useGlobalStylesReset } = unlock( blockEditorPrivateApis ); const [ canReset, onReset ] = useGlobalStylesReset(); const { goTo } = useNavigator(); const loadCustomCSS = () => goTo( '/css' ); diff --git a/packages/edit-site/src/components/navigation-inspector/navigation-menu.js b/packages/edit-site/src/components/navigation-inspector/navigation-menu.js index e261fdaa4030d..44acc24da62cf 100644 --- a/packages/edit-site/src/components/navigation-inspector/navigation-menu.js +++ b/packages/edit-site/src/components/navigation-inspector/navigation-menu.js @@ -2,7 +2,7 @@ * WordPress dependencies */ import { - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, store as blockEditorStore, } from '@wordpress/block-editor'; import { useEffect } from '@wordpress/element'; @@ -39,7 +39,7 @@ const ALLOWED_BLOCKS = { export default function NavigationMenu( { innerBlocks, onSelect } ) { const { updateBlockListSettings } = useDispatch( blockEditorStore ); - const { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorExperiments ); + const { OffCanvasEditor, LeafMoreMenu } = unlock( blockEditorPrivateApis ); //TODO: Block settings are normally updated as a side effect of rendering InnerBlocks in BlockList //Think through a better way of doing this, possible with adding allowed blocks to block library metadata diff --git a/packages/edit-site/src/components/style-book/index.js b/packages/edit-site/src/components/style-book/index.js index dfeb1d419c934..b4f55ad1de271 100644 --- a/packages/edit-site/src/components/style-book/index.js +++ b/packages/edit-site/src/components/style-book/index.js @@ -21,7 +21,7 @@ import { } from '@wordpress/blocks'; import { BlockPreview, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { closeSmall } from '@wordpress/icons'; import { useResizeObserver } from '@wordpress/compose'; @@ -32,7 +32,7 @@ import { useMemo, memo } from '@wordpress/element'; */ import { unlock } from '../../private-apis'; -const { useGlobalStyle } = unlock( blockEditorExperiments ); +const { useGlobalStyle } = unlock( blockEditorPrivateApis ); const SLOT_FILL_NAME = 'EditSiteStyleBook'; const { Slot: StyleBookSlot, Fill: StyleBookFill } = diff --git a/packages/edit-site/src/hooks/push-changes-to-global-styles/index.js b/packages/edit-site/src/hooks/push-changes-to-global-styles/index.js index 24b71c8aaffaf..815aa6f6b20c3 100644 --- a/packages/edit-site/src/hooks/push-changes-to-global-styles/index.js +++ b/packages/edit-site/src/hooks/push-changes-to-global-styles/index.js @@ -11,7 +11,7 @@ import { createHigherOrderComponent } from '@wordpress/compose'; import { InspectorAdvancedControls, store as blockEditorStore, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { BaseControl, Button } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; @@ -29,7 +29,7 @@ import { store as noticesStore } from '@wordpress/notices'; import { useSupportedStyles } from '../../components/global-styles/hooks'; import { unlock } from '../../private-apis'; -const { GlobalStylesContext } = unlock( blockEditorExperiments ); +const { GlobalStylesContext } = unlock( blockEditorPrivateApis ); // TODO: Temporary duplication of constant in @wordpress/block-editor. Can be // removed by moving PushChangesToGlobalStylesControl to diff --git a/packages/edit-widgets/src/components/widget-areas-block-editor-provider/index.js b/packages/edit-widgets/src/components/widget-areas-block-editor-provider/index.js index 42d8117c14234..042cd0dc9c617 100644 --- a/packages/edit-widgets/src/components/widget-areas-block-editor-provider/index.js +++ b/packages/edit-widgets/src/components/widget-areas-block-editor-provider/index.js @@ -13,7 +13,7 @@ import { useMemo } from '@wordpress/element'; import { BlockEditorKeyboardShortcuts, CopyHandler, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks'; import { ShortcutProvider } from '@wordpress/keyboard-shortcuts'; @@ -29,7 +29,7 @@ import { store as editWidgetsStore } from '../../store'; import { ALLOW_REUSABLE_BLOCKS } from '../../constants'; import { unlock } from '../../private-apis'; -const { ExperimentalBlockEditorProvider } = unlock( blockEditorExperiments ); +const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis ); export default function WidgetAreasBlockEditorProvider( { blockEditorSettings, diff --git a/packages/editor/src/components/provider/index.js b/packages/editor/src/components/provider/index.js index eaf9b1bf7d19d..1cff19c7daae7 100644 --- a/packages/editor/src/components/provider/index.js +++ b/packages/editor/src/components/provider/index.js @@ -8,7 +8,7 @@ import { EntityProvider, useEntityBlockEditor } from '@wordpress/core-data'; import { BlockEditorProvider, BlockContextProvider, - experiments as blockEditorExperiments, + privateApis as blockEditorPrivateApis, } from '@wordpress/block-editor'; import { ReusableBlocksMenuItems } from '@wordpress/reusable-blocks'; import { store as noticesStore } from '@wordpress/notices'; @@ -21,7 +21,7 @@ import { store as editorStore } from '../../store'; import useBlockEditorSettings from './use-block-editor-settings'; import { unlock } from '../../lockUnlock'; -const { ExperimentalBlockEditorProvider } = unlock( blockEditorExperiments ); +const { ExperimentalBlockEditorProvider } = unlock( blockEditorPrivateApis ); export const ExperimentalEditorProvider = withRegistryProvider( ( { diff --git a/packages/editor/src/private-apis.js b/packages/editor/src/private-apis.js index c54c895d961a0..edfc3045f1100 100644 --- a/packages/editor/src/private-apis.js +++ b/packages/editor/src/private-apis.js @@ -4,7 +4,7 @@ import { ExperimentalEditorProvider } from './components/provider'; import { lock } from './lockUnlock'; -export const experiments = {}; -lock( experiments, { +export const privateApis = {}; +lock( privateApis, { ExperimentalEditorProvider, } ); diff --git a/packages/private-apis/README.md b/packages/private-apis/README.md index a57e5e339e4be..828663dc760de 100644 --- a/packages/private-apis/README.md +++ b/packages/private-apis/README.md @@ -58,17 +58,17 @@ Use `lock()` and `unlock()` to privately distribute the `__experimental` APIs ac // In packages/package1/index.js: import { lock } from './private-apis'; -export const experiments = {}; +export const privateApis = {}; /* Attach private data to the exported object */ -lock( experiments, { +lock( privateApis, { __experimentalFunction: function () {}, } ); // In packages/package2/index.js: -import { experiments } from '@wordpress/package1'; +import { privateApis } from '@wordpress/package1'; import { unlock } from './private-apis'; -const { __experimentalFunction } = unlock( experiments ); +const { __experimentalFunction } = unlock( privateApis ); ``` ## Shipping experimental APIs diff --git a/packages/private-apis/src/implementation.js b/packages/private-apis/src/implementation.js index 26502a4723111..6a88e9812ca8c 100644 --- a/packages/private-apis/src/implementation.js +++ b/packages/private-apis/src/implementation.js @@ -1,15 +1,15 @@ /** - * wordpress/experimental – the utilities to enable private cross-package - * exports of experimental APIs. + * wordpress/private-apis – the utilities to enable private cross-package + * exports of private APIs. * * This "implementation.js" file is needed for the sake of the unit tests. It * exports more than the public API of the package to aid in testing. */ /** - * The list of core modules allowed to opt-in to the experimental APIs. + * The list of core modules allowed to opt-in to the private APIs. */ -const CORE_MODULES_USING_EXPERIMENTS = [ +const CORE_MODULES_USING_PRIVATE_APIS = [ '@wordpress/block-editor', '@wordpress/block-library', '@wordpress/blocks', @@ -24,21 +24,21 @@ const CORE_MODULES_USING_EXPERIMENTS = [ /** * A list of core modules that already opted-in to - * the experiments package. + * the privateApis package. * * @type {string[]} */ -const registeredExperiments = []; +const registeredPrivateApis = []; /* * Warning for theme and plugin developers. * - * The use of experimental developer APIs is intended for use by WordPress Core + * The use of private developer APIs is intended for use by WordPress Core * and the Gutenberg plugin exclusively. * * Dangerously opting in to using these APIs is NOT RECOMMENDED. Furthermore, * the WordPress Core philosophy to strive to maintain backward compatibility - * for third-party developers DOES NOT APPLY to experimental APIs. + * for third-party developers DOES NOT APPLY to private APIs. * * THE CONSENT STRING FOR OPTING IN TO THESE APIS MAY CHANGE AT ANY TIME AND * WITHOUT NOTICE. THIS CHANGE WILL BREAK EXISTING THIRD-PARTY CODE. SUCH A @@ -59,7 +59,7 @@ try { /** * Called by a @wordpress package wishing to opt-in to accessing or exposing - * private experimental APIs. + * private private APIs. * * @param {string} consent The consent string. * @param {string} moduleName The name of the module that is opting in. @@ -69,7 +69,7 @@ export const __dangerousOptInToUnstableAPIsOnlyForCoreModules = ( consent, moduleName ) => { - if ( ! CORE_MODULES_USING_EXPERIMENTS.includes( moduleName ) ) { + if ( ! CORE_MODULES_USING_PRIVATE_APIS.includes( moduleName ) ) { throw new Error( `You tried to opt-in to unstable APIs as module "${ moduleName }". ` + 'This feature is only for JavaScript modules shipped with WordPress core. ' + @@ -80,7 +80,7 @@ export const __dangerousOptInToUnstableAPIsOnlyForCoreModules = ( } if ( ! allowReRegistration && - registeredExperiments.includes( moduleName ) + registeredPrivateApis.includes( moduleName ) ) { // This check doesn't play well with Story Books / Hot Module Reloading // and isn't included in the Gutenberg plugin. It only matters in the @@ -102,7 +102,7 @@ export const __dangerousOptInToUnstableAPIsOnlyForCoreModules = ( 'your product will inevitably break on the next WordPress release.' ); } - registeredExperiments.push( moduleName ); + registeredPrivateApis.push( moduleName ); return { lock, @@ -138,10 +138,10 @@ function lock( object, privateData ) { if ( ! object ) { throw new Error( 'Cannot lock an undefined object.' ); } - if ( ! ( __experiment in object ) ) { - object[ __experiment ] = {}; + if ( ! ( __private in object ) ) { + object[ __private ] = {}; } - lockedData.set( object[ __experiment ], privateData ); + lockedData.set( object[ __private ], privateData ); } /** @@ -171,13 +171,13 @@ function unlock( object ) { if ( ! object ) { throw new Error( 'Cannot unlock an undefined object.' ); } - if ( ! ( __experiment in object ) ) { + if ( ! ( __private in object ) ) { throw new Error( 'Cannot unlock an object that was not locked before. ' ); } - return lockedData.get( object[ __experiment ] ); + return lockedData.get( object[ __private ] ); } const lockedData = new WeakMap(); @@ -186,18 +186,18 @@ const lockedData = new WeakMap(); * Used by lock() and unlock() to uniquely identify the private data * related to a containing object. */ -const __experiment = Symbol( 'Experiment ID' ); +const __private = Symbol( 'Private API ID' ); // Unit tests utilities: /** * Private function to allow the unit tests to allow - * a mock module to access the experimental APIs. + * a mock module to access the private APIs. * * @param {string} name The name of the module. */ export function allowCoreModule( name ) { - CORE_MODULES_USING_EXPERIMENTS.push( name ); + CORE_MODULES_USING_PRIVATE_APIS.push( name ); } /** @@ -205,16 +205,16 @@ export function allowCoreModule( name ) { * a custom list of allowed modules. */ export function resetAllowedCoreModules() { - while ( CORE_MODULES_USING_EXPERIMENTS.length ) { - CORE_MODULES_USING_EXPERIMENTS.pop(); + while ( CORE_MODULES_USING_PRIVATE_APIS.length ) { + CORE_MODULES_USING_PRIVATE_APIS.pop(); } } /** * Private function to allow the unit tests to reset - * the list of registered experiments. + * the list of registered private apis. */ -export function resetRegisteredExperiments() { - while ( registeredExperiments.length ) { - registeredExperiments.pop(); +export function resetRegisteredPrivateApis() { + while ( registeredPrivateApis.length ) { + registeredPrivateApis.pop(); } } diff --git a/packages/private-apis/src/test/index.js b/packages/private-apis/src/test/index.js index 2456d5ca5039d..2e73a1a58eaa1 100644 --- a/packages/private-apis/src/test/index.js +++ b/packages/private-apis/src/test/index.js @@ -3,16 +3,16 @@ */ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '../'; import { - resetRegisteredExperiments, + resetRegisteredPrivateApis, resetAllowedCoreModules, allowCoreModule, } from '../implementation'; beforeEach( () => { - resetRegisteredExperiments(); + resetRegisteredPrivateApis(); resetAllowedCoreModules(); - allowCoreModule( '@experiments/test' ); - allowCoreModule( '@experiments/test-consumer' ); + allowCoreModule( '@privateApis/test' ); + allowCoreModule( '@privateApis/test-consumer' ); } ); const requiredConsent = @@ -23,7 +23,7 @@ describe( '__dangerousOptInToUnstableAPIsOnlyForCoreModules', () => { expect( () => { __dangerousOptInToUnstableAPIsOnlyForCoreModules( '', - '@experiments/test' + '@privateApis/test' ); } ).toThrow( /without confirming you know the consequences/ ); } ); @@ -41,18 +41,18 @@ describe( '__dangerousOptInToUnstableAPIsOnlyForCoreModules', () => { expect( () => { __dangerousOptInToUnstableAPIsOnlyForCoreModules( requiredConsent, - '@experiments/test' + '@privateApis/test' ); __dangerousOptInToUnstableAPIsOnlyForCoreModules( requiredConsent, - '@experiments/test' + '@privateApis/test' ); } ).toThrow( /is already registered/ ); } ); it( 'Should grant access to unstable APIs when passed both a consent string and a previously unregistered package name', () => { const unstableAPIs = __dangerousOptInToUnstableAPIsOnlyForCoreModules( requiredConsent, - '@experiments/test' + '@privateApis/test' ); expect( unstableAPIs.lock ).toEqual( expect.any( Function ) ); expect( unstableAPIs.unlock ).toEqual( expect.any( Function ) ); @@ -62,14 +62,14 @@ describe( '__dangerousOptInToUnstableAPIsOnlyForCoreModules', () => { describe( 'lock(), unlock()', () => { let lock, unlock; beforeEach( () => { - // This would live in @experiments/test: - // Opt-in to experimental APIs - const experimentsAPI = __dangerousOptInToUnstableAPIsOnlyForCoreModules( + // This would live in @privateApis/test: + // Opt-in to private APIs + const privateApisAPI = __dangerousOptInToUnstableAPIsOnlyForCoreModules( requiredConsent, - '@experiments/test' + '@privateApis/test' ); - lock = experimentsAPI.lock; - unlock = experimentsAPI.unlock; + lock = privateApisAPI.lock; + unlock = privateApisAPI.unlock; } ); it( 'Should lock and unlock objects "inside" other objects', () => { @@ -120,95 +120,95 @@ describe( 'lock(), unlock()', () => { lock( object, privateData ); // This would live in @wordpress/core-data: - // Register the experimental APIs - const coreDataExperiments = + // Register the private APIs + const coreDataPrivateApis = __dangerousOptInToUnstableAPIsOnlyForCoreModules( requiredConsent, - '@experiments/test-consumer' + '@privateApis/test-consumer' ); - // Get the experimental APIs registered by @experiments/test - expect( coreDataExperiments.unlock( object ).secret ).toBe( 'sh' ); + // Get the private APIs registered by @privateApis/test + expect( coreDataPrivateApis.unlock( object ).secret ).toBe( 'sh' ); } ); } ); describe( 'Specific use-cases of sharing private APIs', () => { let lock, unlock; beforeEach( () => { - // This would live in @experiments/test: - // Opt-in to experimental APIs - const experimentsAPI = __dangerousOptInToUnstableAPIsOnlyForCoreModules( + // This would live in @privateApis/test: + // Opt-in to private APIs + const privateApisAPI = __dangerousOptInToUnstableAPIsOnlyForCoreModules( requiredConsent, - '@experiments/test' + '@privateApis/test' ); - lock = experimentsAPI.lock; - unlock = experimentsAPI.unlock; + lock = privateApisAPI.lock; + unlock = privateApisAPI.unlock; } ); - it( 'Should enable privately exporting experimental functions', () => { + it( 'Should enable privately exporting private functions', () => { /** - * Problem: The private __experimentalFunction should not be publicly + * Problem: The private __privateFunction should not be publicly * exposed to the consumers of package1. */ - function __experimentalFunction() {} + function __privateFunction() {} /** * Solution: Privately lock it inside a publicly exported object. * * In `package1/index.js` we'd say: * * ```js - * export const experiments = {}; - * lock(experiments, { - * __experimentalFunction + * export const privateApis = {}; + * lock(privateApis, { + * __privateFunction * }); * ``` * * Let's simulate in the test code: */ - const experiments = {}; + const privateApis = {}; const package1Exports = { - experiments, + privateApis, }; - lock( experiments, { __experimentalFunction } ); + lock( privateApis, { __privateFunction } ); /** * Then, in the consumer package we'd say: * * ```js - * import { experiments } from 'package1'; - * const { __experimentalFunction } = unlock( experiments ); + * import { privateApis } from 'package1'; + * const { __privateFunction } = unlock( privateApis ); * ``` * * Let's simulate that, too: */ const unlockedFunction = unlock( - package1Exports.experiments - ).__experimentalFunction; - expect( unlockedFunction ).toBe( __experimentalFunction ); + package1Exports.privateApis + ).__privateFunction; + expect( unlockedFunction ).toBe( __privateFunction ); } ); - it( 'Should enable exporting functions with private experimental arguments', () => { + it( 'Should enable exporting functions with private private arguments', () => { /** - * The publicly exported function does not have any experimental + * The publicly exported function does not have any private * arguments. * * @param {any} data The data to log */ function logData( data ) { - // Internally, it calls the experimental version of the function - // with fixed default values for the experimental arguments. - __experimentalLogData( data, 'plain' ); + // Internally, it calls the private version of the function + // with fixed default values for the private arguments. + __privateLogData( data, 'plain' ); } /** - * The private experimental function is not publicly exported. Instead, it's + * The private private function is not publicly exported. Instead, it's * "locked" inside of the public logData function. It can be unlocked by any * participant of the private importing system. * - * @param {any} data The data to log - * @param {string} __experimentalFormat The logging format to use. + * @param {any} data The data to log + * @param {string} __privateFormat The logging format to use. */ - function __experimentalLogData( data, __experimentalFormat ) { - if ( __experimentalFormat === 'table' ) { + function __privateLogData( data, __privateFormat ) { + if ( __privateFormat === 'table' ) { // eslint-disable-next-line no-console console.table( data ); } else { @@ -216,12 +216,12 @@ describe( 'Specific use-cases of sharing private APIs', () => { console.log( data ); } } - lock( logData, __experimentalLogData ); + lock( logData, __privateLogData ); /** * In package/log-data.js: * * ```js - * lock( logData, __experimentalLogData ); + * lock( logData, __privateLogData ); * export logData; * ``` * @@ -232,43 +232,40 @@ describe( 'Specific use-cases of sharing private APIs', () => { * ``` * * And that's it! The public function is publicly exported, and the - * experimental function is available via unlock( logData ): + * private function is available via unlock( logData ): * * ```js * import { logData } from 'package1'; * const experimenalLogData = unlock( logData ); * ``` */ - expect( unlock( logData ) ).toBe( __experimentalLogData ); + expect( unlock( logData ) ).toBe( __privateLogData ); } ); - it( 'Should enable exporting React Components with private experimental properties', () => { + it( 'Should enable exporting React Components with private private properties', () => { // eslint-disable-next-line jsdoc/require-param /** - * The publicly exported component does not have any experimental + * The publicly exported component does not have any private * properties. */ function DataTable( { data } ) { - // Internally, it calls the experimental version of the function - // with fixed default values for the experimental arguments. + // Internally, it calls the private version of the function + // with fixed default values for the private arguments. return ( - ); } // eslint-disable-next-line jsdoc/require-param /** - * The private experimental component is not publicly exported. Instead, it's + * The private private component is not publicly exported. Instead, it's * "locked" inside of the public logData function. It can be unlocked by any * participant of the private importing system. */ - function ExperimentalDataTable( { - data, - __experimentalFancyFormatting, - } ) { - const className = __experimentalFancyFormatting + function PrivateDataTable( { data, __privateFancyFormatting } ) { + const className = __privateFancyFormatting ? 'savage-css' : 'regular-css'; return ( @@ -283,12 +280,12 @@ describe( 'Specific use-cases of sharing private APIs', () => { ); } - lock( DataTable, ExperimentalDataTable ); + lock( DataTable, PrivateDataTable ); /** * In package/data-table.js: * * ```js - * lock( DataTable, ExperimentalDataTable ); + * lock( DataTable, PrivateDataTable ); * export DataTable; * ``` * @@ -299,13 +296,13 @@ describe( 'Specific use-cases of sharing private APIs', () => { * ``` * * And that's it! The public function is publicly exported, and the - * experimental function is available via unlock( logData ): + * private function is available via unlock( logData ): * * ```js * import { DataTable } from 'package1'; - * const ExperimentalDataTable = unlock( DataTable ); + * const PrivateDataTable = unlock( DataTable ); * ``` */ - expect( unlock( DataTable ) ).toBe( ExperimentalDataTable ); + expect( unlock( DataTable ) ).toBe( PrivateDataTable ); } ); } ); From b019306a4dd98908b2d1686f13ab7404fa7ddfd9 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Sun, 12 Feb 2023 11:00:50 +0100 Subject: [PATCH 08/76] Visual Regression tests: use default playwright utils (#47991) * Visual Regression tests: use default playwright utils instead of custom wordpress utils * Add new snapshot dir to gitignore --- .gitignore | 1 + test/storybook-playwright/specs/font-size-picker.spec.ts | 4 ++-- test/storybook-playwright/specs/popover.spec.ts | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 71ffc1c5bbb25..ee043c9a3e4b2 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ phpunit-watcher.yml .tool-versions test/storybook-playwright/test-results test/storybook-playwright/specs/__snapshots__ +test/storybook-playwright/specs/*-snapshots/** diff --git a/test/storybook-playwright/specs/font-size-picker.spec.ts b/test/storybook-playwright/specs/font-size-picker.spec.ts index 6aa11e89262c9..c2f6fc3580681 100644 --- a/test/storybook-playwright/specs/font-size-picker.spec.ts +++ b/test/storybook-playwright/specs/font-size-picker.spec.ts @@ -1,7 +1,7 @@ /** - * WordPress dependencies + * External dependencies */ -import { test, expect } from '@wordpress/e2e-test-utils-playwright'; +import { test, expect } from '@playwright/test'; /** * Internal dependencies diff --git a/test/storybook-playwright/specs/popover.spec.ts b/test/storybook-playwright/specs/popover.spec.ts index f11a20538edfc..247e61ffc8138 100644 --- a/test/storybook-playwright/specs/popover.spec.ts +++ b/test/storybook-playwright/specs/popover.spec.ts @@ -1,7 +1,7 @@ /** - * WordPress dependencies + * External dependencies */ -import { test, expect } from '@wordpress/e2e-test-utils-playwright'; +import { test, expect } from '@playwright/test'; /** * Internal dependencies From 4008678a9cd086f5bfeb8ae6b614692299f162d4 Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Mon, 13 Feb 2023 09:38:24 +0200 Subject: [PATCH 09/76] [Layout]: Fix align controls for hybrid themes (#47961) --- .../use-available-alignments.js | 29 +++++++++++-------- packages/block-editor/src/layouts/flow.js | 17 ++++++++++- .../provider/use-block-editor-settings.js | 1 + 3 files changed, 34 insertions(+), 13 deletions(-) diff --git a/packages/block-editor/src/components/block-alignment-control/use-available-alignments.js b/packages/block-editor/src/components/block-alignment-control/use-available-alignments.js index ab6213b438928..d77eb2af2a597 100644 --- a/packages/block-editor/src/components/block-alignment-control/use-available-alignments.js +++ b/packages/block-editor/src/components/block-alignment-control/use-available-alignments.js @@ -19,20 +19,25 @@ export default function useAvailableAlignments( controls = DEFAULT_CONTROLS ) { if ( ! controls.includes( 'none' ) ) { controls = [ 'none', ...controls ]; } - const { wideControlsEnabled = false, themeSupportsLayout } = useSelect( - ( select ) => { - const { getSettings } = select( blockEditorStore ); - const settings = getSettings(); - return { - wideControlsEnabled: settings.alignWide, - themeSupportsLayout: settings.supportsLayout, - }; - }, - [] - ); + const { + wideControlsEnabled = false, + themeSupportsLayout, + isBlockBasedTheme, + } = useSelect( ( select ) => { + const { getSettings } = select( blockEditorStore ); + const settings = getSettings(); + return { + wideControlsEnabled: settings.alignWide, + themeSupportsLayout: settings.supportsLayout, + isBlockBasedTheme: settings.__unstableIsBlockBasedTheme, + }; + }, [] ); const layout = useLayout(); const layoutType = getLayoutType( layout?.type ); - const layoutAlignments = layoutType.getAlignments( layout ); + const layoutAlignments = layoutType.getAlignments( + layout, + isBlockBasedTheme + ); if ( themeSupportsLayout ) { const alignments = layoutAlignments.filter( diff --git a/packages/block-editor/src/layouts/flow.js b/packages/block-editor/src/layouts/flow.js index 9367d5b91508a..d064edce65fed 100644 --- a/packages/block-editor/src/layouts/flow.js +++ b/packages/block-editor/src/layouts/flow.js @@ -56,7 +56,7 @@ export default { getOrientation() { return 'vertical'; }, - getAlignments( layout ) { + getAlignments( layout, isBlockBasedTheme ) { const alignmentInfo = getAlignmentsInfo( layout ); if ( layout.alignments !== undefined ) { if ( ! layout.alignments.includes( 'none' ) ) { @@ -74,6 +74,21 @@ export default { { name: 'right' }, ]; + // This is for backwards compatibility with hybrid themes. + if ( ! isBlockBasedTheme ) { + const { contentSize, wideSize } = layout; + if ( contentSize ) { + alignments.unshift( { name: 'full' } ); + } + + if ( wideSize ) { + alignments.unshift( { + name: 'wide', + info: alignmentInfo.wide, + } ); + } + } + alignments.unshift( { name: 'none', info: alignmentInfo.none } ); return alignments; diff --git a/packages/editor/src/components/provider/use-block-editor-settings.js b/packages/editor/src/components/provider/use-block-editor-settings.js index 8b9d9e5ba86d7..4c5c431e5915f 100644 --- a/packages/editor/src/components/provider/use-block-editor-settings.js +++ b/packages/editor/src/components/provider/use-block-editor-settings.js @@ -73,6 +73,7 @@ const BLOCK_EDITOR_SETTINGS = [ '__unstableHasCustomAppender', '__unstableIsPreviewMode', '__unstableResolvedAssets', + '__unstableIsBlockBasedTheme', ]; /** From 378290a8b7cacdbdaa441c3c3f43436464f02dba Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 13 Feb 2023 09:12:05 +0100 Subject: [PATCH 10/76] Add parent navigation support for the navigator component (#47883) Co-authored-by: Marco Ciampini --- docs/manifest.json | 6 + packages/components/CHANGELOG.md | 1 + packages/components/src/index.js | 1 + packages/components/src/navigator/context.ts | 1 + packages/components/src/navigator/index.ts | 1 + .../navigator/navigator-back-button/README.md | 18 +-- .../navigator/navigator-back-button/hook.ts | 15 +- .../navigator/navigator-provider/README.md | 25 ++- .../navigator-provider/component.tsx | 102 +++++++++--- .../navigator-to-parent-button/README.md | 15 ++ .../navigator-to-parent-button/component.tsx | 65 ++++++++ .../navigator-to-parent-button/index.ts | 1 + .../src/navigator/stories/index.tsx | 66 ++++++++ .../components/src/navigator/test/index.tsx | 145 ++++++++++++++++++ .../components/src/navigator/test/router.ts | 74 ++++++++- packages/components/src/navigator/types.ts | 14 +- .../components/src/navigator/use-navigator.ts | 4 +- .../components/src/navigator/utils/router.ts | 34 +++- .../src/components/global-styles/header.js | 4 +- .../global-styles/navigation-button.js | 6 +- .../src/components/global-styles/ui.js | 5 - .../sidebar-navigation-screen/index.js | 4 +- test/e2e/specs/site-editor/style-book.spec.js | 7 +- 23 files changed, 546 insertions(+), 68 deletions(-) create mode 100644 packages/components/src/navigator/navigator-to-parent-button/README.md create mode 100644 packages/components/src/navigator/navigator-to-parent-button/component.tsx create mode 100644 packages/components/src/navigator/navigator-to-parent-button/index.ts diff --git a/docs/manifest.json b/docs/manifest.json index 580fc8c70e2e5..9d0954b6b4b44 100644 --- a/docs/manifest.json +++ b/docs/manifest.json @@ -1061,6 +1061,12 @@ "markdown_source": "../packages/components/src/navigator/navigator-screen/README.md", "parent": "components" }, + { + "title": "NavigatorToParentButton", + "slug": "navigator-to-parent-button", + "markdown_source": "../packages/components/src/navigator/navigator-to-parent-button/README.md", + "parent": "components" + }, { "title": "Notice", "slug": "notice", diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index d7e78770b56c0..5039370d56725 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -11,6 +11,7 @@ - `ColorPalette`, `GradientPicker`, `PaletteEdit`, `ToolsPanel`: add new props to set a custom heading level ([43848](https://github.com/WordPress/gutenberg/pull/43848) and [#47788](https://github.com/WordPress/gutenberg/pull/47788)). - `ColorPalette`: ensure text label contrast checking works with CSS variables ([#47373](https://github.com/WordPress/gutenberg/pull/47373)). - `Navigator`: Support dynamic paths with parameters ([#47827](https://github.com/WordPress/gutenberg/pull/47827)). +- `Navigator`: Support hierarchical paths navigation and add `NavigatorToParentButton` component ([#47883](https://github.com/WordPress/gutenberg/pull/47883)). ### Internal diff --git a/packages/components/src/index.js b/packages/components/src/index.js index a97682c3e4976..90ed86944dbec 100644 --- a/packages/components/src/index.js +++ b/packages/components/src/index.js @@ -115,6 +115,7 @@ export { NavigatorScreen as __experimentalNavigatorScreen, NavigatorButton as __experimentalNavigatorButton, NavigatorBackButton as __experimentalNavigatorBackButton, + NavigatorToParentButton as __experimentalNavigatorToParentButton, useNavigator as __experimentalUseNavigator, } from './navigator'; export { default as Notice } from './notice'; diff --git a/packages/components/src/navigator/context.ts b/packages/components/src/navigator/context.ts index fd069b616a7f8..e195621b03d20 100644 --- a/packages/components/src/navigator/context.ts +++ b/packages/components/src/navigator/context.ts @@ -12,6 +12,7 @@ const initialContextValue: NavigatorContextType = { location: {}, goTo: () => {}, goBack: () => {}, + goToParent: () => {}, addScreen: () => {}, removeScreen: () => {}, params: {}, diff --git a/packages/components/src/navigator/index.ts b/packages/components/src/navigator/index.ts index 49f5655dc4b39..74c69a0daa9c3 100644 --- a/packages/components/src/navigator/index.ts +++ b/packages/components/src/navigator/index.ts @@ -2,4 +2,5 @@ export { NavigatorProvider } from './navigator-provider'; export { NavigatorScreen } from './navigator-screen'; export { NavigatorButton } from './navigator-button'; export { NavigatorBackButton } from './navigator-back-button'; +export { NavigatorToParentButton } from './navigator-to-parent-button'; export { default as useNavigator } from './use-navigator'; diff --git a/packages/components/src/navigator/navigator-back-button/README.md b/packages/components/src/navigator/navigator-back-button/README.md index d147027697597..01d4221be536e 100644 --- a/packages/components/src/navigator/navigator-back-button/README.md +++ b/packages/components/src/navigator/navigator-back-button/README.md @@ -10,22 +10,6 @@ The `NavigatorBackButton` component can be used to navigate to a screen and shou Refer to [the `NavigatorProvider` component](/packages/components/src/navigator/navigator-provider/README.md#usage) for a usage example. -## Props - -The component accepts the following props: - -### `onClick`: `React.MouseEventHandler< HTMLElement >` - -The callback called in response to a `click` event. - -- Required: No - -### `path`: `string` - -The path of the screen to navigate to. - -- Required: Yes - ### Inherited props -`NavigatorBackButton` also inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href`. +`NavigatorBackButton` also inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href` and `target`. diff --git a/packages/components/src/navigator/navigator-back-button/hook.ts b/packages/components/src/navigator/navigator-back-button/hook.ts index 5e7adabf3d9bb..437c60731cc95 100644 --- a/packages/components/src/navigator/navigator-back-button/hook.ts +++ b/packages/components/src/navigator/navigator-back-button/hook.ts @@ -9,26 +9,31 @@ import { useCallback } from '@wordpress/element'; import { useContextSystem, WordPressComponentProps } from '../../ui/context'; import Button from '../../button'; import useNavigator from '../use-navigator'; -import type { NavigatorBackButtonProps } from '../types'; +import type { NavigatorBackButtonHookProps } from '../types'; export function useNavigatorBackButton( - props: WordPressComponentProps< NavigatorBackButtonProps, 'button' > + props: WordPressComponentProps< NavigatorBackButtonHookProps, 'button' > ) { const { onClick, as = Button, + goToParent: goToParentProp = false, ...otherProps } = useContextSystem( props, 'NavigatorBackButton' ); - const { goBack } = useNavigator(); + const { goBack, goToParent } = useNavigator(); const handleClick: React.MouseEventHandler< HTMLButtonElement > = useCallback( ( e ) => { e.preventDefault(); - goBack(); + if ( goToParentProp ) { + goToParent(); + } else { + goBack(); + } onClick?.( e ); }, - [ goBack, onClick ] + [ goToParentProp, goToParent, goBack, onClick ] ); return { diff --git a/packages/components/src/navigator/navigator-provider/README.md b/packages/components/src/navigator/navigator-provider/README.md index 6f90cf31198e9..8be27a6510184 100644 --- a/packages/components/src/navigator/navigator-provider/README.md +++ b/packages/components/src/navigator/navigator-provider/README.md @@ -4,7 +4,7 @@ This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes.
-The `NavigatorProvider` component allows rendering nested views/panels/menus (via the [`NavigatorScreen` component](/packages/components/src/navigator/navigator-screen/README.md)) and navigate between these different states (via the [`NavigatorButton`](/packages/components/src/navigator/navigator-button/README.md) and [`NavigatorBackButton`](/packages/components/src/navigator/navigator-back-button/README.md) components or the `useNavigator` hook). The Global Styles sidebar is an example of this. +The `NavigatorProvider` component allows rendering nested views/panels/menus (via the [`NavigatorScreen` component](/packages/components/src/navigator/navigator-screen/README.md)) and navigate between these different states (via the [`NavigatorButton`](/packages/components/src/navigator/navigator-button/README.md), [`NavigatorToParentButton`](/packages/components/src/navigator/navigator-to-parent-button/README.md) and [`NavigatorBackButton`](/packages/components/src/navigator/navigator-back-button/README.md) components or the `useNavigator` hook). The Global Styles sidebar is an example of this. ## Usage @@ -13,7 +13,7 @@ import { __experimentalNavigatorProvider as NavigatorProvider, __experimentalNavigatorScreen as NavigatorScreen, __experimentalNavigatorButton as NavigatorButton, - __experimentalNavigatorBackButton as NavigatorBackButton, + __experimentalNavigatorToParentButton as NavigatorToParentButton, } from '@wordpress/components'; const MyNavigation = () => ( @@ -27,13 +27,21 @@ const MyNavigation = () => (

This is the child screen.

- + Go back - +
); ``` +**Important note** + +Parent/child navigation only works if the path you define are hierarchical, following a URL-like scheme where each path segment is separated by the `/` character. +For example: +- `/` is the root of all paths. There should always be a screen with `path="/"`. +- `/parent/child` is a child of `/parent`. +- `/parent/child/grand-child` is a child of `/parent/child`. +- `/parent/:param` is a child of `/parent` as well. ## Props @@ -58,6 +66,15 @@ The `goTo` function allows navigating to a given path. The second argument can a The available options are: - `focusTargetSelector`: `string`. An optional property used to specify the CSS selector used to restore focus on the matching element when navigating back. +- `isBack`: `boolean`. An optional property used to specify whether the navigation should be considered as backwards (thus enabling focus restoration when possible, and causing the animation to be backwards too) + +### `goToParent`: `() => void;` + +The `goToParent` function allows navigating to the parent screen. + +Parent/child navigation only works if the path you define are hierarchical (see note above). + +When a match is not found, the function will try to recursively navigate the path hierarchy until a matching screen (or the root `/`) are found. ### `goBack`: `() => void` diff --git a/packages/components/src/navigator/navigator-provider/component.tsx b/packages/components/src/navigator/navigator-provider/component.tsx index 77447d6e97fca..28e710fa577b2 100644 --- a/packages/components/src/navigator/navigator-provider/component.tsx +++ b/packages/components/src/navigator/navigator-provider/component.tsx @@ -13,6 +13,7 @@ import { useCallback, useReducer, useRef, + useEffect, } from '@wordpress/element'; import isShallowEqual from '@wordpress/is-shallow-equal'; @@ -33,11 +34,13 @@ import type { NavigatorContext as NavigatorContextType, Screen, } from '../types'; -import { patternMatch } from '../utils/router'; +import { patternMatch, findParent } from '../utils/router'; type MatchedPath = ReturnType< typeof patternMatch >; type ScreenAction = { type: string; screen: Screen }; +const MAX_HISTORY_LENGTH = 50; + function screensReducer( state: Screen[] = [], action: ScreenAction @@ -66,7 +69,15 @@ function UnconnectedNavigatorProvider( path: initialPath, }, ] ); + const currentLocationHistory = useRef< NavigatorLocation[] >( [] ); const [ screens, dispatch ] = useReducer( screensReducer, [] ); + const currentScreens = useRef< Screen[] >( [] ); + useEffect( () => { + currentScreens.current = screens; + }, [ screens ] ); + useEffect( () => { + currentLocationHistory.current = locationHistory; + }, [ locationHistory ] ); const currentMatch = useRef< MatchedPath >(); const matchedPath = useMemo( () => { let currentPath: string | undefined; @@ -115,15 +126,47 @@ function UnconnectedNavigatorProvider( [] ); + const goBack: NavigatorContextType[ 'goBack' ] = useCallback( () => { + setLocationHistory( ( prevLocationHistory ) => { + if ( prevLocationHistory.length <= 1 ) { + return prevLocationHistory; + } + return [ + ...prevLocationHistory.slice( 0, -2 ), + { + ...prevLocationHistory[ prevLocationHistory.length - 2 ], + isBack: true, + hasRestoredFocus: false, + }, + ]; + } ); + }, [] ); + const goTo: NavigatorContextType[ 'goTo' ] = useCallback( ( path, options = {} ) => { - setLocationHistory( ( prevLocationHistory ) => { - const { focusTargetSelector, ...restOptions } = options; + const { + focusTargetSelector, + isBack = false, + ...restOptions + } = options; + + const isNavigatingToPreviousPath = + isBack && + currentLocationHistory.current.length > 1 && + currentLocationHistory.current[ + currentLocationHistory.current.length - 2 + ].path === path; + + if ( isNavigatingToPreviousPath ) { + goBack(); + return; + } + setLocationHistory( ( prevLocationHistory ) => { const newLocation = { ...restOptions, path, - isBack: false, + isBack, hasRestoredFocus: false, }; @@ -132,7 +175,12 @@ function UnconnectedNavigatorProvider( } return [ - ...prevLocationHistory.slice( 0, -1 ), + ...prevLocationHistory.slice( + prevLocationHistory.length > MAX_HISTORY_LENGTH - 1 + ? 1 + : 0, + -1 + ), // Assign `focusTargetSelector` to the previous location in history // (the one we just navigated from). { @@ -145,24 +193,27 @@ function UnconnectedNavigatorProvider( ]; } ); }, - [] + [ goBack ] ); - const goBack: NavigatorContextType[ 'goBack' ] = useCallback( () => { - setLocationHistory( ( prevLocationHistory ) => { - if ( prevLocationHistory.length <= 1 ) { - return prevLocationHistory; + const goToParent: NavigatorContextType[ 'goToParent' ] = + useCallback( () => { + const currentPath = + currentLocationHistory.current[ + currentLocationHistory.current.length - 1 + ].path; + if ( currentPath === undefined ) { + return; } - return [ - ...prevLocationHistory.slice( 0, -2 ), - { - ...prevLocationHistory[ prevLocationHistory.length - 2 ], - isBack: true, - hasRestoredFocus: false, - }, - ]; - } ); - }, [] ); + const parentPath = findParent( + currentPath, + currentScreens.current + ); + if ( parentPath === undefined ) { + return; + } + goTo( parentPath, { isBack: true } ); + }, [ goTo ] ); const navigatorContextValue: NavigatorContextType = useMemo( () => ( { @@ -174,10 +225,19 @@ function UnconnectedNavigatorProvider( match: matchedPath ? matchedPath.id : undefined, goTo, goBack, + goToParent, addScreen, removeScreen, } ), - [ locationHistory, matchedPath, goTo, goBack, addScreen, removeScreen ] + [ + locationHistory, + matchedPath, + goTo, + goBack, + goToParent, + addScreen, + removeScreen, + ] ); const cx = useCx(); diff --git a/packages/components/src/navigator/navigator-to-parent-button/README.md b/packages/components/src/navigator/navigator-to-parent-button/README.md new file mode 100644 index 0000000000000..62dacc3dfa4ea --- /dev/null +++ b/packages/components/src/navigator/navigator-to-parent-button/README.md @@ -0,0 +1,15 @@ +# `NavigatorToParentButton` + +
+This feature is still experimental. “Experimental” means this is an early implementation subject to drastic and breaking changes. +
+ +The `NavigatorToParentButton` component can be used to navigate to a screen and should be used in combination with the [`NavigatorProvider`](/packages/components/src/navigator/navigator-provider/README.md), the [`NavigatorScreen`](/packages/components/src/navigator/navigator-screen/README.md) and the [`NavigatorButton`](/packages/components/src/navigator/navigator-button/README.md) components (or the `useNavigator` hook). + +## Usage + +Refer to [the `NavigatorProvider` component](/packages/components/src/navigator/navigator-provider/README.md#usage) for a usage example. + +### Inherited props + +`NavigatorToParentButton` also inherits all of the [`Button` props](/packages/components/src/button/README.md#props), except for `href` and `target`. diff --git a/packages/components/src/navigator/navigator-to-parent-button/component.tsx b/packages/components/src/navigator/navigator-to-parent-button/component.tsx new file mode 100644 index 0000000000000..5dd8ab1624ae9 --- /dev/null +++ b/packages/components/src/navigator/navigator-to-parent-button/component.tsx @@ -0,0 +1,65 @@ +/** + * External dependencies + */ +import type { ForwardedRef } from 'react'; + +/** + * Internal dependencies + */ +import { contextConnect, WordPressComponentProps } from '../../ui/context'; +import { View } from '../../view'; +import { useNavigatorBackButton } from '../navigator-back-button/hook'; +import type { NavigatorToParentButtonProps } from '../types'; + +function UnconnectedNavigatorToParentButton( + props: WordPressComponentProps< NavigatorToParentButtonProps, 'button' >, + forwardedRef: ForwardedRef< any > +) { + const navigatorToParentButtonProps = useNavigatorBackButton( { + ...props, + goToParent: true, + } ); + + return ; +} + +/* + * The `NavigatorToParentButton` component can be used to navigate to a screen and + * should be used in combination with the `NavigatorProvider`, the + * `NavigatorScreen` and the `NavigatorButton` components (or the `useNavigator` + * hook). + * + * @example + * ```jsx + * import { + * __experimentalNavigatorProvider as NavigatorProvider, + * __experimentalNavigatorScreen as NavigatorScreen, + * __experimentalNavigatorButton as NavigatorButton, + * __experimentalNavigatorToParentButton as NavigatorToParentButton, + * } from '@wordpress/components'; + * + * const MyNavigation = () => ( + * + * + *

This is the home screen.

+ * + * Navigate to child screen. + * + *
+ * + * + *

This is the child screen.

+ * + * Go to parent + * + *
+ *
+ * ); + * ``` + */ +export const NavigatorToParentButton = contextConnect( + UnconnectedNavigatorToParentButton, + 'NavigatorToParentButton' +); + +export default NavigatorToParentButton; diff --git a/packages/components/src/navigator/navigator-to-parent-button/index.ts b/packages/components/src/navigator/navigator-to-parent-button/index.ts new file mode 100644 index 0000000000000..f5218e456065e --- /dev/null +++ b/packages/components/src/navigator/navigator-to-parent-button/index.ts @@ -0,0 +1 @@ +export { default as NavigatorToParentButton } from './component'; diff --git a/packages/components/src/navigator/stories/index.tsx b/packages/components/src/navigator/stories/index.tsx index ffc7a87ae1cc1..4c8a968e881f1 100644 --- a/packages/components/src/navigator/stories/index.tsx +++ b/packages/components/src/navigator/stories/index.tsx @@ -15,6 +15,7 @@ import { NavigatorScreen, NavigatorButton, NavigatorBackButton, + NavigatorToParentButton, useNavigator, } from '..'; @@ -232,3 +233,68 @@ function ProductDetails() { ); } + +const NestedNavigatorTemplate: ComponentStory< typeof NavigatorProvider > = ( { + style, + ...props +} ) => ( + + + + + + Go to first child. + + + Go to second child. + + + + + + + + This is the first child + + Go back to parent + + + + + + + + This is the second child + + Go back to parent + + + Go to grand child. + + + + + + + + This is the grand child + + Go back to parent + + + + + +); + +export const NestedNavigator: ComponentStory< typeof NavigatorProvider > = + NestedNavigatorTemplate.bind( {} ); +NestedNavigator.args = { + initialPath: '/child2/grandchild', +}; diff --git a/packages/components/src/navigator/test/index.tsx b/packages/components/src/navigator/test/index.tsx index dbc2ba30ebdb3..927f6f3abf0e0 100644 --- a/packages/components/src/navigator/test/index.tsx +++ b/packages/components/src/navigator/test/index.tsx @@ -13,11 +13,13 @@ import { useState } from '@wordpress/element'; /** * Internal dependencies */ +import Button from '../../button'; import { NavigatorProvider, NavigatorScreen, NavigatorButton, NavigatorBackButton, + NavigatorToParentButton, useNavigator, } from '..'; @@ -75,6 +77,7 @@ const BUTTON_TEXT = { toInvalidHtmlPathScreen: 'Navigate to screen with an invalid HTML value as a path.', back: 'Go back', + backUsingGoTo: 'Go back using goTo', }; type CustomTestOnClickHandler = ( @@ -84,6 +87,7 @@ type CustomTestOnClickHandler = ( path: string; } | { type: 'goBack' } + | { type: 'goToParent' } ) => void; function CustomNavigatorButton( { @@ -105,6 +109,26 @@ function CustomNavigatorButton( { ); } +function CustomNavigatorGoToBackButton( { + path, + onClick, + ...props +}: Omit< ComponentPropsWithoutRef< typeof NavigatorButton >, 'onClick' > & { + onClick?: CustomTestOnClickHandler; +} ) { + const { goTo } = useNavigator(); + return ( + + + { BUTTON_TEXT.toChildScreen } + + + + +

{ SCREEN_TEXT.child }

+ { /* + * A button useful to test focus restoration. This button is the first + * tabbable item in the screen, but should not receive focus when + * navigating to screen as a result of a backwards navigation. + */ } + + + { BUTTON_TEXT.toNestedScreen } + + + { BUTTON_TEXT.back } + +
+ + +

{ SCREEN_TEXT.nested }

+ + { BUTTON_TEXT.back } + + + { BUTTON_TEXT.backUsingGoTo } + +
+ + + ); +}; + const getScreen = ( screenKey: keyof typeof SCREEN_TEXT ) => screen.getByText( SCREEN_TEXT[ screenKey ] ); const queryScreen = ( screenKey: keyof typeof SCREEN_TEXT ) => @@ -592,5 +699,43 @@ describe( 'Navigator', () => { getNavigationButton( 'toInvalidHtmlPathScreen' ) ).toHaveFocus(); } ); + + it( 'should restore focus while using goTo and goToParent', async () => { + const user = userEvent.setup(); + + render( ); + + expect( getScreen( 'home' ) ).toBeInTheDocument(); + + // Navigate to child screen. + await user.click( getNavigationButton( 'toChildScreen' ) ); + expect( getScreen( 'child' ) ).toBeInTheDocument(); + + // Navigate to nested screen. + await user.click( getNavigationButton( 'toNestedScreen' ) ); + expect( getScreen( 'nested' ) ).toBeInTheDocument(); + expect( getNavigationButton( 'back' ) ).toBeInTheDocument(); + + // Navigate back to child screen using the back button. + await user.click( getNavigationButton( 'back' ) ); + expect( getScreen( 'child' ) ).toBeInTheDocument(); + expect( getNavigationButton( 'toNestedScreen' ) ).toHaveFocus(); + + // Re navigate to nested screen. + await user.click( getNavigationButton( 'toNestedScreen' ) ); + expect( getScreen( 'nested' ) ).toBeInTheDocument(); + expect( + getNavigationButton( 'backUsingGoTo' ) + ).toBeInTheDocument(); + + // Navigate back to child screen using the go to button. + await user.click( getNavigationButton( 'backUsingGoTo' ) ); + expect( getScreen( 'child' ) ).toBeInTheDocument(); + expect( getNavigationButton( 'toNestedScreen' ) ).toHaveFocus(); + + // Navigate back to home screen. + await user.click( getNavigationButton( 'back' ) ); + expect( getNavigationButton( 'toChildScreen' ) ).toHaveFocus(); + } ); } ); } ); diff --git a/packages/components/src/navigator/test/router.ts b/packages/components/src/navigator/test/router.ts index 7c60b846a4ab1..50e05fed47bb7 100644 --- a/packages/components/src/navigator/test/router.ts +++ b/packages/components/src/navigator/test/router.ts @@ -1,7 +1,7 @@ /** * Internal dependencies */ -import { patternMatch } from '../utils/router'; +import { patternMatch, findParent } from '../utils/router'; describe( 'patternMatch', () => { it( 'should return undefined if not pattern is matched', () => { @@ -48,3 +48,75 @@ describe( 'patternMatch', () => { } ); } ); } ); + +describe( 'findParent', () => { + it( 'should return undefined if no parent is found', () => { + const result = findParent( '/test', [ + { id: 'route', path: '/test' }, + ] ); + expect( result ).toBeUndefined(); + } ); + + it( 'should return the parent path', () => { + const result = findParent( '/test', [ + { id: 'route1', path: '/test' }, + { id: 'route2', path: '/' }, + ] ); + expect( result ).toEqual( '/' ); + } ); + + it( 'should return to another parent path', () => { + const result = findParent( '/test/123', [ + { id: 'route1', path: '/test/:id' }, + { id: 'route2', path: '/test' }, + ] ); + expect( result ).toEqual( '/test' ); + } ); + + it( 'should return the parent path with params', () => { + const result = findParent( '/test/123/456', [ + { id: 'route1', path: '/test/:id/:subId' }, + { id: 'route2', path: '/test/:id' }, + ] ); + expect( result ).toEqual( '/test/123' ); + } ); + + it( 'should return the parent path with optional params', () => { + const result = findParent( '/test/123', [ + { id: 'route', path: '/test/:id?' }, + ] ); + expect( result ).toEqual( '/test' ); + } ); + + it( 'should return the grand parent if no parent found', () => { + const result = findParent( '/test/123/456', [ + { id: 'route1', path: '/test/:id/:subId' }, + { id: 'route2', path: '/test' }, + ] ); + expect( result ).toEqual( '/test' ); + } ); + + it( 'should return the root when no grand parent found', () => { + const result = findParent( '/test/nested/path', [ + { id: 'route1', path: '/other-path' }, + { id: 'route2', path: '/yet-another-path' }, + { id: 'root', path: '/' }, + ] ); + expect( result ).toEqual( '/' ); + } ); + + it( 'should return undefined when no potential parent found', () => { + const result = findParent( '/test/nested/path', [ + { id: 'route1', path: '/other-path' }, + { id: 'route2', path: '/yet-another-path' }, + ] ); + expect( result ).toBeUndefined(); + } ); + + it( 'should return undefined for non supported paths', () => { + const result = findParent( 'this-is-a-path', [ + { id: 'route', path: '/' }, + ] ); + expect( result ).toBeUndefined(); + } ); +} ); diff --git a/packages/components/src/navigator/types.ts b/packages/components/src/navigator/types.ts index 98494095e0038..f6d8f5c22b0a5 100644 --- a/packages/components/src/navigator/types.ts +++ b/packages/components/src/navigator/types.ts @@ -12,11 +12,11 @@ export type MatchParams = Record< string, string | string[] >; type NavigateOptions = { focusTargetSelector?: string; + isBack?: boolean; }; export type NavigatorLocation = NavigateOptions & { isInitial?: boolean; - isBack?: boolean; path?: string; hasRestoredFocus?: boolean; }; @@ -27,6 +27,7 @@ export type Navigator = { params: MatchParams; goTo: ( path: string, options?: NavigateOptions ) => void; goBack: () => void; + goToParent: () => void; }; export type NavigatorContext = Navigator & { @@ -59,6 +60,17 @@ export type NavigatorScreenProps = { export type NavigatorBackButtonProps = ButtonAsButtonProps; +export type NavigatorBackButtonHookProps = NavigatorBackButtonProps & { + /** + * Whether we should navigate to the parent screen. + * + * @default 'false' + */ + goToParent?: boolean; +}; + +export type NavigatorToParentButtonProps = NavigatorBackButtonProps; + export type NavigatorButtonProps = NavigatorBackButtonProps & { /** * The path of the screen to navigate to. The value of this prop needs to be diff --git a/packages/components/src/navigator/use-navigator.ts b/packages/components/src/navigator/use-navigator.ts index bef5d37f5039f..4d917649374d5 100644 --- a/packages/components/src/navigator/use-navigator.ts +++ b/packages/components/src/navigator/use-navigator.ts @@ -13,12 +13,14 @@ import type { Navigator } from './types'; * Retrieves a `navigator` instance. */ function useNavigator(): Navigator { - const { location, params, goTo, goBack } = useContext( NavigatorContext ); + const { location, params, goTo, goBack, goToParent } = + useContext( NavigatorContext ); return { location, goTo, goBack, + goToParent, params, }; } diff --git a/packages/components/src/navigator/utils/router.ts b/packages/components/src/navigator/utils/router.ts index 5675c415c200f..6ff5be66661f9 100644 --- a/packages/components/src/navigator/utils/router.ts +++ b/packages/components/src/navigator/utils/router.ts @@ -8,12 +8,16 @@ import { match } from 'path-to-regexp'; */ import type { Screen, MatchParams } from '../types'; +function matchPath( path: string, pattern: string ) { + const matchingFunction = match< MatchParams >( pattern, { + decode: decodeURIComponent, + } ); + return matchingFunction( path ); +} + export function patternMatch( path: string, screens: Screen[] ) { for ( const screen of screens ) { - const matchingFunction = match< MatchParams >( screen.path, { - decode: decodeURIComponent, - } ); - const matched = matchingFunction( path ); + const matched = matchPath( path, screen.path ); if ( matched ) { return { params: matched.params, id: screen.id }; } @@ -21,3 +25,25 @@ export function patternMatch( path: string, screens: Screen[] ) { return undefined; } + +export function findParent( path: string, screens: Screen[] ) { + if ( ! path.startsWith( '/' ) ) { + return undefined; + } + const pathParts = path.split( '/' ); + let parentPath; + while ( pathParts.length > 1 && parentPath === undefined ) { + pathParts.pop(); + const potentialParentPath = + pathParts.join( '/' ) === '' ? '/' : pathParts.join( '/' ); + if ( + screens.find( ( screen ) => { + return matchPath( potentialParentPath, screen.path ) !== false; + } ) + ) { + parentPath = potentialParentPath; + } + } + + return parentPath; +} diff --git a/packages/edit-site/src/components/global-styles/header.js b/packages/edit-site/src/components/global-styles/header.js index 11923d4f916cc..f62820653ff92 100644 --- a/packages/edit-site/src/components/global-styles/header.js +++ b/packages/edit-site/src/components/global-styles/header.js @@ -7,7 +7,7 @@ import { __experimentalSpacer as Spacer, __experimentalHeading as Heading, __experimentalView as View, - __experimentalNavigatorBackButton as NavigatorBackButton, + __experimentalNavigatorToParentButton as NavigatorToParentButton, } from '@wordpress/components'; import { isRTL, __ } from '@wordpress/i18n'; import { chevronRight, chevronLeft } from '@wordpress/icons'; @@ -18,7 +18,7 @@ function ScreenHeader( { title, description } ) { - ; + return ( + + ); } export { NavigationButtonAsItem, NavigationBackButtonAsItem }; diff --git a/packages/edit-site/src/components/global-styles/ui.js b/packages/edit-site/src/components/global-styles/ui.js index 157ed92e2efab..5372ce9e5fbd5 100644 --- a/packages/edit-site/src/components/global-styles/ui.js +++ b/packages/edit-site/src/components/global-styles/ui.js @@ -267,11 +267,6 @@ function GlobalStylesStyleBook( { onClose } ) { ) } onSelect={ ( blockName ) => { - // Clear navigator history by going back to the root. - const depth = path.match( /\//g ).length; - for ( let i = 0; i < depth; i++ ) { - navigator.goBack(); - } // Now go to the selected block. navigator.goTo( '/blocks/' + encodeURIComponent( blockName ) ); } } diff --git a/packages/edit-site/src/components/sidebar-navigation-screen/index.js b/packages/edit-site/src/components/sidebar-navigation-screen/index.js index a5f2eb2cc927b..3f61a7c8208e8 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen/index.js @@ -4,7 +4,7 @@ import { __experimentalHStack as HStack, __experimentalVStack as VStack, - __experimentalNavigatorBackButton as NavigatorBackButton, + __experimentalNavigatorToParentButton as NavigatorToParentButton, __experimentalNavigatorScreen as NavigatorScreen, } from '@wordpress/components'; import { isRTL, __, sprintf } from '@wordpress/i18n'; @@ -29,7 +29,7 @@ export default function SidebarNavigationScreen( { className="edit-site-sidebar-navigation-screen__title-icon" > { parentTitle ? ( - { ).toBeVisible(); } ); - test( 'should clear Global Styles navigator history when example is clicked', async ( { + test( 'should allow to return Global Styles root when example is clicked', async ( { page, } ) => { await page.click( 'role=button[name="Blocks styles"]' ); @@ -109,11 +109,12 @@ test.describe( 'Style Book', () => { 'role=button[name="Open Quote styles in Styles panel"i]' ); + await page.click( 'role=button[name="Navigate to the previous view"]' ); await page.click( 'role=button[name="Navigate to the previous view"]' ); await expect( - page.locator( 'role=button[name="Navigate to the previous view"]' ) - ).not.toBeVisible(); + page.locator( 'role=button[name="Blocks styles"]' ) + ).toBeVisible(); } ); test( 'should disappear when closed', async ( { page } ) => { From a0ef1139112aa93235eba2c582bc3cc5fcc05d55 Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Mon, 13 Feb 2023 09:34:39 +0100 Subject: [PATCH 11/76] `ToolsPanel`: refactor Storybook examples to TypeScript, fix types inconsistencies (#47944) * Rename files * Fix imports * Allow panelId to be null across all types * `ToolsPanel`: mark `hasInnerWrapper` and `shouldRenderPlaceholderItems` as optional, assign `false` default value * `ToolsPanelItem`: mark `resetAllFilter` as optional, assign `noop` default value * `ToolsPanelItem`: change `isShownByDefault` to be optional, assign default `false` value * Storybook examples: add component and state types * Storybook example: ignore unsolved errors, add TODO notes * Add Storybook meta object * Fix type errors in Storybook examples * Remove extraneous `isFirstToolsPanelItemShownByDefault` prop from Story args * CHANGELOG * Fix resetAll prop forwarding typo * Update `ResetAllFilter` type to receive and return data. Update READMEs * Update READMEs to sync `resetAll` and `resetAllFilter` types and descriptions * Remove @ts-ignore comments after updating the `ResetAllFilter` type * Remove unnecessary `ToolsPanelWithItemGroupSlot` story * update `resetAll` prop descritption in types JSDocs * Fix ToolsPanel component exports * Draft ToolsPanel JSDoc example comment --------- Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> --- packages/components/CHANGELOG.md | 2 + .../stories/{index.js => index.tsx} | 291 ++++++++++++------ .../utils/tools-panel-with-item-group-slot.js | 246 --------------- .../tools-panel/tools-panel-item/README.md | 10 +- .../tools-panel-item/component.tsx | 8 +- .../src/tools-panel/tools-panel-item/hook.ts | 6 +- .../src/tools-panel/tools-panel/README.md | 9 +- .../src/tools-panel/tools-panel/component.tsx | 58 +++- .../src/tools-panel/tools-panel/hook.ts | 4 +- packages/components/src/tools-panel/types.ts | 41 ++- 10 files changed, 300 insertions(+), 375 deletions(-) rename packages/components/src/tools-panel/stories/{index.js => index.tsx} (60%) delete mode 100644 packages/components/src/tools-panel/stories/utils/tools-panel-with-item-group-slot.js diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 5039370d56725..8889af90dd997 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -4,6 +4,7 @@ ### Bug Fix +- `ToolsPanel`: fix type inconsistencies between types, docs and normal component usage ([47944](https://github.com/WordPress/gutenberg/pull/47944)). - `SelectControl`: Fix styling when `multiple` prop is enabled ([#47893](https://github.com/WordPress/gutenberg/pull/43213)). ### Enhancements @@ -29,6 +30,7 @@ - `ToolsPanel`: Allow display of optional items when values are updated externally to item controls ([47727](https://github.com/WordPress/gutenberg/pull/47727)). - `ToolsPanel`: Ensure display of optional items when values are updated externally and multiple blocks selected ([47864](https://github.com/WordPress/gutenberg/pull/47864)). - `Navigator`: add more pattern matching tests, refine existing tests ([47910](https://github.com/WordPress/gutenberg/pull/47910)). +- `ToolsPanel`: Refactor Storybook examples to TypeScript ([47944](https://github.com/WordPress/gutenberg/pull/47944)). ## 23.3.0 (2023-02-01) diff --git a/packages/components/src/tools-panel/stories/index.js b/packages/components/src/tools-panel/stories/index.tsx similarity index 60% rename from packages/components/src/tools-panel/stories/index.js rename to packages/components/src/tools-panel/stories/index.tsx index 0ff9824406a91..52c89a6ece5d6 100644 --- a/packages/components/src/tools-panel/stories/index.js +++ b/packages/components/src/tools-panel/stories/index.tsx @@ -1,50 +1,73 @@ /** * External dependencies */ +import type { ComponentMeta, ComponentStory } from '@storybook/react'; import styled from '@emotion/styled'; /** * WordPress dependencies */ import { useState } from '@wordpress/element'; + +/** + * Internal dependencies + */ import { - __experimentalToggleGroupControl as ToggleGroupControl, - __experimentalToggleGroupControlOption as ToggleGroupControlOption, -} from '@wordpress/components'; + ToggleGroupControl, + ToggleGroupControlOption, +} from '../../toggle-group-control'; /** * Internal dependencies */ -import { ToolsPanel, ToolsPanelItem } from '../'; +import { ToolsPanel, ToolsPanelItem } from '..'; import Panel from '../../panel'; import UnitControl from '../../unit-control'; import { createSlotFill, Provider as SlotFillProvider } from '../../slot-fill'; -export default { +const meta: ComponentMeta< typeof ToolsPanel > = { title: 'Components (Experimental)/ToolsPanel', component: ToolsPanel, + subcomponents: { + ToolsPanelItem, + }, + argTypes: { + as: { control: { type: null } }, + children: { control: { type: null } }, + panelId: { control: { type: null } }, + resetAll: { action: 'resetAll' }, + }, + parameters: { + actions: { argTypesRegex: '^on.*' }, + controls: { + expanded: true, + }, + docs: { source: { state: 'open' } }, + }, }; - -export const _default = () => { - const [ height, setHeight ] = useState(); - const [ minHeight, setMinHeight ] = useState(); - const [ width, setWidth ] = useState(); - const [ scale, setScale ] = useState(); - - const resetAll = () => { +export default meta; + +export const Default: ComponentStory< typeof ToolsPanel > = ( { + resetAll: resetAllProp, + ...props +} ) => { + const [ height, setHeight ] = useState< string | undefined >(); + const [ minHeight, setMinHeight ] = useState< string | undefined >(); + const [ width, setWidth ] = useState< string | undefined >(); + const [ scale, setScale ] = useState< React.ReactText | undefined >(); + + const resetAll: typeof resetAllProp = ( filters ) => { setHeight( undefined ); setWidth( undefined ); setMinHeight( undefined ); setScale( undefined ); + resetAllProp( filters ); }; return ( - + !! width } label="Width" @@ -112,23 +135,27 @@ export const _default = () => { ); }; +Default.args = { + label: 'Tools Panel (default example)', +}; -export const WithNonToolsPanelItems = () => { - const [ height, setHeight ] = useState(); - const [ width, setWidth ] = useState(); +export const WithNonToolsPanelItems: ComponentStory< typeof ToolsPanel > = ( { + resetAll: resetAllProp, + ...props +} ) => { + const [ height, setHeight ] = useState< string | undefined >(); + const [ width, setWidth ] = useState< string | undefined >(); - const resetAll = () => { + const resetAll: typeof resetAllProp = ( filters ) => { setHeight( undefined ); setWidth( undefined ); + resetAllProp( filters ); }; return ( - + This text illustrates not all items must be wrapped in a ToolsPanelItem and represented in the panel menu. @@ -162,81 +189,127 @@ export const WithNonToolsPanelItems = () => { ); }; +WithNonToolsPanelItems.args = { + ...Default.args, + label: 'ToolsPanel (with non-menu items)', +}; -export const WithOptionalItemsPlusIcon = ( { isShownByDefault } ) => { - const [ height, setHeight ] = useState(); - const [ width, setWidth ] = useState(); - const [ minWidth, setMinWidth ] = useState(); - - const resetAll = () => { +export const WithOptionalItemsPlusIcon: ComponentStory< + typeof ToolsPanel +> = ( { resetAll: resetAllProp, ...props } ) => { + const [ + isFirstToolsPanelItemShownByDefault, + setIsFirstToolsPanelItemShownByDefault, + ] = useState( false ); + const [ height, setHeight ] = useState< string | undefined >(); + const [ width, setWidth ] = useState< string | undefined >(); + const [ minWidth, setMinWidth ] = useState< string | undefined >(); + + const resetAll: typeof resetAllProp = ( filters ) => { setHeight( undefined ); setWidth( undefined ); setMinWidth( undefined ); + resetAllProp( filters ); }; return ( - - - - !! minWidth } - label="Minimum width" - onDeselect={ () => setMinWidth( undefined ) } - isShownByDefault={ isShownByDefault } + <> + + + - !! minWidth } label="Minimum width" - value={ minWidth } - onChange={ ( next ) => setMinWidth( next ) } - /> - - !! width } - label="Width" - onDeselect={ () => setWidth( undefined ) } - isShownByDefault={ false } - > - setMinWidth( undefined ) } + isShownByDefault={ + isFirstToolsPanelItemShownByDefault + } + > + setMinWidth( next ) } + /> + + !! width } label="Width" - value={ width } - onChange={ ( next ) => setWidth( next ) } - /> - - !! height } - label="Height" - onDeselect={ () => setHeight( undefined ) } - isShownByDefault={ false } - > - setWidth( undefined ) } + isShownByDefault={ false } + > + setWidth( next ) } + /> + + !! height } label="Height" - value={ height } - onChange={ ( next ) => setHeight( next ) } - /> - - - - + onDeselect={ () => setHeight( undefined ) } + isShownByDefault={ false } + > + setHeight( next ) } + /> + + + + + + + ); }; WithOptionalItemsPlusIcon.args = { - isShownByDefault: false, + ...Default.args, + label: 'Tools Panel (optional items only)', }; const { Fill: ToolsPanelItems, Slot } = createSlotFill( 'ToolsPanelSlot' ); -const panelId = 'unique-tools-panel-id'; -export const WithSlotFillItems = () => { - const [ attributes, setAttributes ] = useState( {} ); +export const WithSlotFillItems: ComponentStory< typeof ToolsPanel > = ( { + resetAll: resetAllProp, + panelId, + ...props +} ) => { + const [ attributes, setAttributes ] = useState< { + width?: string; + height?: string; + } >( {} ); const { width, height } = attributes; - const resetAll = ( resetFilters = [] ) => { - let newAttributes = {}; + const resetAll: typeof resetAllProp = ( resetFilters = [] ) => { + let newAttributes: typeof attributes = {}; resetFilters.forEach( ( resetFilter ) => { newAttributes = { @@ -246,9 +319,10 @@ export const WithSlotFillItems = () => { } ); setAttributes( newAttributes ); + resetAllProp( resetFilters ); }; - const updateAttribute = ( name, value ) => { + const updateAttribute = ( name: string, value?: any ) => { setAttributes( { ...attributes, [ name ]: value, @@ -304,7 +378,7 @@ export const WithSlotFillItems = () => { @@ -315,13 +389,23 @@ export const WithSlotFillItems = () => { ); }; +WithSlotFillItems.args = { + ...Default.args, + label: 'Tools Panel With SlotFill Items', + panelId: 'unique-tools-panel-id', +}; -export const WithConditionalDefaultControl = () => { - const [ attributes, setAttributes ] = useState( {} ); +export const WithConditionalDefaultControl: ComponentStory< + typeof ToolsPanel +> = ( { resetAll: resetAllProp, panelId, ...props } ) => { + const [ attributes, setAttributes ] = useState< { + height?: string; + scale?: React.ReactText; + } >( {} ); const { height, scale } = attributes; - const resetAll = ( resetFilters = [] ) => { - let newAttributes = {}; + const resetAll: typeof resetAllProp = ( resetFilters = [] ) => { + let newAttributes: typeof attributes = {}; resetFilters.forEach( ( resetFilter ) => { newAttributes = { @@ -331,9 +415,11 @@ export const WithConditionalDefaultControl = () => { } ); setAttributes( newAttributes ); + + resetAllProp( resetFilters ); }; - const updateAttribute = ( name, value ) => { + const updateAttribute = ( name: string, value?: any ) => { setAttributes( { ...attributes, [ name ]: value, @@ -388,7 +474,7 @@ export const WithConditionalDefaultControl = () => { @@ -399,13 +485,23 @@ export const WithConditionalDefaultControl = () => { ); }; +WithConditionalDefaultControl.args = { + ...Default.args, + label: 'Tools Panel With Conditional Default via SlotFill', + panelId: 'unique-tools-panel-id', +}; -export const WithConditionallyRenderedControl = () => { - const [ attributes, setAttributes ] = useState( {} ); +export const WithConditionallyRenderedControl: ComponentStory< + typeof ToolsPanel +> = ( { resetAll: resetAllProp, panelId, ...props } ) => { + const [ attributes, setAttributes ] = useState< { + height?: string; + scale?: React.ReactText; + } >( {} ); const { height, scale } = attributes; - const resetAll = ( resetFilters = [] ) => { - let newAttributes = {}; + const resetAll: typeof resetAllProp = ( resetFilters = [] ) => { + let newAttributes: typeof attributes = {}; resetFilters.forEach( ( resetFilter ) => { newAttributes = { @@ -415,9 +511,11 @@ export const WithConditionallyRenderedControl = () => { } ); setAttributes( newAttributes ); + + resetAllProp( resetFilters ); }; - const updateAttribute = ( name, value ) => { + const updateAttribute = ( name: string, value?: any ) => { setAttributes( { ...attributes, [ name ]: value, @@ -485,7 +583,7 @@ export const WithConditionallyRenderedControl = () => { @@ -496,8 +594,11 @@ export const WithConditionallyRenderedControl = () => { ); }; - -export { ToolsPanelWithItemGroupSlot } from './utils/tools-panel-with-item-group-slot'; +WithConditionallyRenderedControl.args = { + ...Default.args, + label: 'Tools Panel With Conditionally Rendered Item via SlotFill', + panelId: 'unique-tools-panel-id', +}; const PanelWrapperView = styled.div` font-size: 13px; diff --git a/packages/components/src/tools-panel/stories/utils/tools-panel-with-item-group-slot.js b/packages/components/src/tools-panel/stories/utils/tools-panel-with-item-group-slot.js deleted file mode 100644 index d1895324df4c3..0000000000000 --- a/packages/components/src/tools-panel/stories/utils/tools-panel-with-item-group-slot.js +++ /dev/null @@ -1,246 +0,0 @@ -/** - * External dependencies - */ -import styled from '@emotion/styled'; -import { css } from '@emotion/react'; - -/** - * WordPress dependencies - */ -import { useContext, useState } from '@wordpress/element'; - -/** - * Internal dependencies - */ -import Button from '../../../button'; -import ColorIndicator from '../../../color-indicator'; -import ColorPalette from '../../../color-palette'; -import Dropdown from '../../../dropdown'; -import Panel from '../../../panel'; -import { FlexItem } from '../../../flex'; -import { HStack } from '../../../h-stack'; -import { Item, ItemGroup } from '../../../item-group'; -import { ToolsPanel, ToolsPanelItem, ToolsPanelContext } from '../..'; -import { - createSlotFill, - Provider as SlotFillProvider, -} from '../../../slot-fill'; -import { useCx } from '../../../utils'; - -// Available border colors. -const colors = [ - { name: 'Gray 0', color: '#f6f7f7' }, - { name: 'Gray 5', color: '#dcdcde' }, - { name: 'Gray 20', color: '#a7aaad' }, - { name: 'Gray 70', color: '#3c434a' }, - { name: 'Gray 100', color: '#101517' }, - { name: 'Blue 20', color: '#72aee6' }, - { name: 'Blue 40', color: '#3582c4' }, - { name: 'Blue 70', color: '#0a4b78' }, - { name: 'Red 40', color: '#e65054' }, - { name: 'Red 70', color: '#8a2424' }, - { name: 'Green 10', color: '#68de7c' }, - { name: 'Green 40', color: '#00a32a' }, - { name: 'Green 60', color: '#007017' }, - { name: 'Yellow 10', color: '#f2d675' }, - { name: 'Yellow 40', color: '#bd8600' }, -]; -const panelId = 'unique-tools-panel-id'; - -const { Fill, Slot } = createSlotFill( 'ToolsPanelSlot' ); - -// This storybook example aims to replicate a virtual bubbling SlotFill use case -// for the `ToolsPanel` when the Slot itself is an `ItemGroup`. - -// In this scenario the `ToolsPanel` has to render item placeholders so fills -// maintain their order in the DOM. These placeholders in the DOM prevent the -// normal styling of the `ItemGroup` in particular the border radii on the first -// and last items. In case consumers of the ItemGroup and ToolsPanel are -// applying their own styles to these components, the ToolsPanel needs to assist -// consumers in identifying which of its visible items are first and last. - -// This custom fill is required to re-establish the ToolsPanelContext for -// injected ToolsPanelItem components as they will not have access to the React -// Context as the Provider is part of the ToolsPanelItems.Slot tree. -const ToolsPanelItems = ( { children } ) => { - return ( - - { ( fillProps ) => ( - - { children } - - ) } - - ); -}; - -// This fetches the ToolsPanelContext and passes it through `fillProps` so that -// rendered fills can re-establish the `ToolsPanelContext.Provider`. -const SlotContainer = ( { Slot: ToolsPanelSlot, ...props } ) => { - const toolsPanelContext = useContext( ToolsPanelContext ); - - return ( - - ); -}; - -// This wraps the slot with a `ToolsPanel` mimicking a real-world use case from -// the block editor. -ToolsPanelItems.Slot = ( { resetAll, ...props } ) => ( - - - -); - -export const ToolsPanelWithItemGroupSlot = () => { - const [ attributes, setAttributes ] = useState( {} ); - const { text, background, link } = attributes; - - const cx = useCx(); - const slotWrapperClassName = cx( SlotWrapper ); - const itemClassName = cx( ToolsPanelItemClass ); - - const resetAll = ( resetFilters = [] ) => { - let newAttributes = {}; - - resetFilters.forEach( ( resetFilter ) => { - newAttributes = { - ...newAttributes, - ...resetFilter( newAttributes ), - }; - } ); - - setAttributes( newAttributes ); - }; - - const updateAttribute = ( name, value ) => { - setAttributes( { - ...attributes, - [ name ]: value, - } ); - }; - - const ToolsPanelColorDropdown = ( { attribute, label, value } ) => { - return ( - !! value } - label={ label } - onDeselect={ () => updateAttribute( attribute, undefined ) } - resetAllFilter={ () => ( { [ attribute ]: undefined } ) } - panelId={ panelId } - as={ Item } - > - ( - - ) } - renderContent={ () => ( - - updateAttribute( attribute, newColor ) - } - /> - ) } - /> - - ); - }; - - // ToolsPanelItems are rendered via two different fills to simulate - // injection from multiple locations. - return ( - - - - - - - - - - - - - - - ); -}; - -const PanelWrapperView = styled.div` - font-size: 13px; - - .components-dropdown-menu__menu { - max-width: 220px; - } -`; - -const SlotWrapper = css` - &&& { - row-gap: 0; - border-radius: 20px; - } - - > div { - grid-column: span 2; - border-radius: inherit; - } -`; - -const ToolsPanelItemClass = css` - padding: 0; - - &&.first { - border-top-left-radius: inherit; - border-top-right-radius: inherit; - } - - &.last { - border-bottom-left-radius: inherit; - border-bottom-right-radius: inherit; - border-bottom-color: transparent; - } - && > div, - && > div > button { - width: 100%; - border-radius: inherit; - } -`; diff --git a/packages/components/src/tools-panel/tools-panel-item/README.md b/packages/components/src/tools-panel/tools-panel-item/README.md index 85d03f96d1d04..91f9c78ff9cbe 100644 --- a/packages/components/src/tools-panel/tools-panel-item/README.md +++ b/packages/components/src/tools-panel/tools-panel-item/README.md @@ -31,7 +31,8 @@ This prop identifies the current item as being displayed by default. This means it will show regardless of whether it has a value set or is toggled on in the panel's menu. -- Required: Yes +- Required: No +- Default: `false` ### `label`: `string` @@ -58,18 +59,19 @@ A callback to take action when this item is selected in the `ToolsPanel` menu. - Required: No -### `panelId`: `string` +### `panelId`: `string | null` Panel items will ensure they are only registering with their intended panel by -comparing the `panelId` props set on both the item and the panel itself. This +comparing the `panelId` props set on both the item and the panel itself, or if the `panelId` is explicitly `null`. This allows items to be injected from a shared source. - Required: No -### `resetAllFilter`: `() => void` +### `resetAllFilter`: `( attributes?: any ) => any` A `ToolsPanel` will collect each item's `resetAllFilter` and pass an array of these functions through to the panel's `resetAll` callback. They can then be iterated over to perform additional tasks. - Required: No +- Default: `() => {}` diff --git a/packages/components/src/tools-panel/tools-panel-item/component.tsx b/packages/components/src/tools-panel/tools-panel-item/component.tsx index b0cc12c0f19fd..f66d3845ff083 100644 --- a/packages/components/src/tools-panel/tools-panel-item/component.tsx +++ b/packages/components/src/tools-panel/tools-panel-item/component.tsx @@ -13,7 +13,7 @@ import type { ToolsPanelItemProps } from '../types'; // This wraps controls to be conditionally displayed within a tools panel. It // prevents props being applied to HTML elements that would make them invalid. -const ToolsPanelItem = ( +const UnconnectedToolsPanelItem = ( props: WordPressComponentProps< ToolsPanelItemProps, 'div' >, forwardedRef: ForwardedRef< any > ) => { @@ -37,9 +37,9 @@ const ToolsPanelItem = ( ); }; -const ConnectedToolsPanelItem = contextConnect( - ToolsPanelItem, +export const ToolsPanelItem = contextConnect( + UnconnectedToolsPanelItem, 'ToolsPanelItem' ); -export default ConnectedToolsPanelItem; +export default ToolsPanelItem; diff --git a/packages/components/src/tools-panel/tools-panel-item/hook.ts b/packages/components/src/tools-panel/tools-panel-item/hook.ts index c0b5572fee0d1..84572fba451a5 100644 --- a/packages/components/src/tools-panel/tools-panel-item/hook.ts +++ b/packages/components/src/tools-panel/tools-panel-item/hook.ts @@ -13,16 +13,18 @@ import { useContextSystem, WordPressComponentProps } from '../../ui/context'; import { useCx } from '../../utils/hooks/use-cx'; import type { ToolsPanelItemProps } from '../types'; +const noop = () => {}; + export function useToolsPanelItem( props: WordPressComponentProps< ToolsPanelItemProps, 'div' > ) { const { className, hasValue, - isShownByDefault, + isShownByDefault = false, label, panelId, - resetAllFilter, + resetAllFilter = noop, onDeselect, onSelect, ...otherProps diff --git a/packages/components/src/tools-panel/tools-panel/README.md b/packages/components/src/tools-panel/tools-panel/README.md index e04b774e9201b..6802a6436875a 100644 --- a/packages/components/src/tools-panel/tools-panel/README.md +++ b/packages/components/src/tools-panel/tools-panel/README.md @@ -155,6 +155,7 @@ Flags that the items in this ToolsPanel will be contained within an inner wrapper element allowing the panel to lay them out accordingly. - Required: No +- Default: `false` ### `headingLevel`: `1 | 2 | 3 | 4 | 5 | 6 | '1' | '2' | '3' | '4' | '5' | '6'` @@ -170,7 +171,7 @@ panel's dropdown menu. - Required: Yes -### `panelId`: `string` +### `panelId`: `string | null` If a `panelId` is set, it is passed through the `ToolsPanelContext` and used to restrict panel items. When a `panelId` is set, items can only register @@ -179,10 +180,9 @@ exactly. - Required: No -### `resetAll`: `() => void` +### `resetAll`: `( filters?: ResetAllFilter[] ) => void` -A function to call when the `Reset all` menu option is selected. This is passed -through to the panel's header component. +A function to call when the `Reset all` menu option is selected. As an argument, it receives an array containing the `resetAllFilter` callbacks of all the valid registered `ToolsPanelItems`. - Required: Yes @@ -192,3 +192,4 @@ Advises the `ToolsPanel` that all of its `ToolsPanelItem` children should render placeholder content (instead of `null`) when they are toggled off and hidden. - Required: No +- Default: `false` diff --git a/packages/components/src/tools-panel/tools-panel/component.tsx b/packages/components/src/tools-panel/tools-panel/component.tsx index 929868e3f1f8c..c6f3a9ce5469d 100644 --- a/packages/components/src/tools-panel/tools-panel/component.tsx +++ b/packages/components/src/tools-panel/tools-panel/component.tsx @@ -13,7 +13,7 @@ import { Grid } from '../../grid'; import { contextConnect, WordPressComponentProps } from '../../ui/context'; import type { ToolsPanelProps } from '../types'; -const ToolsPanel = ( +const UnconnectedToolsPanel = ( props: WordPressComponentProps< ToolsPanelProps, 'div' >, forwardedRef: ForwardedRef< any > ) => { @@ -42,6 +42,58 @@ const ToolsPanel = ( ); }; -const ConnectedToolsPanel = contextConnect( ToolsPanel, 'ToolsPanel' ); +/** + * The `ToolsPanel` is a container component that displays its children preceded + * by a header. The header includes a dropdown menu which is automatically + * generated from the panel's inner `ToolsPanelItems`. + * + * @example + * ```jsx + * import { __ } from '@wordpress/i18n'; + * import { + * __experimentalToolsPanel as ToolsPanel, + * __experimentalToolsPanelItem as ToolsPanelItem, + * __experimentalUnitControl as UnitControl + * } from '@wordpress/components'; + * + * function Example() { + * const [ height, setHeight ] = useState(); + * const [ width, setWidth ] = useState(); + * + * const resetAll = () => { + * setHeight(); + * setWidth(); + * } + * + * return ( + * + * !! height } + * label={ __( 'Height' ) } + * onDeselect={ () => setHeight() } + * > + * + * + * !! width } + * label={ __( 'Width' ) } + * onDeselect={ () => setWidth() } + * > + * + * + * + * ); + * } + * ``` + */ +export const ToolsPanel = contextConnect( UnconnectedToolsPanel, 'ToolsPanel' ); -export default ConnectedToolsPanel; +export default ToolsPanel; diff --git a/packages/components/src/tools-panel/tools-panel/hook.ts b/packages/components/src/tools-panel/tools-panel/hook.ts index 38751ecb951ad..66b91f0ee671f 100644 --- a/packages/components/src/tools-panel/tools-panel/hook.ts +++ b/packages/components/src/tools-panel/tools-panel/hook.ts @@ -59,8 +59,8 @@ export function useToolsPanel( headingLevel = 2, resetAll, panelId, - hasInnerWrapper, - shouldRenderPlaceholderItems, + hasInnerWrapper = false, + shouldRenderPlaceholderItems = false, __experimentalFirstVisibleItemClass, __experimentalLastVisibleItemClass, ...otherProps diff --git a/packages/components/src/tools-panel/types.ts b/packages/components/src/tools-panel/types.ts index ed846c900b18e..86a8c1579b9b5 100644 --- a/packages/components/src/tools-panel/types.ts +++ b/packages/components/src/tools-panel/types.ts @@ -8,7 +8,7 @@ import type { ReactNode } from 'react'; */ import type { HeadingSize } from '../heading/types'; -type ResetAllFilter = () => void; +type ResetAllFilter = ( attributes?: any ) => any; type ResetAll = ( filters?: ResetAllFilter[] ) => void; export type ToolsPanelProps = { @@ -19,8 +19,10 @@ export type ToolsPanelProps = { /** * Flags that the items in this ToolsPanel will be contained within an inner * wrapper element allowing the panel to lay them out accordingly. + * + * @default false */ - hasInnerWrapper: boolean; + hasInnerWrapper?: boolean; /** * The heading level of the panel's header. * @@ -34,20 +36,24 @@ export type ToolsPanelProps = { label: string; /** * If a `panelId` is set, it is passed through the `ToolsPanelContext` and - * used to restrict panel items. Only items with a matching `panelId` will - * be able to register themselves with this panel. + * used to restrict panel items. When a `panelId` is set, items can only + * register themselves if the `panelId` is explicitly `null` or the item's + * `panelId` matches exactly. */ - panelId: string; + panelId?: string | null; /** - * A function to call when the `Reset all` menu option is selected. This is - * passed through to the panel's header component. + * A function to call when the `Reset all` menu option is selected. As an + * argument, it receives an array containing the `resetAllFilter` callbacks + * of all the valid registered `ToolsPanelItems`. */ resetAll: ResetAll; /** * Advises the `ToolsPanel` that its child `ToolsPanelItem`s should render * placeholder content instead of null when they are toggled off and hidden. + * + * @default false */ - shouldRenderPlaceholderItems: boolean; + shouldRenderPlaceholderItems?: boolean; /** * Experimental prop allowing for a custom CSS class to be applied to the * first visible `ToolsPanelItem` within the `ToolsPanel`. @@ -96,8 +102,10 @@ export type ToolsPanelItem = { * This prop identifies the current item as being displayed by default. This * means it will show regardless of whether it has a value set or is toggled * on in the panel's menu. + * + * @default false */ - isShownByDefault: boolean; + isShownByDefault?: boolean; /** * The supplied label is dual purpose. It is used as: * 1. the human-readable label for the panel's dropdown menu @@ -108,17 +116,20 @@ export type ToolsPanelItem = { */ label: string; /** - * Panel items will ensure they are only registering with their intended - * panel by comparing the `panelId` props set on both the item and the panel - * itself. This allows items to be injected from a shared source. + * Panel items will ensure they are only registering with their intended panel + * by comparing the `panelId` props set on both the item and the panel itself, + * or if the `panelId` is explicitly `null`. This allows items to be injected + * from a shared source. */ - panelId: string; + panelId?: string | null; /** * A `ToolsPanel` will collect each item's `resetAllFilter` and pass an * array of these functions through to the panel's `resetAll` callback. They * can then be iterated over to perform additional tasks. + * + * @default noop */ - resetAllFilter: ResetAllFilter; + resetAllFilter?: ResetAllFilter; }; export type ToolsPanelItemProps = ToolsPanelItem & { @@ -145,7 +156,7 @@ export type ToolsPanelMenuItems = { }; export type ToolsPanelContext = { - panelId?: string; + panelId?: string | null; menuItems: ToolsPanelMenuItems; hasMenuItems: boolean; registerPanelItem: ( item: ToolsPanelItem ) => void; From 1eea892f47c6e027bfae351ebf80153357a604e5 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Mon, 13 Feb 2023 17:52:42 +0900 Subject: [PATCH 12/76] Fix: Remove browser default border for iframe in the editor (#47987) --- packages/block-library/src/editor.scss | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss index edb66416af88c..0b9e3e451337e 100644 --- a/packages/block-library/src/editor.scss +++ b/packages/block-library/src/editor.scss @@ -93,3 +93,8 @@ * These are only output in the editor, but styles here are NOT prefixed .editor-styles-wrapper. * This allows us to create normalization styles that are easily overridden by editor styles. */ + +// Remove the browser default border for iframe in Custom HTML block, Embed block, etc. +.editor-styles-wrapper iframe:not([frameborder]) { + border: 0; +} From f1bc31a4381f55c160868e9d00ff1b8e3d7e42e3 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Mon, 13 Feb 2023 18:14:50 +0900 Subject: [PATCH 13/76] Distraction free mode: Fix keyboard shortcut not working (#47900) * Distraction free mode: Fix keyboard shortcut not working on Windows * Include mac --- packages/keycodes/src/index.js | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/packages/keycodes/src/index.js b/packages/keycodes/src/index.js index 2aa1cb70fa3f3..cd31fef5fa719 100644 --- a/packages/keycodes/src/index.js +++ b/packages/keycodes/src/index.js @@ -390,6 +390,14 @@ export const isKeyboardEvent = mapValues( ) => { const mods = getModifiers( _isApple ); const eventMods = getEventModifiers( event ); + /** @type {Record} */ + const replacementWithShiftKeyMap = { + Comma: ',', + Backslash: '\\', + // Windows returns `\` for both IntlRo and IntlYen. + IntlRo: '\\', + IntlYen: '\\', + }; const modsDiff = mods.filter( ( mod ) => ! eventMods.includes( mod ) @@ -412,16 +420,17 @@ export const isKeyboardEvent = mapValues( key = String.fromCharCode( event.keyCode ).toLowerCase(); } - // Replace some characters to match the key indicated - // by the shortcut on Windows. - if ( ! _isApple() ) { - if ( - event.shiftKey && - character.length === 1 && - event.code === 'Comma' - ) { - key = ','; - } + // `event.key` returns the value of the key pressed, taking into the state of + // modifier keys such as `Shift`. If the shift key is pressed, a different + // value may be returned depending on the keyboard layout. It is necessary to + // convert to the physical key value that don't take into account keyboard + // layout or modifier key state. + if ( + event.shiftKey && + character.length === 1 && + replacementWithShiftKeyMap[ event.code ] + ) { + key = replacementWithShiftKeyMap[ event.code ]; } // For backwards compatibility. From a1fd207256fdd70e71750ca48a27ae37aa0c5c31 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Mon, 13 Feb 2023 09:20:09 +0000 Subject: [PATCH 14/76] Handle block metadata attribute and related experimental APIs (#47791) * Move PHP attribute registration to experiments dir * Limit __experimentalMetadata to Core blocks * fix check --------- Co-authored-by: ntsekouras --- lib/compat/wordpress-6.1/blocks.php | 25 --------------------- lib/experimental/blocks.php | 23 +++++++++++++++++++ packages/block-editor/src/hooks/metadata.js | 4 ++++ 3 files changed, 27 insertions(+), 25 deletions(-) diff --git a/lib/compat/wordpress-6.1/blocks.php b/lib/compat/wordpress-6.1/blocks.php index 3aa790dadcb1c..e8093961896a4 100644 --- a/lib/compat/wordpress-6.1/blocks.php +++ b/lib/compat/wordpress-6.1/blocks.php @@ -323,28 +323,3 @@ function gutenberg_block_type_metadata_render_template( $settings, $metadata ) { return $settings; } add_filter( 'block_type_metadata_settings', 'gutenberg_block_type_metadata_render_template', 10, 2 ); - -/** - * Registers the metadata block attribute for block types. - * - * Once 6.1 is the minimum supported WordPress version for the Gutenberg - * plugin, this shim can be removed - * - * @param array $args Array of arguments for registering a block type. - * @return array $args - */ -function gutenberg_register_metadata_attribute( $args ) { - // Setup attributes if needed. - if ( ! isset( $args['attributes'] ) || ! is_array( $args['attributes'] ) ) { - $args['attributes'] = array(); - } - - if ( ! array_key_exists( 'metadata', $args['attributes'] ) ) { - $args['attributes']['metadata'] = array( - 'type' => 'object', - ); - } - - return $args; -} -add_filter( 'register_block_type_args', 'gutenberg_register_metadata_attribute' ); diff --git a/lib/experimental/blocks.php b/lib/experimental/blocks.php index b789deaba6ed5..a33d2f6b98012 100644 --- a/lib/experimental/blocks.php +++ b/lib/experimental/blocks.php @@ -77,3 +77,26 @@ function wp_enqueue_block_view_script( $block_name, $args ) { add_filter( 'render_block', $callback, 10, 2 ); } } + + +/** + * Registers the metadata block attribute for block types. + * + * @param array $args Array of arguments for registering a block type. + * @return array $args + */ +function gutenberg_register_metadata_attribute( $args ) { + // Setup attributes if needed. + if ( ! isset( $args['attributes'] ) || ! is_array( $args['attributes'] ) ) { + $args['attributes'] = array(); + } + + if ( ! array_key_exists( 'metadata', $args['attributes'] ) ) { + $args['attributes']['metadata'] = array( + 'type' => 'object', + ); + } + + return $args; +} +add_filter( 'register_block_type_args', 'gutenberg_register_metadata_attribute' ); diff --git a/packages/block-editor/src/hooks/metadata.js b/packages/block-editor/src/hooks/metadata.js index 9f39082f46d85..918f4f80ee9c2 100644 --- a/packages/block-editor/src/hooks/metadata.js +++ b/packages/block-editor/src/hooks/metadata.js @@ -7,6 +7,10 @@ import { getBlockSupport } from '@wordpress/blocks'; const META_ATTRIBUTE_NAME = 'metadata'; export function hasBlockMetadataSupport( blockType, feature = '' ) { + // Only core blocks are allowed to use __experimentalMetadata until the fetaure is stablised. + if ( ! blockType.name.startsWith( 'core/' ) ) { + return false; + } const support = getBlockSupport( blockType, '__experimentalMetadata' ); return !! ( true === support || support?.[ feature ] ); } From 96d601bf01b067faa6b1c6a3d55087a53519ed2d Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Mon, 13 Feb 2023 10:40:28 +0000 Subject: [PATCH 15/76] Remove out of the loop (#47981) --- packages/block-library/src/page-list/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/page-list/index.php b/packages/block-library/src/page-list/index.php index efc73ad3a0a48..62160cb2051e5 100644 --- a/packages/block-library/src/page-list/index.php +++ b/packages/block-library/src/page-list/index.php @@ -150,7 +150,8 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click, if ( empty( $nested_pages ) ) { return; } - $markup = ''; + $front_page_id = (int) get_option( 'page_on_front' ); + $markup = ''; foreach ( (array) $nested_pages as $page ) { $css_class = $page['is_active'] ? ' current-menu-item' : ''; $aria_current = $page['is_active'] ? ' aria-current="page"' : ''; @@ -181,7 +182,6 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click, } } - $front_page_id = (int) get_option( 'page_on_front' ); if ( (int) $page['page_id'] === $front_page_id ) { $css_class .= ' menu-item-home'; } From 8d11d2b3d31c28278650fdf2d198d4f64b27420c Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Mon, 13 Feb 2023 10:41:00 +0000 Subject: [PATCH 16/76] Use post object instead of id. (#48004) --- packages/block-library/src/page-list/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/page-list/index.php b/packages/block-library/src/page-list/index.php index 62160cb2051e5..b9ef8bf745a73 100644 --- a/packages/block-library/src/page-list/index.php +++ b/packages/block-library/src/page-list/index.php @@ -282,14 +282,14 @@ function render_block_core_page_list( $attributes, $content, $block ) { $pages_with_children[ $page->post_parent ][ $page->ID ] = array( 'page_id' => $page->ID, 'title' => $page->post_title, - 'link' => get_permalink( $page->ID ), + 'link' => get_permalink( $page ), 'is_active' => $is_active, ); } else { $top_level_pages[ $page->ID ] = array( 'page_id' => $page->ID, 'title' => $page->post_title, - 'link' => get_permalink( $page->ID ), + 'link' => get_permalink( $page ), 'is_active' => $is_active, ); From 30d825812a420b8a104c22e4c6090fc94b6d357a Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Mon, 13 Feb 2023 15:05:35 +0400 Subject: [PATCH 17/76] Edit Post: Fix the 'inlineToolbar' settings toggle (#47960) --- packages/edit-post/src/editor.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/edit-post/src/editor.js b/packages/edit-post/src/editor.js index 79bd55317f91f..e173d80098b24 100644 --- a/packages/edit-post/src/editor.js +++ b/packages/edit-post/src/editor.js @@ -139,6 +139,7 @@ function Editor( { postId, postType, settings, initialEdits, ...props } ) { }, [ settings, hasFixedToolbar, + hasInlineToolbar, focusMode, isDistractionFree, hiddenBlockTypes, From b071855aba0cd70c3237d3d9a2efe0549729a9b2 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 13 Feb 2023 12:31:40 +0100 Subject: [PATCH 18/76] Add a nested level when selecting templates or template parts (#47777) --- lib/compat/wordpress-6.3/site-editor.php | 27 +++ lib/load.php | 3 + .../e2e-test-utils-playwright/src/index.ts | 1 - .../src/site-editor/index.ts | 23 --- .../src/site-editor/toggle-canvas-mode.js | 8 - .../e2e-test-utils-playwright/src/test.ts | 6 +- packages/e2e-test-utils/src/site-editor.js | 10 +- .../specs/performance/site-editor.test.js | 6 +- .../site-editor/multi-entity-saving.test.js | 2 + .../site-editor/settings-sidebar.test.js | 1 + .../edit-site/src/components/layout/index.js | 81 ++++---- .../src/components/layout/style.scss | 34 ++-- .../edit-site/src/components/list/table.js | 4 + .../index.js | 1 - .../index.js | 52 +++++ .../index.js | 31 +++ .../index.js | 70 +++---- .../sidebar-navigation-screen/index.js | 11 +- .../sidebar-navigation-screen/style.scss | 3 +- .../edit-site/src/components/sidebar/index.js | 10 +- .../src/components/site-hub/index.js | 187 +++++++----------- .../src/components/site-hub/style.scss | 12 +- .../use-init-edited-entity-from-url.js | 62 ++++-- ...-with-url.js => use-sync-path-with-url.js} | 20 +- .../use-edited-entity-record/index.js | 8 +- .../edit-site/src/utils/get-is-list-page.js | 10 +- .../block-list-panel-preference.spec.js | 5 +- .../site-editor/iframe-rendering.spec.js | 1 + .../site-editor/push-to-global-styles.spec.js | 4 +- .../site-editor/site-editor-inserter.spec.js | 4 +- test/e2e/specs/site-editor/style-book.spec.js | 4 +- .../site-editor/style-variations.spec.js | 25 ++- .../specs/site-editor/template-part.spec.js | 35 ++-- .../specs/site-editor/template-revert.spec.js | 7 +- test/e2e/specs/site-editor/title.spec.js | 15 +- .../specs/site-editor/writing-flow.spec.js | 8 +- 36 files changed, 406 insertions(+), 385 deletions(-) create mode 100644 lib/compat/wordpress-6.3/site-editor.php delete mode 100644 packages/e2e-test-utils-playwright/src/site-editor/index.ts delete mode 100644 packages/e2e-test-utils-playwright/src/site-editor/toggle-canvas-mode.js create mode 100644 packages/edit-site/src/components/sidebar-navigation-screen-template/index.js create mode 100644 packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js rename packages/edit-site/src/components/sync-state-with-url/{use-sync-sidebar-path-with-url.js => use-sync-path-with-url.js} (62%) diff --git a/lib/compat/wordpress-6.3/site-editor.php b/lib/compat/wordpress-6.3/site-editor.php new file mode 100644 index 0000000000000..2cfde082554c4 --- /dev/null +++ b/lib/compat/wordpress-6.3/site-editor.php @@ -0,0 +1,27 @@ + 'none' ), + admin_url( 'site-editor.php' ) + ); + } + + return $location; +} + +add_filter( 'wp_redirect', 'gutenberg_prevent_site_editor_redirection', 1 ); diff --git a/lib/load.php b/lib/load.php index dc253408a9289..38839d047a455 100644 --- a/lib/load.php +++ b/lib/load.php @@ -101,6 +101,9 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/compat/wordpress-6.2/html-api/class-wp-html-tag-processor.php'; } +// WordPress 6.3 compat. +require __DIR__ . '/compat/wordpress-6.3/site-editor.php'; + // Experimental features. remove_action( 'plugins_loaded', '_wp_theme_json_webfonts_handler' ); // Turns off WP 6.0's stopgap handler for Webfonts API. require __DIR__ . '/experimental/block-editor-settings-mobile.php'; diff --git a/packages/e2e-test-utils-playwright/src/index.ts b/packages/e2e-test-utils-playwright/src/index.ts index eb87d3b798751..9f283017f1016 100644 --- a/packages/e2e-test-utils-playwright/src/index.ts +++ b/packages/e2e-test-utils-playwright/src/index.ts @@ -3,5 +3,4 @@ export { Admin } from './admin'; export { Editor } from './editor'; export { PageUtils } from './page-utils'; export { RequestUtils } from './request-utils'; -export { SiteEditor } from './site-editor'; export { test, expect } from './test'; diff --git a/packages/e2e-test-utils-playwright/src/site-editor/index.ts b/packages/e2e-test-utils-playwright/src/site-editor/index.ts deleted file mode 100644 index 740dc56d31496..0000000000000 --- a/packages/e2e-test-utils-playwright/src/site-editor/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -/** - * External dependencies - */ -import type { Page } from '@playwright/test'; - -/** - * Internal dependencies - */ -import { enterEditMode } from './toggle-canvas-mode'; - -type AdminConstructorProps = { - page: Page; -}; - -export class SiteEditor { - page: Page; - - constructor( { page }: AdminConstructorProps ) { - this.page = page; - } - - enterEditMode = enterEditMode.bind( this ); -} diff --git a/packages/e2e-test-utils-playwright/src/site-editor/toggle-canvas-mode.js b/packages/e2e-test-utils-playwright/src/site-editor/toggle-canvas-mode.js deleted file mode 100644 index 01340eb085d88..0000000000000 --- a/packages/e2e-test-utils-playwright/src/site-editor/toggle-canvas-mode.js +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Enters the site editor edit mode. - * - * @this {import('.').SiteEditor} - */ -export async function enterEditMode() { - await this.page.click( '.edit-site-site-hub__edit-button' ); -} diff --git a/packages/e2e-test-utils-playwright/src/test.ts b/packages/e2e-test-utils-playwright/src/test.ts index 5e62c2d3e172c..b26117ff077ff 100644 --- a/packages/e2e-test-utils-playwright/src/test.ts +++ b/packages/e2e-test-utils-playwright/src/test.ts @@ -8,7 +8,7 @@ import type { ConsoleMessage } from '@playwright/test'; /** * Internal dependencies */ -import { Admin, Editor, PageUtils, RequestUtils, SiteEditor } from './index'; +import { Admin, Editor, PageUtils, RequestUtils } from './index'; const STORAGE_STATE_PATH = process.env.STORAGE_STATE_PATH || @@ -102,7 +102,6 @@ const test = base.extend< editor: Editor; pageUtils: PageUtils; snapshotConfig: void; - siteEditor: SiteEditor; }, { requestUtils: RequestUtils; @@ -114,9 +113,6 @@ const test = base.extend< editor: async ( { page }, use ) => { await use( new Editor( { page } ) ); }, - siteEditor: async ( { page }, use ) => { - await use( new SiteEditor( { page } ) ); - }, page: async ( { page }, use ) => { page.on( 'console', observeConsoleLogging ); diff --git a/packages/e2e-test-utils/src/site-editor.js b/packages/e2e-test-utils/src/site-editor.js index 425931ccf9cbc..bccbb51057912 100644 --- a/packages/e2e-test-utils/src/site-editor.js +++ b/packages/e2e-test-utils/src/site-editor.js @@ -1,7 +1,7 @@ /** * WordPress dependencies */ -import { visitAdminPage } from '@wordpress/e2e-test-utils'; +import { canvas, visitAdminPage } from '@wordpress/e2e-test-utils'; import { addQueryArgs } from '@wordpress/url'; /** @@ -166,11 +166,13 @@ export async function openPreviousGlobalStylesPanel() { * Enters edit mode. */ export async function enterEditMode() { - const editSiteToggle = await page.$( '.edit-site-site-hub__edit-button' ); + const isViewMode = await page.$( + '.edit-site-visual-editor__editor-canvas[role="button"]' + ); // This check is necessary for the performance tests in old branches // where the site editor toggle was not implemented yet. - if ( ! editSiteToggle ) { + if ( ! isViewMode ) { return; } - await page.click( '.edit-site-site-hub__edit-button' ); + await canvas().click( 'body' ); } diff --git a/packages/e2e-tests/specs/performance/site-editor.test.js b/packages/e2e-tests/specs/performance/site-editor.test.js index cd071f0be5a85..2e4002bf0bb1c 100644 --- a/packages/e2e-tests/specs/performance/site-editor.test.js +++ b/packages/e2e-tests/specs/performance/site-editor.test.js @@ -87,7 +87,11 @@ describe( 'Site Editor Performance', () => { } ); beforeEach( async () => { - await visitSiteEditor( { postId: id, postType: 'page' } ); + await visitSiteEditor( { + postId: id, + postType: 'page', + path: '/navigation/single', + } ); } ); it( 'Loading', async () => { diff --git a/packages/e2e-tests/specs/site-editor/multi-entity-saving.test.js b/packages/e2e-tests/specs/site-editor/multi-entity-saving.test.js index fa039fb10fd2e..30b634712119a 100644 --- a/packages/e2e-tests/specs/site-editor/multi-entity-saving.test.js +++ b/packages/e2e-tests/specs/site-editor/multi-entity-saving.test.js @@ -265,6 +265,7 @@ describe( 'Multi-entity save flow', () => { await visitSiteEditor( { postId: 'emptytheme//index', postType: 'wp_template', + path: '/templates/single', } ); await enterEditMode(); @@ -304,6 +305,7 @@ describe( 'Multi-entity save flow', () => { await visitSiteEditor( { postId: 'emptytheme//index', postType: 'wp_template', + path: '/templates/single', } ); await enterEditMode(); diff --git a/packages/e2e-tests/specs/site-editor/settings-sidebar.test.js b/packages/e2e-tests/specs/site-editor/settings-sidebar.test.js index 3428ddd654023..c1d4a755a7c57 100644 --- a/packages/e2e-tests/specs/site-editor/settings-sidebar.test.js +++ b/packages/e2e-tests/specs/site-editor/settings-sidebar.test.js @@ -69,6 +69,7 @@ describe( 'Settings sidebar', () => { await visitSiteEditor( { postId: 'emptytheme//singular', postType: 'wp_template', + path: '/templates/single', } ); await enterEditMode(); const templateCardAfterNavigation = await getTemplateCard(); diff --git a/packages/edit-site/src/components/layout/index.js b/packages/edit-site/src/components/layout/index.js index 7c30496abd7c4..5beb5259d5b16 100644 --- a/packages/edit-site/src/components/layout/index.js +++ b/packages/edit-site/src/components/layout/index.js @@ -19,7 +19,7 @@ import { useResizeObserver, } from '@wordpress/compose'; import { __ } from '@wordpress/i18n'; -import { useState, useEffect, useRef } from '@wordpress/element'; +import { useState, useRef } from '@wordpress/element'; import { NavigableRegion } from '@wordpress/interface'; import { store as keyboardShortcutsStore } from '@wordpress/keyboard-shortcuts'; @@ -87,21 +87,20 @@ export default function Layout() { } ); const disableMotion = useReducedMotion(); const isMobileViewport = useViewportMatch( 'medium', '<' ); - const [ isMobileCanvasVisible, setIsMobileCanvasVisible ] = - useState( false ); const canvasPadding = isMobileViewport ? 0 : 24; const showSidebar = - ( isMobileViewport && ! isMobileCanvasVisible ) || + ( isMobileViewport && ! isListPage ) || ( ! isMobileViewport && ( canvasMode === 'view' || ! isEditorPage ) ); const showCanvas = - ( isMobileViewport && isMobileCanvasVisible ) || ! isMobileViewport; + ( isMobileViewport && isEditorPage && canvasMode === 'edit' ) || + ! isMobileViewport || + ! isEditorPage; const showFrame = - ! isEditorPage || ( canvasMode === 'view' && ! isMobileViewport ); - + ( ! isEditorPage && ! isMobileViewport ) || + ( ! isMobileViewport && isEditorPage && canvasMode === 'view' ); const isFullCanvas = - ( isEditorPage && canvasMode === 'edit' && ! isMobileViewport ) || - isMobileCanvasVisible; - // Ideally this effect could be removed if we move the "isMobileCanvasVisible" into the store. + ( isMobileViewport && isListPage ) || + ( isEditorPage && canvasMode === 'edit' ); const [ canvasResizer, canvasSize ] = useResizeObserver(); const [ fullResizer, fullSize ] = useResizeObserver(); const [ forcedWidth, setForcedWidth ] = useState( null ); @@ -112,15 +111,6 @@ export default function Layout() { if ( showFrame && ! isResizing ) { canvasWidth = canvasSize.width - canvasPadding; } - useEffect( () => { - if ( canvasMode === 'view' && isMobileViewport ) { - setIsMobileCanvasVisible( false ); - } - - if ( canvasMode === 'edit' && isMobileViewport ) { - setIsMobileCanvasVisible( true ); - } - }, [ canvasMode, isMobileViewport ] ); // Synchronizing the URL with the store value of canvasMode happens in an effect // This condition ensures the component is only rendered after the synchronization happens @@ -153,37 +143,34 @@ export default function Layout() { ? forcedWidth - 48 : undefined, } } - isMobileCanvasVisible={ isMobileCanvasVisible } - setIsMobileCanvasVisible={ setIsMobileCanvasVisible } /> - { isEditorPage && - ( canvasMode === 'edit' || isMobileCanvasVisible ) && ( - - { canvasMode === 'edit' &&
} - - ) } + { isEditorPage && canvasMode === 'edit' && ( + + { canvasMode === 'edit' &&
} + + ) }
diff --git a/packages/edit-site/src/components/layout/style.scss b/packages/edit-site/src/components/layout/style.scss index 0957bfa20bafb..f9837e5fa3c84 100644 --- a/packages/edit-site/src/components/layout/style.scss +++ b/packages/edit-site/src/components/layout/style.scss @@ -1,5 +1,3 @@ -$hub-height: $grid-unit-20 * 2 + $button-size; - .edit-site-layout { height: 100%; background: $gray-900; @@ -10,24 +8,23 @@ $hub-height: $grid-unit-20 * 2 + $button-size; .edit-site-layout__hub { position: fixed; - top: $canvas-padding; - left: $canvas-padding; + top: 0; + left: 0; width: calc(100vw - #{$canvas-padding * 2}); - height: $hub-height; + height: $header-height; z-index: z-index(".edit-site-layout__hub"); - background: $black; - padding: $grid-unit-20; - padding-left: 0; - border-radius: $radius-block-ui * 4; - box-shadow: $shadow-modal; + .edit-site-layout.is-full-canvas.is-edit-mode & { + width: auto; + padding-right: 0; + } + + @include break-medium { + width: calc(#{$nav-sidebar-width} - #{$canvas-padding * 2}); + } .edit-site-layout.is-full-canvas & { - top: 0; - left: 0; - padding: 0; padding-right: $grid-unit-20; - height: $header-height; border-radius: 0; width: 100vw; box-shadow: none; @@ -37,15 +34,6 @@ $hub-height: $grid-unit-20 * 2 + $button-size; padding-right: 0; } } - - .edit-site-layout.is-full-canvas.is-edit-mode & { - width: auto; - padding-right: 0; - } - - @include break-medium { - width: calc(#{$nav-sidebar-width} - #{$canvas-padding * 2}); - } } .edit-site-layout__header { diff --git a/packages/edit-site/src/components/list/table.js b/packages/edit-site/src/components/list/table.js index d6f2405d76b42..8d561b7e9b818 100644 --- a/packages/edit-site/src/components/list/table.js +++ b/packages/edit-site/src/components/list/table.js @@ -84,6 +84,10 @@ export default function Table( { templateType } ) { diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-template/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-template/index.js new file mode 100644 index 0000000000000..043cee5dd3f2a --- /dev/null +++ b/packages/edit-site/src/components/sidebar-navigation-screen-template/index.js @@ -0,0 +1,52 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; +import { useDispatch } from '@wordpress/data'; +import { Button } from '@wordpress/components'; + +/** + * Internal dependencies + */ +import SidebarNavigationScreen from '../sidebar-navigation-screen'; +import useEditedEntityRecord from '../use-edited-entity-record'; +import { unlock } from '../../private-apis'; +import { store as editSiteStore } from '../../store'; + +const config = { + wp_template: { + path: '/templates/single', + }, + wp_template_part: { + path: '/template-parts/single', + }, +}; + +export default function SidebarNavigationScreenTemplate( { + postType = 'wp_template', +} ) { + const { setCanvasMode } = unlock( useDispatch( editSiteStore ) ); + const { getDescription, getTitle, record } = useEditedEntityRecord(); + let description = getDescription(); + if ( ! description && record.is_custom ) { + description = __( + 'This is a custom template that can be applied manually to any Post or Page.' + ); + } + + return ( + setCanvasMode( 'edit' ) } + > + { __( 'Edit' ) } + + } + content={ description ?

{ description }

: undefined } + /> + ); +} diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js new file mode 100644 index 0000000000000..b843a9f7d3b6a --- /dev/null +++ b/packages/edit-site/src/components/sidebar-navigation-screen-templates-browse/index.js @@ -0,0 +1,31 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; + +/** + * Internal dependencies + */ +import SidebarNavigationScreen from '../sidebar-navigation-screen'; + +const config = { + wp_template: { + path: '/templates/all', + title: __( 'All templates' ), + }, + wp_template_part: { + path: '/template-parts/all', + title: __( 'All template parts' ), + }, +}; + +export default function SidebarNavigationScreenTemplatesBrowse( { + postType = 'wp_template', +} ) { + return ( + + ); +} diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js index 138cb8ed7bc38..5bba2467c0b73 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js @@ -3,7 +3,6 @@ */ import { __experimentalItemGroup as ItemGroup } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; -import { useSelect } from '@wordpress/data'; import { useEntityRecords } from '@wordpress/core-data'; import { decodeEntities } from '@wordpress/html-entities'; import { useViewportMatch } from '@wordpress/compose'; @@ -14,8 +13,6 @@ import { useViewportMatch } from '@wordpress/compose'; import SidebarNavigationScreen from '../sidebar-navigation-screen'; import { useLink } from '../routes/link'; import SidebarNavigationItem from '../sidebar-navigation-item'; -import { useLocation } from '../routes'; -import { store as editSiteStore } from '../../store'; import AddNewTemplate from '../add-new-template'; function omit( object, keys ) { @@ -24,14 +21,6 @@ function omit( object, keys ) { ); } -const Item = ( { item } ) => { - const linkInfo = useLink( item.params ); - const props = item.params - ? { ...omit( item, 'params' ), ...linkInfo } - : item; - return ; -}; - const config = { wp_template: { path: '/templates', @@ -53,23 +42,22 @@ const config = { }, }; +const Item = ( { item } ) => { + const linkInfo = useLink( { + ...item.params, + path: config[ item.params.postType ].path + '/single', + } ); + const props = item.params + ? { ...omit( item, 'params' ), ...linkInfo } + : item; + return ; +}; + export default function SidebarNavigationScreenTemplates( { postType = 'wp_template', } ) { - const { params } = useLocation(); const isMobileViewport = useViewportMatch( 'medium', '<' ); - // Ideally the URL params would be enough. - // Loading the editor should ideally redirect to the home page - // instead of fetching the edited entity here. - const { editedPostId, editedPostType } = useSelect( ( select ) => { - const { getEditedPostType, getEditedPostId } = select( editSiteStore ); - return { - editedPostId: getEditedPostId(), - editedPostType: getEditedPostType(), - }; - }, [] ); - const { records: templates, isResolving: isLoading } = useEntityRecords( 'postType', postType, @@ -100,22 +88,18 @@ export default function SidebarNavigationScreenTemplates( { children: decodeEntities( template.title?.rendered || template.slug ), - 'aria-current': - ( params.postType === postType && - params.postId === template.id ) || - // This is a special case for the home page. - ( editedPostId === template.id && - editedPostType === postType && - !! params.postId ) - ? 'page' - : undefined, } ) ); } + const browseAllLink = useLink( { + postType, + postId: undefined, + path: config[ postType ].path + '/all', + } ); + return ( ) ) } - + { ! isMobileViewport && ( + + ) } } diff --git a/packages/edit-site/src/components/sidebar-navigation-screen/index.js b/packages/edit-site/src/components/sidebar-navigation-screen/index.js index 3f61a7c8208e8..6e34c9f10e4f9 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen/index.js @@ -7,12 +7,11 @@ import { __experimentalNavigatorToParentButton as NavigatorToParentButton, __experimentalNavigatorScreen as NavigatorScreen, } from '@wordpress/components'; -import { isRTL, __, sprintf } from '@wordpress/i18n'; +import { isRTL, __ } from '@wordpress/i18n'; import { chevronRight, chevronLeft } from '@wordpress/icons'; export default function SidebarNavigationScreen( { path, - parentTitle, title, actions, content, @@ -28,15 +27,11 @@ export default function SidebarNavigationScreen( { justify="flex-start" className="edit-site-sidebar-navigation-screen__title-icon" > - { parentTitle ? ( + { path !== '/' ? ( ) : (
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen/style.scss b/packages/edit-site/src/components/sidebar-navigation-screen/style.scss index 1cfb27def5476..efef42e625d27 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen/style.scss +++ b/packages/edit-site/src/components/sidebar-navigation-screen/style.scss @@ -7,13 +7,14 @@ .edit-site-sidebar-navigation-screen__content { margin: 0 $grid-unit-20 $grid-unit-20 $button-size; + color: $gray-600; } .edit-site-sidebar-navigation-screen__title-icon { position: sticky; top: 0; background: $gray-900; - padding-top: $grid-unit-60 + $hub-height + $canvas-padding * 2; + padding-top: $grid-unit-60 + $header-height; box-shadow: 0 $grid-unit-10 $grid-unit-20 $gray-900; margin-bottom: $grid-unit-10; padding-bottom: $grid-unit-10; diff --git a/packages/edit-site/src/components/sidebar/index.js b/packages/edit-site/src/components/sidebar/index.js index 5fa49717b6908..796ac6b0d6567 100644 --- a/packages/edit-site/src/components/sidebar/index.js +++ b/packages/edit-site/src/components/sidebar/index.js @@ -11,12 +11,14 @@ import { store as coreStore } from '@wordpress/core-data'; */ import SidebarNavigationScreenMain from '../sidebar-navigation-screen-main'; import SidebarNavigationScreenTemplates from '../sidebar-navigation-screen-templates'; -import useSyncSidebarPathWithURL from '../sync-state-with-url/use-sync-sidebar-path-with-url'; +import SidebarNavigationScreenTemplate from '../sidebar-navigation-screen-template'; +import useSyncPathWithURL from '../sync-state-with-url/use-sync-path-with-url'; import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus'; +import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse'; import SaveButton from '../save-button'; function SidebarScreens() { - useSyncSidebarPathWithURL(); + useSyncPathWithURL(); return ( <> @@ -24,6 +26,10 @@ function SidebarScreens() { + + + + ); } diff --git a/packages/edit-site/src/components/site-hub/index.js b/packages/edit-site/src/components/site-hub/index.js index 461352af8a926..dc7ef20bd51c0 100644 --- a/packages/edit-site/src/components/site-hub/index.js +++ b/packages/edit-site/src/components/site-hub/index.js @@ -11,9 +11,8 @@ import { Button, __unstableMotion as motion, __experimentalHStack as HStack, - __experimentalVStack as VStack, } from '@wordpress/components'; -import { useReducedMotion, useViewportMatch } from '@wordpress/compose'; +import { useReducedMotion } from '@wordpress/compose'; import { __ } from '@wordpress/i18n'; import { store as blockEditorStore } from '@wordpress/block-editor'; import { store as coreStore } from '@wordpress/core-data'; @@ -23,137 +22,83 @@ import { forwardRef } from '@wordpress/element'; * Internal dependencies */ import { store as editSiteStore } from '../../store'; -import { useLocation } from '../routes'; -import getIsListPage from '../../utils/get-is-list-page'; import SiteIcon from '../site-icon'; -import useEditedEntityRecord from '../use-edited-entity-record'; import { unlock } from '../../private-apis'; const HUB_ANIMATION_DURATION = 0.3; -const SiteHub = forwardRef( - ( { isMobileCanvasVisible, setIsMobileCanvasVisible, ...props }, ref ) => { - const { params } = useLocation(); - const isListPage = getIsListPage( params ); - const isEditorPage = ! isListPage; - const { canvasMode, dashboardLink, entityConfig } = useSelect( - ( select ) => { - select( editSiteStore ).getEditedPostType(); - const { getCanvasMode, getSettings, getEditedPostType } = - unlock( select( editSiteStore ) ); - return { - canvasMode: getCanvasMode(), - dashboardLink: getSettings().__experimentalDashboardLink, - entityConfig: select( coreStore ).getEntityConfig( - 'postType', - getEditedPostType() - ), - }; - }, - [] +const SiteHub = forwardRef( ( props, ref ) => { + const { canvasMode, dashboardLink } = useSelect( ( select ) => { + select( editSiteStore ).getEditedPostType(); + const { getCanvasMode, getSettings } = unlock( + select( editSiteStore ) ); - const disableMotion = useReducedMotion(); - const isMobileViewport = useViewportMatch( 'medium', '<' ); - const { setCanvasMode } = unlock( useDispatch( editSiteStore ) ); - const { clearSelectedBlock } = useDispatch( blockEditorStore ); - const showEditButton = - ( isEditorPage && canvasMode === 'view' && ! isMobileViewport ) || - ( isMobileViewport && - canvasMode === 'view' && - isMobileCanvasVisible ); - const isBackToDashboardButton = - ( ! isMobileViewport && canvasMode === 'view' ) || - ( isMobileViewport && ! isMobileCanvasVisible ); - const showLabels = canvasMode !== 'edit'; - const siteIconButtonProps = isBackToDashboardButton - ? { - href: dashboardLink || 'index.php', - 'aria-label': __( 'Go back to the dashboard' ), - } - : { - label: __( 'Open Navigation Sidebar' ), - onClick: () => { - clearSelectedBlock(); - setIsMobileCanvasVisible( false ); - setCanvasMode( 'view' ); - }, - }; - const { getTitle } = useEditedEntityRecord(); + return { + canvasMode: getCanvasMode(), + dashboardLink: getSettings().__experimentalDashboardLink, + }; + }, [] ); + const disableMotion = useReducedMotion(); + const { setCanvasMode } = unlock( useDispatch( editSiteStore ) ); + const { clearSelectedBlock } = useDispatch( blockEditorStore ); + const isBackToDashboardButton = canvasMode === 'view'; + const showLabels = canvasMode !== 'edit'; + const siteIconButtonProps = isBackToDashboardButton + ? { + href: dashboardLink || 'index.php', + 'aria-label': __( 'Go back to the dashboard' ), + } + : { + label: __( 'Open Navigation Sidebar' ), + onClick: () => { + clearSelectedBlock(); + setCanvasMode( 'view' ); + }, + }; + const siteTitle = useSelect( + ( select ) => + select( coreStore ).getEntityRecord( 'root', 'site' )?.title, + [] + ); - return ( - + - - - - - - { showLabels && ( - -
- { getTitle() } -
-
- { entityConfig?.label } -
-
- ) } -
- - { showEditButton && ( - ) } +
- { isMobileViewport && ! isMobileCanvasVisible && ( - - ) } - - ); - } -); + { showLabels &&
{ siteTitle }
} + + + ); +} ); export default SiteHub; diff --git a/packages/edit-site/src/components/site-hub/style.scss b/packages/edit-site/src/components/site-hub/style.scss index dc7d121e7caf1..004bf19251422 100644 --- a/packages/edit-site/src/components/site-hub/style.scss +++ b/packages/edit-site/src/components/site-hub/style.scss @@ -5,11 +5,6 @@ gap: $grid-unit-10; } -.edit-site-site-hub__edit-button { - height: $grid-unit-40; - color: $white; -} - .edit-site-site-hub__post-type { opacity: 0.6; } @@ -18,12 +13,7 @@ height: $header-height; width: $header-height + 4px; flex-shrink: 0; -} - -.edit-site-layout.is-edit-mode { - .edit-site-site-hub__view-mode-toggle-container { - width: $header-height; - } + background: $gray-900; } .edit-site-site-hub__text-content { diff --git a/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js b/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js index a6061d205ffc0..52fae37e0d51d 100644 --- a/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js +++ b/packages/edit-site/src/components/sync-state-with-url/use-init-edited-entity-from-url.js @@ -2,7 +2,8 @@ * WordPress dependencies */ import { useEffect } from '@wordpress/element'; -import { useDispatch } from '@wordpress/data'; +import { useSelect, useDispatch } from '@wordpress/data'; +import { store as coreDataStore } from '@wordpress/core-data'; /** * Internal dependencies @@ -11,22 +12,55 @@ import { useLocation } from '../routes'; import { store as editSiteStore } from '../../store'; export default function useInitEditedEntityFromURL() { + const { params: { postId, postType, path = '/' } = {} } = useLocation(); + const { isRequestingSite, homepageId } = useSelect( ( select ) => { + const { getSite } = select( coreDataStore ); + const siteData = getSite(); + + return { + isRequestingSite: ! siteData, + homepageId: + siteData?.show_on_front === 'page' + ? siteData.page_on_front + : null, + }; + }, [] ); + const { setTemplate, setTemplatePart, setPage } = useDispatch( editSiteStore ); - const { - params: { postId, postType }, - } = useLocation(); - // Set correct entity on page navigation. useEffect( () => { - // This URL scheme mean we can't open a template part with the context of a given post. - // Potentially posts and pages could be moved to a "context" query string instead. - if ( 'page' === postType || 'post' === postType ) { - setPage( { context: { postType, postId } } ); // Resolves correct template based on ID. - } else if ( 'wp_template' === postType ) { - setTemplate( postId ); - } else if ( 'wp_template_part' === postType ) { - setTemplatePart( postId ); + switch ( path ) { + case '/templates/single': + setTemplate( postId ); + break; + case '/template-parts/single': + setTemplatePart( postId ); + break; + case '/navigation/single': + setPage( { + context: { postType, postId }, + } ); + break; + default: { + if ( homepageId ) { + setPage( { + context: { postType: 'page', postId: homepageId }, + } ); + } else if ( ! isRequestingSite ) { + setPage( { + path: '/', + } ); + } + } } - }, [ postId, postType ] ); + }, [ + path, + postId, + homepageId, + isRequestingSite, + setPage, + setTemplate, + setTemplatePart, + ] ); } diff --git a/packages/edit-site/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js b/packages/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js similarity index 62% rename from packages/edit-site/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js rename to packages/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js index 885772cdf4046..f7376fcffbe19 100644 --- a/packages/edit-site/src/components/sync-state-with-url/use-sync-sidebar-path-with-url.js +++ b/packages/edit-site/src/components/sync-state-with-url/use-sync-path-with-url.js @@ -9,28 +9,28 @@ import { useEffect, useRef } from '@wordpress/element'; */ import { useLocation, useHistory } from '../routes'; -export default function useSyncSidebarPathWithURL() { +export default function useSyncPathWithURL() { const history = useHistory(); const { params } = useLocation(); - const { sidebar = '/' } = params; + const { path = '/' } = params; const { location, goTo } = useNavigator(); - const currentSidebar = useRef( sidebar ); + const currentPath = useRef( path ); const currentNavigatorLocation = useRef( location.path ); useEffect( () => { - currentSidebar.current = sidebar; - if ( sidebar !== currentNavigatorLocation.current ) { - goTo( sidebar ); + currentPath.current = path; + if ( path !== currentNavigatorLocation.current ) { + goTo( path ); } - }, [ sidebar ] ); + }, [ path ] ); useEffect( () => { currentNavigatorLocation.current = location.path; - if ( location.path !== currentSidebar.current ) { + if ( location.path !== currentPath.current ) { history.push( { ...params, - sidebar: location.path, + path: location.path, } ); } }, [ location.path, history ] ); - return sidebar; + return path; } diff --git a/packages/edit-site/src/components/use-edited-entity-record/index.js b/packages/edit-site/src/components/use-edited-entity-record/index.js index 5d72877095782..66377e0d80976 100644 --- a/packages/edit-site/src/components/use-edited-entity-record/index.js +++ b/packages/edit-site/src/components/use-edited-entity-record/index.js @@ -12,7 +12,7 @@ import { decodeEntities } from '@wordpress/html-entities'; import { store as editSiteStore } from '../../store'; export default function useEditedEntityRecord() { - const { record, title, isLoaded } = useSelect( ( select ) => { + const { record, title, description, isLoaded } = useSelect( ( select ) => { const { getEditedPostType, getEditedPostId } = select( editSiteStore ); const { getEditedEntityRecord } = select( coreStore ); const { __experimentalGetTemplateInfo: getTemplateInfo } = @@ -21,10 +21,12 @@ export default function useEditedEntityRecord() { const postId = getEditedPostId(); const _record = getEditedEntityRecord( 'postType', postType, postId ); const _isLoaded = !! postId; + const templateInfo = getTemplateInfo( _record ); return { record: _record, - title: getTemplateInfo( _record ).title, + title: templateInfo.title, + description: templateInfo.description, isLoaded: _isLoaded, }; }, [] ); @@ -33,5 +35,7 @@ export default function useEditedEntityRecord() { isLoaded, record, getTitle: () => ( title ? decodeEntities( title ) : null ), + getDescription: () => + description ? decodeEntities( description ) : null, }; } diff --git a/packages/edit-site/src/utils/get-is-list-page.js b/packages/edit-site/src/utils/get-is-list-page.js index ef08058d00e82..58a4ebe0bfdf4 100644 --- a/packages/edit-site/src/utils/get-is-list-page.js +++ b/packages/edit-site/src/utils/get-is-list-page.js @@ -1,11 +1,11 @@ /** * Returns if the params match the list page route. * - * @param {Object} params The search params. - * @param {string} params.postId The post ID. - * @param {string} params.postType The post type. + * @param {Object} params The url params. + * @param {string} params.path The current path. + * * @return {boolean} Is list page or not. */ -export default function getIsListPage( { postId, postType } ) { - return !! ( ! postId && postType ); +export default function getIsListPage( { path } ) { + return path === '/templates/all' || path === '/template-parts/all'; } diff --git a/test/e2e/specs/site-editor/block-list-panel-preference.spec.js b/test/e2e/specs/site-editor/block-list-panel-preference.spec.js index 8745a75f3ad46..ede473816235e 100644 --- a/test/e2e/specs/site-editor/block-list-panel-preference.spec.js +++ b/test/e2e/specs/site-editor/block-list-panel-preference.spec.js @@ -12,13 +12,14 @@ test.describe( 'Block list view', () => { await requestUtils.activateTheme( 'twentytwentyone' ); } ); - test( 'Should open by default', async ( { admin, page, siteEditor } ) => { + test( 'Should open by default', async ( { admin, page, editor } ) => { await admin.visitSiteEditor( { postId: 'emptytheme//index', postType: 'wp_template', + path: '/templates/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); // Should display the Preview button. await expect( diff --git a/test/e2e/specs/site-editor/iframe-rendering.spec.js b/test/e2e/specs/site-editor/iframe-rendering.spec.js index 02389cc936f06..a4c39cdbbbfad 100644 --- a/test/e2e/specs/site-editor/iframe-rendering.spec.js +++ b/test/e2e/specs/site-editor/iframe-rendering.spec.js @@ -19,6 +19,7 @@ test.describe( 'Site editor iframe rendering mode', () => { await admin.visitSiteEditor( { postId: 'emptytheme//index', postType: 'wp_template', + path: '/templates/single', } ); const compatMode = await page diff --git a/test/e2e/specs/site-editor/push-to-global-styles.spec.js b/test/e2e/specs/site-editor/push-to-global-styles.spec.js index d51ce41dc3ea8..06c634a1f5498 100644 --- a/test/e2e/specs/site-editor/push-to-global-styles.spec.js +++ b/test/e2e/specs/site-editor/push-to-global-styles.spec.js @@ -16,9 +16,9 @@ test.describe( 'Push to Global Styles button', () => { await requestUtils.activateTheme( 'twentytwentyone' ); } ); - test.beforeEach( async ( { admin, siteEditor } ) => { + test.beforeEach( async ( { admin, editor } ) => { await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); } ); test( 'should apply Heading block styles to all Heading blocks', async ( { diff --git a/test/e2e/specs/site-editor/site-editor-inserter.spec.js b/test/e2e/specs/site-editor/site-editor-inserter.spec.js index d3dfedc9bde71..f8ab0a534d858 100644 --- a/test/e2e/specs/site-editor/site-editor-inserter.spec.js +++ b/test/e2e/specs/site-editor/site-editor-inserter.spec.js @@ -16,9 +16,9 @@ test.describe( 'Site Editor Inserter', () => { await requestUtils.activateTheme( 'twentytwentyone' ); } ); - test.beforeEach( async ( { admin, siteEditor } ) => { + test.beforeEach( async ( { admin, editor } ) => { await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); } ); test( 'inserter toggle button should toggle global inserter', async ( { diff --git a/test/e2e/specs/site-editor/style-book.spec.js b/test/e2e/specs/site-editor/style-book.spec.js index ca58ff154a481..cf7fa8dfa67c9 100644 --- a/test/e2e/specs/site-editor/style-book.spec.js +++ b/test/e2e/specs/site-editor/style-book.spec.js @@ -18,9 +18,9 @@ test.describe( 'Style Book', () => { await requestUtils.activateTheme( 'twentytwentyone' ); } ); - test.beforeEach( async ( { admin, siteEditor, styleBook, page } ) => { + test.beforeEach( async ( { admin, editor, styleBook, page } ) => { await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); await styleBook.open(); await expect( page.locator( 'role=region[name="Style Book"i]' ) diff --git a/test/e2e/specs/site-editor/style-variations.spec.js b/test/e2e/specs/site-editor/style-variations.spec.js index 925be3780c8fd..d662238535745 100644 --- a/test/e2e/specs/site-editor/style-variations.spec.js +++ b/test/e2e/specs/site-editor/style-variations.spec.js @@ -33,13 +33,14 @@ test.describe( 'Global styles variations', () => { admin, page, siteEditorStyleVariations, - siteEditor, + editor, } ) => { await admin.visitSiteEditor( { postId: 'gutenberg-test-themes/style-variations//index', postType: 'wp_template', + path: '/templates/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); await siteEditorStyleVariations.browseStyles(); @@ -70,13 +71,14 @@ test.describe( 'Global styles variations', () => { admin, page, siteEditorStyleVariations, - siteEditor, + editor, } ) => { await admin.visitSiteEditor( { postId: 'gutenberg-test-themes/style-variations//index', postType: 'wp_template', + path: '/templates/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); await siteEditorStyleVariations.browseStyles(); await page.click( 'role=button[name="pink"i]' ); await page.click( @@ -111,13 +113,14 @@ test.describe( 'Global styles variations', () => { admin, page, siteEditorStyleVariations, - siteEditor, + editor, } ) => { await admin.visitSiteEditor( { postId: 'gutenberg-test-themes/style-variations//index', postType: 'wp_template', + path: '/templates/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); await siteEditorStyleVariations.browseStyles(); await page.click( 'role=button[name="yellow"i]' ); await page.click( @@ -158,13 +161,14 @@ test.describe( 'Global styles variations', () => { admin, page, siteEditorStyleVariations, - siteEditor, + editor, } ) => { await admin.visitSiteEditor( { postId: 'gutenberg-test-themes/style-variations//index', postType: 'wp_template', + path: '/templates/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); await siteEditorStyleVariations.browseStyles(); await page.click( 'role=button[name="pink"i]' ); await page.click( @@ -190,13 +194,14 @@ test.describe( 'Global styles variations', () => { admin, page, siteEditorStyleVariations, - siteEditor, + editor, } ) => { await admin.visitSiteEditor( { postId: 'gutenberg-test-themes/style-variations//index', postType: 'wp_template', + path: '/templates/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); await siteEditorStyleVariations.browseStyles(); await page.click( 'role=button[name="yellow"i]' ); diff --git a/test/e2e/specs/site-editor/template-part.spec.js b/test/e2e/specs/site-editor/template-part.spec.js index 8002fafad107c..c33da19290855 100644 --- a/test/e2e/specs/site-editor/template-part.spec.js +++ b/test/e2e/specs/site-editor/template-part.spec.js @@ -23,13 +23,13 @@ test.describe( 'Template Part', () => { admin, editor, page, - siteEditor, } ) => { await admin.visitSiteEditor( { postId: 'emptytheme//header', postType: 'wp_template_part', + path: '/template-parts/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); // Insert a new template block and 'start blank'. await editor.insertBlock( { name: 'core/template-part' } ); @@ -54,11 +54,10 @@ test.describe( 'Template Part', () => { admin, editor, page, - siteEditor, } ) => { // Visit the index. await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); const headerTemplateParts = editor.canvas.locator( '[data-type="core/template-part"]' ); @@ -81,12 +80,11 @@ test.describe( 'Template Part', () => { admin, editor, page, - siteEditor, } ) => { const paragraphText = 'Test 2'; await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); // Add a block and select it. await editor.insertBlock( { name: 'core/paragraph', @@ -121,13 +119,12 @@ test.describe( 'Template Part', () => { admin, editor, page, - siteEditor, } ) => { const paragraphText1 = 'Test 3'; const paragraphText2 = 'Test 4'; await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); // Add a block and select it. await editor.insertBlock( { name: 'core/paragraph', @@ -181,7 +178,6 @@ test.describe( 'Template Part', () => { test( 'can detach blocks from a template part', async ( { admin, editor, - siteEditor, } ) => { const paragraphText = 'Test 3'; @@ -189,8 +185,9 @@ test.describe( 'Template Part', () => { await admin.visitSiteEditor( { postId: 'emptytheme//header', postType: 'wp_template_part', + path: '/template-parts/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); await editor.insertBlock( { name: 'core/paragraph', attributes: { @@ -201,7 +198,7 @@ test.describe( 'Template Part', () => { // Visit the index. await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); // Check that the header contains the paragraph added earlier. const paragraph = editor.canvas.locator( `p >> text="${ paragraphText }"` @@ -226,15 +223,15 @@ test.describe( 'Template Part', () => { test( 'shows changes in a template when a template part it contains is modified', async ( { admin, editor, - siteEditor, } ) => { const paragraphText = 'Test 1'; await admin.visitSiteEditor( { postId: 'emptytheme//header', postType: 'wp_template_part', + path: '/template-parts/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); // Edit the header. await editor.insertBlock( { name: 'core/paragraph', @@ -247,7 +244,7 @@ test.describe( 'Template Part', () => { // Visit the index. await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); const paragraph = editor.canvas.locator( `p >> text="${ paragraphText }"` ); @@ -260,15 +257,15 @@ test.describe( 'Template Part', () => { admin, editor, page, - siteEditor, } ) => { const paragraphText = 'Test 4'; await admin.visitSiteEditor( { postId: 'emptytheme//header', postType: 'wp_template_part', + path: '/template-parts/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); await editor.insertBlock( { name: 'core/paragraph', attributes: { @@ -302,12 +299,11 @@ test.describe( 'Template Part', () => { test( 'can import a widget area into an empty template part', async ( { admin, - siteEditor, editor, page, } ) => { await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); // Add a block and select it. await editor.insertBlock( { @@ -344,12 +340,11 @@ test.describe( 'Template Part', () => { test( 'can not import a widget area into a non-empty template part', async ( { admin, - siteEditor, editor, page, } ) => { await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); // Select existing header template part. await editor.selectBlocks( diff --git a/test/e2e/specs/site-editor/template-revert.spec.js b/test/e2e/specs/site-editor/template-revert.spec.js index dcf8ebedb8b78..f1f6b3eb5d014 100644 --- a/test/e2e/specs/site-editor/template-revert.spec.js +++ b/test/e2e/specs/site-editor/template-revert.spec.js @@ -20,10 +20,10 @@ test.describe( 'Template Revert', () => { await requestUtils.deleteAllTemplates( 'wp_template_part' ); await requestUtils.activateTheme( 'twentytwentyone' ); } ); - test.beforeEach( async ( { admin, requestUtils, siteEditor } ) => { + test.beforeEach( async ( { admin, requestUtils, editor } ) => { await requestUtils.deleteAllTemplates( 'wp_template' ); await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); } ); test( 'should delete the template after saving the reverted template', async ( { @@ -248,7 +248,6 @@ test.describe( 'Template Revert', () => { editor, page, templateRevertUtils, - siteEditor, } ) => { await editor.insertBlock( { name: 'core/paragraph', @@ -267,7 +266,7 @@ test.describe( 'Template Revert', () => { await editor.saveSiteEditorEntities(); await admin.visitSiteEditor(); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); const contentAfter = await templateRevertUtils.getCurrentSiteEditorContent(); expect( contentAfter ).toEqual( contentBefore ); diff --git a/test/e2e/specs/site-editor/title.spec.js b/test/e2e/specs/site-editor/title.spec.js index 9b1ad4a5098d1..d8059531aabc5 100644 --- a/test/e2e/specs/site-editor/title.spec.js +++ b/test/e2e/specs/site-editor/title.spec.js @@ -15,14 +15,15 @@ test.describe( 'Site editor title', () => { test( 'displays the selected template name in the title for the index template', async ( { admin, page, - siteEditor, + editor, } ) => { // Navigate to a template. await admin.visitSiteEditor( { postId: 'emptytheme//index', postType: 'wp_template', + path: '/templates/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); const title = await page.locator( 'role=region[name="Editor top bar"i] >> role=heading[level=1]' ); @@ -33,14 +34,15 @@ test.describe( 'Site editor title', () => { test( 'displays the selected template name in the title for the header template', async ( { admin, page, - siteEditor, + editor, } ) => { // Navigate to a template part. await admin.visitSiteEditor( { postId: 'emptytheme//header', postType: 'wp_template_part', + path: '/template-parts/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); const title = await page.locator( 'role=region[name="Editor top bar"i] >> role=heading[level=1]' ); @@ -51,13 +53,14 @@ test.describe( 'Site editor title', () => { test( "displays the selected template part's name in the secondary title when a template part is selected from List View", async ( { admin, page, - siteEditor, + editor, } ) => { await admin.visitSiteEditor( { postId: 'emptytheme//index', postType: 'wp_template', + path: '/templates/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); // Select the header template part via list view. await page.click( 'role=button[name="List View"i]' ); const listView = await page.locator( diff --git a/test/e2e/specs/site-editor/writing-flow.spec.js b/test/e2e/specs/site-editor/writing-flow.spec.js index f8fa78b4fd812..0f8d4773b84c5 100644 --- a/test/e2e/specs/site-editor/writing-flow.spec.js +++ b/test/e2e/specs/site-editor/writing-flow.spec.js @@ -18,14 +18,14 @@ test.describe( 'Site editor writing flow', () => { editor, page, pageUtils, - siteEditor, } ) => { // Navigate to a template part with only a couple of blocks. await admin.visitSiteEditor( { postId: 'emptytheme//header', postType: 'wp_template_part', + path: '/template-parts/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); // Select the first site title block. const siteTitleBlock = editor.canvas.locator( 'role=document[name="Block: Site Title"i]' @@ -47,14 +47,14 @@ test.describe( 'Site editor writing flow', () => { editor, page, pageUtils, - siteEditor, } ) => { // Navigate to a template part with only a couple of blocks. await admin.visitSiteEditor( { postId: 'emptytheme//header', postType: 'wp_template_part', + path: '/template-parts/single', } ); - await siteEditor.enterEditMode(); + await editor.canvas.click( 'body' ); // Make sure the sidebar is open. await editor.openDocumentSettingsSidebar(); From 5fd88ff8ac163d292a09a6f37e0c19fb088f6ced Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Mon, 13 Feb 2023 12:28:44 +0000 Subject: [PATCH 19/76] Chore: Remove unexistant parameter from selectNavigationMenus call. (#47941) --- packages/block-library/src/navigation/use-navigation-menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/navigation/use-navigation-menu.js b/packages/block-library/src/navigation/use-navigation-menu.js index 7ce66683300a3..607a92cb82f95 100644 --- a/packages/block-library/src/navigation/use-navigation-menu.js +++ b/packages/block-library/src/navigation/use-navigation-menu.js @@ -24,7 +24,7 @@ export default function useNavigationMenu( ref ) { navigationMenus, isResolvingNavigationMenus, hasResolvedNavigationMenus, - } = selectNavigationMenus( select, ref ); + } = selectNavigationMenus( select ); const { navigationMenu, From 490becbf5895e239bb5bd24dce42c5934c5ea2f9 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 13 Feb 2023 13:51:48 +0100 Subject: [PATCH 20/76] Move 6.2 specific code to the right place (#48023) --- lib/compat/wordpress-6.2/site-editor.php | 21 ++++++++++++++++++ lib/compat/wordpress-6.3/site-editor.php | 27 ------------------------ lib/load.php | 3 --- 3 files changed, 21 insertions(+), 30 deletions(-) delete mode 100644 lib/compat/wordpress-6.3/site-editor.php diff --git a/lib/compat/wordpress-6.2/site-editor.php b/lib/compat/wordpress-6.2/site-editor.php index b6246e49c6d11..37087fae3fb62 100644 --- a/lib/compat/wordpress-6.2/site-editor.php +++ b/lib/compat/wordpress-6.2/site-editor.php @@ -22,3 +22,24 @@ function gutenberg_site_editor_unset_homepage_setting( $settings, $context ) { return $settings; } add_filter( 'block_editor_settings_all', 'gutenberg_site_editor_unset_homepage_setting', 10, 2 ); + +/** + * Overrides the site editor initialization for WordPress 6.2 and cancels the redirection. + * The logic of this function is not important, we just need to remove the redirection from core. + * + * @param string $location Location. + * + * @return string Updated location. + */ +function gutenberg_prevent_site_editor_redirection( $location ) { + if ( strpos( $location, 'site-editor.php' ) !== false && strpos( $location, '?' ) !== false ) { + return add_query_arg( + array( 'postId' => 'none' ), + admin_url( 'site-editor.php' ) + ); + } + + return $location; +} + +add_filter( 'wp_redirect', 'gutenberg_prevent_site_editor_redirection', 1 ); diff --git a/lib/compat/wordpress-6.3/site-editor.php b/lib/compat/wordpress-6.3/site-editor.php deleted file mode 100644 index 2cfde082554c4..0000000000000 --- a/lib/compat/wordpress-6.3/site-editor.php +++ /dev/null @@ -1,27 +0,0 @@ - 'none' ), - admin_url( 'site-editor.php' ) - ); - } - - return $location; -} - -add_filter( 'wp_redirect', 'gutenberg_prevent_site_editor_redirection', 1 ); diff --git a/lib/load.php b/lib/load.php index 38839d047a455..dc253408a9289 100644 --- a/lib/load.php +++ b/lib/load.php @@ -101,9 +101,6 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/compat/wordpress-6.2/html-api/class-wp-html-tag-processor.php'; } -// WordPress 6.3 compat. -require __DIR__ . '/compat/wordpress-6.3/site-editor.php'; - // Experimental features. remove_action( 'plugins_loaded', '_wp_theme_json_webfonts_handler' ); // Turns off WP 6.0's stopgap handler for Webfonts API. require __DIR__ . '/experimental/block-editor-settings-mobile.php'; From db3ad9bb18936f371db4feb3c47ea5fa4ffe874c Mon Sep 17 00:00:00 2001 From: Maggie Date: Mon, 13 Feb 2023 21:55:58 +0800 Subject: [PATCH 21/76] Navigation block e2e tests: default to classic menu (#47867) * added create and delete navigation functions * check markup of the block * checked the block in the canvas and frontend too * removed pause, passed page as an argument to the test * Update test/e2e/specs/editor/blocks/navigation.spec.js Co-authored-by: Kai Hao * commented on the theme selection * use toMatchObject to check the block instead of toEqual * change css selectors to use role instead * make string check case insensitive * moved utils to utils package * undo regression from rebase * create classic menu util * check that the block is visible * reorder utils and finish the selector checks for the test * renaming variables and custom link label --------- Co-authored-by: Kai Hao --- .../src/request-utils/index.ts | 8 ++ .../src/request-utils/menus.ts | 108 +++++++++++++++++ .../specs/editor/blocks/navigation.spec.js | 112 +++++++++--------- 3 files changed, 173 insertions(+), 55 deletions(-) create mode 100644 packages/e2e-test-utils-playwright/src/request-utils/menus.ts 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 5c6f849f86751..7d7ee2cb7f2aa 100644 --- a/packages/e2e-test-utils-playwright/src/request-utils/index.ts +++ b/packages/e2e-test-utils-playwright/src/request-utils/index.ts @@ -21,6 +21,11 @@ import { activateTheme } from './themes'; import { deleteAllBlocks } from './blocks'; import { createComment, deleteAllComments } from './comments'; import { createPost, deleteAllPosts } from './posts'; +import { + createClassicMenu, + createNavigationMenu, + deleteAllMenus, +} from './menus'; import { resetPreferences } from './preferences'; import { getSiteSettings, updateSiteSettings } from './site-settings'; import { deleteAllWidgets, addWidgetBlock } from './widgets'; @@ -125,6 +130,9 @@ class RequestUtils { deleteAllBlocks = deleteAllBlocks; createPost = createPost.bind( this ); deleteAllPosts = deleteAllPosts.bind( this ); + createClassicMenu = createClassicMenu.bind( this ); + createNavigationMenu = createNavigationMenu.bind( this ); + deleteAllMenus = deleteAllMenus.bind( this ); createComment = createComment.bind( this ); deleteAllComments = deleteAllComments.bind( this ); deleteAllWidgets = deleteAllWidgets.bind( this ); diff --git a/packages/e2e-test-utils-playwright/src/request-utils/menus.ts b/packages/e2e-test-utils-playwright/src/request-utils/menus.ts new file mode 100644 index 0000000000000..e5da27e032c79 --- /dev/null +++ b/packages/e2e-test-utils-playwright/src/request-utils/menus.ts @@ -0,0 +1,108 @@ +/** + * Internal dependencies + */ +import type { RequestUtils } from './index'; + +export interface MenuData { + title: string; + content: string; +} +export interface NavigationMenu { + id: number; + content: string; + status: 'publish' | 'future' | 'draft' | 'pending' | 'private'; +} + +/** + * Create a classic menu + * + * @param {string} name Menu name. + * @return {string} Menu content. + */ +export async function createClassicMenu( this: RequestUtils, name: string ) { + const menuItems = [ + { + title: 'Custom link', + url: 'http://localhost:8889/', + type: 'custom', + menu_order: 1, + }, + ]; + + const menu = await this.rest< NavigationMenu >( { + method: 'POST', + path: `/wp/v2/menus/`, + data: { + name, + }, + } ); + + if ( menuItems?.length ) { + await this.batchRest( + menuItems.map( ( menuItem ) => ( { + method: 'POST', + path: `/wp/v2/menu-items`, + body: { + menus: menu.id, + object_id: undefined, + ...menuItem, + parent: undefined, + }, + } ) ) + ); + } + + return menu; +} + +/** + * Create a navigation menu + * + * @param {Object} menuData navigation menu post data. + * @return {string} Menu content. + */ +export async function createNavigationMenu( + this: RequestUtils, + menuData: MenuData +) { + return this.rest( { + method: 'POST', + path: `/wp/v2/navigation/`, + data: { + status: 'publish', + ...menuData, + }, + } ); +} + +/** + * Delete all navigation and classic menus + * + */ +export async function deleteAllMenus( this: RequestUtils ) { + const navMenus = await this.rest< NavigationMenu[] >( { + path: `/wp/v2/navigation/`, + } ); + + if ( navMenus?.length ) { + await this.batchRest( + navMenus.map( ( menu ) => ( { + method: 'DELETE', + path: `/wp/v2/navigation/${ menu.id }?force=true`, + } ) ) + ); + } + + const classicMenus = await this.rest< NavigationMenu[] >( { + path: `/wp/v2/menus/`, + } ); + + if ( classicMenus?.length ) { + await this.batchRest( + classicMenus.map( ( menu ) => ( { + method: 'DELETE', + path: `/wp/v2/menus/${ menu.id }?force=true`, + } ) ) + ); + } +} diff --git a/test/e2e/specs/editor/blocks/navigation.spec.js b/test/e2e/specs/editor/blocks/navigation.spec.js index 9b4ad7123bcbb..57ef99cbc09d6 100644 --- a/test/e2e/specs/editor/blocks/navigation.spec.js +++ b/test/e2e/specs/editor/blocks/navigation.spec.js @@ -4,8 +4,8 @@ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); test.use( { - navBlockUtils: async ( { page, requestUtils }, use ) => { - await use( new NavigationBlockUtils( { page, requestUtils } ) ); + navBlockUtils: async ( { editor, page, requestUtils }, use ) => { + await use( new NavigationBlockUtils( { editor, page, requestUtils } ) ); }, } ); @@ -17,16 +17,13 @@ test.describe( await requestUtils.activateTheme( 'twentytwentythree' ); } ); - test.beforeEach( async ( { admin, navBlockUtils } ) => { - await Promise.all( [ - navBlockUtils.deleteAllNavigationMenus(), - admin.createNewPost(), - ] ); + test.beforeEach( async ( { requestUtils } ) => { + await Promise.all( [ requestUtils.deleteAllMenus() ] ); } ); - test.afterAll( async ( { requestUtils, navBlockUtils } ) => { + test.afterAll( async ( { requestUtils } ) => { await Promise.all( [ - navBlockUtils.deleteAllNavigationMenus(), + requestUtils.deleteAllMenus(), requestUtils.activateTheme( 'twentytwentyone' ), ] ); } ); @@ -36,8 +33,10 @@ test.describe( } ); test( 'default to a list of pages if there are no menus', async ( { + admin, editor, } ) => { + await admin.createNewPost(); await editor.insertBlock( { name: 'core/navigation' } ); const pageListBlock = editor.canvas.getByRole( 'document', { @@ -63,11 +62,14 @@ test.describe( } ); test( 'default to my only existing menu', async ( { + admin, editor, page, + requestUtils, navBlockUtils, } ) => { - const createdMenu = await navBlockUtils.createNavigationMenu( { + await admin.createNewPost(); + const createdMenu = await requestUtils.createNavigationMenu( { title: 'Test Menu 1', content: '', @@ -75,12 +77,8 @@ test.describe( await editor.insertBlock( { name: 'core/navigation' } ); - //check the block in the canvas. - await expect( - editor.canvas.locator( - 'role=textbox[name="Navigation link text"i] >> text="WordPress"' - ) - ).toBeVisible(); + // Check the block in the canvas. + await navBlockUtils.selectNavigationItemOnCanvas( 'WordPress' ); // Check the markup of the block is correct. await editor.publishPost(); @@ -92,13 +90,35 @@ test.describe( ] ); await page.locator( 'role=button[name="Close panel"i]' ).click(); - //check the block in the frontend. - await page.goto( '/' ); - await expect( - page.locator( - 'role=navigation >> role=link[name="WordPress"i]' - ) - ).toBeVisible(); + // Check the block in the frontend. + await navBlockUtils.selectNavigationItemOnFrontend( 'WordPress' ); + } ); + + test( 'default to the only existing classic menu if there are no block menus', async ( { + admin, + editor, + requestUtils, + navBlockUtils, + } ) => { + // Create a classic menu. + await requestUtils.createClassicMenu( 'Test Classic 1' ); + await admin.createNewPost(); + + await editor.insertBlock( { name: 'core/navigation' } ); + // We need to check the canvas after inserting the navigation block to be able to target the block. + await expect.poll( editor.getBlocks ).toMatchObject( [ + { + name: 'core/navigation', + }, + ] ); + + // Check the block in the canvas. + await editor.page.pause(); + await navBlockUtils.selectNavigationItemOnCanvas( 'Custom link' ); + + // Check the block in the frontend. + await navBlockUtils.selectNavigationItemOnFrontend( 'Custom link' ); + await editor.page.pause(); } ); } ); @@ -110,40 +130,22 @@ class NavigationBlockUtils { this.requestUtils = requestUtils; } - /** - * Create a navigation menu - * - * @param {Object} menuData navigation menu post data. - * @return {string} Menu content. - */ - async createNavigationMenu( menuData ) { - return this.requestUtils.rest( { - method: 'POST', - path: `/wp/v2/navigation/`, - data: { - status: 'publish', - ...menuData, - }, - } ); + async selectNavigationItemOnCanvas( name ) { + await expect( + this.editor.canvas.locator( + `role=textbox[name="Navigation link text"i] >> text="${ name }"` + ) + ).toBeVisible(); } - /** - * Delete all navigation menus - * - */ - async deleteAllNavigationMenus() { - const menus = await this.requestUtils.rest( { - path: `/wp/v2/navigation/`, - } ); - - if ( ! menus?.length ) return; - - await this.requestUtils.batchRest( - menus.map( ( menu ) => ( { - method: 'DELETE', - path: `/wp/v2/navigation/${ menu.id }?force=true`, - } ) ) - ); + async selectNavigationItemOnFrontend( name ) { + await this.page.goto( '/' ); + await this.editor.page.pause(); + await expect( + this.page.locator( + `role=navigation >> role=link[name="${ name }"i]` + ) + ).toBeVisible(); } } From ea74a306e5289a90d29c0b3eb1d9b4ef893f7f19 Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Mon, 13 Feb 2023 14:11:07 +0000 Subject: [PATCH 22/76] Set update_post_meta_cache and update_post_term_cache as false. (#47998) Co-authored-by: Jonathan Harris --- packages/block-library/src/navigation/index.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/block-library/src/navigation/index.php b/packages/block-library/src/navigation/index.php index d29270a35109d..03aaae31c5bc9 100644 --- a/packages/block-library/src/navigation/index.php +++ b/packages/block-library/src/navigation/index.php @@ -373,12 +373,14 @@ function block_core_navigation_get_most_recently_published_navigation() { // Default to the most recently created menu. $parsed_args = array( - 'post_type' => 'wp_navigation', - 'no_found_rows' => true, - 'order' => 'DESC', - 'orderby' => 'date', - 'post_status' => 'publish', - 'posts_per_page' => 1, // get only the most recent. + 'post_type' => 'wp_navigation', + 'no_found_rows' => true, + 'update_post_meta_cache' => false, + 'update_post_term_cache' => false, + 'order' => 'DESC', + 'orderby' => 'date', + 'post_status' => 'publish', + 'posts_per_page' => 1, // get only the most recent. ); $navigation_post = new WP_Query( $parsed_args ); From 0433f44b4d00bfbcc08ebc089e81146111bc0bfb Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 13 Feb 2023 15:30:41 +0100 Subject: [PATCH 23/76] Fix site editor navigation (#48025) --- .../add-new-template/new-template-part.js | 9 +- .../add-new-template/new-template.js | 12 ++- .../index.js | 52 +++++++++++ .../index.js | 1 + .../index.js | 92 ++++++++----------- .../edit-site/src/components/sidebar/index.js | 2 + 6 files changed, 108 insertions(+), 60 deletions(-) create mode 100644 packages/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js diff --git a/packages/edit-site/src/components/add-new-template/new-template-part.js b/packages/edit-site/src/components/add-new-template/new-template-part.js index 172eb7fb47846..1d5a6e08d0c0e 100644 --- a/packages/edit-site/src/components/add-new-template/new-template-part.js +++ b/packages/edit-site/src/components/add-new-template/new-template-part.js @@ -67,9 +67,12 @@ export default function NewTemplatePart( { setCanvasMode( 'edit' ); // Navigate to the created template part editor. - history.push( { - postId: templatePart.id, - postType: templatePart.type, + window.queueMicrotask( () => { + history.push( { + postId: templatePart.id, + postType: 'wp_template_part', + path: '/template-parts/single', + } ); } ); // TODO: Add a success notice? 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 09f4319f708da..6b41c0625a4ca 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 @@ -100,7 +100,6 @@ export default function NewTemplate( { const { setTemplate, setCanvasMode } = unlock( useDispatch( editSiteStore ) ); - async function createTemplate( template, isWPSuggestion = true ) { if ( isCreatingTemplate ) { return; @@ -125,15 +124,18 @@ export default function NewTemplate( { // Set template before navigating away to avoid initial stale value. setTemplate( newTemplate.id, newTemplate.slug ); - // Switch to edit mode. setCanvasMode( 'edit' ); // Navigate to the created template editor. - history.push( { - postId: newTemplate.id, - postType: newTemplate.type, + window.queueMicrotask( () => { + history.push( { + postId: newTemplate.id, + postType: newTemplate.type, + path: '/templates/single', + } ); } ); + createSuccessNotice( sprintf( // translators: %s: Title of the created template e.g: "Category". diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js new file mode 100644 index 0000000000000..639f6c8ccb83c --- /dev/null +++ b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-item/index.js @@ -0,0 +1,52 @@ +/** + * WordPress dependencies + */ +import { __ } from '@wordpress/i18n'; +import { useDispatch, useSelect } from '@wordpress/data'; +import { Button } from '@wordpress/components'; +import { store as coreStore } from '@wordpress/core-data'; +import { decodeEntities } from '@wordpress/html-entities'; + +/** + * Internal dependencies + */ +import SidebarNavigationScreen from '../sidebar-navigation-screen'; +import { unlock } from '../../private-apis'; +import { store as editSiteStore } from '../../store'; + +export default function SidebarNavigationScreenNavigationItem() { + const { setCanvasMode } = unlock( useDispatch( editSiteStore ) ); + + const { post } = useSelect( ( select ) => { + const { getEditedPostContext } = select( editSiteStore ); + const { getEntityRecord } = select( coreStore ); + const { postType, postId } = getEditedPostContext() ?? {}; + + // The currently selected entity to display. + // Typically template or template part in the site editor. + return { + post: + postId && postType + ? getEntityRecord( 'postType', postType, postId ) + : null, + }; + }, [] ); + + return ( + setCanvasMode( 'edit' ) } + > + { __( 'Edit' ) } + + } + content={ + post ? decodeEntities( post?.description?.rendered ) : null + } + /> + ); +} diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js index d006fb000d9cc..9e939d2392b18 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/index.js @@ -25,6 +25,7 @@ export default function SidebarNavigationScreenNavigationMenus() { history.push( { postType: attributes.type, postId: attributes.id, + path: '/navigation/single', } ); } }, diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js b/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js index 5bba2467c0b73..4c1fd155ac7eb 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen-templates/index.js @@ -1,7 +1,10 @@ /** * WordPress dependencies */ -import { __experimentalItemGroup as ItemGroup } from '@wordpress/components'; +import { + __experimentalItemGroup as ItemGroup, + __experimentalItem as Item, +} from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { useEntityRecords } from '@wordpress/core-data'; import { decodeEntities } from '@wordpress/html-entities'; @@ -15,12 +18,6 @@ import { useLink } from '../routes/link'; import SidebarNavigationItem from '../sidebar-navigation-item'; import AddNewTemplate from '../add-new-template'; -function omit( object, keys ) { - return Object.fromEntries( - Object.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) ) - ); -} - const config = { wp_template: { path: '/templates', @@ -42,15 +39,13 @@ const config = { }, }; -const Item = ( { item } ) => { +const TemplateItem = ( { postType, postId, ...props } ) => { const linkInfo = useLink( { - ...item.params, - path: config[ item.params.postType ].path + '/single', + postType, + postId, + path: config[ postType ].path + '/single', } ); - const props = item.params - ? { ...omit( item, 'params' ), ...linkInfo } - : item; - return ; + return ; }; export default function SidebarNavigationScreenTemplates( { @@ -66,31 +61,6 @@ export default function SidebarNavigationScreenTemplates( { } ); - let items = []; - if ( isLoading ) { - items = [ - { - children: config[ postType ].labels.loading, - }, - ]; - } else if ( ! templates && ! isLoading ) { - items = [ - { - children: config[ postType ].labels.notFound, - }, - ]; - } else { - items = templates?.map( ( template ) => ( { - params: { - postType, - postId: template.id, - }, - children: decodeEntities( - template.title?.rendered || template.slug - ), - } ) ); - } - const browseAllLink = useLink( { postType, postId: undefined, @@ -114,19 +84,37 @@ export default function SidebarNavigationScreenTemplates( { } content={ <> - - { items.map( ( item, index ) => ( - - ) ) } - - { ! isMobileViewport && ( - - ) } - + { isLoading && config[ postType ].labels.loading } + { ! isLoading && ( + + { ! templates?.length && ( + + { config[ postType ].labels.notFound } + + ) } + { ( templates ?? [] ).map( ( template ) => ( + + { decodeEntities( + template.title?.rendered || + template.slug + ) } + + ) ) } + { ! isMobileViewport && ( + + ) } + + ) } } /> diff --git a/packages/edit-site/src/components/sidebar/index.js b/packages/edit-site/src/components/sidebar/index.js index 796ac6b0d6567..e7b4e76a78add 100644 --- a/packages/edit-site/src/components/sidebar/index.js +++ b/packages/edit-site/src/components/sidebar/index.js @@ -16,6 +16,7 @@ import useSyncPathWithURL from '../sync-state-with-url/use-sync-path-with-url'; import SidebarNavigationScreenNavigationMenus from '../sidebar-navigation-screen-navigation-menus'; import SidebarNavigationScreenTemplatesBrowse from '../sidebar-navigation-screen-templates-browse'; import SaveButton from '../save-button'; +import SidebarNavigationScreenNavigationItem from '../sidebar-navigation-screen-navigation-item'; function SidebarScreens() { useSyncPathWithURL(); @@ -24,6 +25,7 @@ function SidebarScreens() { <> + From 27bb4021f655ceb5352be1bafcc98f049e5cb9e1 Mon Sep 17 00:00:00 2001 From: Bart Kalisz Date: Mon, 13 Feb 2023 16:12:24 +0100 Subject: [PATCH 24/76] Fix ComplementaryArea's initial isActive state (#47498) --- .../editor/open-document-settings-sidebar.ts | 32 +++++----- .../src/open-document-settings-sidebar.js | 13 ++-- .../src/components/sidebar-edit-mode/index.js | 2 +- .../components/complementary-area/index.js | 64 ++++++++++++------- packages/interface/src/store/selectors.js | 14 +++- 5 files changed, 79 insertions(+), 46 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 0cb27c33c6c88..bb8c23b16348d 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,29 +2,29 @@ * Internal dependencies */ import type { Editor } from './index'; -import { expect } from '../test'; /** - * Clicks on the button in the header which opens Document Settings sidebar when it is closed. + * Clicks on the button in the header which opens Document Settings sidebar when + * it is closed. * * @param {Editor} this */ export async function openDocumentSettingsSidebar( this: Editor ) { - const editorSettingsButton = this.page.locator( - 'role=region[name="Editor top bar"i] >> role=button[name="Settings"i]' - ); + const toggleButton = this.page + .getByRole( 'region', { name: 'Editor top bar' } ) + .getByRole( 'button', { + name: 'Settings', + disabled: false, + } ); - const isEditorSettingsOpened = - ( await editorSettingsButton.getAttribute( 'aria-expanded' ) ) === - 'true'; + const isClosed = + ( await toggleButton.getAttribute( 'aria-expanded' ) ) === 'false'; - if ( ! isEditorSettingsOpened ) { - await editorSettingsButton.click(); - - await expect( - this.page.locator( - 'role=region[name="Editor settings"i] >> role=button[name^="Close settings"i]' - ) - ).toBeVisible(); + if ( isClosed ) { + await toggleButton.click(); + await this.page + .getByRole( 'region', { name: 'Editor settings' } ) + .getByRole( 'button', { name: 'Close settings' } ) + .waitFor(); } } diff --git a/packages/e2e-test-utils/src/open-document-settings-sidebar.js b/packages/e2e-test-utils/src/open-document-settings-sidebar.js index 2ab5f773c3715..8d50c8c74b996 100644 --- a/packages/e2e-test-utils/src/open-document-settings-sidebar.js +++ b/packages/e2e-test-utils/src/open-document-settings-sidebar.js @@ -2,12 +2,17 @@ * Clicks on the button in the header which opens Document Settings sidebar when it is closed. */ export async function openDocumentSettingsSidebar() { - const openButton = await page.$( - '.edit-post-header__settings button[aria-label="Settings"][aria-expanded="false"]' + const toggleButton = await page.waitForSelector( + '.edit-post-header__settings button[aria-label="Settings"][aria-disabled="false"]' ); - if ( openButton ) { - await openButton.click(); + const isClosed = await page.evaluate( + ( element ) => element.getAttribute( 'aria-expanded' ) === 'false', + toggleButton + ); + + if ( isClosed ) { + await toggleButton.click(); await page.waitForSelector( '.edit-post-sidebar' ); } } diff --git a/packages/edit-site/src/components/sidebar-edit-mode/index.js b/packages/edit-site/src/components/sidebar-edit-mode/index.js index cba7bae649fe4..48574b783f5a2 100644 --- a/packages/edit-site/src/components/sidebar-edit-mode/index.js +++ b/packages/edit-site/src/components/sidebar-edit-mode/index.js @@ -69,7 +69,7 @@ export function SidebarComplementaryAreaFills() { identifier={ sidebarName } title={ __( 'Settings' ) } icon={ isRTL() ? drawerLeft : drawerRight } - closeLabel={ __( 'Close settings sidebar' ) } + closeLabel={ __( 'Close settings' ) } header={ } headerClassName="edit-site-sidebar-edit-mode__panel-tabs" > diff --git a/packages/interface/src/components/complementary-area/index.js b/packages/interface/src/components/complementary-area/index.js index bac359b10326a..5617c39da301b 100644 --- a/packages/interface/src/components/complementary-area/index.js +++ b/packages/interface/src/components/complementary-area/index.js @@ -47,26 +47,29 @@ function useAdjustComplementaryListener( const { enableComplementaryArea, disableComplementaryArea } = useDispatch( interfaceStore ); useEffect( () => { - // If the complementary area is active and the editor is switching from a big to a small window size. + // If the complementary area is active and the editor is switching from + // a big to a small window size. if ( isActive && isSmall && ! previousIsSmall.current ) { - // Disable the complementary area. disableComplementaryArea( scope ); - // Flag the complementary area to be reopened when the window size goes from small to big. + // Flag the complementary area to be reopened when the window size + // goes from small to big. shouldOpenWhenNotSmall.current = true; } else if ( - // If there is a flag indicating the complementary area should be enabled when we go from small to big window size - // and we are going from a small to big window size. + // If there is a flag indicating the complementary area should be + // enabled when we go from small to big window size and we are going + // from a small to big window size. shouldOpenWhenNotSmall.current && ! isSmall && previousIsSmall.current ) { - // Remove the flag indicating the complementary area should be enabled. + // Remove the flag indicating the complementary area should be + // enabled. shouldOpenWhenNotSmall.current = false; - // Enable the complementary area. enableComplementaryArea( scope, identifier ); } else if ( - // If the flag is indicating the current complementary should be reopened but another complementary area becomes active, - // remove the flag. + // If the flag is indicating the current complementary should be + // reopened but another complementary area becomes active, remove + // the flag. shouldOpenWhenNotSmall.current && activeArea && activeArea !== identifier @@ -97,21 +100,29 @@ function ComplementaryArea( { isActiveByDefault, showIconLabels = false, } ) { - const { isActive, isPinned, activeArea, isSmall, isLarge } = useSelect( - ( select ) => { - const { getActiveComplementaryArea, isItemPinned } = - select( interfaceStore ); - const _activeArea = getActiveComplementaryArea( scope ); - return { - isActive: _activeArea === identifier, - isPinned: isItemPinned( scope, identifier ), - activeArea: _activeArea, - isSmall: select( viewportStore ).isViewportMatch( '< medium' ), - isLarge: select( viewportStore ).isViewportMatch( 'large' ), - }; - }, - [ identifier, scope ] - ); + const { isLoading, isActive, isPinned, activeArea, isSmall, isLarge } = + useSelect( + ( select ) => { + const { + getActiveComplementaryArea, + isComplementaryAreaLoading, + isItemPinned, + } = select( interfaceStore ); + + const _activeArea = getActiveComplementaryArea( scope ); + + return { + isLoading: isComplementaryAreaLoading( scope ), + isActive: _activeArea === identifier, + isPinned: isItemPinned( scope, identifier ), + activeArea: _activeArea, + isSmall: + select( viewportStore ).isViewportMatch( '< medium' ), + isLarge: select( viewportStore ).isViewportMatch( 'large' ), + }; + }, + [ identifier, scope ] + ); useAdjustComplementaryListener( scope, identifier, @@ -127,8 +138,12 @@ function ComplementaryArea( { } = useDispatch( interfaceStore ); useEffect( () => { + // Set initial visibility: For large screens, enable if it's active by + // default. For small screens, always initially disable. if ( isActiveByDefault && activeArea === undefined && ! isSmall ) { enableComplementaryArea( scope, identifier ); + } else if ( activeArea === undefined && isSmall ) { + disableComplementaryArea( scope, identifier ); } }, [ activeArea, isActiveByDefault, scope, identifier, isSmall ] ); @@ -144,6 +159,7 @@ function ComplementaryArea( { isActive && ( ! showIconLabels || isLarge ) } aria-expanded={ isActive } + aria-disabled={ isLoading } label={ title } icon={ showIconLabels ? check : icon } showTooltip={ ! showIconLabels } diff --git a/packages/interface/src/store/selectors.js b/packages/interface/src/store/selectors.js index 13b5915e17aac..c92e45bbd3c59 100644 --- a/packages/interface/src/store/selectors.js +++ b/packages/interface/src/store/selectors.js @@ -28,7 +28,7 @@ export const getActiveComplementaryArea = createRegistrySelector( } // Return `null` to indicate the user hid the complementary area. - if ( ! isComplementaryAreaVisible ) { + if ( isComplementaryAreaVisible === false ) { return null; } @@ -36,6 +36,18 @@ export const getActiveComplementaryArea = createRegistrySelector( } ); +export const isComplementaryAreaLoading = createRegistrySelector( + ( select ) => ( state, scope ) => { + const isVisible = select( preferencesStore ).get( + scope, + 'isComplementaryAreaVisible' + ); + const identifier = state?.complementaryAreas?.[ scope ]; + + return isVisible && identifier === undefined; + } +); + /** * Returns a boolean indicating if an item is pinned or not. * From 1e9c93bb617ccd380c9d23db2506b0d05d6f72d7 Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Tue, 14 Feb 2023 00:00:15 +0800 Subject: [PATCH 25/76] Migrate query test to Playwright (#47995) * Migrate query test to Playwright * Add page status Co-authored-by: pavanpatil1 <=> --- .../src/request-utils/index.ts | 2 + .../src/request-utils/pages.ts | 51 ++++++++++++++ .../src/request-utils/posts.ts | 1 + .../specs/editor/blocks/query.test.js | 66 ------------------- test/e2e/specs/editor/blocks/query.spec.js | 64 ++++++++++++++++++ 5 files changed, 118 insertions(+), 66 deletions(-) create mode 100644 packages/e2e-test-utils-playwright/src/request-utils/pages.ts delete mode 100644 packages/e2e-tests/specs/editor/blocks/query.test.js create mode 100644 test/e2e/specs/editor/blocks/query.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 7d7ee2cb7f2aa..38fb0b9c3faa6 100644 --- a/packages/e2e-test-utils-playwright/src/request-utils/index.ts +++ b/packages/e2e-test-utils-playwright/src/request-utils/index.ts @@ -26,6 +26,7 @@ import { createNavigationMenu, deleteAllMenus, } from './menus'; +import { deleteAllPages } from './pages'; import { resetPreferences } from './preferences'; import { getSiteSettings, updateSiteSettings } from './site-settings'; import { deleteAllWidgets, addWidgetBlock } from './widgets'; @@ -147,6 +148,7 @@ class RequestUtils { deleteAllUsers = deleteAllUsers.bind( this ); getSiteSettings = getSiteSettings.bind( this ); updateSiteSettings = updateSiteSettings.bind( this ); + deleteAllPages = deleteAllPages.bind( this ); } export type { StorageState }; diff --git a/packages/e2e-test-utils-playwright/src/request-utils/pages.ts b/packages/e2e-test-utils-playwright/src/request-utils/pages.ts new file mode 100644 index 0000000000000..a9d67e2e57b76 --- /dev/null +++ b/packages/e2e-test-utils-playwright/src/request-utils/pages.ts @@ -0,0 +1,51 @@ +/** + * Internal dependencies + */ +import type { RequestUtils } from './index'; + +const PAGE_STATUS = [ + 'publish', + 'future', + 'draft', + 'pending', + 'private', + 'trash', +] as const; + +export type Page = { + id: number; + status: typeof PAGE_STATUS[ number ]; +}; + +/** + * Delete all pages using REST API. + * + * @param {RequestUtils} this + */ +export async function deleteAllPages( this: RequestUtils ) { + // List all pages. + // https://developer.wordpress.org/rest-api/reference/pages/#list-pages + const pages = await this.rest< Page[] >( { + path: '/wp/v2/pages', + params: { + per_page: 100, + + status: PAGE_STATUS.join( ',' ), + }, + } ); + + // Delete all pages one by one. + // https://developer.wordpress.org/rest-api/reference/pages/#delete-a-page + // "/wp/v2/pages" not yet supports batch requests. + await Promise.all( + pages.map( ( page ) => + this.rest( { + method: 'DELETE', + path: `/wp/v2/pages/${ page.id }`, + params: { + force: true, + }, + } ) + ) + ); +} diff --git a/packages/e2e-test-utils-playwright/src/request-utils/posts.ts b/packages/e2e-test-utils-playwright/src/request-utils/posts.ts index d4d08eaf0f5b5..667b49f5931de 100644 --- a/packages/e2e-test-utils-playwright/src/request-utils/posts.ts +++ b/packages/e2e-test-utils-playwright/src/request-utils/posts.ts @@ -10,6 +10,7 @@ export interface Post { } export interface CreatePostPayload { + title?: string; content: string; status: 'publish' | 'future' | 'draft' | 'pending' | 'private'; } diff --git a/packages/e2e-tests/specs/editor/blocks/query.test.js b/packages/e2e-tests/specs/editor/blocks/query.test.js deleted file mode 100644 index d99918a253462..0000000000000 --- a/packages/e2e-tests/specs/editor/blocks/query.test.js +++ /dev/null @@ -1,66 +0,0 @@ -/** - * WordPress dependencies - */ -import { - activatePlugin, - deactivatePlugin, - createNewPost, - insertBlock, - publishPost, - trashAllPosts, -} from '@wordpress/e2e-test-utils'; - -const createDemoPosts = async () => { - await createNewPost( { postType: 'post', title: `Post 1` } ); - await publishPost(); -}; - -describe( 'Query block', () => { - beforeAll( async () => { - await activatePlugin( 'gutenberg-test-query-block' ); - await createDemoPosts(); - } ); - afterAll( async () => { - await trashAllPosts(); - await deactivatePlugin( 'gutenberg-test-query-block' ); - } ); - beforeEach( async () => { - await createNewPost( { postType: 'page', title: `Query Page` } ); - } ); - afterEach( async () => { - await trashAllPosts( 'page' ); - } ); - describe( 'Query block insertion', () => { - it( 'List', async () => { - await insertBlock( 'Query' ); - // Wait for the choose pattern button - const choosePatternButton = await page.waitForSelector( - 'div[data-type="core/query"] button.is-primary' - ); - await choosePatternButton.click(); - // Wait for pattern blocks to be loaded. - await page.waitForSelector( - '.block-library-query-pattern__selection-content iframe[title="Editor canvas"]' - ); - // Choose the standard pattern. - const chosenPattern = await page.waitForSelector( - '.block-editor-block-patterns-list__item[aria-label="Standard"]' - ); - chosenPattern.click(); - // Wait for pattern setup to go away. - await page.waitForSelector( - '.block-library-query-pattern__selection-content', - { - hidden: true, - } - ); - /** - * We can't use `getEditedPostContent` easily for now because - * `query` makes used of `instanceId` so it's not very reliable. - * This should be revisited. - */ - await page.waitForSelector( '.wp-block-post-date' ); - await page.waitForSelector( '.wp-block-post-title' ); - } ); - } ); -} ); diff --git a/test/e2e/specs/editor/blocks/query.spec.js b/test/e2e/specs/editor/blocks/query.spec.js new file mode 100644 index 0000000000000..79b15222630ef --- /dev/null +++ b/test/e2e/specs/editor/blocks/query.spec.js @@ -0,0 +1,64 @@ +/** + * WordPress dependencies + */ +const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); + +test.describe( 'Query block', () => { + test.beforeAll( async ( { requestUtils } ) => { + await Promise.all( [ + requestUtils.activatePlugin( 'gutenberg-test-query-block' ), + requestUtils.deleteAllPosts(), + requestUtils.deleteAllPages(), + ] ); + await requestUtils.createPost( { title: 'Post 1', status: 'publish' } ); + } ); + + test.afterAll( async ( { requestUtils } ) => { + await Promise.all( [ + requestUtils.deleteAllPosts(), + requestUtils.deactivatePlugin( 'gutenberg-test-query-block' ), + ] ); + } ); + + test.beforeEach( async ( { admin } ) => { + await admin.createNewPost( { postType: 'page', title: 'Query Page' } ); + } ); + + test.afterEach( async ( { requestUtils } ) => { + await requestUtils.deleteAllPages(); + } ); + + test.describe( 'Query block insertion', () => { + test( 'List', async ( { page, editor } ) => { + await editor.insertBlock( { name: 'core/query' } ); + + await editor.canvas + .getByRole( 'document', { name: 'Block: Query Loop' } ) + .getByRole( 'button', { name: 'Choose' } ) + .click(); + + await page + .getByRole( 'dialog', { name: 'Choose a pattern' } ) + .getByRole( 'option', { name: 'Standard' } ) + .click(); + + await expect.poll( editor.getBlocks ).toMatchObject( [ + { + name: 'core/query', + innerBlocks: [ + { + name: 'core/post-template', + innerBlocks: [ + { name: 'core/post-title' }, + { name: 'core/post-featured-image' }, + { name: 'core/post-excerpt' }, + { name: 'core/separator' }, + { name: 'core/post-date' }, + ], + }, + ], + }, + ] ); + } ); + } ); +} ); From 1c087d4369c1ec2c1dee58301da4aba6017210ba Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Mon, 13 Feb 2023 18:17:10 +0000 Subject: [PATCH 26/76] Update: Make button a content block. (#47936) --- packages/block-library/src/button/block.json | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/packages/block-library/src/button/block.json b/packages/block-library/src/button/block.json index f2d41a42e6dc2..a8d7caaba6e0c 100644 --- a/packages/block-library/src/button/block.json +++ b/packages/block-library/src/button/block.json @@ -16,30 +16,35 @@ "type": "string", "source": "attribute", "selector": "a", - "attribute": "href" + "attribute": "href", + "__experimentalRole": "content" }, "title": { "type": "string", "source": "attribute", "selector": "a", - "attribute": "title" + "attribute": "title", + "__experimentalRole": "content" }, "text": { "type": "string", "source": "html", - "selector": "a" + "selector": "a", + "__experimentalRole": "content" }, "linkTarget": { "type": "string", "source": "attribute", "selector": "a", - "attribute": "target" + "attribute": "target", + "__experimentalRole": "content" }, "rel": { "type": "string", "source": "attribute", "selector": "a", - "attribute": "rel" + "attribute": "rel", + "__experimentalRole": "content" }, "placeholder": { "type": "string" From f580ad6d34e6e45b847ccad6127b20316155b0f4 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Mon, 13 Feb 2023 20:28:32 +0000 Subject: [PATCH 27/76] Remove: Unused code from the navigation inspector select logic. (#48044) --- .../components/navigation-inspector/index.js | 32 ------------------- .../style.scss | 4 --- 2 files changed, 36 deletions(-) diff --git a/packages/edit-site/src/components/navigation-inspector/index.js b/packages/edit-site/src/components/navigation-inspector/index.js index e109878f65466..7c3553743779c 100644 --- a/packages/edit-site/src/components/navigation-inspector/index.js +++ b/packages/edit-site/src/components/navigation-inspector/index.js @@ -3,14 +3,12 @@ */ import { useSelect } from '@wordpress/data'; import { useState, useEffect } from '@wordpress/element'; -import { SelectControl } from '@wordpress/components'; import { store as coreStore, useEntityBlockEditor } from '@wordpress/core-data'; import { store as blockEditorStore, BlockEditorProvider, } from '@wordpress/block-editor'; import { speak } from '@wordpress/a11y'; -import { useInstanceId } from '@wordpress/compose'; import { __ } from '@wordpress/i18n'; /** @@ -71,11 +69,6 @@ export default function NavigationInspector( { onSelect } ) { }; }, [] ); - const navMenuListId = useInstanceId( - NavigationMenu, - 'edit-site-navigation-inspector-menu' - ); - const firstNavRefInTemplate = clientIdToRef[ firstNavigationBlockId ]; const firstNavigationMenuRef = navigationMenus?.[ 0 ]?.id; @@ -99,14 +92,6 @@ export default function NavigationInspector( { onSelect } ) { } }, [ selectedNavigationBlockId ] ); - let options = []; - if ( navigationMenus ) { - options = navigationMenus.map( ( { id, title } ) => ( { - value: id, - label: title.rendered, - } ) ); - } - const [ innerBlocks, onInput, onChange ] = useEntityBlockEditor( 'postType', 'wp_navigation', @@ -137,8 +122,6 @@ export default function NavigationInspector( { onSelect } ) { const isLoading = ! ( hasResolvedNavigationMenus && hasLoadedInnerBlocks ); - const hasMoreThanOneNavigationMenu = navigationMenus?.length > 1; - const hasNavigationMenus = !! navigationMenus?.length; // Entity block editor will return entities that are not currently published. @@ -178,21 +161,6 @@ export default function NavigationInspector( { onSelect } ) { { ! hasResolvedNavigationMenus && (
) } - { hasResolvedNavigationMenus && hasMoreThanOneNavigationMenu && ( - - setCurrentMenuId( Number( newMenuId ) ) - } - /> - ) } { isLoading && ( <>
diff --git a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/style.scss b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/style.scss index 81196bac163ae..86a0c19534fbd 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/style.scss +++ b/packages/edit-site/src/components/sidebar-navigation-screen-navigation-menus/style.scss @@ -1,8 +1,4 @@ .edit-site-sidebar-navigation-screen-navigation-menus { - .block-editor-list-view-block__menu-edit, - .edit-site-navigation-inspector__select-menu { - display: none; - } .offcanvas-editor-list-view-leaf { max-width: calc(100% - #{ $grid-unit-05 }); } From 79103f124925d1f457f627e154f52a56228ed5ad Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 14 Feb 2023 10:16:29 +1300 Subject: [PATCH 28/76] Add back link to Design heading in site editor navigation to return to Dashboard (#47950) --- .../sidebar-navigation-screen/index.js | 23 ++++++++++++++++++- .../sidebar-navigation-screen/style.scss | 4 ---- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/packages/edit-site/src/components/sidebar-navigation-screen/index.js b/packages/edit-site/src/components/sidebar-navigation-screen/index.js index 6e34c9f10e4f9..754508985be06 100644 --- a/packages/edit-site/src/components/sidebar-navigation-screen/index.js +++ b/packages/edit-site/src/components/sidebar-navigation-screen/index.js @@ -5,10 +5,18 @@ import { __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalNavigatorToParentButton as NavigatorToParentButton, + Button, __experimentalNavigatorScreen as NavigatorScreen, } from '@wordpress/components'; import { isRTL, __ } from '@wordpress/i18n'; import { chevronRight, chevronLeft } from '@wordpress/icons'; +import { useSelect } from '@wordpress/data'; + +/** + * Internal dependencies + */ +import { store as editSiteStore } from '../../store'; +import { unlock } from '../../private-apis'; export default function SidebarNavigationScreen( { path, @@ -16,6 +24,13 @@ export default function SidebarNavigationScreen( { actions, content, } ) { + const { dashboardLink } = useSelect( ( select ) => { + const { getSettings } = unlock( select( editSiteStore ) ); + return { + dashboardLink: getSettings().__experimentalDashboardLink, + }; + }, [] ); + return ( ) : ( -
+
-
-
    -
  • -
-
-
-

+
- Global shortcuts -

-
    +
  • +
+
+
-
  • -
    - Navigate to the nearest toolbar. -
    -
    - - - Alt - - + - - F10 - - -
    -
  • -
  • +
      -
      - Save your changes. -
      -
      - - - Ctrl - - + - - S - - -
      - -
    • -
      - Undo your last changes. -
      -
      - +
      - Ctrl - - + - - Z - - -
      -
    • -
    • -
      - Redo your last undo. -
      -
      - + + Alt + + + + + F10 + + +
      +
    • +
    • +
      + Save your changes. +
      +
      - Ctrl - - + - - Shift - - + - - Z - - - + + Ctrl + + + + + S + + +
      +
    • +
    • +
      + Undo your last changes. +
      +
      - Ctrl - - + + aria-label="Control + Z" + class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination" + > + + Ctrl + + + + + Z + + +
      +
    • +
    • +
      + Redo your last undo. +
      +
      - Y - - -
      -
    • -
    -
  • -
    -

    - Selection shortcuts -

    -
      + + Ctrl + + + + + Shift + + + + + Z + + + + + Ctrl + + + + + Y + + +
    + + + +
    -
  • -
    - Select all text when typing. Press again to select all blocks. -
    -
    +
      +
    • - + Select all text when typing. Press again to select all blocks. +
    +
    - Ctrl - - + - - A - - -
    -
  • -
  • -
    - Clear selection. -
    -
    - + + Ctrl + + + + + A + + +
    +
  • +
  • +
    + Clear selection. +
    +
    - escape - - -
    -
  • - -
    -
    -

    + + escape + + +

    + + + +
    - Block shortcuts - -
      -
    • -
      - Duplicate the selected block(s). -
      -
      - - - Ctrl - - + - - Shift - - + - - D - - -
      -
    • -
    • +
        -
        - Remove the selected block(s). -
        -
        - - - Shift - - + - - Alt - - + - - Z - - -
        - -
      • -
        - Insert a new block before the selected block(s). -
        -
        - +
        - Ctrl - - + - - Alt - - + - - T - - -
        -
      • -
      • -
        - Insert a new block after the selected block(s). -
        -
        - + + Ctrl + + + + + Shift + + + + + D + + +
        +
      • +
      • +
        - - Ctrl - - + - - Alt - - + - - Y - - -
        -
      • -
      • -
        - Delete selection. -
        -
        - +
        - del - - - + + Shift + + + + + Alt + + + + + Z + + +
        +
      • +
      • +
        - - backspace - - -
        -
      • -
      • -
        - Move the selected block(s) up. -
        -
        - +
        - Ctrl - - + + aria-label="Control + Alt + T" + class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination" + > + + Ctrl + + + + + Alt + + + + + T + + +
        +
      • +
      • +
        + Insert a new block after the selected block(s). +
        +
        - Shift - - + + aria-label="Control + Alt + Y" + class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination" + > + + Ctrl + + + + + Alt + + + + + Y + + +
        +
      • +
      • +
        + Delete selection. +
        +
        - Alt + + del + - + - T + + backspace + - -
        -
      • -
      • -
        - Move the selected block(s) down. -
        -
        +
      • +
      • - + Move the selected block(s) up. +
    +
    - Ctrl - - + - - Shift - - + - - Alt - - + + aria-label="Control + Shift + Alt + T" + class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination" + > + + Ctrl + + + + + Shift + + + + + Alt + + + + + T + + +
    + +
  • +
    + Move the selected block(s) down. +
    +
    - Y - - -
    -
  • -
  • -
    - Change the block type after adding a new paragraph. -
    -
    - + + Ctrl + + + + + Shift + + + + + Alt + + + + + Y + + +
    +
  • +
  • +
    + Change the block type after adding a new paragraph. +
    +
    - / - - -
    -
  • - - -
    -

    + + / + + +

    + + + +
    - Text formatting - -
      -
    • -
      - Make the selected text bold. -
      -
      - - - Ctrl - - + - - B - - -
      -
    • -
    • +
        -
        - Make the selected text italic. -
        -
        - - - Ctrl - - + - - I - - -
        - -
      • -
        - Convert the selected text into a link. -
        -
        - +
        - Ctrl - - + - - K - - -
        -
      • -
      • -
        - Remove a link. -
        -
        - + + Ctrl + + + + + B + + +
        +
      • +
      • +
        - - Ctrl - - + - - Shift - - + - - K - - -
        -
      • -
      • -
        - Insert a link to a post or page. -
        -
        - +
        - [[ - - -
        -
      • -
      • -
        - Underline the selected text. -
        -
        - + + Ctrl + + + + + I + + +
        +
      • +
      • +
        - - Ctrl - - + - - U - - -
        -
      • -
      • -
        - Strikethrough the selected text. -
        -
        - +
        - Shift - - + - - Alt - - + - - D - - -
        -
      • -
      • -
        - Make the selected text inline code. -
        -
        - + + Ctrl + + + + + K + + +
        +
      • +
      • +
        + Remove a link. +
        +
        - Shift - - + - - Alt - - + + aria-label="Control + Shift + K" + class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination" + > + + Ctrl + + + + + Shift + + + + + K + + +
        +
      • +
      • +
        + Insert a link to a post or page. +
        +
        - X + + [[ + - -
        -
      • -
      • -
        - Convert the current heading to a paragraph. -
        -
        +
      • +
      • - + Underline the selected text. + +
        - Shift - - + - - Alt - - + + aria-label="Control + U" + class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination" + > + + Ctrl + + + + + U + + +
        +
      • +
      • +
        + Strikethrough the selected text. +
        +
        - 0 - - -
        -
      • -
      • -
        - Convert the current paragraph or heading to a heading of level 1 to 6. -
        -
        - + + Shift + + + + + Alt + + + + + D + + +
        +
      • +
      • +
        + Make the selected text inline code. +
        +
        - Shift - - + + aria-label="Shift + Alt + X" + class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination" + > + + Shift + + + + + Alt + + + + + X + + +
        +
      • +
      • +
        + Convert the current heading to a paragraph. +
        +
        - Alt - - + + aria-label="Shift + Alt + 0" + class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination" + > + + Shift + + + + + Alt + + + + + 0 + + +
        +
      • +
      • +
        + Convert the current paragraph or heading to a heading of level 1 to 6. +
        +
        - 1-6 - - -
        -
      • -
      -
    + aria-label="Shift + Alt + 1 6" + class="edit-post-keyboard-shortcut-help-modal__shortcut-key-combination" + > + + Shift + + + + + Alt + + + + + 1-6 + + + + + + + `; diff --git a/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap b/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap index c0d2d8b7a6b73..67d5ee4e18436 100644 --- a/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap +++ b/packages/edit-post/src/components/preferences-modal/test/__snapshots__/index.js.snap @@ -102,425 +102,427 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active -
    +
    - - - -
    -
    -
    +
    - -

    - Publishing -

    -

    - Change options related to publishing. -

    -
    -
    +

    + Publishing +

    +

    + Change options related to publishing. +

    +
    - - - - - - + + + + + + +
    +

    + Review settings, such as visibility and tags. +

    -

    - Review settings, such as visibility and tags. -

    -
    - -
    - +
    -

    - Appearance -

    -

    - Customize options related to the block editor interface and editing flow. -

    - -
    +

    + Appearance +

    +

    + Customize options related to the block editor interface and editing flow. +

    +
    - - - - - - + + + + + + +
    +

    + Reduce visual distractions by hiding the toolbar and other elements to focus on writing. +

    -

    - Reduce visual distractions by hiding the toolbar and other elements to focus on writing. -

    -
    -
    - - - - - - + + + + + + +
    +

    + Highlights the current block and fades other content. +

    -

    - Highlights the current block and fades other content. -

    -
    -
    - - - - - - + + + + + + +
    +

    + Show text instead of icons on buttons. +

    -

    - Show text instead of icons on buttons. -

    - -
    - - - - - - + + + + + + +
    +

    + Opens the block list view sidebar by default. +

    -

    - Opens the block list view sidebar by default. -

    - -
    - - - - - - + + + + + + +
    +

    + Make the editor look like your theme. +

    -

    - Make the editor look like your theme. -

    - -
    - - - - - - + + + + + + +
    +

    + Shows block breadcrumbs at the bottom of the editor. +

    -

    - Shows block breadcrumbs at the bottom of the editor. -

    - - + + @@ -721,198 +723,200 @@ exports[`EditPostPreferencesModal should match snapshot when the modal is active -
    +
    -
    - -
    -
    -
    +
    -
    - - Blocks - -
    -
    -
    +
    - - + +
    -
    - -
    -
    -
    +
    -
    - - Panels - -
    -
    -
    +
    - - + +
    -
    - + +
    + diff --git a/test/e2e/specs/editor/various/a11y.spec.js b/test/e2e/specs/editor/various/a11y.spec.js index 6ff397fc9cab8..4e37c08b08e0c 100644 --- a/test/e2e/specs/editor/various/a11y.spec.js +++ b/test/e2e/specs/editor/various/a11y.spec.js @@ -3,7 +3,16 @@ */ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); -test.describe( 'a11y', () => { +test.use( { + // Make the viewport tall enough so that some tabs panels within the + // Preferences modal are not scrollable and other tab panels are. + viewport: { + width: 1280, + height: 1024, + }, +} ); + +test.describe( 'a11y (@firefox, @webkit)', () => { test.beforeEach( async ( { admin } ) => { await admin.createNewPost(); } ); @@ -38,9 +47,13 @@ test.describe( 'a11y', () => { page, pageUtils, } ) => { - // Open keyboard help modal. + // Open keyboard shortcuts modal. await pageUtils.pressKeyWithModifier( 'access', 'h' ); + const modalContent = page.locator( + 'role=dialog[name="Keyboard shortcuts"i] >> role=document' + ); + const closeButton = page.locator( 'role=dialog[name="Keyboard shortcuts"i] >> role=button[name="Close"i]' ); @@ -49,10 +62,15 @@ test.describe( 'a11y', () => { // See: https://github.com/WordPress/gutenberg/issues/9410 await expect( closeButton ).not.toBeFocused(); + // Open keyboard shortcuts modal. await page.keyboard.press( 'Tab' ); + await expect( modalContent ).toBeFocused(); - // Ensure the Close button of the modal is focused after tabbing. + await page.keyboard.press( 'Tab' ); await expect( closeButton ).toBeFocused(); + + await page.keyboard.press( 'Tab' ); + await expect( modalContent ).toBeFocused(); } ); test( 'should return focus to the first tabbable in a modal after blurring a tabbable', async ( { @@ -93,4 +111,90 @@ test.describe( 'a11y', () => { ) ).toBeFocused(); } ); + + test( 'should make the modal content focusable when it is scrollable', async ( { + page, + } ) => { + // Open the top bar Options menu. + await page.click( + 'role=region[name="Editor top bar"i] >> role=button[name="Options"i]' + ); + + // Open the Preferences modal. + await page.click( + 'role=menu[name="Options"i] >> role=menuitem[name="Preferences"i]' + ); + + const preferencesModal = page.locator( + 'role=dialog[name="Preferences"i]' + ); + const preferencesModalContent = + preferencesModal.locator( 'role=document' ); + const closeButton = preferencesModal.locator( + 'role=button[name="Close"i]' + ); + const generalTab = preferencesModal.locator( + 'role=tab[name="General"i]' + ); + const blocksTab = preferencesModal.locator( + 'role=tab[name="Blocks"i]' + ); + const panelsTab = preferencesModal.locator( + 'role=tab[name="Panels"i]' + ); + + // Check initial focus is on the modal dialog container. + await expect( preferencesModal ).toBeFocused(); + + // Check the General tab panel is visible by default. + await expect( + preferencesModal.locator( 'role=tabpanel[name="General"i]' ) + ).toBeVisible(); + + async function clickAndFocusTab( tab ) { + // Some browsers, e.g. Safari, don't set focus after a click. We need + // to ensure focus is set to start tabbing from a predictable place + // in the UI. This isn't part of the user flow we want to test. + await tab.click(); + await tab.focus(); + } + + // The General tab panel content is short and not scrollable. + // Check it's not focusable. + await clickAndFocusTab( generalTab ); + await page.keyboard.press( 'Shift+Tab' ); + await expect( closeButton ).toBeFocused(); + await page.keyboard.press( 'Shift+Tab' ); + await expect( preferencesModalContent ).not.toBeFocused(); + + // The Blocks tab panel content is long and scrollable. + // Check it's focusable. + await clickAndFocusTab( blocksTab ); + await page.keyboard.press( 'Shift+Tab' ); + await expect( closeButton ).toBeFocused(); + await page.keyboard.press( 'Shift+Tab' ); + await expect( preferencesModalContent ).toBeFocused(); + + // Make the Blocks tab panel content shorter by searching for a block + // that doesn't exist. The content only shows 'No blocks found' and it's + // not scrollable any longer. Check it's not focusable. + await clickAndFocusTab( blocksTab ); + await page.type( + 'role=searchbox[name="Search for a block"i]', + 'qwerty' + ); + await clickAndFocusTab( blocksTab ); + await page.keyboard.press( 'Shift+Tab' ); + await expect( closeButton ).toBeFocused(); + await page.keyboard.press( 'Shift+Tab' ); + await expect( preferencesModalContent ).not.toBeFocused(); + + // The Panels tab panel content is short and not scrollable. + // Check it's not focusable. + await clickAndFocusTab( panelsTab ); + await page.keyboard.press( 'Shift+Tab' ); + await expect( closeButton ).toBeFocused(); + await page.keyboard.press( 'Shift+Tab' ); + await expect( preferencesModalContent ).not.toBeFocused(); + } ); } ); From d6a116977e6bfa748bee3576b2ad21c3cc9905e0 Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Tue, 14 Feb 2023 22:29:25 +1300 Subject: [PATCH 33/76] Site Editor: tidy up the generation of the site editor page title (#48053) * Tidy up the generation of the edit site page title * Remove isReady as doesn't seem to add anything above the isLoaded from useEditedEntityRecord --- .../edit-site/src/components/editor/index.js | 52 ++++++++----------- 1 file changed, 21 insertions(+), 31 deletions(-) diff --git a/packages/edit-site/src/components/editor/index.js b/packages/edit-site/src/components/editor/index.js index 901a66d2e3121..c74e74df61772 100644 --- a/packages/edit-site/src/components/editor/index.js +++ b/packages/edit-site/src/components/editor/index.js @@ -4,7 +4,7 @@ import { useMemo } from '@wordpress/element'; import { useSelect, useDispatch } from '@wordpress/data'; import { Notice } from '@wordpress/components'; -import { EntityProvider, store as coreStore } from '@wordpress/core-data'; +import { EntityProvider } from '@wordpress/core-data'; import { store as preferencesStore } from '@wordpress/preferences'; import { BlockContextProvider, @@ -17,7 +17,7 @@ import { store as interfaceStore, } from '@wordpress/interface'; import { EditorNotices, EditorSnackbars } from '@wordpress/editor'; -import { __ } from '@wordpress/i18n'; +import { __, sprintf } from '@wordpress/i18n'; /** * Internal dependencies @@ -36,6 +36,7 @@ import { GlobalStylesProvider } from '../global-styles/global-styles-provider'; import useTitle from '../routes/use-title'; import CanvasSpinner from '../canvas-spinner'; import { unlock } from '../../private-apis'; +import useEditedEntityRecord from '../use-edited-entity-record'; const interfaceLabels = { /* translators: accessibility text for the editor content landmark region. */ @@ -50,11 +51,15 @@ const interfaceLabels = { export default function Editor() { const { - editedPostId, - editedPostType, - editedPost, + record: editedPost, + getTitle, + isLoaded: hasLoadedPost, + } = useEditedEntityRecord(); + + const { id: editedPostId, type: editedPostType } = editedPost; + + const { context, - hasLoadedPost, editorMode, canvasMode, blockEditorMode, @@ -64,36 +69,19 @@ export default function Editor() { showIconLabels, } = useSelect( ( select ) => { const { - getEditedPostType, - getEditedPostId, getEditedPostContext, getEditorMode, getCanvasMode, isInserterOpened, isListViewOpened, } = unlock( select( editSiteStore ) ); - const { hasFinishedResolution, getEntityRecord } = select( coreStore ); const { __unstableGetEditorMode } = select( blockEditorStore ); const { getActiveComplementaryArea } = select( interfaceStore ); - const postType = getEditedPostType(); - const postId = getEditedPostId(); // The currently selected entity to display. // Typically template or template part in the site editor. return { - editedPostId: postId, - editedPostType: postType, - editedPost: postId - ? getEntityRecord( 'postType', postType, postId ) - : null, context: getEditedPostContext(), - hasLoadedPost: postId - ? hasFinishedResolution( 'getEntityRecord', [ - 'postType', - postType, - postId, - ] ) - : false, editorMode: getEditorMode(), canvasMode: getCanvasMode(), blockEditorMode: __unstableGetEditorMode(), @@ -135,26 +123,28 @@ export default function Editor() { } ), ], } ), - [ context ] + [ context, setEditedPostContext ] ); - const isReady = editedPostType !== undefined && editedPostId !== undefined; let title; - if ( isReady && editedPost ) { + if ( hasLoadedPost ) { const type = editedPostType === 'wp_template' ? __( 'Template' ) : __( 'Template Part' ); - title = `${ editedPost.title?.rendered } ‹ ${ type } ‹ ${ __( - 'Editor (beta)' - ) }`; + title = sprintf( + // translators: A breadcrumb trail in browser tab. %1$s: title of template being edited, %2$s: type of template (Template or Template Part). + __( '%1$s ‹ %2$s ‹ Editor' ), + getTitle(), + type + ); } // Only announce the title once the editor is ready to prevent "Replace" // action in from double-announcing. - useTitle( isReady && title ); + useTitle( hasLoadedPost && title ); - if ( ! isReady ) { + if ( ! hasLoadedPost ) { return ; } From 3bab065078c7e9df3c33ba41c7b43985487180fb Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Tue, 14 Feb 2023 10:21:17 +0000 Subject: [PATCH 34/76] Use post object instead of id. (#48001) --- packages/block-library/src/post-title/index.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/block-library/src/post-title/index.php b/packages/block-library/src/post-title/index.php index 1f03b12fc2b46..e123a9993304b 100644 --- a/packages/block-library/src/post-title/index.php +++ b/packages/block-library/src/post-title/index.php @@ -19,8 +19,8 @@ function render_block_core_post_title( $attributes, $content, $block ) { return ''; } - $post_ID = $block->context['postId']; - $title = get_the_title(); + $post = get_post( $block->context['postId'] ); + $title = get_the_title( $post ); if ( ! $title ) { return ''; @@ -33,7 +33,7 @@ function render_block_core_post_title( $attributes, $content, $block ) { if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) { $rel = ! empty( $attributes['rel'] ) ? 'rel="' . esc_attr( $attributes['rel'] ) . '"' : ''; - $title = sprintf( '%4$s', get_the_permalink( $post_ID ), esc_attr( $attributes['linkTarget'] ), $rel, $title ); + $title = sprintf( '%4$s', get_the_permalink( $post ), esc_attr( $attributes['linkTarget'] ), $rel, $title ); } $classes = array(); From f93a8f67b8b16eb00e6915555b3f3dac4f54c04d Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Tue, 14 Feb 2023 10:55:42 +0000 Subject: [PATCH 35/76] Updates text (#48030) --- .../src/components/off-canvas-editor/leaf-more-menu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js b/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js index 6b4d8cf893382..5d3eaef3cd87f 100644 --- a/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js +++ b/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js @@ -81,7 +81,7 @@ export default function LeafMoreMenu( props ) { onClose(); } } > - { __( 'Add submenu item' ) } + { __( 'Add submenu link' ) } { From 8892fdefa30200ffa4fd79e6ae8e657e65f9b833 Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Tue, 14 Feb 2023 11:43:36 +0000 Subject: [PATCH 36/76] Improve performance gutenberg_render_layout_support_flag (#48003) --- lib/block-supports/layout.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/block-supports/layout.php b/lib/block-supports/layout.php index 7697f610af86d..1c8de2e2c3412 100644 --- a/lib/block-supports/layout.php +++ b/lib/block-supports/layout.php @@ -380,14 +380,9 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) { return (string) $content; } - $global_settings = gutenberg_get_global_settings(); - $block_gap = _wp_array_get( $global_settings, array( 'spacing', 'blockGap' ), null ); - $has_block_gap_support = isset( $block_gap ); - $global_layout_settings = _wp_array_get( $global_settings, array( 'layout' ), null ); - $root_padding_aware_alignments = _wp_array_get( $global_settings, array( 'useRootPaddingAwareAlignments' ), false ); - - $default_block_layout = _wp_array_get( $block_type->supports, array( '__experimentalLayout', 'default' ), array() ); - $used_layout = isset( $block['attrs']['layout'] ) ? $block['attrs']['layout'] : $default_block_layout; + $global_settings = gutenberg_get_global_settings(); + $global_layout_settings = _wp_array_get( $global_settings, array( 'layout' ), null ); + $used_layout = isset( $block['attrs']['layout'] ) ? $block['attrs']['layout'] : _wp_array_get( $block_type->supports, array( '__experimentalLayout', 'default' ), array() ); if ( isset( $used_layout['inherit'] ) && $used_layout['inherit'] && ! $global_layout_settings ) { return $block_content; @@ -403,6 +398,8 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) { $used_layout['type'] = 'constrained'; } + $root_padding_aware_alignments = _wp_array_get( $global_settings, array( 'useRootPaddingAwareAlignments' ), false ); + if ( $root_padding_aware_alignments && isset( $used_layout['type'] ) && @@ -470,6 +467,9 @@ function gutenberg_render_layout_support_flag( $block_content, $block ) { */ $should_skip_gap_serialization = wp_should_skip_block_supports_serialization( $block_type, 'spacing', 'blockGap' ); + $block_gap = _wp_array_get( $global_settings, array( 'spacing', 'blockGap' ), null ); + $has_block_gap_support = isset( $block_gap ); + $style = gutenberg_get_layout_style( ".$container_class.$container_class", $used_layout, From 2c8e618bc423c2861b1280b68e892fe38d305b3e Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Tue, 14 Feb 2023 11:48:30 +0000 Subject: [PATCH 37/76] Disable lazy loading get_block_templates. (#47999) --- lib/compat/wordpress-6.1/block-template-utils.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/compat/wordpress-6.1/block-template-utils.php b/lib/compat/wordpress-6.1/block-template-utils.php index 928291b500084..5423b8cd29abd 100644 --- a/lib/compat/wordpress-6.1/block-template-utils.php +++ b/lib/compat/wordpress-6.1/block-template-utils.php @@ -76,11 +76,12 @@ function gutenberg_get_block_templates( $query = array(), $template_type = 'wp_t $post_type = isset( $query['post_type'] ) ? $query['post_type'] : ''; $wp_query_args = array( - 'post_status' => array( 'auto-draft', 'draft', 'publish' ), - 'post_type' => $template_type, - 'posts_per_page' => -1, - 'no_found_rows' => true, - 'tax_query' => array( + 'post_status' => array( 'auto-draft', 'draft', 'publish' ), + 'post_type' => $template_type, + 'posts_per_page' => -1, + 'no_found_rows' => true, + 'lazy_load_term_meta' => false, + 'tax_query' => array( array( 'taxonomy' => 'wp_theme', 'field' => 'name', From f7414b04f1f79edd32617a4be859a08a56627fdd Mon Sep 17 00:00:00 2001 From: Glen Davies Date: Wed, 15 Feb 2023 02:55:06 +1300 Subject: [PATCH 38/76] Template editor: only disable the save button if no changes rather than hiding it (#47895) * Only show button save state of the button itself initiated the save * Revert "Only show button save state of the button itself initiated the save" This reverts commit d6d3f20ed61b46045664dd3decebb5891e6e3102. * Disable the button when nothing to save, rather than hiding it --- .../edit-site/src/components/sidebar/index.js | 21 ++++--------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/packages/edit-site/src/components/sidebar/index.js b/packages/edit-site/src/components/sidebar/index.js index e7b4e76a78add..1bc0548d3abd7 100644 --- a/packages/edit-site/src/components/sidebar/index.js +++ b/packages/edit-site/src/components/sidebar/index.js @@ -2,9 +2,7 @@ * WordPress dependencies */ import { memo } from '@wordpress/element'; -import { useSelect } from '@wordpress/data'; import { __experimentalNavigatorProvider as NavigatorProvider } from '@wordpress/components'; -import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies @@ -37,16 +35,6 @@ function SidebarScreens() { } function Sidebar() { - const { isDirty } = useSelect( ( select ) => { - const { __experimentalGetDirtyEntityRecords } = select( coreStore ); - const dirtyEntityRecords = __experimentalGetDirtyEntityRecords(); - // The currently selected entity to display. - // Typically template or template part in the site editor. - return { - isDirty: dirtyEntityRecords.length > 0, - }; - }, [] ); - return ( <> - { isDirty && ( -
    - -
    - ) } + +
    + +
    ); } From 01641fddf8e4dd57a0ba6114889bcc6076d8250c Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Tue, 14 Feb 2023 14:31:58 +0000 Subject: [PATCH 39/76] Close Link UI if cancelled (#48029) --- .../src/components/off-canvas-editor/block-contents.js | 1 + .../block-editor/src/components/off-canvas-editor/link-ui.js | 1 + packages/block-library/src/navigation-link/link-ui.js | 1 + 3 files changed, 3 insertions(+) diff --git a/packages/block-editor/src/components/off-canvas-editor/block-contents.js b/packages/block-editor/src/components/off-canvas-editor/block-contents.js index 46144d9d85111..77922df8441ea 100644 --- a/packages/block-editor/src/components/off-canvas-editor/block-contents.js +++ b/packages/block-editor/src/components/off-canvas-editor/block-contents.js @@ -121,6 +121,7 @@ const ListViewBlockContents = forwardRef( ); setIsLinkUIOpen( false ); } } + onCancel={ () => setIsLinkUIOpen( false ) } /> ) } diff --git a/packages/block-editor/src/components/off-canvas-editor/link-ui.js b/packages/block-editor/src/components/off-canvas-editor/link-ui.js index 695d8b62dda92..f6b5e2538d9e7 100644 --- a/packages/block-editor/src/components/off-canvas-editor/link-ui.js +++ b/packages/block-editor/src/components/off-canvas-editor/link-ui.js @@ -151,6 +151,7 @@ export function LinkUI( props ) { suggestionsQuery={ getSuggestionsQuery( type, kind ) } onChange={ props.onChange } onRemove={ props.onRemove } + onCancel={ props.onCancel } renderControlBottom={ ! url ? () => ( diff --git a/packages/block-library/src/navigation-link/link-ui.js b/packages/block-library/src/navigation-link/link-ui.js index a2df4f2a29405..3dede053de3db 100644 --- a/packages/block-library/src/navigation-link/link-ui.js +++ b/packages/block-library/src/navigation-link/link-ui.js @@ -198,6 +198,7 @@ export function LinkUI( props ) { suggestionsQuery={ getSuggestionsQuery( type, kind ) } onChange={ props.onChange } onRemove={ props.onRemove } + onCancel={ props.onCancel } renderControlBottom={ ! url ? () => ( From 601789876f7e9749a69b6bf93f86fa201e321a54 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Tue, 14 Feb 2023 14:56:51 +0000 Subject: [PATCH 40/76] OffCanvasEditor: Only allow some blocks to be converted to submenus (#47974) * OffCanvasEditor: Only allow some blocks to be converted to submenus * make the option disabled * Update packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js Co-authored-by: Dave Smith --------- Co-authored-by: Dave Smith --- .../off-canvas-editor/leaf-more-menu.js | 103 ++++++++++-------- 1 file changed, 60 insertions(+), 43 deletions(-) diff --git a/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js b/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js index 5d3eaef3cd87f..a266f0d9377c3 100644 --- a/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js +++ b/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js @@ -19,11 +19,68 @@ const POPOVER_PROPS = { variant: 'toolbar', }; +const BLOCKS_THAT_CAN_BE_CONVERTED_TO_SUBMENU = [ + 'core/navigation-link', + 'core/navigation-submenu', +]; + +function AddSubmenuItem( { block, onClose } ) { + const { insertBlock, replaceBlock, replaceInnerBlocks } = + useDispatch( blockEditorStore ); + + const clientId = block.clientId; + const isDisabled = ! BLOCKS_THAT_CAN_BE_CONVERTED_TO_SUBMENU.includes( + block.name + ); + return ( + { + const updateSelectionOnInsert = false; + const newLink = createBlock( 'core/navigation-link' ); + + if ( block.name === 'core/navigation-submenu' ) { + insertBlock( + newLink, + block.innerBlocks.length, + clientId, + updateSelectionOnInsert + ); + } else { + // Convert to a submenu if the block currently isn't one. + const newSubmenu = createBlock( + 'core/navigation-submenu', + block.attributes, + block.innerBlocks + ); + + // The following must happen as two independent actions. + // Why? Because the offcanvas editor relies on the getLastInsertedBlocksClientIds + // selector to determine which block is "active". As the UX needs the newLink to be + // the "active" block it must be the last block to be inserted. + // Therefore the Submenu is first created and **then** the newLink is inserted + // thus ensuring it is the last inserted block. + replaceBlock( clientId, newSubmenu ); + + replaceInnerBlocks( + newSubmenu.clientId, + [ newLink ], + updateSelectionOnInsert + ); + } + onClose(); + } } + > + { __( 'Add submenu link' ) } + + ); +} + export default function LeafMoreMenu( props ) { const { clientId, block } = props; - const { insertBlock, replaceBlock, removeBlocks, replaceInnerBlocks } = - useDispatch( blockEditorStore ); + const { removeBlocks } = useDispatch( blockEditorStore ); const label = sprintf( /* translators: %s: block name */ @@ -42,47 +99,7 @@ export default function LeafMoreMenu( props ) { > { ( { onClose } ) => ( - { - const updateSelectionOnInsert = false; - const newLink = createBlock( - 'core/navigation-link' - ); - if ( block.name === 'core/navigation-submenu' ) { - insertBlock( - newLink, - block.innerBlocks.length, - clientId, - updateSelectionOnInsert - ); - } else { - // Convert to a submenu if the block currently isn't one. - const newSubmenu = createBlock( - 'core/navigation-submenu', - block.attributes, - block.innerBlocks - ); - - // The following must happen as two independent actions. - // Why? Because the offcanvas editor relies on the getLastInsertedBlocksClientIds - // selector to determine which block is "active". As the UX needs the newLink to be - // the "active" block it must be the last block to be inserted. - // Therefore the Submenu is first created and **then** the newLink is inserted - // thus ensuring it is the last inserted block. - replaceBlock( clientId, newSubmenu ); - - replaceInnerBlocks( - newSubmenu.clientId, - [ newLink ], - updateSelectionOnInsert - ); - } - onClose(); - } } - > - { __( 'Add submenu link' ) } - + { removeBlocks( [ clientId ], false ); From 1d3c2f7ada87a4c408fe56edc2889cc9eb8058f9 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Tue, 14 Feb 2023 19:06:27 +0000 Subject: [PATCH 41/76] Chore: Move Gutenberg_REST_Templates_Controller from 6.2 to 6.3 compatibility. (#48077) --- lib/compat/wordpress-6.2/rest-api.php | 15 --------------- ...s-gutenberg-rest-templates-controller-6-3.php} | 2 +- lib/compat/wordpress-6.3/rest-api.php | 15 +++++++++++++++ lib/load.php | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) rename lib/compat/{wordpress-6.2/class-gutenberg-rest-templates-controller-6-2.php => wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php} (97%) diff --git a/lib/compat/wordpress-6.2/rest-api.php b/lib/compat/wordpress-6.2/rest-api.php index 06780aceb245e..a504be4dca2a6 100644 --- a/lib/compat/wordpress-6.2/rest-api.php +++ b/lib/compat/wordpress-6.2/rest-api.php @@ -5,21 +5,6 @@ * @package gutenberg */ -/** - * Update `wp_template` and `wp_template-part` post types to use - * Gutenberg's REST controller. - * - * @param array $args Array of arguments for registering a post type. - * @param string $post_type Post type key. - */ -function gutenberg_update_templates_template_parts_rest_controller( $args, $post_type ) { - if ( in_array( $post_type, array( 'wp_template', 'wp_template-part' ), true ) ) { - $args['rest_controller_class'] = 'Gutenberg_REST_Templates_Controller_6_2'; - } - return $args; -} -add_filter( 'register_post_type_args', 'gutenberg_update_templates_template_parts_rest_controller', 10, 2 ); - /** * Registers the block pattern categories REST API routes. */ diff --git a/lib/compat/wordpress-6.2/class-gutenberg-rest-templates-controller-6-2.php b/lib/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php similarity index 97% rename from lib/compat/wordpress-6.2/class-gutenberg-rest-templates-controller-6-2.php rename to lib/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php index 16d38ac073e68..f857cedd37f9a 100644 --- a/lib/compat/wordpress-6.2/class-gutenberg-rest-templates-controller-6-2.php +++ b/lib/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php @@ -9,7 +9,7 @@ /** * Base Templates REST API Controller. */ -class Gutenberg_REST_Templates_Controller_6_2 extends Gutenberg_REST_Templates_Controller { +class Gutenberg_REST_Templates_Controller_6_3 extends Gutenberg_REST_Templates_Controller { /** * Registers the controllers routes. diff --git a/lib/compat/wordpress-6.3/rest-api.php b/lib/compat/wordpress-6.3/rest-api.php index 55a45df07d593..93422289100df 100644 --- a/lib/compat/wordpress-6.3/rest-api.php +++ b/lib/compat/wordpress-6.3/rest-api.php @@ -13,3 +13,18 @@ function gutenberg_register_rest_pattern_directory() { $pattern_directory_controller->register_routes(); } add_action( 'rest_api_init', 'gutenberg_register_rest_pattern_directory' ); + +/** + * Update `wp_template` and `wp_template-part` post types to use + * Gutenberg's REST controller. + * + * @param array $args Array of arguments for registering a post type. + * @param string $post_type Post type key. + */ +function gutenberg_update_templates_template_parts_rest_controller( $args, $post_type ) { + if ( in_array( $post_type, array( 'wp_template', 'wp_template-part' ), true ) ) { + $args['rest_controller_class'] = 'Gutenberg_REST_Templates_Controller_6_3'; + } + return $args; +} +add_filter( 'register_post_type_args', 'gutenberg_update_templates_template_parts_rest_controller', 10, 2 ); diff --git a/lib/load.php b/lib/load.php index dc253408a9289..035fbe3740627 100644 --- a/lib/load.php +++ b/lib/load.php @@ -44,13 +44,13 @@ function gutenberg_is_experiment_enabled( $name ) { require_once __DIR__ . '/compat/wordpress-6.2/class-gutenberg-rest-block-patterns-controller-6-2.php'; require_once __DIR__ . '/compat/wordpress-6.2/class-gutenberg-rest-block-pattern-categories-controller.php'; require_once __DIR__ . '/compat/wordpress-6.2/class-gutenberg-rest-pattern-directory-controller-6-2.php'; - require_once __DIR__ . '/compat/wordpress-6.2/class-gutenberg-rest-templates-controller-6-2.php'; require_once __DIR__ . '/compat/wordpress-6.2/rest-api.php'; require_once __DIR__ . '/compat/wordpress-6.2/block-patterns.php'; require_once __DIR__ . '/compat/wordpress-6.2/class-gutenberg-rest-global-styles-controller-6-2.php'; // WordPress 6.3 compat. require_once __DIR__ . '/compat/wordpress-6.3/class-gutenberg-rest-pattern-directory-controller-6-3.php'; + require_once __DIR__ . '/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php'; require_once __DIR__ . '/compat/wordpress-6.3/rest-api.php'; // Experimental. From 7a8a44abe4b0aaf57b4fd7e2bb8512167789fb7e Mon Sep 17 00:00:00 2001 From: Jonny Harris Date: Tue, 14 Feb 2023 20:45:35 +0000 Subject: [PATCH 42/76] Replace usage of wp_get_theme()->get_stylesheet() with get_stylesheet() (#48027) --- lib/compat/wordpress-6.1/block-template-utils.php | 2 +- packages/block-library/src/template-part/index.php | 2 +- 2 files changed, 2 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 5423b8cd29abd..5e240d227d358 100644 --- a/lib/compat/wordpress-6.1/block-template-utils.php +++ b/lib/compat/wordpress-6.1/block-template-utils.php @@ -148,7 +148,7 @@ function gutenberg_get_block_templates( $query = array(), $template_type = 'wp_t } $is_not_custom = false === array_search( - wp_get_theme()->get_stylesheet() . '//' . $template_file['slug'], + get_stylesheet() . '//' . $template_file['slug'], array_column( $query_result, 'id' ), true ); diff --git a/packages/block-library/src/template-part/index.php b/packages/block-library/src/template-part/index.php index 7c4cb693fde54..b0507e46464a2 100644 --- a/packages/block-library/src/template-part/index.php +++ b/packages/block-library/src/template-part/index.php @@ -22,7 +22,7 @@ function render_block_core_template_part( $attributes ) { if ( isset( $attributes['slug'] ) && isset( $attributes['theme'] ) && - wp_get_theme()->get_stylesheet() === $attributes['theme'] + get_stylesheet() === $attributes['theme'] ) { $template_part_id = $attributes['theme'] . '//' . $attributes['slug']; $template_part_query = new WP_Query( From 0c208a7a1f730b546ecb9f38bc7b22e1c892c3a4 Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Wed, 15 Feb 2023 10:47:22 +1100 Subject: [PATCH 43/76] Block schema and block supports docs: Add dimensions and position settings (#48057) * Schema and docs: Add dimensions and position settings * Fix typos and nit picks --------- Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> --- .../block-api/block-supports.md | 75 ++++++++++++++++++- .../theme-json-reference/theme-json-living.md | 1 + schemas/json/block.json | 42 ++++++++--- schemas/json/theme.json | 4 +- 4 files changed, 107 insertions(+), 15 deletions(-) diff --git a/docs/reference-guides/block-api/block-supports.md b/docs/reference-guides/block-api/block-supports.md index eecac6cf2a9d7..2e5f509f6dc48 100644 --- a/docs/reference-guides/block-api/block-supports.md +++ b/docs/reference-guides/block-api/block-supports.md @@ -466,6 +466,39 @@ supports: { } ``` +## dimensions + +_**Note:** Since WordPress 6.2._ + +- Type: `Object` +- Default value: null +- Subproperties: + - `minHeight`: type `boolean`, default value `false` + +This value signals that a block supports some of the CSS style properties related to dimensions. When it does, the block editor will show UI controls for the user to set their values if [the theme declares support](/docs/how-to-guides/themes/theme-json/#opt-in-into-ui-controls). + +```js +supports: { + dimensions: { + minHeight: true // Enable min height control. + } +} +``` + +When a block declares support for a specific dimensions property, its attributes definition is extended to include the `style` attribute. + +- `style`: attribute of `object` type with no default assigned. This is added when `minHeight` support is declared. It stores the custom values set by the user, e.g.: + +```js +attributes: { + style: { + dimensions: { + minHeight: "50vh" + } + } +} +``` + ## html - Type: `boolean` @@ -485,7 +518,7 @@ supports: { - Type: `boolean` - Default value: `true` -By default, all blocks will appear in the inserter, block transforms menu, Style Book, etc. To hide a block from all parts of the user interface so that it can only be inserted programatically, set `inserter` to `false`. +By default, all blocks will appear in the inserter, block transforms menu, Style Book, etc. To hide a block from all parts of the user interface so that it can only be inserted programmatically, set `inserter` to `false`. ```js supports: { @@ -536,6 +569,42 @@ supports: { } ``` +## position + +_**Note:** Since WordPress 6.2._ + +- Type: `Object` +- Default value: null +- Subproperties: + - `sticky`: type `boolean`, default value `false` + +This value signals that a block supports some of the CSS style properties related to position. When it does, the block editor will show UI controls for the user to set their values if [the theme declares support](/docs/how-to-guides/themes/theme-json/#opt-in-into-ui-controls). + +Note that sticky position controls are currently only available for blocks set at the root level of the document. Setting a block to the `sticky` position will stick the block to its most immediate parent when the user scrolls the page. + +```js +supports: { + position: { + sticky: true // Enable selecting sticky position. + } +} +``` + +When the block declares support for a specific position property, its attributes definition is extended to include the `style` attribute. + +- `style`: attribute of `object` type with no default assigned. This is added when `sticky` support is declared. It stores the custom values set by the user, e.g.: + +```js +attributes: { + style: { + position: { + type: "sticky", + top: "0px" + } + } +} +``` + ## spacing - Type: `Object` @@ -545,7 +614,7 @@ supports: { - `padding`: type `boolean` or `array`, default value `false` - `blockGap`: type `boolean` or `array`, default value `false` -This value signals that a block supports some of the CSS style properties related to spacing. When it does, the block editor will show UI controls for the user to set their values, if [the theme declares support](/docs/how-to-guides/themes/theme-support.md#cover-block-padding). +This value signals that a block supports some of the CSS style properties related to spacing. When it does, the block editor will show UI controls for the user to set their values if [the theme declares support](/docs/how-to-guides/themes/theme-support.md#cover-block-padding). ```js supports: { @@ -557,7 +626,7 @@ supports: { } ``` -When the block declares support for a specific spacing property, the attributes definition is extended to include the `style` attribute. +When the block declares support for a specific spacing property, its attributes definition is extended to include the `style` attribute. - `style`: attribute of `object` type with no default assigned. This is added when `margin` or `padding` support is declared. It stores the custom values set by the user, e.g.: 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 118327a1f8b0d..acc0a499ec61b 100644 --- a/docs/reference-guides/theme-json-reference/theme-json-living.md +++ b/docs/reference-guides/theme-json-reference/theme-json-living.md @@ -23,6 +23,7 @@ Setting that enables the following UI tools: - border: color, radius, style, width - color: link - dimensions: minHeight +- position: sticky - spacing: blockGap, margin, padding - typography: lineHeight diff --git a/schemas/json/block.json b/schemas/json/block.json index 9e7d43470b180..ad3bb45516b9f 100644 --- a/schemas/json/block.json +++ b/schemas/json/block.json @@ -269,22 +269,22 @@ "properties": { "background": { "type": "boolean", - "description": "This property adds UI controls which allow the user to apply a solid background color to a block.\n\nWhen color support is declared, this property is enabled by default (along with text), so simply setting color will enable background color.\n\nTo disable background support while keeping other color supports enabled, set to false.\n\nWhen the block declares support for color.background, the attributes definition is extended to include two new attributes: backgroundColor and style", + "description": "This property adds UI controls which allow the user to apply a solid background color to a block.\n\nWhen color support is declared, this property is enabled by default (along with text), so simply setting color will enable background color.\n\nTo disable background support while keeping other color supports enabled, set to false.\n\nWhen the block declares support for color.background, its attributes definition is extended to include two new attributes: backgroundColor and style", "default": true }, "gradients": { "type": "boolean", - "description": "This property adds UI controls which allow the user to apply a gradient background to a block.\n\nGradient presets are sourced from editor-gradient-presets theme support.\n\nWhen the block declares support for color.gradient, the attributes definition is extended to include two new attributes: gradient and style", + "description": "This property adds UI controls which allow the user to apply a gradient background to a block.\n\nGradient presets are sourced from editor-gradient-presets theme support.\n\nWhen the block declares support for color.gradient, its attributes definition is extended to include two new attributes: gradient and style", "default": false }, "link": { "type": "boolean", - "description": "This property adds block controls which allow the user to set link color in a block, link color is disabled by default.\n\nLink color presets are sourced from the editor-color-palette theme support.\n\nWhen the block declares support for color.link, the attributes definition is extended to include the style attribute", + "description": "This property adds block controls which allow the user to set link color in a block, link color is disabled by default.\n\nLink color presets are sourced from the editor-color-palette theme support.\n\nWhen the block declares support for color.link, its attributes definition is extended to include the style attribute", "default": false }, "text": { "type": "boolean", - "description": "This property adds block controls which allow the user to set text color in a block.\n\nWhen color support is declared, this property is enabled by default (along with background), so simply setting color will enable text color.\n\nText color presets are sourced from the editor-color-palette theme support.\n\nWhen the block declares support for color.text, the attributes definition is extended to include two new attributes: textColor and style", + "description": "This property adds block controls which allow the user to set text color in a block.\n\nWhen color support is declared, this property is enabled by default (along with background), so simply setting color will enable text color.\n\nText color presets are sourced from the editor-color-palette theme support.\n\nWhen the block declares support for color.text, its attributes definition is extended to include two new attributes: textColor and style", "default": true }, "enableContrastChecker": { @@ -304,6 +304,17 @@ "description": "When the style picker is shown, a dropdown is displayed so the user can select a default style for this block type. If you prefer not to show the dropdown, set this property to false.", "default": true }, + "dimensions": { + "type": "object", + "description": "This value signals that a block supports some of the CSS style properties related to dimensions. When it does, the block editor will show UI controls for the user to set their values if the theme declares support.\n\nWhen the block declares support for a specific dimensions property, its attributes definition is extended to include the style attribute.", + "properties": { + "minHeight": { + "type": "boolean", + "description": "Allow blocks to define a minimum height value.", + "default": false + } + } + }, "html": { "type": "boolean", "description": "By default, a block’s markup can be edited individually. To disable this behavior, set html to false.", @@ -311,7 +322,7 @@ }, "inserter": { "type": "boolean", - "description": "By default, all blocks will appear in the inserter, block transforms menu, Style Book, etc. To hide a block from all parts of the user interface so that it can only be inserted programatically, set inserter to false.", + "description": "By default, all blocks will appear in the inserter, block transforms menu, Style Book, etc. To hide a block from all parts of the user interface so that it can only be inserted programmatically, set inserter to false.", "default": true }, "multiple": { @@ -329,9 +340,20 @@ "description": "A block may want to disable the ability to toggle the lock state. It can be locked/unlocked by a user from the block 'Options' dropdown by default. To disable this behavior, set lock to false.", "default": true }, + "position": { + "type": "object", + "description": "This value signals that a block supports some of the CSS style properties related to position. When it does, the block editor will show UI controls for the user to set their values if the theme declares support.\n\nWhen the block declares support for a specific position property, its attributes definition is extended to include the style attribute.", + "properties": { + "sticky": { + "type": "boolean", + "description": "Allow blocks to stick to their immediate parent when scrolling the page.", + "default": false + } + } + }, "spacing": { "type": "object", - "description": "This value signals that a block supports some of the CSS style properties related to spacing. When it does, the block editor will show UI controls for the user to set their values, if the theme declares support.\n\nWhen the block declares support for a specific spacing property, the attributes definition is extended to include the style attribute.", + "description": "This value signals that a block supports some of the CSS style properties related to spacing. When it does, the block editor will show UI controls for the user to set their values if the theme declares support.\n\nWhen the block declares support for a specific spacing property, its attributes definition is extended to include the style attribute.", "properties": { "margin": { "oneOf": [ @@ -389,16 +411,16 @@ }, "typography": { "type": "object", - "description": "This value signals that a block supports some of the CSS style properties related to typography. When it does, the block editor will show UI controls for the user to set their values, if the theme declares support.\n\nWhen the block declares support for a specific typography property, the attributes definition is extended to include the style attribute.", + "description": "This value signals that a block supports some of the CSS style properties related to typography. When it does, the block editor will show UI controls for the user to set their values if the theme declares support.\n\nWhen the block declares support for a specific typography property, its attributes definition is extended to include the style attribute.", "properties": { "fontSize": { "type": "boolean", - "description": "This value signals that a block supports the font-size CSS style property. When it does, the block editor will show an UI control for the user to set its value.\n\nThe values shown in this control are the ones declared by the theme via the editor-font-sizes theme support, or the default ones if none is provided.\n\nWhen the block declares support for fontSize, the attributes definition is extended to include two new attributes: fontSize and style", + "description": "This value signals that a block supports the font-size CSS style property. When it does, the block editor will show an UI control for the user to set its value.\n\nThe values shown in this control are the ones declared by the theme via the editor-font-sizes theme support, or the default ones if none is provided.\n\nWhen the block declares support for fontSize, its attributes definition is extended to include two new attributes: fontSize and style", "default": false }, "lineHeight": { "type": "boolean", - "description": "This value signals that a block supports the line-height CSS style property. When it does, the block editor will show an UI control for the user to set its value if the theme declares support.\n\nWhen the block declares support for lineHeight, the attributes definition is extended to include a new attribute style of object type with no default assigned. It stores the custom value set by the user. The block can apply a default style by specifying its own style attribute with a default", + "description": "This value signals that a block supports the line-height CSS style property. When it does, the block editor will show an UI control for the user to set its value if the theme declares support.\n\nWhen the block declares support for lineHeight, its attributes definition is extended to include a new attribute style of object type with no default assigned. It stores the custom value set by the user. The block can apply a default style by specifying its own style attribute with a default", "default": false } } @@ -438,7 +460,7 @@ }, "attributes": { "type": "object", - "description": "Set the attribues for the block example" + "description": "Set the attributes for the block example" }, "innerBlocks": { "type": "array", diff --git a/schemas/json/theme.json b/schemas/json/theme.json index 53404cbdbff5e..d2fb13b6f13b4 100644 --- a/schemas/json/theme.json +++ b/schemas/json/theme.json @@ -20,7 +20,7 @@ "type": "object", "properties": { "appearanceTools": { - "description": "Setting that enables the following UI tools:\n\n- border: color, radius, style, width\n- color: link\n- dimensions: minHeight\n- spacing: blockGap, margin, padding\n- typography: lineHeight", + "description": "Setting that enables the following UI tools:\n\n- border: color, radius, style, width\n- color: link\n- dimensions: minHeight\n- position: sticky\n- spacing: blockGap, margin, padding\n- typography: lineHeight", "type": "boolean", "default": false } @@ -332,7 +332,7 @@ "type": "object", "properties": { "operator": { - "description": "With + or * depending on whether scale is generated by increment or mulitplier.", + "description": "With + or * depending on whether scale is generated by increment or multiplier.", "type": "string", "enum": [ "+", "*" ], "default": "*" From f21dba8327a36da33238412b6c3116a07c2fb52a Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Wed, 15 Feb 2023 09:56:30 +1000 Subject: [PATCH 44/76] Shadow: Wrap resetShadow in useCallback --- .../edit-site/src/components/global-styles/shadow-panel.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/global-styles/shadow-panel.js b/packages/edit-site/src/components/global-styles/shadow-panel.js index 8272d90726443..efe97c0d5c71d 100644 --- a/packages/edit-site/src/components/global-styles/shadow-panel.js +++ b/packages/edit-site/src/components/global-styles/shadow-panel.js @@ -44,7 +44,10 @@ export default function ShadowPanel( { name, variation = '' } ) { const [ userShadow ] = useGlobalStyle( `${ prefix }shadow`, name, 'user' ); const hasShadow = () => !! userShadow; - const resetShadow = () => setShadow( undefined ); + const resetShadow = useCallback( + () => setShadow( undefined ), + [ setShadow ] + ); const resetAll = useCallback( () => resetShadow( undefined ), [ resetShadow ] From f8d4ddfe498d096759b7b1cb690e7bb6035e50ea Mon Sep 17 00:00:00 2001 From: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> Date: Wed, 15 Feb 2023 11:35:47 +1000 Subject: [PATCH 45/76] Verse: Adopt border supports (#48021) --- packages/block-library/src/verse/block.json | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/block-library/src/verse/block.json b/packages/block-library/src/verse/block.json index dc0772cc9aa52..4f023d716b5c5 100644 --- a/packages/block-library/src/verse/block.json +++ b/packages/block-library/src/verse/block.json @@ -47,6 +47,12 @@ "spacing": { "margin": true, "padding": true + }, + "__experimentalBorder": { + "radius": true, + "width": true, + "color": true, + "style": true } }, "style": "wp-block-verse", From 4a6ffee7ce42059ac96d7fa4daa38ed5316e9097 Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Wed, 15 Feb 2023 09:48:56 +0800 Subject: [PATCH 46/76] Upgrade Playwright to 1.30.0 (#48007) * Upgrade Playwright to 1.30.0 * Update doc for best practices * Fix snapshot path * Fix strict locator * Try to fix safari test * Update image test to use visual testing * Update docs/contributors/code/e2e/README.md Co-authored-by: Glen Davies * Drop unnecessary await in toMatchSnapshot Co-authored-by: Bart Kalisz --------- Co-authored-by: Glen Davies Co-authored-by: Bart Kalisz --- docs/contributors/code/e2e/README.md | 20 ++--- package-lock.json | 66 +++++++------- package.json | 2 +- .../e2e-test-utils-playwright/src/test.ts | 18 ---- test/e2e/playwright.config.ts | 9 +- ...-ratio-using-the-crop-tools-1-chromium.png | Bin 0 -> 270 bytes ...-ratio-using-the-crop-tools-1-chromium.txt | 6 -- ...tating-using-the-crop-tools-1-chromium.png | Bin 0 -> 278 bytes ...tating-using-the-crop-tools-1-chromium.txt | 6 -- ...ooming-using-the-crop-tools-1-chromium.png | Bin 0 -> 260 bytes ...ooming-using-the-crop-tools-1-chromium.txt | 6 -- test/e2e/specs/editor/blocks/image.spec.js | 83 +++++++++++++----- test/e2e/specs/editor/blocks/list.spec.js | 2 +- 13 files changed, 110 insertions(+), 108 deletions(-) create mode 100644 test/e2e/specs/editor/blocks/__snapshots__/Image-allows-changing-aspect-ratio-using-the-crop-tools-1-chromium.png delete mode 100644 test/e2e/specs/editor/blocks/__snapshots__/Image-allows-changing-aspect-ratio-using-the-crop-tools-1-chromium.txt create mode 100644 test/e2e/specs/editor/blocks/__snapshots__/Image-allows-rotating-using-the-crop-tools-1-chromium.png delete mode 100644 test/e2e/specs/editor/blocks/__snapshots__/Image-allows-rotating-using-the-crop-tools-1-chromium.txt create mode 100644 test/e2e/specs/editor/blocks/__snapshots__/Image-allows-zooming-using-the-crop-tools-1-chromium.png delete mode 100644 test/e2e/specs/editor/blocks/__snapshots__/Image-allows-zooming-using-the-crop-tools-1-chromium.txt diff --git a/docs/contributors/code/e2e/README.md b/docs/contributors/code/e2e/README.md index 968db5638a6a9..1776fde77baf6 100644 --- a/docs/contributors/code/e2e/README.md +++ b/docs/contributors/code/e2e/README.md @@ -36,6 +36,8 @@ xvfb-run -- npm run test:e2e:playwright -- --project=webkit ## Best practices +Read the [best practices](https://playwright.dev/docs/best-practices) guide for Playwright. +

    Forbid `$`, use `locator` instead

    @@ -45,26 +47,22 @@ In fact, any API that returns `ElementHandle` is [discouraged](https://playwrigh

    Use accessible selectors

    -Use the selector engine [role-selector](https://playwright.dev/docs/selectors#role-selector) to construct the query wherever possible. It enables us to write accessible queries without having to rely on internal implementations. The syntax should be straightforward and looks like this: +Use [`getByRole`](https://playwright.dev/docs/locators#locate-by-role) to construct the query wherever possible. It enables us to write accessible queries without having to rely on internal implementations. ```js -// Select a button with the accessible name "Hello World" (case-insensitive). -page.locator( 'role=button[name="Hello World"i]' ); - -// Using short-form API, the `name` is case-insensitive by default. +// Select a button which includes the accessible name "Hello World" (case-insensitive). page.getByRole( 'button', { name: 'Hello World' } ); ``` -It's recommended to append `i` to the name attribute to match it case-insensitively wherever it makes sense. It can also be chained with built-in selector engines to perform complex queries: +It can also be chained to perform complex queries: ```js -// Select a button with a name ends with `Back` and is visible on the screen. -page.locator( 'role=button[name=/Back$/] >> visible=true' ); -// Select a button with the (exact) name "View options" under `#some-section`. -page.locator( 'css=#some-section >> role=button[name="View options"]' ); +// Select an option with a name "Buttons" under the "Block Library" region. +page.getByRole( 'region', { name: 'Block Library' } ) + .getByRole( 'option', { name: 'Buttons' } ) ``` -See the [official documentation](https://playwright.dev/docs/selectors#role-selector) for more info on how to use them. +See the [official documentation](https://playwright.dev/docs/locators) for more info on how to use them.
    diff --git a/package-lock.json b/package-lock.json index 58914db037710..6fb9ece91f420 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7941,19 +7941,19 @@ } }, "@playwright/test": { - "version": "1.27.1", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.27.1.tgz", - "integrity": "sha512-mrL2q0an/7tVqniQQF6RBL2saskjljXzqNcCOVMUjRIgE6Y38nCNaP+Dc2FBW06bcpD3tqIws/HT9qiMHbNU0A==", + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.30.0.tgz", + "integrity": "sha512-SVxkQw1xvn/Wk/EvBnqWIq6NLo1AppwbYOjNLmyU0R1RoQ3rLEBtmjTnElcnz8VEtn11fptj1ECxK0tgURhajw==", "dev": true, "requires": { "@types/node": "*", - "playwright-core": "1.27.1" + "playwright-core": "1.30.0" }, "dependencies": { "playwright-core": { - "version": "1.27.1", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.27.1.tgz", - "integrity": "sha512-9EmeXDncC2Pmp/z+teoVYlvmPWUC6ejSSYZUln7YaP89Z6lpAaiaAnqroUt/BoLo8tn7WYShcfaCh+xofZa44Q==", + "version": "1.30.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.30.0.tgz", + "integrity": "sha512-7AnRmTCf+GVYhHbLJsGUtskWTE33SwMZkybJ0v6rqR1boxq2x36U7p1vDRV7HO2IwTZgmycracLxPEJI49wu4g==", "dev": true } } @@ -19363,7 +19363,7 @@ "app-root-dir": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/app-root-dir/-/app-root-dir-1.0.2.tgz", - "integrity": "sha1-OBh+wt6nV3//Az/8sSFyaS/24Rg=", + "integrity": "sha512-jlpIfsOoNoafl92Sz//64uQHGSyMrD2vYG5d8o2a4qGvyNCvXur7bzIsWtAC/6flI2RYAp3kv8rsfBtaLm7w0g==", "dev": true }, "app-root-path": { @@ -26021,7 +26021,7 @@ "array-ify": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-ify/-/array-ify-1.0.0.tgz", - "integrity": "sha512-c5AMf34bKdvPhQ7tBGhqkgKNUzMr4WUs+WDtC2ZUGOUncbxKMTvqxYctiseW3+L4bA8ec+GcZ6/A/FW4m8ukng==", + "integrity": "sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4=", "dev": true }, "array-includes": { @@ -27656,7 +27656,7 @@ "babel-plugin-add-react-displayname": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/babel-plugin-add-react-displayname/-/babel-plugin-add-react-displayname-0.0.5.tgz", - "integrity": "sha1-M51M3be2X9YtHfnbn+BN4TQSK9U=", + "integrity": "sha512-LY3+Y0XVDYcShHHorshrDbt4KFWL4bSeniCtl4SYZbask+Syngk1uMPCeN9+nSiZo6zX5s0RTq/J9Pnaaf/KHw==", "dev": true }, "babel-plugin-apply-mdx-type-prop": { @@ -28028,7 +28028,7 @@ "batch-processor": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/batch-processor/-/batch-processor-1.0.0.tgz", - "integrity": "sha1-dclcMrdI4IUNEMKxaPa9vpiRrOg=", + "integrity": "sha512-xoLQD8gmmR32MeuBHgH0Tzd5PuSZx71ZsbhVxOCRbgktZEPe4SQy7s9Z50uPp0F/f7iw2XmkHN2xkgbMfckMDA==", "dev": true }, "bcrypt-pbkdf": { @@ -31121,7 +31121,7 @@ "css.escape": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", - "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==", + "integrity": "sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=", "dev": true }, "cssesc": { @@ -31345,7 +31345,7 @@ "debuglog": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/debuglog/-/debuglog-1.0.1.tgz", - "integrity": "sha512-syBZ+rnAK3EgMsH2aYEOLUW7mZSY9Gb+0wUMCFsZvcmiz+HigA0LOcq/HoQqVuGG+EKykunc7QG2bzrponfaSw==", + "integrity": "sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI=", "dev": true }, "decache": { @@ -36277,7 +36277,7 @@ "git-remote-origin-url": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/git-remote-origin-url/-/git-remote-origin-url-2.0.0.tgz", - "integrity": "sha512-eU+GGrZgccNJcsDH5LkXR3PB9M958hxc7sbA8DFJjrv9j4L2P/eZfKhM+QD6wyzpiv+b1BpK0XrYCxkovtjSLw==", + "integrity": "sha1-UoJlna4hBxRaERJhEq0yFuxfpl8=", "dev": true, "requires": { "gitconfiglocal": "^1.0.0", @@ -36324,7 +36324,7 @@ "gitconfiglocal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/gitconfiglocal/-/gitconfiglocal-1.0.0.tgz", - "integrity": "sha512-spLUXeTAVHxDtKsJc8FkFVgFtMdEN9qPGpL23VfSHx4fP4+Ds097IXLvymbnDH8FnmxX5Nr9bPw3A+AQ6mWEaQ==", + "integrity": "sha1-QdBF84UaXqiPA/JMocYXgRRGS5s=", "dev": true, "requires": { "ini": "^1.3.2" @@ -36363,7 +36363,7 @@ "is-glob": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw==", + "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", "dev": true, "requires": { "is-extglob": "^2.1.0" @@ -36672,7 +36672,7 @@ "has-glob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-glob/-/has-glob-1.0.0.tgz", - "integrity": "sha1-mqqe7b/7G6OZCnsAEPtnjuAIEgc=", + "integrity": "sha512-D+8A457fBShSEI3tFCj65PAbT++5sKiFtdCdOam0gnfBgw9D277OERk+HM9qYJXmdVLZ/znez10SqHN0BBQ50g==", "dev": true, "requires": { "is-glob": "^3.0.0" @@ -36681,7 +36681,7 @@ "is-glob": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", + "integrity": "sha512-UFpDDrPgM6qpnFNI+rh/p3bUaq9hKLZN8bMUWzxmcnZVS3omf4IPK+BrewlnWjO1WmUsMYuSjKh4UJuV4+Lqmw==", "dev": true, "requires": { "is-extglob": "^2.1.0" @@ -37526,7 +37526,7 @@ "humanize-ms": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz", - "integrity": "sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==", + "integrity": "sha1-xG4xWaKT9riW2ikxbYtv6Lt5u+0=", "dev": true, "requires": { "ms": "^2.0.0" @@ -38543,7 +38543,7 @@ "is-text-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-text-path/-/is-text-path-1.0.1.tgz", - "integrity": "sha512-xFuJpne9oFz5qDaodwmmG08e3CawH/2ZV8Qqza1Ko7Sk8POWbkRdwIoAWVhqvq0XeUzANEhKo2n0IXUGBm7A/w==", + "integrity": "sha1-Thqg+1G/vLPpJogAE5cgLBd1tm4=", "dev": true, "requires": { "text-extensions": "^1.0.0" @@ -38855,7 +38855,7 @@ "is-window": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-window/-/is-window-1.0.2.tgz", - "integrity": "sha1-LIlspT25feRdPDMTOmXYyfVjSA0=", + "integrity": "sha512-uj00kdXyZb9t9RcAUAwMZAnkBUwdYGhYlt7djMXhfyhUCzwNba50tIiBKR7q0l7tdoBtFVw/3JmLY6fI3rmZmg==", "dev": true }, "is-windows": { @@ -42255,7 +42255,7 @@ "js-string-escape": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/js-string-escape/-/js-string-escape-1.0.1.tgz", - "integrity": "sha1-4mJbrbwNZ8dTPp7cEGjFh65BN+8=", + "integrity": "sha512-Smw4xcfIQ5LVjAOuJCvN/zIodzA/BBSsluuoSykP+lUvScIi4U6RJLfwHet5cxFnCswUjISV8oAXaqaJDY3chg==", "dev": true }, "js-tokens": { @@ -42646,7 +42646,7 @@ "jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", - "integrity": "sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", "dev": true }, "jsprim": { @@ -43727,7 +43727,7 @@ "lodash.ismatch": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz", - "integrity": "sha512-fPMfXjGQEV9Xsq/8MTSgUf255gawYRbjwMyDbcvDhXgV7enSZA0hynz6vMPnpAb5iONEzBHBPsT+0zes5Z301g==", + "integrity": "sha1-dWy1FQyjum8RCFp4hJZF8Yj4Xzc=", "dev": true }, "lodash.isplainobject": { @@ -43986,7 +43986,7 @@ "lz-string": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz", - "integrity": "sha512-0ckx7ZHRPqb0oUm8zNr+90mtf9DQB60H1wMCjBtfi62Kl3a7JbHob6gA2bC+xRvZoOL+1hzUK8jeuEIQE8svEQ==", + "integrity": "sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=", "dev": true }, "macos-release": { @@ -47293,7 +47293,7 @@ "num2fraction": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/num2fraction/-/num2fraction-1.2.2.tgz", - "integrity": "sha1-b2gragJ6Tp3fpFZM0lidHU5mnt4=", + "integrity": "sha512-Y1wZESM7VUThYY+4W+X4ySH2maqcA+p7UR+w8VWNWVAd6lwuXXWz/w/Cz43J/dI2I+PS6wD5N+bJUF+gjWvIqg==", "dev": true }, "number-is-nan": { @@ -48761,7 +48761,7 @@ "p-defer": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-defer/-/p-defer-1.0.0.tgz", - "integrity": "sha1-n26xgvbJqozXQwBKfU+WsZaw+ww=", + "integrity": "sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==", "dev": true }, "p-event": { @@ -50317,7 +50317,7 @@ "pretty-hrtime": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/pretty-hrtime/-/pretty-hrtime-1.0.3.tgz", - "integrity": "sha1-t+PqQkNaTJsnWdmeDyAesZWALuE=", + "integrity": "sha512-66hKPCr+72mlfiSjlEB1+45IjXSqvVAIy6mocupoww4tBFE9R9IhwwUGoI4G++Tc9Aq+2rxOt0RFU6gPcrte0A==", "dev": true }, "private": { @@ -50876,7 +50876,7 @@ "promzard": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/promzard/-/promzard-0.3.0.tgz", - "integrity": "sha512-JZeYqd7UAcHCwI+sTOeUDYkvEU+1bQ7iE0UT1MgB/tERkAPkesW46MrpIySzODi+owTjZtiF8Ay5j9m60KmMBw==", + "integrity": "sha1-JqXW7ox97kyxIggwWs+5O6OCqe4=", "dev": true, "requires": { "read": "1" @@ -50910,7 +50910,7 @@ "proto-list": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", - "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==", + "integrity": "sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk=", "dev": true }, "protocols": { @@ -52255,7 +52255,7 @@ "read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", - "integrity": "sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==", + "integrity": "sha1-s9oZvQUkMal2cdRKQmNK33ELQMQ=", "dev": true, "requires": { "mute-stream": "~0.0.4" @@ -52814,7 +52814,7 @@ "relateurl": { "version": "0.2.7", "resolved": "https://registry.npmjs.org/relateurl/-/relateurl-0.2.7.tgz", - "integrity": "sha1-VNvzd+UUQKypCkzSdGANP/LYiKk=", + "integrity": "sha512-G08Dxvm4iDN3MLM0EsP62EDV9IuhXPR6blNz6Utcp7zyV3tr4HVNINt6MpaRWbxoOHT3Q7YN2P+jaHX8vUbgog==", "dev": true }, "remark": { @@ -57875,7 +57875,7 @@ "temp-dir": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz", - "integrity": "sha512-xZFXEGbG7SNC3itwBzI3RYjq/cEhBkx2hJuKGIUOcEULmkQExXiHat2z/qkISYsuR+IKumhEfKKbV5qXmhICFQ==", + "integrity": "sha1-CnwOom06Oa+n4OvqnB/AvE2qAR0=", "dev": true }, "terminal-link": { diff --git a/package.json b/package.json index d49bb29104aec..aaf16e907f13e 100644 --- a/package.json +++ b/package.json @@ -99,7 +99,7 @@ "@octokit/rest": "16.26.0", "@octokit/types": "6.34.0", "@octokit/webhooks-types": "5.6.0", - "@playwright/test": "1.27.1", + "@playwright/test": "1.30.0", "@pmmmwh/react-refresh-webpack-plugin": "0.5.2", "@storybook/addon-a11y": "6.5.7", "@storybook/addon-actions": "6.5.7", diff --git a/packages/e2e-test-utils-playwright/src/test.ts b/packages/e2e-test-utils-playwright/src/test.ts index b26117ff077ff..a277afa1cd13d 100644 --- a/packages/e2e-test-utils-playwright/src/test.ts +++ b/packages/e2e-test-utils-playwright/src/test.ts @@ -151,24 +151,6 @@ const test = base.extend< }, { scope: 'worker', auto: true }, ], - // An automatic fixture to configure snapshot settings globally. - snapshotConfig: [ - async ( {}, use, testInfo ) => { - // A work-around to remove the default snapshot suffix. - // See https://github.com/microsoft/playwright/issues/11134 - testInfo.snapshotSuffix = ''; - // Normalize snapshots into the same `__snapshots__` folder to minimize - // the file name length on Windows. - // See https://github.com/WordPress/gutenberg/issues/40291 - testInfo.snapshotDir = path.join( - path.dirname( testInfo.file ), - '__snapshots__' - ); - - await use(); - }, - { auto: true }, - ], } ); export { test, expect }; diff --git a/test/e2e/playwright.config.ts b/test/e2e/playwright.config.ts index 8796de6fdb28b..e1724a61d6126 100644 --- a/test/e2e/playwright.config.ts +++ b/test/e2e/playwright.config.ts @@ -4,14 +4,13 @@ import os from 'os'; import path from 'path'; import { fileURLToPath } from 'url'; -import { devices } from '@playwright/test'; -import type { PlaywrightTestConfig } from '@playwright/test'; +import { defineConfig, devices } from '@playwright/test'; const STORAGE_STATE_PATH = process.env.STORAGE_STATE_PATH || path.join( process.cwd(), 'artifacts/storage-states/admin.json' ); -const config: PlaywrightTestConfig = { +const config = defineConfig( { reporter: process.env.CI ? [ [ 'github' ], [ './config/flaky-tests-reporter.ts' ] ] : 'list', @@ -23,6 +22,8 @@ const config: PlaywrightTestConfig = { reportSlowTests: null, testDir: fileURLToPath( new URL( './specs', 'file:' + __filename ).href ), outputDir: path.join( process.cwd(), 'artifacts/test-results' ), + snapshotPathTemplate: + '{testDir}/{testFileDir}/__snapshots__/{arg}-{projectName}{ext}', globalSetup: fileURLToPath( new URL( './config/global-setup.ts', 'file:' + __filename ).href ), @@ -81,6 +82,6 @@ const config: PlaywrightTestConfig = { grepInvert: /-firefox/, }, ], -}; +} ); export default config; diff --git a/test/e2e/specs/editor/blocks/__snapshots__/Image-allows-changing-aspect-ratio-using-the-crop-tools-1-chromium.png b/test/e2e/specs/editor/blocks/__snapshots__/Image-allows-changing-aspect-ratio-using-the-crop-tools-1-chromium.png new file mode 100644 index 0000000000000000000000000000000000000000..b488fe1a7e4833ecb2f63a9ae26dc4b79ee303fe GIT binary patch literal 270 zcmeAS@N?(olHy`uVBq!ia0vp^AT}EZ3y=)>dE6IBv7|ftIx;Y9?C1WI$O_~uBzpt_ z#jDg97#dm_7=8hT8eT9klo~KFyh>nTu$sZZAYL$MSD+10f+@+{-G$+Qd;gjJKpuOE zr>`sfb0$7kMaz!czfJ;$#5`RbLpZJ{r~Ek2z*=yOS&dDnL9B_vFNo=tll;FBpbFIz z*NBpo#FA92CkWnhs0lr!lvI6-E$sR$z z3=CCj3=9n|3=F@3LJcn%7)lKo7+xhXFj&oCU=S~uvn$XBD8ZEE?e4Jb0VJq zzPTO#&I?qjTH+c}l9E`GYL#4+3Zxi}42+C*4UBXRO+pMzt&B~q49v9+46FNL6Qo|9znhg z3{`3j3=J&|48MRv4KElNN(~qoUL`OvSj}Ky5HFasE6@fg!Ib3f?!v%$w@Y{lkjGx) z>Fdh=oQaQBRG`p#BFHu#PZ!4!j_b)A5*nNsSeqCnR|$oN0L4{HTq8|2o1UUDVb@NxHW`#?s*5)z~JfX K=d#Wzp$Py`5 { // Assert that the image is initially unscaled and unedited. const initialImageSrc = await image.getAttribute( 'src' ); - const initialImageDataURL = await imageBlockUtils.getDataURL( image ); + await expect + .poll( () => image.boundingBox() ) + .toMatchObject( { + height: 10, + width: 10, + } ); // Zoom in to twice the amount using the zoom input. await editor.clickBlockToolbarButton( 'Crop' ); @@ -340,11 +346,15 @@ test.describe( 'Image', () => { const updatedImageSrc = await image.getAttribute( 'src' ); expect( initialImageSrc ).not.toEqual( updatedImageSrc ); - const updatedImageDataURL = await imageBlockUtils.getDataURL( image ); - expect( initialImageDataURL ).not.toEqual( updatedImageDataURL ); + await expect + .poll( () => image.boundingBox() ) + .toMatchObject( { + height: 5, + width: 5, + } ); expect( - snapshotDiff( initialImageDataURL, updatedImageDataURL ) + await imageBlockUtils.getImageBuffer( updatedImageSrc ) ).toMatchSnapshot(); } ); @@ -369,7 +379,12 @@ test.describe( 'Image', () => { // Assert that the image is initially unscaled and unedited. const initialImageSrc = await image.getAttribute( 'src' ); - const initialImageDataURL = await imageBlockUtils.getDataURL( image ); + await expect + .poll( () => image.boundingBox() ) + .toMatchObject( { + height: 10, + width: 10, + } ); // Zoom in to twice the amount using the zoom input. await editor.clickBlockToolbarButton( 'Crop' ); @@ -386,13 +401,17 @@ test.describe( 'Image', () => { // Assert that the image is edited. const updatedImageSrc = await image.getAttribute( 'src' ); - const updatedImageDataURL = await imageBlockUtils.getDataURL( image ); + expect( updatedImageSrc ).not.toEqual( initialImageSrc ); - expect( initialImageSrc ).not.toEqual( updatedImageSrc ); - expect( initialImageDataURL ).not.toEqual( updatedImageDataURL ); + await expect + .poll( () => image.boundingBox() ) + .toMatchObject( { + height: 6, + width: 10, + } ); expect( - snapshotDiff( initialImageDataURL, updatedImageDataURL ) + await imageBlockUtils.getImageBuffer( updatedImageSrc ) ).toMatchSnapshot(); } ); @@ -415,9 +434,6 @@ test.describe( 'Image', () => { await expect( image ).toHaveAttribute( 'src', new RegExp( filename ) ); - // Assert that the image is initially unscaled and unedited. - const initialImageDataURL = await imageBlockUtils.getDataURL( image ); - // Rotate the image. await editor.clickBlockToolbarButton( 'Crop' ); await editor.clickBlockToolbarButton( 'Rotate' ); @@ -429,14 +445,10 @@ test.describe( 'Image', () => { ).toBeHidden(); // Assert that the image is edited. - await expect - .poll( async () => imageBlockUtils.getDataURL( image ) ) - .not.toBe( initialImageDataURL ); - - const updatedImageDataURL = await imageBlockUtils.getDataURL( image ); + const updatedImageSrc = await image.getAttribute( 'src' ); expect( - snapshotDiff( initialImageDataURL, updatedImageDataURL ) + await imageBlockUtils.getImageBuffer( updatedImageSrc ) ).toMatchSnapshot(); } ); @@ -530,6 +542,7 @@ test.describe( 'Image', () => { class ImageBlockUtils { constructor( { page } ) { + /** @type {Page} */ this.page = page; this.TEST_IMAGE_FILE_PATH = path.join( @@ -555,14 +568,40 @@ class ImageBlockUtils { return filename; } - async getDataURL( element ) { + async getImageBuffer( url ) { + const response = await this.page.request.get( url ); + return await response.body(); + } + + async getHexString( element ) { return element.evaluate( ( node ) => { const canvas = document.createElement( 'canvas' ); - const context = canvas.getContext( '2d' ); canvas.width = node.width; canvas.height = node.height; + + const context = canvas.getContext( '2d' ); context.drawImage( node, 0, 0 ); - return canvas.toDataURL( 'image/jpeg' ); + const imageData = context.getImageData( + 0, + 0, + canvas.width, + canvas.height + ); + const pixels = imageData.data; + + let hexString = ''; + for ( let i = 0; i < pixels.length; i += 4 ) { + if ( i !== 0 && i % ( canvas.width * 4 ) === 0 ) { + hexString += '\n'; + } + + const r = pixels[ i ].toString( 16 ).padStart( 2, '0' ); + const g = pixels[ i + 1 ].toString( 16 ).padStart( 2, '0' ); + const b = pixels[ i + 2 ].toString( 16 ).padStart( 2, '0' ); + const a = pixels[ i + 3 ].toString( 16 ).padStart( 2, '0' ); + hexString += '#' + r + g + b + a; + } + return hexString; } ); } } diff --git a/test/e2e/specs/editor/blocks/list.spec.js b/test/e2e/specs/editor/blocks/list.spec.js index 0a1159f6d5d49..505f077918a97 100644 --- a/test/e2e/specs/editor/blocks/list.spec.js +++ b/test/e2e/specs/editor/blocks/list.spec.js @@ -1247,7 +1247,7 @@ test.describe( 'List', () => { page.locator( 'role=document[name="Block: List"i]' ) ); - await page.getByRole( 'button', { name: 'List' } ).click(); + await page.getByRole( 'button', { name: 'List', exact: true } ).click(); await page.getByRole( 'menuitem', { name: 'Paragraph' } ).click(); expect( await editor.getEditedPostContent() ).toMatchSnapshot(); From 0b8de6479a2ed03aacac56f5315835576a0b67e0 Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Wed, 15 Feb 2023 10:06:09 +0200 Subject: [PATCH 47/76] [Quote]: Fix deprectated `large` style specificity rule (#47969) --- packages/block-library/src/quote/style.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/quote/style.scss b/packages/block-library/src/quote/style.scss index 835dc56afaf5e..e453e407a0875 100644 --- a/packages/block-library/src/quote/style.scss +++ b/packages/block-library/src/quote/style.scss @@ -2,8 +2,8 @@ box-sizing: border-box; overflow-wrap: break-word; // Break long strings of text without spaces so they don't overflow the block. // .is-style-large and .is-large are kept for backwards compatibility. The :not pseudo-class is used to enable switching styles. See PR #37580. - &.is-style-large:not(.is-style-plain), - &.is-large:not(.is-style-plain) { + &.is-style-large:where(:not(.is-style-plain)), + &.is-large:where(:not(.is-style-plain)) { margin-bottom: 1em; padding: 0 1em; From 55b0c385d424a84bf53809159ffa44a7141267ca Mon Sep 17 00:00:00 2001 From: Siobhan Bamber Date: Wed, 15 Feb 2023 08:44:14 +0000 Subject: [PATCH 48/76] [RNMobile] Enable new block in Gutenberg Mobile (#47836) This PR introduces a new block to the Gutenberg Mobile editor. --- .../java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt | 3 +++ packages/react-native-bridge/ios/GutenbergBridgeDelegate.swift | 1 + .../android/app/src/main/java/com/gutenberg/MainActivity.java | 1 + packages/react-native-editor/babel.config.js | 1 + .../ios/GutenbergDemo/GutenbergViewController.swift | 1 + 5 files changed, 7 insertions(+) diff --git a/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt b/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt index 3e880011cd31f..4e97a3974d614 100644 --- a/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt +++ b/packages/react-native-bridge/android/react-native-bridge/src/main/java/org/wordpress/mobile/WPAndroidGlue/GutenbergProps.kt @@ -8,6 +8,7 @@ data class GutenbergProps @JvmOverloads constructor( val enableContactInfoBlock: Boolean, val enableLayoutGridBlock: Boolean, val enableTiledGalleryBlock: Boolean, + val enableVideoPressBlock: Boolean, val enableFacebookEmbed: Boolean, val enableInstagramEmbed: Boolean, val enableLoomEmbed: Boolean, @@ -68,6 +69,7 @@ data class GutenbergProps @JvmOverloads constructor( putBoolean(PROP_CAPABILITIES_CONTACT_INFO_BLOCK, enableContactInfoBlock) putBoolean(PROP_CAPABILITIES_LAYOUT_GRID_BLOCK, enableLayoutGridBlock) putBoolean(PROP_CAPABILITIES_TILED_GALLERY_BLOCK, enableTiledGalleryBlock) + putBoolean(PROP_CAPABILITIES_VIDEOPRESS_BLOCK, enableVideoPressBlock) putBoolean(PROP_CAPABILITIES_MEDIAFILES_COLLECTION_BLOCK, enableMediaFilesCollectionBlocks) putBoolean(PROP_CAPABILITIES_UNSUPPORTED_BLOCK_EDITOR, enableUnsupportedBlockEditor) putBoolean(PROP_CAPABILITIES_CAN_ENABLE_UNSUPPORTED_BLOCK_EDITOR, canEnableUnsupportedBlockEditor) @@ -111,6 +113,7 @@ data class GutenbergProps @JvmOverloads constructor( const val PROP_CAPABILITIES_CONTACT_INFO_BLOCK = "contactInfoBlock" const val PROP_CAPABILITIES_LAYOUT_GRID_BLOCK = "layoutGridBlock" const val PROP_CAPABILITIES_TILED_GALLERY_BLOCK = "tiledGalleryBlock" + const val PROP_CAPABILITIES_VIDEOPRESS_BLOCK = "videoPressBlock" const val PROP_CAPABILITIES_FACEBOOK_EMBED_BLOCK = "facebookEmbed" const val PROP_CAPABILITIES_INSTAGRAM_EMBED_BLOCK = "instagramEmbed" const val PROP_CAPABILITIES_LOOM_EMBED_BLOCK = "loomEmbed" diff --git a/packages/react-native-bridge/ios/GutenbergBridgeDelegate.swift b/packages/react-native-bridge/ios/GutenbergBridgeDelegate.swift index cf41c34ec2c6a..56296d509868d 100644 --- a/packages/react-native-bridge/ios/GutenbergBridgeDelegate.swift +++ b/packages/react-native-bridge/ios/GutenbergBridgeDelegate.swift @@ -21,6 +21,7 @@ public enum Capabilities: String { case contactInfoBlock case layoutGridBlock case tiledGalleryBlock + case videoPressBlock case mediaFilesCollectionBlock case mentions case xposts diff --git a/packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainActivity.java b/packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainActivity.java index ae81e808011ea..2c31c3bdc8281 100644 --- a/packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainActivity.java +++ b/packages/react-native-editor/android/app/src/main/java/com/gutenberg/MainActivity.java @@ -43,6 +43,7 @@ protected Bundle getLaunchOptions() { capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_REUSABLE_BLOCK, false); capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_IS_AUDIO_BLOCK_MEDIA_UPLOAD_ENABLED, true); capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_TILED_GALLERY_BLOCK, true); + capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_VIDEOPRESS_BLOCK, true); capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_FACEBOOK_EMBED_BLOCK, true); capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_INSTAGRAM_EMBED_BLOCK, true); capabilities.putBoolean(GutenbergProps.PROP_CAPABILITIES_LOOM_EMBED_BLOCK, true); diff --git a/packages/react-native-editor/babel.config.js b/packages/react-native-editor/babel.config.js index 705c9cb820961..62a9959bcf45a 100644 --- a/packages/react-native-editor/babel.config.js +++ b/packages/react-native-editor/babel.config.js @@ -13,6 +13,7 @@ module.exports = function ( api ) { '../../node_modules/@babel/plugin-proposal-async-generator-functions' ), '@babel/plugin-transform-runtime', + '@babel/plugin-transform-named-capturing-groups-regex', [ 'react-native-platform-specific-extensions', { diff --git a/packages/react-native-editor/ios/GutenbergDemo/GutenbergViewController.swift b/packages/react-native-editor/ios/GutenbergDemo/GutenbergViewController.swift index 8d5268e298df1..cb485a6bca720 100644 --- a/packages/react-native-editor/ios/GutenbergDemo/GutenbergViewController.swift +++ b/packages/react-native-editor/ios/GutenbergDemo/GutenbergViewController.swift @@ -322,6 +322,7 @@ extension GutenbergViewController: GutenbergBridgeDataSource { .canEnableUnsupportedBlockEditor: unsupportedBlockCanBeActivated, .mediaFilesCollectionBlock: true, .tiledGalleryBlock: true, + .videoPressBlock: true, .isAudioBlockMediaUploadEnabled: true, .reusableBlock: false, .facebookEmbed: true, From 58cd891c93190715fb566cd5b13560da8a2b0ee7 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 15 Feb 2023 11:37:07 +0100 Subject: [PATCH 49/76] Remove the name and element props from the TypographyPanel component (#47908) --- .../src/components/global-styles/hooks.js | 45 ++++++ .../src/components/global-styles/index.js | 1 + .../global-styles/typography-panel.js | 135 +++++------------- packages/block-editor/src/hooks/typography.js | 74 +++++++--- .../components/global-styles/context-menu.js | 19 ++- .../global-styles/screen-block-list.js | 20 +-- .../global-styles/typography-panel.js | 13 +- 7 files changed, 168 insertions(+), 139 deletions(-) diff --git a/packages/block-editor/src/components/global-styles/hooks.js b/packages/block-editor/src/components/global-styles/hooks.js index 5b2151dbfaba4..b843b978bbd4b 100644 --- a/packages/block-editor/src/components/global-styles/hooks.js +++ b/packages/block-editor/src/components/global-styles/hooks.js @@ -218,3 +218,48 @@ export function useSupportedStyles( name, element ) { return supportedPanels; } + +/** + * Given a settings object and a list of supported panels, + * returns a new settings object with the unsupported panels removed. + * + * @param {Object} settings Settings object. + * @param {string[]} supports Supported style panels. + * + * @return {Object} Merge of settings and supports. + */ +export function overrideSettingsWithSupports( settings, supports ) { + const updatedSettings = { ...settings }; + + if ( ! supports.includes( 'fontSize' ) ) { + updatedSettings.typography = { + ...updatedSettings.typography, + fontSizes: {}, + customFontSize: false, + }; + } + + if ( ! supports.includes( 'fontFamily' ) ) { + updatedSettings.typography = { + ...updatedSettings.typography, + fontFamilies: {}, + }; + } + + [ + 'lineHeight', + 'fontStyle', + 'fontWeight', + 'letterSpacing', + 'textTransform', + ].forEach( ( key ) => { + if ( ! supports.includes( key ) ) { + updatedSettings.typography = { + ...updatedSettings.typography, + [ key ]: false, + }; + } + } ); + + return updatedSettings; +} diff --git a/packages/block-editor/src/components/global-styles/index.js b/packages/block-editor/src/components/global-styles/index.js index 6581f46254985..77582d2f05415 100644 --- a/packages/block-editor/src/components/global-styles/index.js +++ b/packages/block-editor/src/components/global-styles/index.js @@ -2,6 +2,7 @@ export { useGlobalStylesReset, useGlobalSetting, useGlobalStyle, + overrideSettingsWithSupports, } from './hooks'; export { useGlobalStylesOutput } from './use-global-styles-output'; export { GlobalStylesContext } from './context'; diff --git a/packages/block-editor/src/components/global-styles/typography-panel.js b/packages/block-editor/src/components/global-styles/typography-panel.js index 471055be391f7..15ebf70da93a8 100644 --- a/packages/block-editor/src/components/global-styles/typography-panel.js +++ b/packages/block-editor/src/components/global-styles/typography-panel.js @@ -17,29 +17,16 @@ import LineHeightControl from '../line-height-control'; import LetterSpacingControl from '../letter-spacing-control'; import TextTransformControl from '../text-transform-control'; import TextDecorationControl from '../text-decoration-control'; -import { useSupportedStyles } from './hooks'; import { getValueFromVariable } from './utils'; -export function useHasTypographyPanel( name, element, settings ) { - const hasFontFamily = useHasFontFamilyControl( name, element, settings ); - const hasLineHeight = useHasLineHeightControl( name, element, settings ); - const hasFontAppearance = useHasAppearanceControl( - name, - element, - settings - ); - const hasLetterSpacing = useHasLetterSpacingControl( - name, - element, - settings - ); - const hasTextTransform = useHasTextTransformControl( - name, - element, - settings - ); - const hasTextDecoration = useHasTextDecorationControl( name, element ); - const hasFontSize = useHasFontSizeControl( name, element, settings ); +export function useHasTypographyPanel( settings ) { + const hasFontFamily = useHasFontFamilyControl( settings ); + const hasLineHeight = useHasLineHeightControl( settings ); + const hasFontAppearance = useHasAppearanceControl( settings ); + const hasLetterSpacing = useHasLetterSpacingControl( settings ); + const hasTextTransform = useHasTextTransformControl( settings ); + const hasTextDecoration = useHasTextDecorationControl( settings ); + const hasFontSize = useHasFontSizeControl( settings ); return ( hasFontFamily || @@ -52,52 +39,38 @@ export function useHasTypographyPanel( name, element, settings ) { ); } -function useHasFontSizeControl( name, element, settings ) { - const supports = useSupportedStyles( name, element ); +function useHasFontSizeControl( settings ) { const disableCustomFontSizes = ! settings?.typography?.customFontSize; const fontSizesPerOrigin = settings?.typography?.fontSizes ?? {}; const fontSizes = fontSizesPerOrigin?.custom ?? fontSizesPerOrigin?.theme ?? fontSizesPerOrigin.default; - return ( - supports.includes( 'fontSize' ) && - ( !! fontSizes?.length || ! disableCustomFontSizes ) - ); + return !! fontSizes?.length || ! disableCustomFontSizes; } -function useHasFontFamilyControl( name, element, settings ) { - const supports = useSupportedStyles( name, element ); +function useHasFontFamilyControl( settings ) { const fontFamiliesPerOrigin = settings?.typography?.fontFamilies; const fontFamilies = fontFamiliesPerOrigin?.custom ?? fontFamiliesPerOrigin?.theme ?? fontFamiliesPerOrigin?.default; - return supports.includes( 'fontFamily' ) && !! fontFamilies?.length; + return !! fontFamilies?.length; } -function useHasLineHeightControl( name, element, settings ) { - const supports = useSupportedStyles( name, element ); - return ( - settings?.typography?.lineHeight && supports.includes( 'lineHeight' ) - ); +function useHasLineHeightControl( settings ) { + return settings?.typography?.lineHeight; } -function useHasAppearanceControl( name, element, settings ) { - const supports = useSupportedStyles( name, element ); - const hasFontStyles = - settings?.typography?.fontStyle && supports.includes( 'fontStyle' ); - const hasFontWeights = - settings?.typography?.fontWeight && supports.includes( 'fontWeight' ); +function useHasAppearanceControl( settings ) { + const hasFontStyles = settings?.typography?.fontStyle; + const hasFontWeights = settings?.typography?.fontWeight; return hasFontStyles || hasFontWeights; } -function useAppearanceControlLabel( name, element, settings ) { - const supports = useSupportedStyles( name, element ); - const hasFontStyles = - settings?.typography?.fontStyle && supports.includes( 'fontStyle' ); - const hasFontWeights = - settings?.typography?.fontWeight && supports.includes( 'fontWeight' ); +function useAppearanceControlLabel( settings ) { + const hasFontStyles = settings?.typography?.fontStyle; + const hasFontWeights = settings?.typography?.fontWeight; if ( ! hasFontStyles ) { return __( 'Font weight' ); } @@ -107,27 +80,16 @@ function useAppearanceControlLabel( name, element, settings ) { return __( 'Appearance' ); } -function useHasLetterSpacingControl( name, element, settings ) { - const setting = settings?.typography?.letterSpacing; - const supports = useSupportedStyles( name, element ); - if ( ! setting ) { - return false; - } - return supports.includes( 'letterSpacing' ); +function useHasLetterSpacingControl( settings ) { + return settings?.typography?.letterSpacing; } -function useHasTextTransformControl( name, element, settings ) { - const setting = settings?.typography?.textTransform; - const supports = useSupportedStyles( name, element ); - if ( ! setting ) { - return false; - } - return supports.includes( 'textTransform' ); +function useHasTextTransformControl( settings ) { + return settings?.typography?.textTransform; } -function useHasTextDecorationControl( name, element ) { - const supports = useSupportedStyles( name, element ); - return supports.includes( 'textDecoration' ); +function useHasTextDecorationControl( settings ) { + return settings?.typography?.textDecoration; } function TypographyToolsPanel( { ...props } ) { @@ -146,8 +108,6 @@ const DEFAULT_CONTROLS = { export default function TypographyPanel( { as: Wrapper = TypographyToolsPanel, - name, - element, value, onChange, inheritedValue = value, @@ -159,11 +119,7 @@ export default function TypographyPanel( { getValueFromVariable( { settings }, '', rawValue ); // Font Family - const hasFontFamilyEnabled = useHasFontFamilyControl( - name, - element, - settings - ); + const hasFontFamilyEnabled = useHasFontFamilyControl( settings ); const fontFamiliesPerOrigin = settings?.typography?.fontFamilies; const fontFamilies = fontFamiliesPerOrigin?.custom ?? @@ -188,7 +144,7 @@ export default function TypographyPanel( { const resetFontFamily = () => setFontFamily( undefined ); // Font Size - const hasFontSizeEnabled = useHasFontSizeControl( name, element, settings ); + const hasFontSizeEnabled = useHasFontSizeControl( settings ); const disableCustomFontSizes = ! settings?.typography?.customFontSize; const fontSizesPerOrigin = settings?.typography?.fontSizes ?? {}; const fontSizes = @@ -213,16 +169,8 @@ export default function TypographyPanel( { const resetFontSize = () => setFontSize( undefined ); // Appearance - const hasAppearanceControl = useHasAppearanceControl( - name, - element, - settings - ); - const appearanceControlLabel = useAppearanceControlLabel( - name, - element, - settings - ); + const hasAppearanceControl = useHasAppearanceControl( settings ); + const appearanceControlLabel = useAppearanceControlLabel( settings ); const hasFontStyles = settings?.typography?.fontStyle; const hasFontWeights = settings?.typography?.fontWeight; const fontStyle = decodeValue( inheritedValue?.typography?.fontStyle ); @@ -247,11 +195,7 @@ export default function TypographyPanel( { }; // Line Height - const hasLineHeightEnabled = useHasLineHeightControl( - name, - element, - settings - ); + const hasLineHeightEnabled = useHasLineHeightControl( settings ); const lineHeight = decodeValue( inheritedValue?.typography?.lineHeight ); const setLineHeight = ( newValue ) => { onChange( { @@ -266,11 +210,7 @@ export default function TypographyPanel( { const resetLineHeight = () => setLineHeight( undefined ); // Letter Spacing - const hasLetterSpacingControl = useHasLetterSpacingControl( - name, - element, - settings - ); + const hasLetterSpacingControl = useHasLetterSpacingControl( settings ); const letterSpacing = decodeValue( inheritedValue?.typography?.letterSpacing ); @@ -287,11 +227,7 @@ export default function TypographyPanel( { const resetLetterSpacing = () => setLetterSpacing( undefined ); // Text Transform - const hasTextTransformControl = useHasTextTransformControl( - name, - element, - settings - ); + const hasTextTransformControl = useHasTextTransformControl( settings ); const textTransform = decodeValue( inheritedValue?.typography?.textTransform ); @@ -308,10 +244,7 @@ export default function TypographyPanel( { const resetTextTransform = () => setTextTransform( undefined ); // Text Decoration - const hasTextDecorationControl = useHasTextDecorationControl( - name, - element - ); + const hasTextDecorationControl = useHasTextDecorationControl( settings ); const textDecoration = decodeValue( inheritedValue?.typography?.textDecoration ); diff --git a/packages/block-editor/src/hooks/typography.js b/packages/block-editor/src/hooks/typography.js index 87e734b00667c..a5aac0cb2d312 100644 --- a/packages/block-editor/src/hooks/typography.js +++ b/packages/block-editor/src/hooks/typography.js @@ -18,6 +18,10 @@ import { FONT_FAMILY_SUPPORT_KEY } from './font-family'; import { FONT_SIZE_SUPPORT_KEY } from './font-size'; import { useSetting } from '../components'; import { cleanEmptyObject } from './utils'; +import { + overrideSettingsWithSupports, + useSupportedStyles, +} from '../components/global-styles/hooks'; function omit( object, keys ) { return Object.fromEntries( @@ -48,33 +52,59 @@ function TypographyInspectorControl( { children } ) { ); } +function useBlockSettings( name ) { + const fontFamilies = useSetting( 'typography.fontFamilies' ); + const fontSizes = useSetting( 'typography.fontSizes' ); + const customFontSize = useSetting( 'typography.customFontSize' ); + const fontStyle = useSetting( 'typography.fontStyle' ); + const fontWeight = useSetting( 'typography.fontWeight' ); + const lineHeight = useSetting( 'typography.lineHeight' ); + const textDecoration = useSetting( 'typography.textDecoration' ); + const textTransform = useSetting( 'typography.textTransform' ); + const letterSpacing = useSetting( 'typography.letterSpacing' ); + const supports = useSupportedStyles( name, null ); + + return useMemo( () => { + const rawSettings = { + typography: { + fontFamilies: { + custom: fontFamilies, + }, + fontSizes: { + custom: fontSizes, + }, + customFontSize, + fontStyle, + fontWeight, + lineHeight, + textDecoration, + textTransform, + letterSpacing, + }, + }; + return overrideSettingsWithSupports( rawSettings, supports ); + }, [ + fontFamilies, + fontSizes, + customFontSize, + fontStyle, + fontWeight, + lineHeight, + textDecoration, + textTransform, + letterSpacing, + supports, + ] ); +} + export function TypographyPanel( { clientId, name, attributes, setAttributes, } ) { - const settings = { - typography: { - fontFamilies: { - custom: useSetting( 'typography.fontFamilies' ), - }, - fontSizes: { - custom: useSetting( 'typography.fontSizes' ), - }, - customFontSize: useSetting( 'typography.customFontSize' ), - fontStyle: useSetting( 'typography.fontStyle' ), - fontWeight: useSetting( 'typography.fontWeight' ), - lineHeight: useSetting( 'typography.lineHeight' ), - textDecoration: useSetting( 'typography.textDecoration' ), - textTransform: useSetting( 'typography.textTransform' ), - letterSpacing: useSetting( 'typography.letterSpacing' ), - }, - }; - - const isSupported = hasTypographySupport( name ); - const isEnabled = useHasTypographyPanel( name, null, settings ); - + const settings = useBlockSettings( name ); + const isEnabled = useHasTypographyPanel( settings ); const value = useMemo( () => { return { ...attributes.style, @@ -115,7 +145,7 @@ export function TypographyPanel( { } ); }; - if ( ! isEnabled || ! isSupported ) { + if ( ! isEnabled ) { return null; } diff --git a/packages/edit-site/src/components/global-styles/context-menu.js b/packages/edit-site/src/components/global-styles/context-menu.js index 04ab8e65f403f..d2753e48774e8 100644 --- a/packages/edit-site/src/components/global-styles/context-menu.js +++ b/packages/edit-site/src/components/global-styles/context-menu.js @@ -22,6 +22,7 @@ import { isRTL, __ } from '@wordpress/i18n'; import { useSelect } from '@wordpress/data'; import { store as coreStore } from '@wordpress/core-data'; import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; +import { useMemo } from '@wordpress/element'; /** * Internal dependencies @@ -35,14 +36,22 @@ import { IconWithCurrentColor } from './icon-with-current-color'; import { ScreenVariations } from './screen-variations'; import { useHasShadowControl } from './shadow-panel'; import { unlock } from '../../private-apis'; +import { useSupportedStyles } from './hooks'; -const { useHasTypographyPanel, useGlobalSetting } = unlock( - blockEditorPrivateApis -); +const { + useHasTypographyPanel, + useGlobalSetting, + overrideSettingsWithSupports, +} = unlock( blockEditorPrivateApis ); function ContextMenu( { name, parentMenu = '' } ) { - const [ settings ] = useGlobalSetting( '', name ); - const hasTypographyPanel = useHasTypographyPanel( name, null, settings ); + const [ rawSettings ] = useGlobalSetting( '', name ); + const supports = useSupportedStyles( name ); + const settings = useMemo( + () => overrideSettingsWithSupports( rawSettings, supports ), + [ rawSettings, supports ] + ); + const hasTypographyPanel = useHasTypographyPanel( settings ); const hasColorPanel = useHasColorPanel( name ); const hasBorderPanel = useHasBorderPanel( name ); const hasEffectsPanel = useHasShadowControl( name ); diff --git a/packages/edit-site/src/components/global-styles/screen-block-list.js b/packages/edit-site/src/components/global-styles/screen-block-list.js index cba1455333898..0bfbe96f23b60 100644 --- a/packages/edit-site/src/components/global-styles/screen-block-list.js +++ b/packages/edit-site/src/components/global-styles/screen-block-list.js @@ -27,10 +27,13 @@ import { useHasVariationsPanel } from './variations-panel'; import ScreenHeader from './header'; import { NavigationButtonAsItem } from './navigation-button'; import { unlock } from '../../private-apis'; +import { useSupportedStyles } from './hooks'; -const { useHasTypographyPanel, useGlobalSetting } = unlock( - blockEditorPrivateApis -); +const { + useHasTypographyPanel, + useGlobalSetting, + overrideSettingsWithSupports, +} = unlock( blockEditorPrivateApis ); function useSortedBlockTypes() { const blockItems = useSelect( @@ -56,12 +59,13 @@ function useSortedBlockTypes() { } function BlockMenuItem( { block } ) { - const [ settings ] = useGlobalSetting( '', block.name ); - const hasTypographyPanel = useHasTypographyPanel( - block.name, - null, - settings + const [ rawSettings ] = useGlobalSetting( '', block.name ); + const supports = useSupportedStyles( block.name ); + const settings = useMemo( + () => overrideSettingsWithSupports( rawSettings, supports ), + [ rawSettings, supports ] ); + const hasTypographyPanel = useHasTypographyPanel( settings ); const hasColorPanel = useHasColorPanel( block.name ); const hasBorderPanel = useHasBorderPanel( block.name ); const hasDimensionsPanel = useHasDimensionsPanel( block.name ); diff --git a/packages/edit-site/src/components/global-styles/typography-panel.js b/packages/edit-site/src/components/global-styles/typography-panel.js index d77594b13663f..da2429432d795 100644 --- a/packages/edit-site/src/components/global-styles/typography-panel.js +++ b/packages/edit-site/src/components/global-styles/typography-panel.js @@ -2,15 +2,18 @@ * WordPress dependencies */ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; +import { useMemo } from '@wordpress/element'; /** * Internal dependencies */ import { unlock } from '../../private-apis'; +import { useSupportedStyles } from './hooks'; const { useGlobalStyle, useGlobalSetting, + overrideSettingsWithSupports, TypographyPanel: StylesTypographyPanel, } = unlock( blockEditorPrivateApis ); @@ -35,12 +38,16 @@ export default function TypographyPanel( { const [ inheritedStyle, setStyle ] = useGlobalStyle( prefix, name, 'all', { shouldDecodeEncode: false, } ); - const [ settings ] = useGlobalSetting( '', name ); + const [ rawSettings ] = useGlobalSetting( '', name ); + const usedElement = element === 'heading' ? headingLevel : element; + const supports = useSupportedStyles( name, usedElement ); + const settings = useMemo( + () => overrideSettingsWithSupports( rawSettings, supports ), + [ rawSettings, supports ] + ); return ( Date: Wed, 15 Feb 2023 20:46:04 +0900 Subject: [PATCH 50/76] LinkControl: fix scrollbar displayed on toggle link settings (#47986) * Link control: fix scrollbar displayed on toggle * Update changelog * Add comment * Fix comment url --- packages/block-editor/CHANGELOG.md | 4 ++++ .../block-editor/src/components/link-control/style.scss | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/CHANGELOG.md b/packages/block-editor/CHANGELOG.md index be28b8306406b..53414b3b3ce4a 100644 --- a/packages/block-editor/CHANGELOG.md +++ b/packages/block-editor/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Bug Fix + +- `LinkControl`: fix scrollbar displayed on toggle link settings ([#47986](https://github.com/WordPress/gutenberg/pull/47986)). + ## 11.3.0 (2023-02-01) ## 11.2.0 (2023-01-11) diff --git a/packages/block-editor/src/components/link-control/style.scss b/packages/block-editor/src/components/link-control/style.scss index f93c724598b89..743ebcebc23c2 100644 --- a/packages/block-editor/src/components/link-control/style.scss +++ b/packages/block-editor/src/components/link-control/style.scss @@ -463,7 +463,13 @@ $preview-image-height: 140px; justify-content: space-between; margin: 0; padding: $grid-unit-20; - padding-top: 0; + + // To hide the horizontal scrollbar on toggle. + // Margin and padding are needed to prevent cutoff of the toggle button focus outline. + // See: https://github.com/WordPress/gutenberg/pull/47986 + margin-top: calc(var(--wp-admin-border-width-focus) * -1); + padding-top: var(--wp-admin-border-width-focus); + overflow: hidden; } .block-editor-link-control__unlink { From 9d37dbc89866a6a5426458b57dcf44aec4b4ea9f Mon Sep 17 00:00:00 2001 From: Gerardo Pacheco Date: Wed, 15 Feb 2023 13:17:14 +0100 Subject: [PATCH 51/76] =?UTF-8?q?[Mobile]=C2=A0-=20Update=20E2E=20tests=20?= =?UTF-8?q?organization=20and=20helpers=20(#48026)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Mobile - Update E2E tests * Mobile - Merge media tests into one * Mobile - E2E - Remove block return await * Mobile - Package remove extra space * Mobile - Combine more E2E tests into one file * Mobile - E2E helpers - Update helpers to use waitForElementToBeDisplayedById * Mobile - Media Blocks E2E - Update comments * Mobile - Set accessibility label prop for BlockTypesList instances --- .../block-types-list/index.native.js | 2 + .../inserter/block-types-tab.native.js | 2 + .../inserter/reusable-blocks-tab.native.js | 2 + .../inserter/search-results.native.js | 2 + .../autocomplete/autocompleter-ui.native.js | 1 + .../src/components/post-title/index.native.js | 1 + .../gutenberg-editor-audio.test.js | 38 ---- ...rg-editor-block-insertion-@canary.test.js} | 95 +++++++++- .../gutenberg-editor-block-insertion.test.js | 119 ------------- .../gutenberg-editor-cover.test.js | 62 ------- ...> gutenberg-editor-device-actions.test.js} | 46 ++++- .../gutenberg-editor-drag-and-drop.test.js | 10 +- .../gutenberg-editor-file-@canary.test.js | 38 ---- .../gutenberg-editor-image-@canary.test.js | 44 ----- ...nberg-editor-initial-html-@canary.test.js} | 0 ...enberg-editor-media-blocks-@canary.test.js | 165 ++++++++++++++++++ .../gutenberg-editor-paragraph.test.js | 17 +- .../gutenberg-editor-rotation.test.js | 49 ------ .../gutenberg-editor-search.test.js | 12 +- .../__device-tests__/helpers/test-data.js | 8 +- .../__device-tests__/pages/editor-page.js | 119 +++++++++---- packages/react-native-editor/package.json | 2 +- 22 files changed, 421 insertions(+), 413 deletions(-) delete mode 100644 packages/react-native-editor/__device-tests__/gutenberg-editor-audio.test.js rename packages/react-native-editor/__device-tests__/{gutenberg-editor-slash-inserter-@canary.test.js => gutenberg-editor-block-insertion-@canary.test.js} (51%) delete mode 100644 packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js delete mode 100644 packages/react-native-editor/__device-tests__/gutenberg-editor-cover.test.js rename packages/react-native-editor/__device-tests__/{gutenberg-editor-paste.test.js => gutenberg-editor-device-actions.test.js} (73%) delete mode 100644 packages/react-native-editor/__device-tests__/gutenberg-editor-file-@canary.test.js delete mode 100644 packages/react-native-editor/__device-tests__/gutenberg-editor-image-@canary.test.js rename packages/react-native-editor/__device-tests__/{gutenberg-editor-initial-html.test.js => gutenberg-editor-initial-html-@canary.test.js} (100%) create mode 100644 packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js delete mode 100644 packages/react-native-editor/__device-tests__/gutenberg-editor-rotation.test.js diff --git a/packages/block-editor/src/components/block-types-list/index.native.js b/packages/block-editor/src/components/block-types-list/index.native.js index d62987d408aea..450e45220436e 100644 --- a/packages/block-editor/src/components/block-types-list/index.native.js +++ b/packages/block-editor/src/components/block-types-list/index.native.js @@ -32,6 +32,7 @@ export default function BlockTypesList( { name, sections, onSelect, + label, listProps, initialNumToRender = 3, } ) { @@ -154,6 +155,7 @@ export default function BlockTypesList( { ); } diff --git a/packages/block-editor/src/components/inserter/reusable-blocks-tab.native.js b/packages/block-editor/src/components/inserter/reusable-blocks-tab.native.js index 825169e17315f..d50a5a99f2728 100644 --- a/packages/block-editor/src/components/inserter/reusable-blocks-tab.native.js +++ b/packages/block-editor/src/components/inserter/reusable-blocks-tab.native.js @@ -2,6 +2,7 @@ * WordPress dependencies */ import { useSelect } from '@wordpress/data'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies @@ -31,6 +32,7 @@ function ReusableBlocksTab( { onSelect, rootClientId, listProps } ) { sections={ sections } onSelect={ onSelect } listProps={ listProps } + label={ __( 'Reusable blocks' ) } /> ); } diff --git a/packages/block-editor/src/components/inserter/search-results.native.js b/packages/block-editor/src/components/inserter/search-results.native.js index a32c6ecf1a1c3..bc951dac1de02 100644 --- a/packages/block-editor/src/components/inserter/search-results.native.js +++ b/packages/block-editor/src/components/inserter/search-results.native.js @@ -2,6 +2,7 @@ * WordPress dependencies */ import { useSelect } from '@wordpress/data'; +import { __ } from '@wordpress/i18n'; /** * Internal dependencies @@ -54,6 +55,7 @@ function InserterSearchResults( { sections={ [ createInserterSection( { key: 'search', items } ) ] } onSelect={ handleSelect } listProps={ listProps } + label={ __( 'Blocks' ) } /> ); } diff --git a/packages/components/src/autocomplete/autocompleter-ui.native.js b/packages/components/src/autocomplete/autocompleter-ui.native.js index a8f0efa447c4f..1785d742d1ee4 100644 --- a/packages/components/src/autocomplete/autocompleter-ui.native.js +++ b/packages/components/src/autocomplete/autocompleter-ui.native.js @@ -144,6 +144,7 @@ export function getAutoCompleterUI( autocompleter ) { { - it( 'should be able to add an audio block and a file to it', async () => { - // add an audio block - await editorPage.addNewBlock( blockNames.audio ); - - // dismiss the media picker automatically opened when adding an audio block - await waitForMediaLibrary( editorPage.driver ); - await editorPage.closePicker(); - - // verify there's an audio block - const block = await editorPage.getFirstBlockVisible(); - await expect( block ).toBeTruthy(); - - // tap on the audio block - block.click(); - - // wait for the media picker's Media Library option to come up - await waitForMediaLibrary( editorPage.driver ); - - // tap on Media Library option - await editorPage.chooseMediaLibrary(); - - // get the html version of the content - const html = await editorPage.getHtmlContent(); - - // verify the html matches the expected content - expect( html.toLowerCase() ).toBe( - testData.audioBlockPlaceholder.toLowerCase() - ); - } ); -} ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-slash-inserter-@canary.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion-@canary.test.js similarity index 51% rename from packages/react-native-editor/__device-tests__/gutenberg-editor-slash-inserter-@canary.test.js rename to packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion-@canary.test.js index af2e64d8aa947..e8f31dcef1216 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-slash-inserter-@canary.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion-@canary.test.js @@ -3,7 +3,97 @@ */ import { blockNames } from './pages/editor-page'; import { isAndroid } from './helpers/utils'; -import { slashInserter, shortText } from './helpers/test-data'; +import testData, { slashInserter, shortText } from './helpers/test-data'; + +describe( 'Gutenberg Editor tests for Block insertion', () => { + it( 'should be able to insert multi-paragraph text, and text to another paragraph block in between', async () => { + await editorPage.addNewBlock( blockNames.paragraph ); + let paragraphBlockElement = await editorPage.getTextBlockAtPosition( + blockNames.paragraph + ); + if ( isAndroid() ) { + await paragraphBlockElement.click(); + } + + await editorPage.sendTextToParagraphBlock( 1, testData.longText ); + // Should have 3 paragraph blocks at this point. + + paragraphBlockElement = await editorPage.getTextBlockAtPosition( + blockNames.paragraph, + 2 + ); + await paragraphBlockElement.click(); + + await editorPage.addNewBlock( blockNames.paragraph ); + + paragraphBlockElement = await editorPage.getTextBlockAtPosition( + blockNames.paragraph, + 3 + ); + await paragraphBlockElement.click(); + await editorPage.sendTextToParagraphBlock( 3, testData.mediumText ); + + const html = await editorPage.getHtmlContent(); + + expect( html.toLowerCase() ).toBe( + testData.blockInsertionHtml.toLowerCase() + ); + + for ( let i = 4; i > 0; i-- ) { + paragraphBlockElement = await editorPage.getTextBlockAtPosition( + blockNames.paragraph + ); + await paragraphBlockElement.click(); + await editorPage.removeBlock(); + } + } ); + + it( 'should be able to insert block at the beginning of post from the title', async () => { + await editorPage.addNewBlock( blockNames.paragraph ); + let paragraphBlockElement = await editorPage.getTextBlockAtPosition( + blockNames.paragraph + ); + if ( isAndroid() ) { + await paragraphBlockElement.click(); + } + + await editorPage.sendTextToParagraphBlock( 1, testData.longText ); + // Should have 3 paragraph blocks at this point. + + if ( isAndroid() ) { + await editorPage.dismissKeyboard(); + } + + const titleElement = await editorPage.getTitleElement( { + autoscroll: true, + } ); + await titleElement.click(); + + await editorPage.addNewBlock( blockNames.paragraph ); + const emptyParagraphBlock = await editorPage.getBlockAtPosition( + blockNames.paragraph + ); + expect( emptyParagraphBlock ).toBeTruthy(); + const emptyParagraphBlockElement = + await editorPage.getTextBlockAtPosition( blockNames.paragraph ); + expect( emptyParagraphBlockElement ).toBeTruthy(); + + await editorPage.sendTextToParagraphBlock( 1, testData.mediumText ); + const html = await editorPage.getHtmlContent(); + expect( html.toLowerCase() ).toBe( + testData.blockInsertionHtmlFromTitle.toLowerCase() + ); + + // Remove blocks + for ( let i = 4; i > 0; i-- ) { + paragraphBlockElement = await editorPage.getTextBlockAtPosition( + blockNames.paragraph + ); + await paragraphBlockElement.click(); + await editorPage.removeBlock(); + } + } ); +} ); describe( 'Gutenberg Editor Slash Inserter tests', () => { it( 'should show the menu after typing /', async () => { @@ -42,9 +132,10 @@ describe( 'Gutenberg Editor Slash Inserter tests', () => { true ); } else { + await paragraphBlockElement.type( '\b' ); await editorPage.typeTextToTextBlock( paragraphBlockElement, - `\b ${ shortText }`, + `${ shortText }`, false ); } diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js deleted file mode 100644 index 447e1a997ecc8..0000000000000 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-block-insertion.test.js +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Internal dependencies - */ -import { blockNames } from './pages/editor-page'; -import { isAndroid, clickMiddleOfElement } from './helpers/utils'; -import testData from './helpers/test-data'; - -describe( 'Gutenberg Editor tests for Block insertion', () => { - it( 'should be able to insert multi-paragraph text, and text to another paragraph block in between', async () => { - await editorPage.addNewBlock( blockNames.paragraph ); - let paragraphBlockElement = await editorPage.getTextBlockAtPosition( - blockNames.paragraph - ); - if ( isAndroid() ) { - await paragraphBlockElement.click(); - } - - await editorPage.sendTextToParagraphBlock( 1, testData.longText ); - // Should have 3 paragraph blocks at this point. - - paragraphBlockElement = await editorPage.getTextBlockAtPosition( - blockNames.paragraph, - 2 - ); - await paragraphBlockElement.click(); - - await editorPage.addNewBlock( blockNames.paragraph ); - - paragraphBlockElement = await editorPage.getTextBlockAtPosition( - blockNames.paragraph, - 3 - ); - await paragraphBlockElement.click(); - await editorPage.sendTextToParagraphBlock( 3, testData.mediumText ); - - const html = await editorPage.getHtmlContent(); - - expect( html.toLowerCase() ).toBe( - testData.blockInsertionHtml.toLowerCase() - ); - - // Workaround for now since deleting the first element causes a crash on CI for Android - if ( isAndroid() ) { - paragraphBlockElement = await editorPage.getTextBlockAtPosition( - blockNames.paragraph, - 3, - { - autoscroll: true, - } - ); - - await paragraphBlockElement.click(); - await editorPage.removeBlockAtPosition( blockNames.paragraph, 3 ); - for ( let i = 3; i > 0; i-- ) { - paragraphBlockElement = await editorPage.getTextBlockAtPosition( - blockNames.paragraph, - i, - { - autoscroll: true, - } - ); - await paragraphBlockElement.click(); - await editorPage.removeBlockAtPosition( - blockNames.paragraph, - i - ); - } - } else { - for ( let i = 4; i > 0; i-- ) { - paragraphBlockElement = await editorPage.getTextBlockAtPosition( - blockNames.paragraph - ); - await clickMiddleOfElement( - editorPage.driver, - paragraphBlockElement - ); - await editorPage.removeBlockAtPosition( blockNames.paragraph ); - } - } - } ); - - it( 'should be able to insert block at the beginning of post from the title', async () => { - await editorPage.addNewBlock( blockNames.paragraph ); - const paragraphBlockElement = await editorPage.getTextBlockAtPosition( - blockNames.paragraph - ); - if ( isAndroid() ) { - await paragraphBlockElement.click(); - } - - await editorPage.sendTextToParagraphBlock( 1, testData.longText ); - // Should have 3 paragraph blocks at this point. - - if ( isAndroid() ) { - await editorPage.dismissKeyboard(); - } - - const titleElement = await editorPage.getTitleElement( { - autoscroll: true, - } ); - expect( titleElement ).toBeTruthy(); - await titleElement.click(); - - await editorPage.addNewBlock( blockNames.paragraph ); - const emptyParagraphBlock = await editorPage.getBlockAtPosition( - blockNames.paragraph - ); - expect( emptyParagraphBlock ).toBeTruthy(); - const emptyParagraphBlockElement = - await editorPage.getTextBlockAtPosition( blockNames.paragraph ); - expect( emptyParagraphBlockElement ).toBeTruthy(); - - await editorPage.sendTextToParagraphBlock( 1, testData.mediumText ); - const html = await editorPage.getHtmlContent(); - expect( html.toLowerCase() ).toBe( - testData.blockInsertionHtmlFromTitle.toLowerCase() - ); - } ); -} ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-cover.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-cover.test.js deleted file mode 100644 index e57dfa68debe6..0000000000000 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-cover.test.js +++ /dev/null @@ -1,62 +0,0 @@ -/** - * Internal dependencies - */ -import { blockNames } from './pages/editor-page'; -import { isAndroid } from './helpers/utils'; -import testData from './helpers/test-data'; - -describe( 'Gutenberg Editor Cover Block test', () => { - it( 'should displayed properly and have properly converted height (ios only)', async () => { - // Temporarily this test is skipped on Android,due to the inconsistency of the results, - // which are related to getting values in raw pixels instead of density pixels on Android. - /* eslint-disable jest/no-conditional-expect */ - if ( ! isAndroid() ) { - await editorPage.setHtmlContent( testData.coverHeightWithRemUnit ); - - const coverBlock = await editorPage.getBlockAtPosition( - blockNames.cover - ); - - const { height } = await coverBlock.getSize(); - // Height is set to 20rem, where 1rem is 16. - // There is also block's vertical padding equal 32. - // Finally, the total height should be 20 * 16 + 32 = 352. - expect( height ).toBe( 352 ); - /* eslint-enable jest/no-conditional-expect */ - - await coverBlock.click(); - expect( coverBlock ).toBeTruthy(); - await editorPage.removeBlockAtPosition( blockNames.cover ); - } - } ); - - // Testing this for iOS on a device is valuable to ensure that it properly - // handles opening multiple modals, as only one can be open at a time. - it( 'allows modifying media from within block settings', async () => { - // Can only add image from media library on iOS - if ( ! isAndroid() ) { - await editorPage.setHtmlContent( testData.coverHeightWithRemUnit ); - - const coverBlock = await editorPage.getBlockAtPosition( - blockNames.cover - ); - - await editorPage.openBlockSettings( coverBlock ); - await editorPage.clickAddMediaFromCoverBlock(); - await editorPage.chooseMediaLibrary(); - await editorPage.replaceMediaImage(); - - // First modal should no longer be presented. - const replaceButtons = - await editorPage.driver.elementsByAccessibilityId( 'Replace' ); - // eslint-disable-next-line jest/no-conditional-expect - expect( replaceButtons.length ).toBe( 0 ); - - // Select different media. - await editorPage.chooseMediaLibrary(); - - expect( coverBlock ).toBeTruthy(); - await editorPage.removeBlockAtPosition( blockNames.cover ); - } - } ); -} ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-paste.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-device-actions.test.js similarity index 73% rename from packages/react-native-editor/__device-tests__/gutenberg-editor-paste.test.js rename to packages/react-native-editor/__device-tests__/gutenberg-editor-device-actions.test.js index 615c9f26fbe6b..3a64ca3750898 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-paste.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-device-actions.test.js @@ -8,11 +8,55 @@ import { tapSelectAllAboveElement, tapCopyAboveElement, tapPasteAboveElement, + toggleOrientation, isAndroid, } from './helpers/utils'; import testData from './helpers/test-data'; -describe( 'Gutenberg Editor paste tests', () => { +describe( 'Gutenberg Editor Rotation tests', () => { + it( 'should be able to add blocks , rotate device and continue adding blocks', async () => { + await editorPage.addNewBlock( blockNames.paragraph ); + let paragraphBlockElement = await editorPage.getTextBlockAtPosition( + blockNames.paragraph + ); + + await editorPage.typeTextToTextBlock( + paragraphBlockElement, + testData.mediumText + ); + + await toggleOrientation( editorPage.driver ); + // On Android the keyboard hides the add block button, let's hide it after rotation + if ( isAndroid() ) { + await editorPage.dismissKeyboard(); + } + + await editorPage.addNewBlock( blockNames.paragraph ); + + if ( isAndroid() ) { + await editorPage.dismissKeyboard(); + } + + paragraphBlockElement = await editorPage.getTextBlockAtPosition( + blockNames.paragraph, + 2 + ); + + await editorPage.typeTextToTextBlock( + paragraphBlockElement, + testData.mediumText + ); + await toggleOrientation( editorPage.driver ); + + const html = await editorPage.getHtmlContent(); + + expect( html.toLowerCase() ).toBe( + testData.deviceRotationHtml.toLowerCase() + ); + } ); +} ); + +describe( 'Gutenberg Editor Paste tests', () => { // skip iOS for now if ( ! isAndroid() ) { it( 'skips the tests on any platform other than Android', async () => { diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-drag-and-drop.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-drag-and-drop.test.js index 104c1ca4d4cbf..5d7cce975e373 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-drag-and-drop.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-drag-and-drop.test.js @@ -51,8 +51,8 @@ describe( 'Gutenberg Editor Drag & Drop blocks tests', () => { // Remove the blocks await spacerBlock.click(); - await editorPage.removeBlockAtPosition( blockNames.spacer, 2 ); - await editorPage.removeBlockAtPosition( blockNames.paragraph, 1 ); + await editorPage.removeBlock(); + await editorPage.removeBlock(); } ); onlyOnAndroid( @@ -84,7 +84,7 @@ describe( 'Gutenberg Editor Drag & Drop blocks tests', () => { expect( paragraphText ).toMatch( testData.shortText ); // Remove the block - await editorPage.removeBlockAtPosition( blockNames.paragraph ); + await editorPage.removeBlock(); } ); @@ -118,7 +118,7 @@ describe( 'Gutenberg Editor Drag & Drop blocks tests', () => { expect( shortcodeText ).toMatch( testData.shortText ); // Remove the block - await editorPage.removeBlockAtPosition( blockNames.shortcode ); + await editorPage.removeBlock(); } ); @@ -158,6 +158,6 @@ describe( 'Gutenberg Editor Drag & Drop blocks tests', () => { expect( secondBlockText ).toMatch( testData.shortText ); // Remove the block - await editorPage.removeBlockAtPosition( blockNames.paragraph ); + await editorPage.removeBlock(); } ); } ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-file-@canary.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-file-@canary.test.js deleted file mode 100644 index 09858bda2ede7..0000000000000 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-file-@canary.test.js +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Internal dependencies - */ -import { blockNames } from './pages/editor-page'; -import { waitForMediaLibrary } from './helpers/utils'; -import testData from './helpers/test-data'; - -describe( 'Gutenberg Editor File Block tests', () => { - it( 'should be able to add a file block and a file to it', async () => { - // add a file block - await editorPage.addNewBlock( blockNames.file ); - - // dismiss the media picker automatically opened when adding a file block - await waitForMediaLibrary( editorPage.driver ); - await editorPage.closePicker(); - - // verify there's a file block - const block = await editorPage.getFirstBlockVisible(); - await expect( block ).toBeTruthy(); - - // tap on the file block - block.click(); - - // wait for the media picker's Media Library option to come up - await waitForMediaLibrary( editorPage.driver ); - - // tap on Media Library option - await editorPage.chooseMediaLibrary(); - - // get the html version of the content - const html = await editorPage.getHtmlContent(); - - // verify the html matches the expected content - expect( html.toLowerCase() ).toBe( - testData.fileBlockPlaceholder.toLowerCase() - ); - } ); -} ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-image-@canary.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-image-@canary.test.js deleted file mode 100644 index 1d8d6fe3c9ea2..0000000000000 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-image-@canary.test.js +++ /dev/null @@ -1,44 +0,0 @@ -/** - * Internal dependencies - */ -import { blockNames } from './pages/editor-page'; -import { isAndroid, clickMiddleOfElement, swipeUp } from './helpers/utils'; -import testData from './helpers/test-data'; - -describe( 'Gutenberg Editor Image Block tests', () => { - it( 'should be able to add an image block', async () => { - // iOS only test - Can only add image from media library on iOS - if ( ! isAndroid() ) { - await editorPage.addNewBlock( blockNames.image ); - await editorPage.closePicker(); - - const imageBlock = await editorPage.getBlockAtPosition( - blockNames.image - ); - - await editorPage.selectEmptyImageBlock( imageBlock ); - await editorPage.chooseMediaLibrary(); - - // Workaround because of #952. - const titleElement = await editorPage.getTitleElement(); - await clickMiddleOfElement( editorPage.driver, titleElement ); - await editorPage.dismissKeyboard(); - // End workaround. - - await swipeUp( editorPage.driver, imageBlock ); - await editorPage.enterCaptionToSelectedImageBlock( - testData.imageCaption, - true - ); - await editorPage.dismissKeyboard(); - - await editorPage.addNewBlock( blockNames.paragraph ); - await editorPage.sendTextToParagraphBlock( 2, testData.shortText ); - const html = await editorPage.getHtmlContent(); - - expect( html.toLowerCase() ).toBe( - testData.imageShorteHtml.toLowerCase() - ); - } - } ); -} ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-initial-html.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-initial-html-@canary.test.js similarity index 100% rename from packages/react-native-editor/__device-tests__/gutenberg-editor-initial-html.test.js rename to packages/react-native-editor/__device-tests__/gutenberg-editor-initial-html-@canary.test.js diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js new file mode 100644 index 0000000000000..1a12e32b99e90 --- /dev/null +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-media-blocks-@canary.test.js @@ -0,0 +1,165 @@ +/** + * Internal dependencies + */ +import { blockNames } from './pages/editor-page'; +import { waitForMediaLibrary, isAndroid } from './helpers/utils'; +import testData from './helpers/test-data'; + +const onlyOniOS = ! isAndroid() ? describe : describe.skip; + +describe( 'Gutenberg Editor Audio Block tests', () => { + it( 'should be able to add an audio block and a file to it', async () => { + // add an audio block + await editorPage.addNewBlock( blockNames.audio ); + + // dismiss the media picker automatically opened when adding an audio block + await waitForMediaLibrary( editorPage.driver ); + await editorPage.closePicker(); + + // verify there's an audio block + let block = await editorPage.getFirstBlockVisible(); + await expect( block ).toBeTruthy(); + + // tap on the audio block + block.click(); + + // wait for the media picker's Media Library option to come up + await waitForMediaLibrary( editorPage.driver ); + + // tap on Media Library option + await editorPage.chooseMediaLibrary(); + + // get the html version of the content + const html = await editorPage.getHtmlContent(); + + // verify the html matches the expected content + expect( html.toLowerCase() ).toBe( + testData.audioBlockPlaceholder.toLowerCase() + ); + + block = await editorPage.getBlockAtPosition( blockNames.audio ); + await block.click(); + await editorPage.removeBlock(); + } ); +} ); + +describe( 'Gutenberg Editor File Block tests', () => { + it( 'should be able to add a file block and a file to it', async () => { + // add a file block + await editorPage.addNewBlock( blockNames.file ); + + // dismiss the media picker automatically opened when adding a file block + await waitForMediaLibrary( editorPage.driver ); + await editorPage.closePicker(); + + // verify there's a file block + let block = await editorPage.getFirstBlockVisible(); + await expect( block ).toBeTruthy(); + + // tap on the file block + block.click(); + + // wait for the media picker's Media Library option to come up + await waitForMediaLibrary( editorPage.driver ); + + // tap on Media Library option + await editorPage.chooseMediaLibrary(); + + // get the html version of the content + const html = await editorPage.getHtmlContent(); + + // verify the html matches the expected content + expect( html.toLowerCase() ).toBe( + testData.fileBlockPlaceholder.toLowerCase() + ); + + block = await editorPage.getBlockAtPosition( blockNames.file ); + await block.click(); + await editorPage.removeBlock(); + } ); +} ); + +// iOS only test - It can only add images from the media library on iOS. +onlyOniOS( 'Gutenberg Editor Image Block tests', () => { + it( 'should be able to add an image block', async () => { + await editorPage.addNewBlock( blockNames.image ); + await editorPage.closePicker(); + + let imageBlock = await editorPage.getBlockAtPosition( + blockNames.image + ); + + await editorPage.selectEmptyImageBlock( imageBlock ); + await editorPage.chooseMediaLibrary(); + + await editorPage.waitForElementToBeDisplayedById( + 'A snow-capped mountain top in a cloudy sky with red-leafed trees in the foreground', + 2000 + ); + await editorPage.enterCaptionToSelectedImageBlock( + testData.imageCaption, + true + ); + + const html = await editorPage.getHtmlContent(); + + expect( html.toLowerCase() ).toBe( + testData.imageShortHtml.toLowerCase() + ); + + imageBlock = await editorPage.getBlockAtPosition( blockNames.image ); + await imageBlock.click(); + await editorPage.removeBlock(); + } ); +} ); + +onlyOniOS( 'Gutenberg Editor Cover Block test', () => { + it( 'should displayed properly and have properly converted height (ios only)', async () => { + // Temporarily this test is skipped on Android, due to the inconsistency of the results, + // which are related to getting values in raw pixels instead of density pixels on Android. + await editorPage.setHtmlContent( testData.coverHeightWithRemUnit ); + + const coverBlock = await editorPage.getBlockAtPosition( + blockNames.cover + ); + + const { height } = await coverBlock.getSize(); + // Height is set to 20rem, where 1rem is 16. + // There is also block's vertical padding equal 32. + // Finally, the total height should be 20 * 16 + 32 = 352. + expect( height ).toBe( 352 ); + + await coverBlock.click(); + expect( coverBlock ).toBeTruthy(); + await editorPage.removeBlockAtPosition( blockNames.cover ); + } ); + + // Testing this for iOS on a device is valuable to ensure that it properly + // handles opening multiple modals, as only one can be open at a time. + // NOTE: It can only add images from the media library on iOS. + it( 'allows modifying media from within block settings', async () => { + await editorPage.setHtmlContent( testData.coverHeightWithRemUnit ); + + const coverBlock = await editorPage.getBlockAtPosition( + blockNames.cover + ); + await coverBlock.click(); + + await editorPage.openBlockSettings(); + await editorPage.clickAddMediaFromCoverBlock(); + await editorPage.chooseMediaLibrary(); + await editorPage.replaceMediaImage(); + + // First modal should no longer be presented. + const replaceButtons = + await editorPage.driver.elementsByAccessibilityId( 'Replace' ); + // eslint-disable-next-line jest/no-conditional-expect + expect( replaceButtons.length ).toBe( 0 ); + + // Select different media. + await editorPage.chooseMediaLibrary(); + + expect( coverBlock ).toBeTruthy(); + await editorPage.removeBlockAtPosition( blockNames.cover ); + } ); +} ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-paragraph.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-paragraph.test.js index e67b7fd6e797b..6604c9ba6f32b 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-paragraph.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-paragraph.test.js @@ -35,8 +35,8 @@ describe( 'Gutenberg Editor tests for Paragraph Block', () => { new RegExp( `${ text0 + text1 }|${ text0 } ${ text1 }` ) ); - await editorPage.removeBlockAtPosition( blockNames.paragraph, 2 ); - await editorPage.removeBlockAtPosition( blockNames.paragraph ); + await editorPage.removeBlock(); + await editorPage.removeBlock(); } ); it( 'should be able to merge 2 paragraph blocks into 1', async () => { @@ -72,8 +72,13 @@ describe( 'Gutenberg Editor tests for Paragraph Block', () => { const text = await editorPage.getTextForParagraphBlockAtPosition( 1 ); expect( text0 + text1 ).toMatch( text ); + paragraphBlockElement = await editorPage.getTextBlockAtPosition( + blockNames.paragraph, + 1 + ); + await paragraphBlockElement.click(); expect( await editorPage.getNumberOfParagraphBlocks() ).toEqual( 1 ); - await editorPage.removeBlockAtPosition( blockNames.paragraph ); + await editorPage.removeBlock(); } ); it( 'should be able to create a post with multiple paragraph blocks', async () => { @@ -81,7 +86,7 @@ describe( 'Gutenberg Editor tests for Paragraph Block', () => { await editorPage.sendTextToParagraphBlock( 1, testData.longText ); for ( let i = 3; i > 0; i-- ) { - await editorPage.removeBlockAtPosition( blockNames.paragraph, i ); + await editorPage.removeBlock(); } } ); @@ -116,7 +121,7 @@ describe( 'Gutenberg Editor tests for Paragraph Block', () => { await editorPage.getTextForParagraphBlockAtPosition( 1 ); expect( text0 + text1 ).toMatch( mergedBlockText ); - await editorPage.removeBlockAtPosition( blockNames.paragraph ); + await editorPage.removeBlock(); } ); // Based on https://github.com/wordpress-mobile/gutenberg-mobile/pull/1507 @@ -145,6 +150,6 @@ describe( 'Gutenberg Editor tests for Paragraph Block', () => { if ( isAndroid() ) { await paragraphBlockElement.click(); } - await editorPage.removeBlockAtPosition( blockNames.paragraph ); + await editorPage.removeBlock(); } ); } ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-rotation.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-rotation.test.js deleted file mode 100644 index 215b81bf98b4d..0000000000000 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-rotation.test.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Internal dependencies - */ -import { blockNames } from './pages/editor-page'; -import { isAndroid, toggleOrientation } from './helpers/utils'; -import testData from './helpers/test-data'; - -describe( 'Gutenberg Editor tests', () => { - it( 'should be able to add blocks , rotate device and continue adding blocks', async () => { - await editorPage.addNewBlock( blockNames.paragraph ); - let paragraphBlockElement = await editorPage.getTextBlockAtPosition( - blockNames.paragraph - ); - - await editorPage.typeTextToTextBlock( - paragraphBlockElement, - testData.mediumText - ); - - await toggleOrientation( editorPage.driver ); - // On Android the keyboard hides the add block button, let's hide it after rotation - if ( isAndroid() ) { - await editorPage.dismissKeyboard(); - } - - await editorPage.addNewBlock( blockNames.paragraph ); - - if ( isAndroid() ) { - await editorPage.dismissKeyboard(); - } - - paragraphBlockElement = await editorPage.getTextBlockAtPosition( - blockNames.paragraph, - 2 - ); - - await editorPage.typeTextToTextBlock( - paragraphBlockElement, - testData.mediumText - ); - await toggleOrientation( editorPage.driver ); - - const html = await editorPage.getHtmlContent(); - - expect( html.toLowerCase() ).toBe( - testData.deviceRotationHtml.toLowerCase() - ); - } ); -} ); diff --git a/packages/react-native-editor/__device-tests__/gutenberg-editor-search.test.js b/packages/react-native-editor/__device-tests__/gutenberg-editor-search.test.js index 2233b56f6c37d..4b425df306c47 100644 --- a/packages/react-native-editor/__device-tests__/gutenberg-editor-search.test.js +++ b/packages/react-native-editor/__device-tests__/gutenberg-editor-search.test.js @@ -92,7 +92,7 @@ describe( 'Gutenberg Editor Search Block tests.', () => { ); await searchBlock.click(); - await editorPage.toggleHideSearchLabelSetting( searchBlock ); + await editorPage.toggleHideSearchLabelSetting(); await editorPage.dismissBottomSheet(); // Switch to html and verify. @@ -106,7 +106,7 @@ describe( 'Gutenberg Editor Search Block tests.', () => { ); await searchBlock.click(); - await editorPage.toggleSearchIconOnlySetting( searchBlock ); + await editorPage.toggleSearchIconOnlySetting(); await editorPage.dismissBottomSheet(); // Switch to html and verify. @@ -121,7 +121,6 @@ describe( 'Gutenberg Editor Search Block tests.', () => { await searchBlock.click(); await editorPage.changeSearchButtonPositionSetting( - searchBlock, 'Button inside' ); await editorPage.isSearchSettingsVisible(); @@ -138,10 +137,7 @@ describe( 'Gutenberg Editor Search Block tests.', () => { ); await searchBlock.click(); - await editorPage.changeSearchButtonPositionSetting( - searchBlock, - 'No button' - ); + await editorPage.changeSearchButtonPositionSetting( 'No button' ); await editorPage.isSearchSettingsVisible(); await editorPage.dismissBottomSheet(); @@ -159,7 +155,7 @@ const removeSearchBlock = async () => { await searchBlock.click(); // Remove search block. - await editorPage.removeBlockAtPosition( blockNames.search ); + await editorPage.removeBlock(); }; const verifySearchElementText = async ( testId, expected ) => { diff --git a/packages/react-native-editor/__device-tests__/helpers/test-data.js b/packages/react-native-editor/__device-tests__/helpers/test-data.js index db84a7ad02926..a4fca9f89ab59 100644 --- a/packages/react-native-editor/__device-tests__/helpers/test-data.js +++ b/packages/react-native-editor/__device-tests__/helpers/test-data.js @@ -95,13 +95,9 @@ exports.imageCompletehtml = `

    The finer continuum interprets the polynomial rabbit. When can the geology runs? An astronomer runs. Should a communist consent?

    `; -exports.imageShorteHtml = ` +exports.imageShortHtml = `
    A snow-capped mountain top in a cloudy sky with red-leafed trees in the foreground
    C'est la vie my friends
    - - - -

    rock music approaches at high velocity.

    -`; +`; exports.unsupportedBlockHtml = ``; diff --git a/packages/react-native-editor/__device-tests__/pages/editor-page.js b/packages/react-native-editor/__device-tests__/pages/editor-page.js index c78cc135c06ba..57490584cb3b9 100644 --- a/packages/react-native-editor/__device-tests__/pages/editor-page.js +++ b/packages/react-native-editor/__device-tests__/pages/editor-page.js @@ -1,3 +1,9 @@ +/** + * External dependencies + */ +// eslint-disable-next-line import/no-extraneous-dependencies +const wd = require( 'wd' ); + /** * Internal dependencies */ @@ -5,7 +11,6 @@ const { doubleTap, isAndroid, isEditorVisible, - isElementVisible, longPressMiddleOfElement, setClipboard, setupDriver, @@ -168,15 +173,21 @@ class EditorPage { } async getTitleElement( options = { autoscroll: false } ) { - // TODO: Improve the identifier for this element - const elements = await this.driver.elementsByXPath( - `//*[contains(@${ this.accessibilityIdXPathAttrib }, "Post title.")]` + const titleElement = isAndroid() + ? 'Post title. Welcome to Gutenberg!, Updates the title.' + : 'post-title'; + const elements = await this.driver.elementsByAccessibilityId( + titleElement ); - if ( elements.length === 0 && options.autoscroll ) { + + if ( + ( elements.length === 0 || ! elements[ 0 ].isDisplayed() ) && + options.autoscroll + ) { await swipeDown( this.driver ); return this.getTitleElement( options ); } - return elements[ elements.length - 1 ]; + return elements[ 0 ]; } // iOS loads the block list more eagerly compared to Android. @@ -278,15 +289,32 @@ class EditorPage { } } - async openBlockSettings( block ) { - await block.click(); - - const settingsButton = await block.elementByAccessibilityId( - 'Open Settings' + async openBlockSettings() { + const settingsButtonElement = 'Open Settings'; + const settingsButton = await this.waitForElementToBeDisplayedById( + settingsButtonElement ); + await settingsButton.click(); } + async removeBlock() { + const blockActionsButtonElement = isAndroid() + ? 'Open Block Actions Menu, Double tap to open Bottom Sheet with available options' + : 'Open Block Actions Menu'; + const blockActionsMenu = await this.waitForElementToBeDisplayedById( + blockActionsButtonElement + ); + await blockActionsMenu.click(); + + const removeElement = 'Remove block'; + const removeBlockButton = await this.waitForElementToBeDisplayedById( + removeElement, + 4000 + ); + return await removeBlockButton.click(); + } + async dismissBottomSheet() { return await swipeDown( this.driver ); } @@ -296,13 +324,12 @@ class EditorPage { // ========================= async addNewBlock( blockName, relativePosition ) { - const addBlockButtonLocator = isAndroid() - ? '//android.widget.Button[@content-desc="Add block, Double tap to add a block"]' - : '//XCUIElementTypeButton[@name="add-block-button"]'; - - const addButton = await waitForVisible( - this.driver, - addBlockButtonLocator + const addBlockElement = isAndroid() + ? 'Add block, Double tap to add a block' + : 'Add block'; + const addButton = await this.waitForElementToBeDisplayedById( + addBlockElement, + 3000 ); if ( relativePosition === 'before' ) { @@ -346,14 +373,19 @@ class EditorPage { return screenHeight * 0.82; } + async waitForInserter() { + const inserterElement = isAndroid() + ? 'Blocks menu' + : 'InserterUI-Blocks'; + return await this.waitForElementToBeDisplayedById( + inserterElement, + 4000 + ); + } + // Attempts to find the given block button in the block inserter control. async findBlockButton( blockName ) { - // Wait for the first block, Paragraph block, to load before looking for other blocks - const paragraphBlockLocator = isAndroid() - ? '//android.widget.Button[@content-desc="Paragraph block"]/android.widget.TextView' - : '//XCUIElementTypeButton[@name="Paragraph block"]'; - - await waitForVisible( this.driver, paragraphBlockLocator ); + await this.waitForInserter(); const blockAccessibilityLabel = `${ blockName } block`; const blockAccessibilityLabelNewBlock = `${ blockAccessibilityLabel }, newly available`; @@ -555,11 +587,20 @@ class EditorPage { } async assertSlashInserterPresent() { - const slashInserterLocator = isAndroid() - ? '//android.widget.HorizontalScrollView[@content-desc="Slash inserter results"]/android.view.ViewGroup' - : '(//XCUIElementTypeOther[@name="Slash inserter results"])[1]'; + let isPresent = false; + const autocompleterElementId = isAndroid() + ? 'Slash inserter results' + : 'autocompleter'; + const autocompleterElement = + await this.driver.elementsByAccessibilityId( + autocompleterElementId + ); + + if ( autocompleterElement?.[ 0 ] ) { + isPresent = await autocompleterElement[ 0 ].isDisplayed(); + } - return await isElementVisible( this.driver, slashInserterLocator, 5 ); + return isPresent; } // ========================= @@ -700,8 +741,8 @@ class EditorPage { return await typeString( this.driver, textViewElement, text ); } - async toggleHideSearchLabelSetting( block ) { - await this.openBlockSettings( block ); + async toggleHideSearchLabelSetting() { + await this.openBlockSettings(); const elementName = isAndroid() ? '//*' : '//XCUIElementTypeOther'; @@ -712,8 +753,8 @@ class EditorPage { ); } - async changeSearchButtonPositionSetting( block, buttonPosition ) { - await this.openBlockSettings( block ); + async changeSearchButtonPositionSetting( buttonPosition ) { + await this.openBlockSettings(); const elementName = isAndroid() ? '//*' : '//XCUIElementTypeButton'; @@ -724,8 +765,8 @@ class EditorPage { return await clickIfClickable( this.driver, optionMenuButtonLocator ); } - async toggleSearchIconOnlySetting( block ) { - await this.openBlockSettings( block ); + async toggleSearchIconOnlySetting() { + await this.openBlockSettings(); const elementName = isAndroid() ? '//*' : '//XCUIElementTypeOther'; @@ -800,6 +841,16 @@ class EditorPage { return await waitForVisible( this.driver, blockLocator ); } + + async waitForElementToBeDisplayedById( id, timeout = 2000 ) { + await this.driver.waitForElementByAccessibilityId( + id, + wd.asserters.isDisplayed, + timeout + ); + + return await this.driver.elementByAccessibilityId( id ); + } } const blockNames = { diff --git a/packages/react-native-editor/package.json b/packages/react-native-editor/package.json index 2601a1871f580..065fe844249a9 100644 --- a/packages/react-native-editor/package.json +++ b/packages/react-native-editor/package.json @@ -108,7 +108,7 @@ "test": "cross-env NODE_ENV=test jest --verbose --config ../../test/native/jest.config.js", "test:debug": "cross-env NODE_ENV=test node --inspect-brk ../../node_modules/.bin/jest --runInBand --verbose --config ../../test/native/jest.config.js", "test:update": "npm run test -- --updateSnapshot", - "device-tests": "cross-env NODE_ENV=test jest --forceExit --detectOpenHandles --no-cache --maxWorkers=3 --testPathIgnorePatterns=@canary --verbose --config ./jest_ui.config.js", + "device-tests": "cross-env NODE_ENV=test jest --forceExit --detectOpenHandles --no-cache --maxWorkers=3 --testPathIgnorePatterns='canary|gutenberg-editor-rendering' --verbose --config ./jest_ui.config.js", "device-tests-canary": "cross-env NODE_ENV=test jest --forceExit --detectOpenHandles --no-cache --maxWorkers=2 --testPathPattern=@canary --verbose --config ./jest_ui.config.js", "device-tests:local": "cross-env NODE_ENV=test jest --runInBand --detectOpenHandles --verbose --forceExit --config ./jest_ui.config.js", "device-tests:debug": "cross-env NODE_ENV=test node $NODE_DEBUG_OPTION --inspect-brk node_modules/jest/bin/jest --runInBand --detectOpenHandles --verbose --config ./jest_ui.config.js", From 63079c7edd8e823664d0fb5e28ed5a558a97fa51 Mon Sep 17 00:00:00 2001 From: Kai Hao Date: Wed, 15 Feb 2023 21:32:41 +0800 Subject: [PATCH 52/76] Fix `editor.getBlocks` for unmodified default block (#48093) --- .../src/editor/get-blocks.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts b/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts index dba597a19c983..70a5a03628ee0 100644 --- a/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts +++ b/packages/e2e-test-utils-playwright/src/editor/get-blocks.ts @@ -15,14 +15,11 @@ export async function getBlocks( this: Editor ) { const blocks = window.wp.data.select( 'core/block-editor' ).getBlocks(); // The editor might still contain an unmodified empty block even when it's technically "empty". - if ( blocks.length === 1 ) { - const blockName = blocks[ 0 ].name; - if ( - blockName === window.wp.blocks.getDefaultBlockName() || - blockName === window.wp.blocks.getFreeformContentHandlerName() - ) { - return []; - } + if ( + blocks.length === 1 && + window.wp.blocks.isUnmodifiedDefaultBlock( blocks[ 0 ] ) + ) { + return []; } return blocks; From 182eaa1096adbb657b05ea4a39158f1ec9f5305d Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Wed, 15 Feb 2023 15:38:37 +0000 Subject: [PATCH 53/76] Bump plugin version to 15.2.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 07ded24a330e2..ca9be89162ebc 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -5,7 +5,7 @@ * Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality. * Requires at least: 6.0 * Requires PHP: 5.6 - * Version: 15.1.0 + * Version: 15.2.0-rc.1 * Author: Gutenberg Team * Text Domain: gutenberg * diff --git a/package-lock.json b/package-lock.json index 6fb9ece91f420..4e181b3ea0dc2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "15.1.0", + "version": "15.2.0-rc.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index aaf16e907f13e..cdac43e2d4ecb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "15.1.0", + "version": "15.2.0-rc.1", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", From fb92f0849032a54b02946c5399275637dde484de Mon Sep 17 00:00:00 2001 From: Marin Atanasov <8436925+tyxla@users.noreply.github.com> Date: Wed, 15 Feb 2023 17:41:39 +0200 Subject: [PATCH 54/76] Lodash: Refactor context system provider away from _.merge() (#48036) --- package-lock.json | 7 +++++++ packages/components/package.json | 2 ++ .../src/ui/context/context-system-provider.js | 11 +++++++---- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 4e181b3ea0dc2..a59aa9f4bbae2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17458,12 +17458,14 @@ "classnames": "^2.3.1", "colord": "^2.7.0", "date-fns": "^2.28.0", + "deepmerge": "^4.3.0", "dom-scroll-into-view": "^1.2.1", "downshift": "^6.0.15", "fast-deep-equal": "^3.1.3", "framer-motion": "^7.6.1", "gradient-parser": "^0.1.5", "highlight-words-core": "^1.2.2", + "is-plain-object": "^5.0.0", "lodash": "^4.17.21", "memize": "^1.1.0", "path-to-regexp": "^6.2.1", @@ -17481,6 +17483,11 @@ "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.29.3.tgz", "integrity": "sha512-dDCnyH2WnnKusqvZZ6+jA1O51Ibt8ZMRNkDZdyAyK4YfbDwa/cEmuztzG5pk6hqlp9aSBPYcjOlktquahGwGeA==" }, + "deepmerge": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.0.tgz", + "integrity": "sha512-z2wJZXrmeHdvYJp/Ux55wIjqo81G5Bp4c+oELTW+7ar6SogWHajt5a9gO3s3IDaGSAXjDk0vlQKN3rms8ab3og==" + }, "path-to-regexp": { "version": "6.2.1", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.1.tgz", diff --git a/packages/components/package.json b/packages/components/package.json index c4c94f7e6558c..9f5b62e5956c6 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -59,12 +59,14 @@ "classnames": "^2.3.1", "colord": "^2.7.0", "date-fns": "^2.28.0", + "deepmerge": "^4.3.0", "dom-scroll-into-view": "^1.2.1", "downshift": "^6.0.15", "fast-deep-equal": "^3.1.3", "framer-motion": "^7.6.1", "gradient-parser": "^0.1.5", "highlight-words-core": "^1.2.2", + "is-plain-object": "^5.0.0", "lodash": "^4.17.21", "memize": "^1.1.0", "path-to-regexp": "^6.2.1", diff --git a/packages/components/src/ui/context/context-system-provider.js b/packages/components/src/ui/context/context-system-provider.js index 33f8ded8526d6..b03a8c6322828 100644 --- a/packages/components/src/ui/context/context-system-provider.js +++ b/packages/components/src/ui/context/context-system-provider.js @@ -1,8 +1,9 @@ /** * External dependencies */ +import deepmerge from 'deepmerge'; import fastDeepEqual from 'fast-deep-equal/es6'; -import { merge } from 'lodash'; +import { isPlainObject } from 'is-plain-object'; /** * WordPress dependencies @@ -54,7 +55,7 @@ function useContextSystemBridge( { value } ) { // `parentContext` will always be memoized (i.e., the result of this hook itself) // or the default value from when the `ComponentsContext` was originally // initialized (which will never change, it's a static variable) - // so this memoization will prevent `merge` and `JSON.parse/stringify` from rerunning unless + // so this memoization will prevent `deepmerge()` from rerunning unless // the references to `value` change OR the `parentContext` has an actual material change // (because again, it's guaranteed to be memoized or a static reference to the empty object // so we know that the only changes for `parentContext` are material ones... i.e., why we @@ -62,10 +63,12 @@ function useContextSystemBridge( { value } ) { // need to bother with the `value`). The `useUpdateEffect` above will ensure that we are // correctly warning when the `value` isn't being properly memoized. All of that to say // that this should be super safe to assume that `useMemo` will only run on actual - // changes to the two dependencies, therefore saving us calls to `merge` and `JSON.parse/stringify`! + // changes to the two dependencies, therefore saving us calls to `deepmerge()`! const config = useMemo( () => { // Deep clone `parentContext` to avoid mutating it later. - return merge( JSON.parse( JSON.stringify( parentContext ) ), value ); + return deepmerge( parentContext ?? {}, value ?? {}, { + isMergeableObject: isPlainObject, + } ); }, [ parentContext, value ] ); return config; From 3d702833c48037f5f424cc1e1d1305eafe3561b4 Mon Sep 17 00:00:00 2001 From: Maggie Date: Thu, 16 Feb 2023 01:48:24 +0800 Subject: [PATCH 55/76] Navigation block: e2e code quality fixes (#48071) * code quality fixes * add no pause rule * Update .eslintrc.js Co-authored-by: Kai Hao * Update test/e2e/specs/editor/blocks/navigation.spec.js Co-authored-by: Kai Hao * Update test/e2e/specs/editor/blocks/navigation.spec.js Co-authored-by: Kai Hao * Update test/e2e/specs/editor/blocks/navigation.spec.js Co-authored-by: Kai Hao * Update test/e2e/specs/editor/blocks/navigation.spec.js Co-authored-by: Kai Hao * remove type from docs * add page as an argument --------- Co-authored-by: Kai Hao --- .eslintrc.js | 1 + .../src/request-utils/menus.ts | 36 +++++------ .../specs/editor/blocks/navigation.spec.js | 64 +++++++------------ 3 files changed, 42 insertions(+), 59 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 11e5eb394dd39..70926c8a9c541 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -392,6 +392,7 @@ module.exports = { rules: { '@wordpress/no-global-active-element': 'off', '@wordpress/no-global-get-selection': 'off', + 'playwright/no-page-pause': 'error', 'no-restricted-syntax': [ 'error', { diff --git a/packages/e2e-test-utils-playwright/src/request-utils/menus.ts b/packages/e2e-test-utils-playwright/src/request-utils/menus.ts index e5da27e032c79..4058662a4d9ee 100644 --- a/packages/e2e-test-utils-playwright/src/request-utils/menus.ts +++ b/packages/e2e-test-utils-playwright/src/request-utils/menus.ts @@ -16,8 +16,8 @@ export interface NavigationMenu { /** * Create a classic menu * - * @param {string} name Menu name. - * @return {string} Menu content. + * @param name Menu name. + * @return Menu content. */ export async function createClassicMenu( this: RequestUtils, name: string ) { const menuItems = [ @@ -37,20 +37,18 @@ export async function createClassicMenu( this: RequestUtils, name: string ) { }, } ); - if ( menuItems?.length ) { - await this.batchRest( - menuItems.map( ( menuItem ) => ( { - method: 'POST', - path: `/wp/v2/menu-items`, - body: { - menus: menu.id, - object_id: undefined, - ...menuItem, - parent: undefined, - }, - } ) ) - ); - } + await this.batchRest( + menuItems.map( ( menuItem ) => ( { + method: 'POST', + path: `/wp/v2/menu-items`, + body: { + menus: menu.id, + object_id: undefined, + ...menuItem, + parent: undefined, + }, + } ) ) + ); return menu; } @@ -58,7 +56,7 @@ export async function createClassicMenu( this: RequestUtils, name: string ) { /** * Create a navigation menu * - * @param {Object} menuData navigation menu post data. + * @param menuData navigation menu post data. * @return {string} Menu content. */ export async function createNavigationMenu( @@ -84,7 +82,7 @@ export async function deleteAllMenus( this: RequestUtils ) { path: `/wp/v2/navigation/`, } ); - if ( navMenus?.length ) { + if ( navMenus.length ) { await this.batchRest( navMenus.map( ( menu ) => ( { method: 'DELETE', @@ -97,7 +95,7 @@ export async function deleteAllMenus( this: RequestUtils ) { path: `/wp/v2/menus/`, } ); - if ( classicMenus?.length ) { + if ( classicMenus.length ) { await this.batchRest( classicMenus.map( ( menu ) => ( { method: 'DELETE', diff --git a/test/e2e/specs/editor/blocks/navigation.spec.js b/test/e2e/specs/editor/blocks/navigation.spec.js index 57ef99cbc09d6..b6e0b832eab5a 100644 --- a/test/e2e/specs/editor/blocks/navigation.spec.js +++ b/test/e2e/specs/editor/blocks/navigation.spec.js @@ -3,12 +3,6 @@ */ const { test, expect } = require( '@wordpress/e2e-test-utils-playwright' ); -test.use( { - navBlockUtils: async ( { editor, page, requestUtils }, use ) => { - await use( new NavigationBlockUtils( { editor, page, requestUtils } ) ); - }, -} ); - test.describe( 'As a user I want the navigation block to fallback to the best possible default', () => { @@ -66,7 +60,6 @@ test.describe( editor, page, requestUtils, - navBlockUtils, } ) => { await admin.createNewPost(); const createdMenu = await requestUtils.createNavigationMenu( { @@ -78,7 +71,11 @@ test.describe( await editor.insertBlock( { name: 'core/navigation' } ); // Check the block in the canvas. - await navBlockUtils.selectNavigationItemOnCanvas( 'WordPress' ); + await expect( + editor.canvas.locator( + `role=textbox[name="Navigation link text"i] >> text="WordPress"` + ) + ).toBeVisible(); // Check the markup of the block is correct. await editor.publishPost(); @@ -91,14 +88,19 @@ test.describe( await page.locator( 'role=button[name="Close panel"i]' ).click(); // Check the block in the frontend. - await navBlockUtils.selectNavigationItemOnFrontend( 'WordPress' ); + await page.goto( '/' ); + await expect( + page.locator( + `role=navigation >> role=link[name="WordPress"i]` + ) + ).toBeVisible(); } ); test( 'default to the only existing classic menu if there are no block menus', async ( { admin, + page, editor, requestUtils, - navBlockUtils, } ) => { // Create a classic menu. await requestUtils.createClassicMenu( 'Test Classic 1' ); @@ -113,42 +115,24 @@ test.describe( ] ); // Check the block in the canvas. - await editor.page.pause(); - await navBlockUtils.selectNavigationItemOnCanvas( 'Custom link' ); + await expect( + editor.canvas.locator( + `role=textbox[name="Navigation link text"i] >> text="Custom link"` + ) + ).toBeVisible(); // Check the block in the frontend. - await navBlockUtils.selectNavigationItemOnFrontend( 'Custom link' ); - await editor.page.pause(); + await page.goto( '/' ); + + await expect( + page.locator( + `role=navigation >> role=link[name="Custom link"i]` + ) + ).toBeVisible(); } ); } ); -class NavigationBlockUtils { - constructor( { editor, page, requestUtils } ) { - this.editor = editor; - this.page = page; - this.requestUtils = requestUtils; - } - - async selectNavigationItemOnCanvas( name ) { - await expect( - this.editor.canvas.locator( - `role=textbox[name="Navigation link text"i] >> text="${ name }"` - ) - ).toBeVisible(); - } - - async selectNavigationItemOnFrontend( name ) { - await this.page.goto( '/' ); - await this.editor.page.pause(); - await expect( - this.page.locator( - `role=navigation >> role=link[name="${ name }"i]` - ) - ).toBeVisible(); - } -} - test.describe( 'Navigation block', () => { test.describe( 'As a user I want to see a warning if the menu referenced by a navigation block is not available', From 4f693b2da613a96b614681c34aecba598a5751f1 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Wed, 15 Feb 2023 20:19:29 +0000 Subject: [PATCH 56/76] Update Changelog for 15.2.0-rc.1 --- changelog.txt | 334 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 334 insertions(+) diff --git a/changelog.txt b/changelog.txt index 1168776ff8d27..262fd96c5dc35 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,339 @@ == Changelog == += 15.2.0-rc.1 = + + + +## Changelog + +### Features + +#### Design Tools +- Add aspect-ratio to post featured image block. ([47854](https://github.com/WordPress/gutenberg/pull/47854)) + + +### Enhancements + +#### Site Editor +- Add a nested level when selecting templates or template parts. ([47777](https://github.com/WordPress/gutenberg/pull/47777)) +- Add back link to Design heading in site editor navigation to return to Dashboard. ([47950](https://github.com/WordPress/gutenberg/pull/47950)) +- Add: Modal to choose a start pattern on new templates. ([46248](https://github.com/WordPress/gutenberg/pull/46248)) +- Adds a global save button to the site editor. ([47142](https://github.com/WordPress/gutenberg/pull/47142)) +- Tidy up the generation of the site editor page title. ([48053](https://github.com/WordPress/gutenberg/pull/48053)) +- Update gutenberg_get_template_hierarchy. ([47716](https://github.com/WordPress/gutenberg/pull/47716)) + +#### Block Library +- Button: Update: Make button a content block. ([47936](https://github.com/WordPress/gutenberg/pull/47936)) +- File block: Add color block support to File block. ([41870](https://github.com/WordPress/gutenberg/pull/41870)) +- Navigation: Add integration tests for NavigationMenuSelector component. ([47825](https://github.com/WordPress/gutenberg/pull/47825)) +- Navigation: Updates "Add Submenu item" text to "Add Submenu link". ([48030](https://github.com/WordPress/gutenberg/pull/48030)) +- Post excerpt: Add excerpt length control. ([44964](https://github.com/WordPress/gutenberg/pull/44964)) +- Update: Make OffCanvasEditor use LeafMoreMenu by default. ([47844](https://github.com/WordPress/gutenberg/pull/47844)) + +#### Global Styles +- Extract the Global Styles Typography Panel into block-editor package. ([47356](https://github.com/WordPress/gutenberg/pull/47356)) +- Move more link about custom CSS to part of description. ([47781](https://github.com/WordPress/gutenberg/pull/47781)) +- Site Editor: Update 'Additional CSS' subtitle string. ([47671](https://github.com/WordPress/gutenberg/pull/47671)) +- Style Book: Exclude blocks that are not allowed to insert. ([47461](https://github.com/WordPress/gutenberg/pull/47461)) + +#### Design Tools +- Button: Adopt support for border color, style, and width. ([44574](https://github.com/WordPress/gutenberg/pull/44574)) +- Latest Comments: Add typography support. ([43310](https://github.com/WordPress/gutenberg/pull/43310)) +- Verse: Adopt border supports. ([48021](https://github.com/WordPress/gutenberg/pull/48021)) + +#### Block Editor +- Migrate from TextControl to NumberControl to remove margin overrides. ([47160](https://github.com/WordPress/gutenberg/pull/47160)) +- Add code owner. ([47733](https://github.com/WordPress/gutenberg/pull/47733)) +- Add settings "drawer" to Link Control. ([47328](https://github.com/WordPress/gutenberg/pull/47328)) +- Button: Prepend HTTP to Buttons block links when missing protocol. ([47311](https://github.com/WordPress/gutenberg/pull/47311)) +- Show a pointer/hint in the settings tab informing the user about the styles tab. ([47670](https://github.com/WordPress/gutenberg/pull/47670)) + +#### Components +- Add parent navigation support for the navigator component. ([47883](https://github.com/WordPress/gutenberg/pull/47883)) +- Zoom out mode: Scale iframe instead of contents. ([47004](https://github.com/WordPress/gutenberg/pull/47004)) + +#### Testing +- end-to-end perf tests: Run each test in a separate page. ([47889](https://github.com/WordPress/gutenberg/pull/47889)) + +#### Navigation Screen +- Components: Add support for named arguments in the navigator components. ([47827](https://github.com/WordPress/gutenberg/pull/47827)) + +#### Document Settings +- Term sorting is incorrect in flat term selector. ([47795](https://github.com/WordPress/gutenberg/pull/47795)) + +#### Patterns +- [Patterns]: Reorder pattern categories. ([47760](https://github.com/WordPress/gutenberg/pull/47760)) + +#### Block API +- Set block attributes to require either type or enum. ([45365](https://github.com/WordPress/gutenberg/pull/45365)) + +#### Inspector Controls +- Add template revision button. ([45215](https://github.com/WordPress/gutenberg/pull/45215)) + +#### Accessibility +- List view: Modify the shortcut to focus while open. ([45135](https://github.com/WordPress/gutenberg/pull/45135)) + +#### Scripts +- Scripts: Add PostCSS (.pcss extension) file support to wp-scripts. ([45352](https://github.com/WordPress/gutenberg/pull/45352)) +- Scripts: Use start without watcher using --no-watch. ([44237](https://github.com/WordPress/gutenberg/pull/44237)) + +### Bug Fixes + +- Distraction free mode: Fix keyboard shortcut not working. ([47900](https://github.com/WordPress/gutenberg/pull/47900)) +- useResizeObserver: Handle strict mode double effects. ([47703](https://github.com/WordPress/gutenberg/pull/47703)) + +#### Block Library +- Embed: Fix: Remove browser default border for iframe in the editor. ([47987](https://github.com/WordPress/gutenberg/pull/47987)) +- File block: Re-add editor styles for classic themes. ([47686](https://github.com/WordPress/gutenberg/pull/47686)) +- Image: Revert "Prevent the image from being resized larger than its container". ([47846](https://github.com/WordPress/gutenberg/pull/47846)) +- Image: Update image block margins on RTL. ([47617](https://github.com/WordPress/gutenberg/pull/47617)) +- Navigation Block inspector: Fix link UI popover opening on links that have a URL. ([47828](https://github.com/WordPress/gutenberg/pull/47828)) +- Navigation: Close Link UI if cancelled. ([48029](https://github.com/WordPress/gutenberg/pull/48029)) +- Navigation: Enable undo after creating a new menu. ([47683](https://github.com/WordPress/gutenberg/pull/47683)) +- Navigation: Fixes undo and redo for nesting operations in the navigation block's inspector. ([47633](https://github.com/WordPress/gutenberg/pull/47633)) +- Navigation: Remove the IS_GUTENBERG_PLUGIN check around block_core_navigation_parse_blocks_from_menu_items. ([47824](https://github.com/WordPress/gutenberg/pull/47824)) +- Navigation: Update deps for the useEffect that creates navigation menus. ([47912](https://github.com/WordPress/gutenberg/pull/47912)) +- OffCanvasEditor: Only allow some blocks to be converted to submenus. ([47974](https://github.com/WordPress/gutenberg/pull/47974)) +- Page List: Respect the selected parent page when converting to a list of navigation links. ([47651](https://github.com/WordPress/gutenberg/pull/47651)) +- Read More: I18N: Update string concatenation method in read more block. ([47815](https://github.com/WordPress/gutenberg/pull/47815)) +- ToolsPanel: Display optional items when values are updated externally. ([47727](https://github.com/WordPress/gutenberg/pull/47727)) +- [Quote]: Fix deprectated `large` style specificity rule. ([47969](https://github.com/WordPress/gutenberg/pull/47969)) + +#### Site Editor +- [Block Editor]: Lock `blockInspectorAnimation` setting. ([47740](https://github.com/WordPress/gutenberg/pull/47740)) +- Disable Strict Mode, breaks dev site editor. ([47701](https://github.com/WordPress/gutenberg/pull/47701)) +- Add: Modal to choose a start pattern on new templates. Take 2. ([47927](https://github.com/WordPress/gutenberg/pull/47927)) +- Fix ComplementaryArea's initial isActive state. ([47498](https://github.com/WordPress/gutenberg/pull/47498)) +- Fix custom Template Parts rename action. ([47932](https://github.com/WordPress/gutenberg/pull/47932)) +- Fix site editor navigation. ([48025](https://github.com/WordPress/gutenberg/pull/48025)) +- Shadow: Move shadow into own panel. ([47634](https://github.com/WordPress/gutenberg/pull/47634)) +- Specify active state color for template navigation button. ([47851](https://github.com/WordPress/gutenberg/pull/47851)) + +#### Accessibility +- Add an aria label to the site save dialog. ([47898](https://github.com/WordPress/gutenberg/pull/47898)) +- Fix UrlInput combobox to use the ARIA 1.0 pattern. ([47148](https://github.com/WordPress/gutenberg/pull/47148)) +- Fix constrained tabbing failures with Safari and Firefox. ([47426](https://github.com/WordPress/gutenberg/pull/47426)) +- Fix the headings hierarchy in the styles sidebar. ([43848](https://github.com/WordPress/gutenberg/pull/43848)) +- Site Editor: Append template type and name to the site editor page title. ([47855](https://github.com/WordPress/gutenberg/pull/47855)) +- Template editor: Only disable the save button if no changes rather than hiding it. ([47895](https://github.com/WordPress/gutenberg/pull/47895)) + +#### Block Editor +- useBlockSync: Change subscribed.current on unsubscribe. ([47752](https://github.com/WordPress/gutenberg/pull/47752)) +- Edit Post: Fix the 'inlineToolbar' settings toggle. ([47960](https://github.com/WordPress/gutenberg/pull/47960)) +- Fix clicking on the toggle button not closing the block inserter. ([47926](https://github.com/WordPress/gutenberg/pull/47926)) +- LinkControl: Fix scrollbar displayed on toggle link settings. ([47986](https://github.com/WordPress/gutenberg/pull/47986)) +- Rich text: Stabilise onFocus. ([47685](https://github.com/WordPress/gutenberg/pull/47685)) + +#### Design Tools +- Avatar: Fix application of borders. ([47630](https://github.com/WordPress/gutenberg/pull/47630)) +- Image: Allow deprecated blocks to render border-radius. ([47766](https://github.com/WordPress/gutenberg/pull/47766)) +- ToolsPanel: Ensure display of optional items when panel id is null. ([47864](https://github.com/WordPress/gutenberg/pull/47864)) + +#### Testing +- Fix `editor.getBlocks` for unmodified default block. ([48093](https://github.com/WordPress/gutenberg/pull/48093)) +- Visual Regression tests: Use default playwright utils. ([47991](https://github.com/WordPress/gutenberg/pull/47991)) + +#### Global Styles +- Fix incorrect targeting of block wrappers for root padding in the edi…. ([48002](https://github.com/WordPress/gutenberg/pull/48002)) +- Fix infinite render of inline block preview. ([47697](https://github.com/WordPress/gutenberg/pull/47697)) + +#### Components +- ColorPalette: Ensure text label contrast checking works with CSS variables. ([47373](https://github.com/WordPress/gutenberg/pull/47373)) +- SelectControl: Fix `multiple` prop styling. ([47893](https://github.com/WordPress/gutenberg/pull/47893)) + +#### Post Editor +- Fix multi entities saved state in the post editor. ([47734](https://github.com/WordPress/gutenberg/pull/47734)) +- LocalAutosaveNotice: Use stable notice id to prevent double notices. ([47776](https://github.com/WordPress/gutenberg/pull/47776)) + +#### Layout +- [Layout]: Fix align controls for hybrid themes. ([47961](https://github.com/WordPress/gutenberg/pull/47961)) + +#### Patterns +- Cover: Ensure `url` is not malformed due to sanitization through `wp_kses`. ([47906](https://github.com/WordPress/gutenberg/pull/47906)) + +#### Themes +- Fix: Issues on block level settings. ([47842](https://github.com/WordPress/gutenberg/pull/47842)) + +#### Plugin +- Fix the 'WP_HTML_Tag_Processor' file path. ([47823](https://github.com/WordPress/gutenberg/pull/47823)) + +#### Build Tooling +- Performance: Restore initial reduce value in perf results log script. ([47650](https://github.com/WordPress/gutenberg/pull/47650)) + +#### Block API +- Block Spacing: Don't show UI when only one direction is supported. ([47523](https://github.com/WordPress/gutenberg/pull/47523)) + +#### Scripts +- Cherry-pick CLI: Fix the default label to match the documentation. ([47832](https://github.com/WordPress/gutenberg/pull/47832)) + +### Performance + +- Avoid string-allocation on keypress with inputRule. ([47094](https://github.com/WordPress/gutenberg/pull/47094)) +- Fix empty results handling in performance test results. ([47646](https://github.com/WordPress/gutenberg/pull/47646)) +- Fix typo in performance script name. ([47647](https://github.com/WordPress/gutenberg/pull/47647)) +- Lodash: Remove from `@wordpress/keycodes` package. ([47737](https://github.com/WordPress/gutenberg/pull/47737)) + +#### Block Editor +- Block Editor: Optimize `__unstableGetVisibleBlocks()`. ([47681](https://github.com/WordPress/gutenberg/pull/47681)) + +#### Site Editor +- Enable React StrictMode again. ([47639](https://github.com/WordPress/gutenberg/pull/47639)) + +#### Block Library +- Navigation: Performance: Improve params in `block_core_navigation_get_most_recently_published_navigation`. ([47998](https://github.com/WordPress/gutenberg/pull/47998)) +- Page List: Block improvement.. ([47981](https://github.com/WordPress/gutenberg/pull/47981)) +- Page List: Performance: Improve page list callback. ([48004](https://github.com/WordPress/gutenberg/pull/48004)) +- Post Title: Performance: Render_block_core_post_title - Use post object instead of id. ([48001](https://github.com/WordPress/gutenberg/pull/48001)) +- Template Part: Performance: Replace usage of wp_get_theme()->get_stylesheet() with get_stylesheet(). ([48027](https://github.com/WordPress/gutenberg/pull/48027)) +- Tweaks to gutenberg_render_layout_support_flag. ([48003](https://github.com/WordPress/gutenberg/pull/48003)) + +#### Data Layer +- Lodash: Refactor away from `_.get()` in resolvers cache middleware. ([47743](https://github.com/WordPress/gutenberg/pull/47743)) +- Lodash: Refactor away from `_.mapValues()` in data registry. ([47742](https://github.com/WordPress/gutenberg/pull/47742)) +- Lodash: Refactor persistence plugin away from `_.merge()`. ([47790](https://github.com/WordPress/gutenberg/pull/47790)) +- Lodash: Remove from `@wordpress/data`'s `getResolutionState()`. ([47838](https://github.com/WordPress/gutenberg/pull/47838)) +- Lodash: Remove from `@wordpress/data`. ([47848](https://github.com/WordPress/gutenberg/pull/47848)) +- Lodash: Remove from `useDispatchWithMap()`. ([47835](https://github.com/WordPress/gutenberg/pull/47835)) + +#### Template Editor +- Disable lazy loading term meta get_block_templates. ([47999](https://github.com/WordPress/gutenberg/pull/47999)) + +#### Themes +- Improvements on append_to_selector method. ([47833](https://github.com/WordPress/gutenberg/pull/47833)) + +#### Block Directory +- Optimize `DownloadableBlocksPanel`. ([47679](https://github.com/WordPress/gutenberg/pull/47679)) + + +### Experiments + +- Handle block metadata attribute and related experimental APIs. ([47791](https://github.com/WordPress/gutenberg/pull/47791)) +- Rename the "experiments" export to "privateApis". ([47975](https://github.com/WordPress/gutenberg/pull/47975)) +- [Trunk] Rename experiments package to private-apis. ([47839](https://github.com/WordPress/gutenberg/pull/47839)) + + +### Documentation + +- Add: Database credentials to wp-env documentation. ([47940](https://github.com/WordPress/gutenberg/pull/47940)) +- Block schema and block supports docs: Add dimensions and position settings. ([48057](https://github.com/WordPress/gutenberg/pull/48057)) +- Components: Polish heading level component APIs. ([47788](https://github.com/WordPress/gutenberg/pull/47788)) +- Docs: Add ancestor property to block-registration.md doc. ([45832](https://github.com/WordPress/gutenberg/pull/45832)) +- Docs: Don't recommend using short array syntax in WP_HTML_Tag_Processor. ([47958](https://github.com/WordPress/gutenberg/pull/47958)) +- Docs: Fix the incorrect link to eslint-plugin-jsx-a11y. ([47773](https://github.com/WordPress/gutenberg/pull/47773)) +- Fix unbalanced parenthesis in Element README. ([47700](https://github.com/WordPress/gutenberg/pull/47700)) +- Minor updates in Private APIs. ([47953](https://github.com/WordPress/gutenberg/pull/47953)) + + +### Code Quality + +- Core Data: Fix ESLint warnings for the hooks directory. ([47811](https://github.com/WordPress/gutenberg/pull/47811)) +- ESLint: Change `jsdoc/check-line-alignment` from `warn` to `error`. ([47878](https://github.com/WordPress/gutenberg/pull/47878)) +- ESLint: Fix a bunch of ESLint alignment warnings. ([47872](https://github.com/WordPress/gutenberg/pull/47872)) +- Enable react-hooks/exhaustive-deps eslint rules. ([24914](https://github.com/WordPress/gutenberg/pull/24914)) +- Update `moment` and `moment-timezone` packages to fix timezone issues. ([47879](https://github.com/WordPress/gutenberg/pull/47879)) + +#### Components +- AnglePickerControl: Refactor to TypeScript. ([45820](https://github.com/WordPress/gutenberg/pull/45820)) +- BorderBoxControl: Migrate tests to TypeScript, remove `act()` call. ([47755](https://github.com/WordPress/gutenberg/pull/47755)) +- BoxControl: Convert to TypeScript. ([47622](https://github.com/WordPress/gutenberg/pull/47622)) +- ComboboxControl: Convert to TypeScript. ([47581](https://github.com/WordPress/gutenberg/pull/47581)) +- CustomSelectControl: Privatise __experimentalShowSelectedHint using @wordpress/experiments. ([47229](https://github.com/WordPress/gutenberg/pull/47229)) +- CustomSelectControl: Update size prop options to new format in Storybook examples. ([47779](https://github.com/WordPress/gutenberg/pull/47779)) +- Navigator: Add more pattern matching tests, refine existing tests. ([47910](https://github.com/WordPress/gutenberg/pull/47910)) +- NavigatorButton: Reuse Button types. ([47754](https://github.com/WordPress/gutenberg/pull/47754)) +- Panel: Convert to TypeScript. ([47259](https://github.com/WordPress/gutenberg/pull/47259)) +- Popover: Lock the __experimentalPopoverPositionToPlacement function. ([47505](https://github.com/WordPress/gutenberg/pull/47505)) +- Refactor Toolbar component to TypeScript. ([47087](https://github.com/WordPress/gutenberg/pull/47087)) +- Remove BaseField component. ([47911](https://github.com/WordPress/gutenberg/pull/47911)) +- Remove unnecessary `act()` from `Button` tests. ([47687](https://github.com/WordPress/gutenberg/pull/47687)) +- Remove unnecessary `act()` from `DropdownMenu` tests. ([47692](https://github.com/WordPress/gutenberg/pull/47692)) +- Remove unnecessary `act()` from `Popover` tests. ([47690](https://github.com/WordPress/gutenberg/pull/47690)) +- Remove unnecessary `act()` from `ToolsPanel` tests. ([47691](https://github.com/WordPress/gutenberg/pull/47691)) +- ResizableBox: Refactor styles to TypeScript. ([47756](https://github.com/WordPress/gutenberg/pull/47756)) +- TreeGrid: Convert to TypeScript. ([47516](https://github.com/WordPress/gutenberg/pull/47516)) +- `MenuItemsChoice`: Refactor to TypeScript. ([47180](https://github.com/WordPress/gutenberg/pull/47180)) +- `ToolsPanel`: Refactor Storybook examples to TypeScript, fix types inconsistencies. ([47944](https://github.com/WordPress/gutenberg/pull/47944)) + +#### Block Library +- Gallery: Minor code quality update. ([47774](https://github.com/WordPress/gutenberg/pull/47774)) +- Image: Simplify the method for getting block editor settings. ([47903](https://github.com/WordPress/gutenberg/pull/47903)) +- Navigation: Chore Remove unexistant parameter from selectNavigationMenus call. ([47941](https://github.com/WordPress/gutenberg/pull/47941)) +- Site Logo: Simplify the method for getting block editor settings. ([47736](https://github.com/WordPress/gutenberg/pull/47736)) +- Table Block: Don't render empty section. ([47753](https://github.com/WordPress/gutenberg/pull/47753)) + +#### Site Editor +- Make process_blocks_custom_css method protected. ([47725](https://github.com/WordPress/gutenberg/pull/47725)) +- Move site editor 6.2 specific code to the right file. ([48023](https://github.com/WordPress/gutenberg/pull/48023)) +- Remove: Unused code from the navigation inspector select logic. ([48044](https://github.com/WordPress/gutenberg/pull/48044)) + +#### Global Styles +- Extract the getSupportedStyles selector to the blocks store as a private selector. ([47606](https://github.com/WordPress/gutenberg/pull/47606)) +- Remove the name and element props from the TypographyPanel component. ([47908](https://github.com/WordPress/gutenberg/pull/47908)) + +#### Post Editor +- Add missing period in keyboard shortcut descriptions. ([47899](https://github.com/WordPress/gutenberg/pull/47899)) +- Edit Post: Remove unnecessary 'classnames' in Header component. ([47635](https://github.com/WordPress/gutenberg/pull/47635)) + +#### REST API +- Chore: Move Gutenberg_REST_Templates_Controller from 6.2 to 6.3 compatibility. ([48077](https://github.com/WordPress/gutenberg/pull/48077)) + +#### Themes +- Sync: Widget import changes from the core. ([47875](https://github.com/WordPress/gutenberg/pull/47875)) + +#### Patterns +- Refactor: usePatternsCategories: Simplify category sorting. ([47843](https://github.com/WordPress/gutenberg/pull/47843)) + +#### Document Settings +- Most Used Terms: Pass dependency to the useSelect. ([47810](https://github.com/WordPress/gutenberg/pull/47810)) + +#### Block API +- HTML API: Move into 6.2 Compat Folder since inclusion in Core. ([47749](https://github.com/WordPress/gutenberg/pull/47749)) + +#### Data Layer +- Fixed incorrect type annotations in @wordpress/data. ([46881](https://github.com/WordPress/gutenberg/pull/46881)) + + +### Tools +- Dependency Extraction Webpack Plugin: Update json2php dependency. ([47831](https://github.com/WordPress/gutenberg/pull/47831)) + +#### Testing +- Add tests for gutenberg_render_layout_support_flag. ([47719](https://github.com/WordPress/gutenberg/pull/47719)) +- Migrate Heading block tests to Playwright. ([47955](https://github.com/WordPress/gutenberg/pull/47955)) +- Migrate query test to Playwright. ([47995](https://github.com/WordPress/gutenberg/pull/47995)) +- Navigation: end-to-end tests: Default to classic menu. ([47867](https://github.com/WordPress/gutenberg/pull/47867)) +- Navigation: end-to-end tests: Default to my only existing menu. ([47744](https://github.com/WordPress/gutenberg/pull/47744)) +- Remove obsolete failing test for Font Size Picker. ([47913](https://github.com/WordPress/gutenberg/pull/47913)) +- Shard playwright tests into two separate jobs using a matrix. ([47629](https://github.com/WordPress/gutenberg/pull/47629)) +- Update code and tests for theme json class after the back port in core. ([47668](https://github.com/WordPress/gutenberg/pull/47668)) +- Upgrade Playwright to 1.30.0. ([48007](https://github.com/WordPress/gutenberg/pull/48007)) + +#### Build Tooling +- Add basic tsconfig.json validation. ([47595](https://github.com/WordPress/gutenberg/pull/47595)) +- Front-end classic performance test: Set TwentyTwentyOne when running in isolation. ([47965](https://github.com/WordPress/gutenberg/pull/47965)) +- Perf tests: Store test run results as artifact. ([45747](https://github.com/WordPress/gutenberg/pull/45747)) +- Performance suite: Track Largest Contentful Paint in the front-end. ([47938](https://github.com/WordPress/gutenberg/pull/47938)) + +#### Block Library +- Navigation: Add warning test. ([45207](https://github.com/WordPress/gutenberg/pull/45207)) + + +## First time contributors + +The following PRs were merged by first time contributors: + +- @creative-andrew: Add: Database credentials to wp-env documentation. ([47940](https://github.com/WordPress/gutenberg/pull/47940)) +- @dpellenwood: Scripts: Add PostCSS (.pcss extension) file support to wp-scripts. ([45352](https://github.com/WordPress/gutenberg/pull/45352)) +- @griffinjohndavid: Set block attributes to require either type or enum. ([45365](https://github.com/WordPress/gutenberg/pull/45365)) +- @mike-day: Refactor Toolbar component to TypeScript. ([47087](https://github.com/WordPress/gutenberg/pull/47087)) + + +## Contributors + +The following contributors merged PRs in this release: + +@aaronrobertshaw @adamziel @afercia @ajlende @alexstine @andrewserong @aristath @brookewp @carolinan @ciampo @creative-andrew @d-alleyne @dcalhoun @dmsnell @dpellenwood @draganescu @ellatrix @flootr @fluiddot @georgeh @geriux @getdave @glendaviesnz @griffinjohndavid @gziolo @jhnstn @jorgefilipecosta @jsnajdr @kebbet @kevin940726 @kkmuffme @madhusudhand @MaggieCabrera @Mamaduka @marekdedic @mauteri @mcsf @mike-day @mirka @mreishus @nielslange @noahtallen @noisysocks @ntsekouras @oandregal @scruffian @sgomes @SiobhyB @spacedmonkey @t-hamano @talldan @tellthemachines @tyxla @wojtekn @WunderBart @youknowriad + + = 15.1.0 = ## Changelog From 5ac25e916d079b1d7b67783a24e7053d6482f730 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Wed, 15 Feb 2023 20:33:03 +0000 Subject: [PATCH 57/76] 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/base-styles/CHANGELOG.md | 2 ++ packages/base-styles/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/custom-templated-path-webpack-plugin/CHANGELOG.md | 2 ++ packages/custom-templated-path-webpack-plugin/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/docgen/CHANGELOG.md | 2 ++ packages/docgen/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/env/CHANGELOG.md | 2 ++ packages/env/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/lazy-import/CHANGELOG.md | 2 ++ packages/lazy-import/package.json | 2 +- packages/library-export-default-webpack-plugin/CHANGELOG.md | 2 ++ packages/library-export-default-webpack-plugin/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/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/private-apis/CHANGELOG.md | 2 ++ packages/private-apis/package.json | 2 +- packages/project-management-automation/CHANGELOG.md | 2 ++ packages/project-management-automation/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 +- 170 files changed, 255 insertions(+), 85 deletions(-) diff --git a/packages/a11y/CHANGELOG.md b/packages/a11y/CHANGELOG.md index d835cb8815a22..2119cc67d4a23 100644 --- a/packages/a11y/CHANGELOG.md +++ b/packages/a11y/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/a11y/package.json b/packages/a11y/package.json index 7f48d5db5599c..838291beb2688 100644 --- a/packages/a11y/package.json +++ b/packages/a11y/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/a11y", - "version": "3.26.0", + "version": "3.27.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 33bce817cc802..0987d90e86022 100644 --- a/packages/annotations/CHANGELOG.md +++ b/packages/annotations/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.27.0 (2023-02-15) + ## 2.26.0 (2023-02-01) ## 2.25.0 (2023-01-11) diff --git a/packages/annotations/package.json b/packages/annotations/package.json index fd067a851e948..9883f2d235e2f 100644 --- a/packages/annotations/package.json +++ b/packages/annotations/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/annotations", - "version": "2.26.0", + "version": "2.27.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 7dd9fea4831cb..d40c43fa486b8 100644 --- a/packages/api-fetch/CHANGELOG.md +++ b/packages/api-fetch/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.24.0 (2023-02-15) + ## 6.23.0 (2023-02-01) ## 6.22.0 (2023-01-11) diff --git a/packages/api-fetch/package.json b/packages/api-fetch/package.json index 8aa13a4940774..3a55abebb1c6f 100644 --- a/packages/api-fetch/package.json +++ b/packages/api-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/api-fetch", - "version": "6.23.0", + "version": "6.24.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 84e66fe3f547a..cb9ab86c44b51 100644 --- a/packages/autop/CHANGELOG.md +++ b/packages/autop/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/autop/package.json b/packages/autop/package.json index e2cce204d0ffd..0ac8aa079c538 100644 --- a/packages/autop/package.json +++ b/packages/autop/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/autop", - "version": "3.26.0", + "version": "3.27.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 76a158423ffb5..d76cedc4682ee 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.10.0 (2023-02-15) + ## 4.9.0 (2023-02-01) ## 4.8.0 (2023-01-11) diff --git a/packages/babel-plugin-import-jsx-pragma/package.json b/packages/babel-plugin-import-jsx-pragma/package.json index b3c45e6500756..7be7c82ac1286 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.9.0", + "version": "4.10.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 744a7bc7d0cad..4e059b869e585 100644 --- a/packages/babel-plugin-makepot/CHANGELOG.md +++ b/packages/babel-plugin-makepot/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.11.0 (2023-02-15) + ## 5.10.0 (2023-02-01) ## 5.9.0 (2023-01-11) diff --git a/packages/babel-plugin-makepot/package.json b/packages/babel-plugin-makepot/package.json index b816b4c6995b2..822986745d3bf 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.10.0", + "version": "5.11.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 faa0ff6cf8464..9c43933c86635 100644 --- a/packages/babel-preset-default/CHANGELOG.md +++ b/packages/babel-preset-default/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.11.0 (2023-02-15) + ## 7.10.0 (2023-02-01) ## 7.9.0 (2023-01-11) diff --git a/packages/babel-preset-default/package.json b/packages/babel-preset-default/package.json index ce128cbd577f0..4bf527e1c5de0 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.10.0", + "version": "7.11.0-prerelease", "description": "Default Babel preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/base-styles/CHANGELOG.md b/packages/base-styles/CHANGELOG.md index 7087147ca31db..24dd4aeec450f 100644 --- a/packages/base-styles/CHANGELOG.md +++ b/packages/base-styles/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.18.0 (2023-02-15) + ## 4.17.0 (2023-02-01) ## 4.16.0 (2023-01-11) diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json index a5c25ef1ef129..e8f711830bf3e 100644 --- a/packages/base-styles/package.json +++ b/packages/base-styles/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/base-styles", - "version": "4.17.0", + "version": "4.18.0-prerelease", "description": "Base SCSS utilities and variables for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blob/CHANGELOG.md b/packages/blob/CHANGELOG.md index 700c3ae303932..cf0ccba9c6862 100644 --- a/packages/blob/CHANGELOG.md +++ b/packages/blob/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/blob/package.json b/packages/blob/package.json index a3d52b827be1f..e1c3861665f04 100644 --- a/packages/blob/package.json +++ b/packages/blob/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blob", - "version": "3.26.0", + "version": "3.27.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 4de8815381e8c..9498e6da9dfa8 100644 --- a/packages/block-directory/CHANGELOG.md +++ b/packages/block-directory/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.4.0 (2023-02-15) + ## 4.3.0 (2023-02-01) ## 4.2.0 (2023-01-11) diff --git a/packages/block-directory/package.json b/packages/block-directory/package.json index df4c760a669d1..c6c806f7e43af 100644 --- a/packages/block-directory/package.json +++ b/packages/block-directory/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-directory", - "version": "4.3.0", + "version": "4.4.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 53414b3b3ce4a..17a8fcb5b872c 100644 --- a/packages/block-editor/CHANGELOG.md +++ b/packages/block-editor/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 11.4.0 (2023-02-15) + ### Bug Fix - `LinkControl`: fix scrollbar displayed on toggle link settings ([#47986](https://github.com/WordPress/gutenberg/pull/47986)). diff --git a/packages/block-editor/package.json b/packages/block-editor/package.json index 129a4f6f178bb..daa1b0acc8d99 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-editor", - "version": "11.3.0", + "version": "11.4.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 fe963a9dd32db..e07172a0f625b 100644 --- a/packages/block-library/CHANGELOG.md +++ b/packages/block-library/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 8.4.0 (2023-02-15) + ## 8.3.0 (2023-02-01) ## 8.2.0 (2023-01-11) diff --git a/packages/block-library/package.json b/packages/block-library/package.json index 49d2bbb51a21d..10900fb63c693 100644 --- a/packages/block-library/package.json +++ b/packages/block-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-library", - "version": "8.3.0", + "version": "8.4.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 553a92191f500..82c1d6453aa95 100644 --- a/packages/block-serialization-default-parser/CHANGELOG.md +++ b/packages/block-serialization-default-parser/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.27.0 (2023-02-15) + ## 4.26.0 (2023-02-01) ## 4.25.0 (2023-01-11) diff --git a/packages/block-serialization-default-parser/package.json b/packages/block-serialization-default-parser/package.json index 9d062413d81c8..4c510774bb315 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.26.0", + "version": "4.27.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 886a06c3cb6ce..3fc96701edacf 100644 --- a/packages/block-serialization-spec-parser/CHANGELOG.md +++ b/packages/block-serialization-spec-parser/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.27.0 (2023-02-15) + ## 4.26.0 (2023-02-01) ## 4.25.0 (2023-01-11) diff --git a/packages/block-serialization-spec-parser/package.json b/packages/block-serialization-spec-parser/package.json index af79ff1c1e7e6..4af6f8e911c25 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.26.0", + "version": "4.27.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 94f99ef8f882f..69003025592fb 100644 --- a/packages/blocks/CHANGELOG.md +++ b/packages/blocks/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 12.4.0 (2023-02-15) + ## 12.3.0 (2023-02-01) ## 12.2.0 (2023-01-11) diff --git a/packages/blocks/package.json b/packages/blocks/package.json index db61fc2af49c0..7c5c4984afec7 100644 --- a/packages/blocks/package.json +++ b/packages/blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blocks", - "version": "12.3.0", + "version": "12.4.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 59cee0278531f..a7445ce055787 100644 --- a/packages/browserslist-config/CHANGELOG.md +++ b/packages/browserslist-config/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.10.0 (2023-02-15) + ## 5.9.0 (2023-02-01) ## 5.8.0 (2023-01-11) diff --git a/packages/browserslist-config/package.json b/packages/browserslist-config/package.json index 25a0873665df6..98812b77a1dff 100644 --- a/packages/browserslist-config/package.json +++ b/packages/browserslist-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/browserslist-config", - "version": "5.9.0", + "version": "5.10.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 8889af90dd997..14b2a74eaf6db 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 23.4.0 (2023-02-15) + ### Bug Fix - `ToolsPanel`: fix type inconsistencies between types, docs and normal component usage ([47944](https://github.com/WordPress/gutenberg/pull/47944)). diff --git a/packages/components/package.json b/packages/components/package.json index 9f5b62e5956c6..8f9cc1317acc2 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/components", - "version": "23.3.0", + "version": "23.4.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 1d1c0fdf710c3..a71915b4af86f 100644 --- a/packages/compose/CHANGELOG.md +++ b/packages/compose/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.4.0 (2023-02-15) + ## 6.3.0 (2023-02-01) ## 6.2.0 (2023-01-11) diff --git a/packages/compose/package.json b/packages/compose/package.json index 776d082d93ccb..aa548e7f1a463 100644 --- a/packages/compose/package.json +++ b/packages/compose/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/compose", - "version": "6.3.0", + "version": "6.4.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 c7d7941938f14..037da410f061d 100644 --- a/packages/core-data/CHANGELOG.md +++ b/packages/core-data/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.4.0 (2023-02-15) + ## 6.3.0 (2023-02-01) ## 6.2.0 (2023-01-11) diff --git a/packages/core-data/package.json b/packages/core-data/package.json index 240fded9a50b7..db4362467c939 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/core-data", - "version": "6.3.0", + "version": "6.4.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 4612933dd2363..b12550512d848 100644 --- a/packages/create-block-tutorial-template/CHANGELOG.md +++ b/packages/create-block-tutorial-template/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.15.0 (2023-02-15) + ## 2.14.0 (2023-02-01) ## 2.13.0 (2023-01-11) diff --git a/packages/create-block-tutorial-template/package.json b/packages/create-block-tutorial-template/package.json index 950b3f566426e..d65f287b35b00 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.14.0", + "version": "2.15.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 5f8ebb7dfcf4c..2fdc6f8b703c1 100644 --- a/packages/create-block/CHANGELOG.md +++ b/packages/create-block/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.11.0 (2023-02-15) + ## 4.10.0 (2023-02-01) ## 4.9.0 (2023-01-11) diff --git a/packages/create-block/package.json b/packages/create-block/package.json index acd42d1598585..4f6516ccba2c7 100644 --- a/packages/create-block/package.json +++ b/packages/create-block/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/create-block", - "version": "4.10.0", + "version": "4.11.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/custom-templated-path-webpack-plugin/CHANGELOG.md b/packages/custom-templated-path-webpack-plugin/CHANGELOG.md index aae7b687edf7e..4baf5cc031639 100644 --- a/packages/custom-templated-path-webpack-plugin/CHANGELOG.md +++ b/packages/custom-templated-path-webpack-plugin/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.11.0 (2023-02-15) + ## 2.10.0 (2023-02-01) ## 2.9.0 (2023-01-11) diff --git a/packages/custom-templated-path-webpack-plugin/package.json b/packages/custom-templated-path-webpack-plugin/package.json index 848d7f0902f2f..e62dc25b28153 100644 --- a/packages/custom-templated-path-webpack-plugin/package.json +++ b/packages/custom-templated-path-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/custom-templated-path-webpack-plugin", - "version": "2.10.0", + "version": "2.11.0-prerelease", "description": "Webpack plugin for creating custom path template tags.", "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 68356dc960bdd..f0548fb33a5f4 100644 --- a/packages/customize-widgets/CHANGELOG.md +++ b/packages/customize-widgets/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.4.0 (2023-02-15) + ## 4.3.0 (2023-02-01) ## 4.2.0 (2023-01-11) diff --git a/packages/customize-widgets/package.json b/packages/customize-widgets/package.json index 0b54cfc01fdbc..d060382a15ea6 100644 --- a/packages/customize-widgets/package.json +++ b/packages/customize-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/customize-widgets", - "version": "4.3.0", + "version": "4.4.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 e0b8bc63ec280..123ee33bad4c5 100644 --- a/packages/data-controls/CHANGELOG.md +++ b/packages/data-controls/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.27.0 (2023-02-15) + ## 2.26.0 (2023-02-01) ## 2.25.0 (2023-01-11) diff --git a/packages/data-controls/package.json b/packages/data-controls/package.json index f68c93c6e4aca..71e70d2f436d7 100644 --- a/packages/data-controls/package.json +++ b/packages/data-controls/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data-controls", - "version": "2.26.0", + "version": "2.27.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 c97fa92ce8dc7..fe4eaaf65340c 100644 --- a/packages/data/CHANGELOG.md +++ b/packages/data/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 8.4.0 (2023-02-15) + ## 8.3.0 (2023-02-01) ## 8.2.0 (2023-01-11) diff --git a/packages/data/package.json b/packages/data/package.json index e3cc7063b617c..9fc0d83d85a92 100644 --- a/packages/data/package.json +++ b/packages/data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data", - "version": "8.3.0", + "version": "8.4.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 d28672547e90a..46e7285c0bddc 100644 --- a/packages/date/CHANGELOG.md +++ b/packages/date/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.27.0 (2023-02-15) + ## 4.26.0 (2023-02-01) ## 4.25.0 (2023-01-11) diff --git a/packages/date/package.json b/packages/date/package.json index 1eea686d9f8c3..960d977c1f511 100644 --- a/packages/date/package.json +++ b/packages/date/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/date", - "version": "4.26.0", + "version": "4.27.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 88cca047d2b1f..0df3a6d0a4f09 100644 --- a/packages/dependency-extraction-webpack-plugin/CHANGELOG.md +++ b/packages/dependency-extraction-webpack-plugin/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.10.0 (2023-02-15) + ### Bug Fix - The bundled `json2php` dependency has been upgraded from requiring `^0.0.5` to `^0.0.7` ([#47831](https://github.com/WordPress/gutenberg/pull/47831)). diff --git a/packages/dependency-extraction-webpack-plugin/package.json b/packages/dependency-extraction-webpack-plugin/package.json index f61ac5deb3684..b67e11fbcd634 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.9.0", + "version": "4.10.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 6e38a348f0eee..a60c919549fd7 100644 --- a/packages/deprecated/CHANGELOG.md +++ b/packages/deprecated/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/deprecated/package.json b/packages/deprecated/package.json index bc3dd6cedb872..a85ee3fb1a833 100644 --- a/packages/deprecated/package.json +++ b/packages/deprecated/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/deprecated", - "version": "3.26.0", + "version": "3.27.0-prerelease", "description": "Deprecation utility for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/docgen/CHANGELOG.md b/packages/docgen/CHANGELOG.md index 175c112b91644..788c6ec4c382c 100644 --- a/packages/docgen/CHANGELOG.md +++ b/packages/docgen/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 1.36.0 (2023-02-15) + ## 1.35.0 (2023-02-01) ## 1.34.0 (2023-01-11) diff --git a/packages/docgen/package.json b/packages/docgen/package.json index f7d6d80cffeeb..eabd167a9a597 100644 --- a/packages/docgen/package.json +++ b/packages/docgen/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/docgen", - "version": "1.35.0", + "version": "1.36.0-prerelease", "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/CHANGELOG.md b/packages/dom-ready/CHANGELOG.md index 39a5e2c779185..fb3375fd38095 100644 --- a/packages/dom-ready/CHANGELOG.md +++ b/packages/dom-ready/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/dom-ready/package.json b/packages/dom-ready/package.json index 3e9692305a67c..05c468d2e7ae6 100644 --- a/packages/dom-ready/package.json +++ b/packages/dom-ready/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dom-ready", - "version": "3.26.0", + "version": "3.27.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 5cde31184492f..c5894b74d05fe 100644 --- a/packages/dom/CHANGELOG.md +++ b/packages/dom/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/dom/package.json b/packages/dom/package.json index b51f937a92d6a..2a5ae560ce906 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dom", - "version": "3.26.0", + "version": "3.27.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 bf76e65dd74dd..5538d331b059b 100644 --- a/packages/e2e-test-utils/CHANGELOG.md +++ b/packages/e2e-test-utils/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 9.4.0 (2023-02-15) + ## 9.3.0 (2023-02-01) ## 9.2.0 (2023-01-11) diff --git a/packages/e2e-test-utils/package.json b/packages/e2e-test-utils/package.json index c81cab5b25702..8a4fa15cb5ac6 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": "9.3.0", + "version": "9.4.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 93911a424655e..ddcb10f10413f 100644 --- a/packages/e2e-tests/CHANGELOG.md +++ b/packages/e2e-tests/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.4.0 (2023-02-15) + ## 6.3.0 (2023-02-01) ## 6.2.0 (2023-01-11) diff --git a/packages/e2e-tests/package.json b/packages/e2e-tests/package.json index dcd96047d13a4..61ed34b6a9765 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-tests", - "version": "6.3.0", + "version": "6.4.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 6eab2fff67655..5a21c72e0cfd5 100644 --- a/packages/edit-post/CHANGELOG.md +++ b/packages/edit-post/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 7.4.0 (2023-02-15) + ## 7.3.0 (2023-02-01) ## 7.2.0 (2023-01-11) diff --git a/packages/edit-post/package.json b/packages/edit-post/package.json index b5045c96bfcf0..d54f9e52cd8fa 100644 --- a/packages/edit-post/package.json +++ b/packages/edit-post/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-post", - "version": "7.3.0", + "version": "7.4.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 b9fd6c36605e7..8620991a7e8db 100644 --- a/packages/edit-site/CHANGELOG.md +++ b/packages/edit-site/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.4.0 (2023-02-15) + ## 5.3.0 (2023-02-01) ### Bug Fix diff --git a/packages/edit-site/package.json b/packages/edit-site/package.json index cee2f97bc0130..f71f1f9740467 100644 --- a/packages/edit-site/package.json +++ b/packages/edit-site/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-site", - "version": "5.3.0", + "version": "5.4.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 96b3cfc0f5674..18c08123f3794 100644 --- a/packages/edit-widgets/CHANGELOG.md +++ b/packages/edit-widgets/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.4.0 (2023-02-15) + ## 5.3.0 (2023-02-01) ## 5.2.0 (2023-01-11) diff --git a/packages/edit-widgets/package.json b/packages/edit-widgets/package.json index 25e2b0e99eea1..b485ec1a80767 100644 --- a/packages/edit-widgets/package.json +++ b/packages/edit-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-widgets", - "version": "5.3.0", + "version": "5.4.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 327e60bfb207b..e820bb94565da 100644 --- a/packages/editor/CHANGELOG.md +++ b/packages/editor/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 13.4.0 (2023-02-15) + ## 13.3.0 (2023-02-01) ## 13.2.0 (2023-01-11) diff --git a/packages/editor/package.json b/packages/editor/package.json index 909b2e87dcf8b..cba285b128579 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/editor", - "version": "13.3.0", + "version": "13.4.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 8d83ab37988e7..1f314874f65c4 100644 --- a/packages/element/CHANGELOG.md +++ b/packages/element/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.4.0 (2023-02-15) + ## 5.3.0 (2023-02-01) ## 5.2.0 (2023-01-11) diff --git a/packages/element/package.json b/packages/element/package.json index 28b303245d519..e0a17668b8fd2 100644 --- a/packages/element/package.json +++ b/packages/element/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/element", - "version": "5.3.0", + "version": "5.4.0-prerelease", "description": "Element React module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/env/CHANGELOG.md b/packages/env/CHANGELOG.md index dd77223ea720e..2eae672d18dab 100644 --- a/packages/env/CHANGELOG.md +++ b/packages/env/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.12.0 (2023-02-15) + ## 5.11.0 (2023-02-01) ### Bug fix diff --git a/packages/env/package.json b/packages/env/package.json index 0912f2661f017..08a38c01e0f65 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/env", - "version": "5.11.0", + "version": "5.12.0-prerelease", "description": "A zero-config, self contained local WordPress environment for development and testing.", "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 1bdb2495f4290..056aae3e5e776 100644 --- a/packages/escape-html/CHANGELOG.md +++ b/packages/escape-html/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.27.0 (2023-02-15) + ## 2.26.0 (2023-02-01) ## 2.25.0 (2023-01-11) diff --git a/packages/escape-html/package.json b/packages/escape-html/package.json index d6c5da81dde39..acc7dfa79143f 100644 --- a/packages/escape-html/package.json +++ b/packages/escape-html/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/escape-html", - "version": "2.26.0", + "version": "2.27.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 192a728404ea0..c4775185070cd 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 14.0.0 (2023-02-15) + ### Breaking Changes - Increase the severity of the rule `jsdoc/check-line-alignment` from `warn` to `error`. ([#47878](https://github.com/WordPress/gutenberg/pull/47878)). diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 80c8996ae6873..75d8183b450ee 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/eslint-plugin", - "version": "13.10.0", + "version": "14.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 47d4c728e990b..ea14c6e5d317e 100644 --- a/packages/format-library/CHANGELOG.md +++ b/packages/format-library/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.4.0 (2023-02-15) + ## 4.3.0 (2023-02-01) ## 4.2.0 (2023-01-11) diff --git a/packages/format-library/package.json b/packages/format-library/package.json index 8869b0fc30278..cda9f9fa01a4e 100644 --- a/packages/format-library/package.json +++ b/packages/format-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/format-library", - "version": "4.3.0", + "version": "4.4.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 3ed2e05c3dedb..440477001b102 100644 --- a/packages/hooks/CHANGELOG.md +++ b/packages/hooks/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/hooks/package.json b/packages/hooks/package.json index c4a4870aa3f1b..619caa59e01de 100644 --- a/packages/hooks/package.json +++ b/packages/hooks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/hooks", - "version": "3.26.0", + "version": "3.27.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 3d95eaf38b023..61bd85476bcf2 100644 --- a/packages/html-entities/CHANGELOG.md +++ b/packages/html-entities/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/html-entities/package.json b/packages/html-entities/package.json index 90c1b7ff92e78..e804847ac97ee 100644 --- a/packages/html-entities/package.json +++ b/packages/html-entities/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/html-entities", - "version": "3.26.0", + "version": "3.27.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 cb5555a40eb6b..70b91a9f9cedc 100644 --- a/packages/i18n/CHANGELOG.md +++ b/packages/i18n/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.27.0 (2023-02-15) + ## 4.26.0 (2023-02-01) ## 4.25.0 (2023-01-11) diff --git a/packages/i18n/package.json b/packages/i18n/package.json index 28426579f0f9d..7bb4cf664e928 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/i18n", - "version": "4.26.0", + "version": "4.27.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 cba47d89297f5..891c7f2f436a4 100644 --- a/packages/icons/CHANGELOG.md +++ b/packages/icons/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 9.18.0 (2023-02-15) + ## 9.17.0 (2023-02-01) ## 9.16.0 (2023-01-11) diff --git a/packages/icons/package.json b/packages/icons/package.json index 8eaf0afa52ca7..0f61f8246688d 100644 --- a/packages/icons/package.json +++ b/packages/icons/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/icons", - "version": "9.17.0", + "version": "9.18.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 13e8eaaa19dee..a99df1569c736 100644 --- a/packages/interface/CHANGELOG.md +++ b/packages/interface/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.4.0 (2023-02-15) + ## 5.3.0 (2023-02-01) ## 5.2.0 (2023-01-11) diff --git a/packages/interface/package.json b/packages/interface/package.json index d217526d94842..2d90f67fbcf02 100644 --- a/packages/interface/package.json +++ b/packages/interface/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/interface", - "version": "5.3.0", + "version": "5.4.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 26448c5bce379..c0d604dd55464 100644 --- a/packages/is-shallow-equal/CHANGELOG.md +++ b/packages/is-shallow-equal/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.27.0 (2023-02-15) + ## 4.26.0 (2023-02-01) ## 4.25.0 (2023-01-11) diff --git a/packages/is-shallow-equal/package.json b/packages/is-shallow-equal/package.json index dc13e5fb1f1e6..be9edae175792 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.26.0", + "version": "4.27.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 b1d2199ba4cc4..a0954000020f8 100644 --- a/packages/jest-console/CHANGELOG.md +++ b/packages/jest-console/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.10.0 (2023-02-15) + ## 6.9.0 (2023-02-01) ## 6.8.0 (2023-01-11) diff --git a/packages/jest-console/package.json b/packages/jest-console/package.json index 09f3aa6aa8914..86eccdce45032 100644 --- a/packages/jest-console/package.json +++ b/packages/jest-console/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/jest-console", - "version": "6.9.0", + "version": "6.10.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 f3a7a4fd22009..682848b7adc44 100644 --- a/packages/jest-preset-default/CHANGELOG.md +++ b/packages/jest-preset-default/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 10.8.0 (2023-02-15) + ## 10.7.0 (2023-02-01) ## 10.6.0 (2023-01-11) diff --git a/packages/jest-preset-default/package.json b/packages/jest-preset-default/package.json index 70d912217f9d7..7e2b9a7c0d868 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": "10.7.0", + "version": "10.8.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 2c850ea12cdc8..18d332612bafb 100644 --- a/packages/jest-puppeteer-axe/CHANGELOG.md +++ b/packages/jest-puppeteer-axe/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.10.0 (2023-02-15) + ## 5.9.0 (2023-02-01) ## 5.8.0 (2023-01-11) diff --git a/packages/jest-puppeteer-axe/package.json b/packages/jest-puppeteer-axe/package.json index ac44bf4d2858c..f355c571eb1cc 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.9.0", + "version": "5.10.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 3e7519de6848f..738488df76cee 100644 --- a/packages/keyboard-shortcuts/CHANGELOG.md +++ b/packages/keyboard-shortcuts/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.4.0 (2023-02-15) + ## 4.3.0 (2023-02-01) ## 4.2.0 (2023-01-11) diff --git a/packages/keyboard-shortcuts/package.json b/packages/keyboard-shortcuts/package.json index ae71eb8f34dcf..67d9b644fcbbe 100644 --- a/packages/keyboard-shortcuts/package.json +++ b/packages/keyboard-shortcuts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/keyboard-shortcuts", - "version": "4.3.0", + "version": "4.4.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 fd3c03d984d1c..afd2e203a5c3d 100644 --- a/packages/keycodes/CHANGELOG.md +++ b/packages/keycodes/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/keycodes/package.json b/packages/keycodes/package.json index 3a71c79c5955a..55224b6eef763 100644 --- a/packages/keycodes/package.json +++ b/packages/keycodes/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/keycodes", - "version": "3.26.0", + "version": "3.27.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/lazy-import/CHANGELOG.md b/packages/lazy-import/CHANGELOG.md index 9f1eb45cf1103..ec6e961a9a6d6 100644 --- a/packages/lazy-import/CHANGELOG.md +++ b/packages/lazy-import/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 1.14.0 (2023-02-15) + ## 1.13.0 (2023-02-01) ## 1.12.0 (2023-01-11) diff --git a/packages/lazy-import/package.json b/packages/lazy-import/package.json index bc3fedf34d0ce..25463a7325518 100644 --- a/packages/lazy-import/package.json +++ b/packages/lazy-import/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/lazy-import", - "version": "1.13.0", + "version": "1.14.0-prerelease", "description": "Lazily import a module, installing it automatically if missing.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/library-export-default-webpack-plugin/CHANGELOG.md b/packages/library-export-default-webpack-plugin/CHANGELOG.md index 3d67eb4309795..ed7c7cdc280b1 100644 --- a/packages/library-export-default-webpack-plugin/CHANGELOG.md +++ b/packages/library-export-default-webpack-plugin/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.13.0 (2023-02-15) + ## 2.12.0 (2023-02-01) ## 2.11.0 (2023-01-11) diff --git a/packages/library-export-default-webpack-plugin/package.json b/packages/library-export-default-webpack-plugin/package.json index 62e6165be6058..0adb6bf4e9ee5 100644 --- a/packages/library-export-default-webpack-plugin/package.json +++ b/packages/library-export-default-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/library-export-default-webpack-plugin", - "version": "2.12.0", + "version": "2.13.0-prerelease", "description": "Webpack plugin for exporting default property for selected libraries.", "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 507723b7b8e70..8a4065027f6f6 100644 --- a/packages/list-reusable-blocks/CHANGELOG.md +++ b/packages/list-reusable-blocks/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.4.0 (2023-02-15) + ## 4.3.0 (2023-02-01) ## 4.2.0 (2023-01-11) diff --git a/packages/list-reusable-blocks/package.json b/packages/list-reusable-blocks/package.json index 67a04fb8ecb54..9fc36e167466c 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": "4.3.0", + "version": "4.4.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 3fabbcf771180..17d330c6e2f61 100644 --- a/packages/media-utils/CHANGELOG.md +++ b/packages/media-utils/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.18.0 (2023-02-15) + ## 4.17.0 (2023-02-01) ## 4.16.0 (2023-01-11) diff --git a/packages/media-utils/package.json b/packages/media-utils/package.json index de9f375da40da..b56b8781a83df 100644 --- a/packages/media-utils/package.json +++ b/packages/media-utils/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/media-utils", - "version": "4.17.0", + "version": "4.18.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 66bf586845301..db5475617072f 100644 --- a/packages/notices/CHANGELOG.md +++ b/packages/notices/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/notices/package.json b/packages/notices/package.json index 731d638cb8a51..716d17fb64cf0 100644 --- a/packages/notices/package.json +++ b/packages/notices/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/notices", - "version": "3.26.0", + "version": "3.27.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 6c77ebefed069..7a213963ccd39 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.12.0 (2023-02-15) + ## 4.11.0 (2023-02-01) ## 4.10.0 (2023-01-11) diff --git a/packages/npm-package-json-lint-config/package.json b/packages/npm-package-json-lint-config/package.json index b5e092b95f871..77389d557cacb 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.11.0", + "version": "4.12.0-prerelease", "description": "WordPress npm-package-json-lint shareable configuration.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/plugins/CHANGELOG.md b/packages/plugins/CHANGELOG.md index 08280cfc91f33..bb011f2f1a1a3 100644 --- a/packages/plugins/CHANGELOG.md +++ b/packages/plugins/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.4.0 (2023-02-15) + ## 5.3.0 (2023-02-01) ## 5.2.0 (2023-01-11) diff --git a/packages/plugins/package.json b/packages/plugins/package.json index 5ab80e9ae081d..d6a557fef6b3c 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/plugins", - "version": "5.3.0", + "version": "5.4.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 8f05a2d71a336..0af9c224529ab 100644 --- a/packages/postcss-plugins-preset/CHANGELOG.md +++ b/packages/postcss-plugins-preset/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.11.0 (2023-02-15) + ## 4.10.0 (2023-02-01) ## 4.9.0 (2023-01-11) diff --git a/packages/postcss-plugins-preset/package.json b/packages/postcss-plugins-preset/package.json index db3b2353f6784..0dfbc08800051 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.10.0", + "version": "4.11.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 f3f4203a161a2..9da1b91e3fd32 100644 --- a/packages/postcss-themes/CHANGELOG.md +++ b/packages/postcss-themes/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.10.0 (2023-02-15) + ## 5.9.0 (2023-02-01) ## 5.8.0 (2023-01-11) diff --git a/packages/postcss-themes/package.json b/packages/postcss-themes/package.json index 7fa4702daeda7..d9aa2c34b85ff 100644 --- a/packages/postcss-themes/package.json +++ b/packages/postcss-themes/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/postcss-themes", - "version": "5.9.0", + "version": "5.10.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 d8521145fa705..809f492cfb998 100644 --- a/packages/preferences-persistence/CHANGELOG.md +++ b/packages/preferences-persistence/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 1.19.0 (2023-02-15) + ## 1.18.0 (2023-02-01) ## 1.17.0 (2023-01-11) diff --git a/packages/preferences-persistence/package.json b/packages/preferences-persistence/package.json index 193f2c51ec3f2..20964fecb8815 100644 --- a/packages/preferences-persistence/package.json +++ b/packages/preferences-persistence/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/preferences-persistence", - "version": "1.18.0", + "version": "1.19.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 b5ec40c8bd5c2..e870238c30fd4 100644 --- a/packages/preferences/CHANGELOG.md +++ b/packages/preferences/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.4.0 (2023-02-15) + ## 3.3.0 (2023-02-01) ## 3.2.0 (2023-01-11) diff --git a/packages/preferences/package.json b/packages/preferences/package.json index 513e44010a9a9..6fee857385e3a 100644 --- a/packages/preferences/package.json +++ b/packages/preferences/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/preferences", - "version": "3.3.0", + "version": "3.4.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 f383a3b84a4a3..0f15baeb296d8 100644 --- a/packages/prettier-config/CHANGELOG.md +++ b/packages/prettier-config/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.10.0 (2023-02-15) + ## 2.9.0 (2023-02-01) ## 2.8.0 (2023-01-11) diff --git a/packages/prettier-config/package.json b/packages/prettier-config/package.json index 720ceeafd0e2d..7b70ae5a934d5 100644 --- a/packages/prettier-config/package.json +++ b/packages/prettier-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/prettier-config", - "version": "2.9.0", + "version": "2.10.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 242cc6bf19a27..dcd4f8d81e8ec 100644 --- a/packages/primitives/CHANGELOG.md +++ b/packages/primitives/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.25.0 (2023-02-15) + ## 3.24.0 (2023-02-01) ## 3.23.0 (2023-01-11) diff --git a/packages/primitives/package.json b/packages/primitives/package.json index fc6635e04fed8..f54fd9c603444 100644 --- a/packages/primitives/package.json +++ b/packages/primitives/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/primitives", - "version": "3.24.0", + "version": "3.25.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 60bc8963c56ca..4400766cfbb36 100644 --- a/packages/priority-queue/CHANGELOG.md +++ b/packages/priority-queue/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.27.0 (2023-02-15) + ## 2.26.0 (2023-02-01) ## 2.25.0 (2023-01-11) diff --git a/packages/priority-queue/package.json b/packages/priority-queue/package.json index d3bbf13fe0333..f831f205179e2 100644 --- a/packages/priority-queue/package.json +++ b/packages/priority-queue/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/priority-queue", - "version": "2.26.0", + "version": "2.27.0-prerelease", "description": "Generic browser priority queue.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/private-apis/CHANGELOG.md b/packages/private-apis/CHANGELOG.md index 48e0a05bba369..531777d39fea2 100644 --- a/packages/private-apis/CHANGELOG.md +++ b/packages/private-apis/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 0.9.0 (2023-02-15) + ## 0.8.0 (2023-02-01) ## 0.7.0 (2023-01-11) diff --git a/packages/private-apis/package.json b/packages/private-apis/package.json index 69ec5a274ad0b..191384fba1ddb 100644 --- a/packages/private-apis/package.json +++ b/packages/private-apis/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/private-apis", - "version": "0.8.0", + "version": "0.9.0-prerelease", "description": "Internal experimental APIs for WordPress core.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/project-management-automation/CHANGELOG.md b/packages/project-management-automation/CHANGELOG.md index 3cd2734311195..bd792209c51e1 100644 --- a/packages/project-management-automation/CHANGELOG.md +++ b/packages/project-management-automation/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 1.26.0 (2023-02-15) + ## 1.25.0 (2023-02-01) ## 1.24.0 (2023-01-11) diff --git a/packages/project-management-automation/package.json b/packages/project-management-automation/package.json index 6b7e186666e60..64b3cdb72807d 100644 --- a/packages/project-management-automation/package.json +++ b/packages/project-management-automation/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/project-management-automation", - "version": "1.25.0", + "version": "1.26.0-prerelease", "description": "GitHub Action that implements various automation to assist with managing the Gutenberg GitHub repository.", "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 ed4aac08f2acc..a5d5631006d70 100644 --- a/packages/react-i18n/CHANGELOG.md +++ b/packages/react-i18n/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.25.0 (2023-02-15) + ## 3.24.0 (2023-02-01) ## 3.23.0 (2023-01-11) diff --git a/packages/react-i18n/package.json b/packages/react-i18n/package.json index dd56d8e436255..f5438aaf983af 100644 --- a/packages/react-i18n/package.json +++ b/packages/react-i18n/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/react-i18n", - "version": "3.24.0", + "version": "3.25.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 7dec0e8fb3e0b..a25525f8c7a86 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.10.0 (2023-02-15) + ## 2.9.0 (2023-02-01) ## 2.8.0 (2023-01-11) diff --git a/packages/readable-js-assets-webpack-plugin/package.json b/packages/readable-js-assets-webpack-plugin/package.json index a3f28d0631b94..2fdaa4c315226 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.9.0", + "version": "2.10.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 810f76347e87a..43b2881607b85 100644 --- a/packages/redux-routine/CHANGELOG.md +++ b/packages/redux-routine/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.27.0 (2023-02-15) + ## 4.26.0 (2023-02-01) ## 4.25.0 (2023-01-11) diff --git a/packages/redux-routine/package.json b/packages/redux-routine/package.json index b9b2718c4024b..9fd275328633b 100644 --- a/packages/redux-routine/package.json +++ b/packages/redux-routine/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/redux-routine", - "version": "4.26.0", + "version": "4.27.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 7b530ef338638..ff16dcb3d8f32 100644 --- a/packages/reusable-blocks/CHANGELOG.md +++ b/packages/reusable-blocks/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.4.0 (2023-02-15) + ## 4.3.0 (2023-02-01) ## 4.2.0 (2023-01-11) diff --git a/packages/reusable-blocks/package.json b/packages/reusable-blocks/package.json index 8d3c24811cf3b..4c81caa83dd5e 100644 --- a/packages/reusable-blocks/package.json +++ b/packages/reusable-blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/reusable-blocks", - "version": "4.3.0", + "version": "4.4.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 4161589682bcd..bfae53535b701 100644 --- a/packages/rich-text/CHANGELOG.md +++ b/packages/rich-text/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 6.4.0 (2023-02-15) + ## 6.3.0 (2023-02-01) ## 6.2.0 (2023-01-11) diff --git a/packages/rich-text/package.json b/packages/rich-text/package.json index 6467a1e4c477d..01e465f0872f3 100644 --- a/packages/rich-text/package.json +++ b/packages/rich-text/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/rich-text", - "version": "6.3.0", + "version": "6.4.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 09d784ffe13e2..080d25681c90e 100644 --- a/packages/scripts/CHANGELOG.md +++ b/packages/scripts/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 25.4.0 (2023-02-15) + ### New Features - The `WP_DEVTOOL` environment variable can now be used to set the Webpack devtool option for sourcemaps in production builds ([#46812](https://github.com/WordPress/gutenberg/pull/46812)). Previously, this only worked for development builds. diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 82157fd4ebec9..a1859d6fff4d9 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/scripts", - "version": "25.3.0", + "version": "25.4.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 569183bfea49f..b8209479bcda5 100644 --- a/packages/server-side-render/CHANGELOG.md +++ b/packages/server-side-render/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 4.4.0 (2023-02-15) + ## 4.3.0 (2023-02-01) ## 4.2.0 (2023-01-11) diff --git a/packages/server-side-render/package.json b/packages/server-side-render/package.json index 2a7499e006795..2324fca09224e 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": "4.3.0", + "version": "4.4.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 06ed4fc6b88b4..3f5406d531028 100644 --- a/packages/shortcode/CHANGELOG.md +++ b/packages/shortcode/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/shortcode/package.json b/packages/shortcode/package.json index 049b8767619ae..9cf84fc6020da 100644 --- a/packages/shortcode/package.json +++ b/packages/shortcode/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/shortcode", - "version": "3.26.0", + "version": "3.27.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 1337a4012c286..2fc1209a63032 100644 --- a/packages/style-engine/CHANGELOG.md +++ b/packages/style-engine/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 1.10.0 (2023-02-15) + ## 1.9.0 (2023-02-01) ## 1.8.0 (2023-01-11) diff --git a/packages/style-engine/package.json b/packages/style-engine/package.json index c20152ee91a18..de392ecb68194 100644 --- a/packages/style-engine/package.json +++ b/packages/style-engine/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/style-engine", - "version": "1.9.0", + "version": "1.10.0-prerelease", "description": "A suite of parsers and compilers for WordPress styles.", "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 fbe79bb8d7275..697c7340955b1 100644 --- a/packages/stylelint-config/CHANGELOG.md +++ b/packages/stylelint-config/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 21.10.0 (2023-02-15) + ## 21.9.0 (2023-02-01) ## 21.8.0 (2023-01-11) diff --git a/packages/stylelint-config/package.json b/packages/stylelint-config/package.json index f797ab9a72aaa..fa8a23c295194 100644 --- a/packages/stylelint-config/package.json +++ b/packages/stylelint-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/stylelint-config", - "version": "21.9.0", + "version": "21.10.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 195ddb816f84a..6850cce224bc8 100644 --- a/packages/token-list/CHANGELOG.md +++ b/packages/token-list/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.27.0 (2023-02-15) + ## 2.26.0 (2023-02-01) ## 2.25.0 (2023-01-11) diff --git a/packages/token-list/package.json b/packages/token-list/package.json index fb9c130dd7675..ec36c946c176d 100644 --- a/packages/token-list/package.json +++ b/packages/token-list/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/token-list", - "version": "2.26.0", + "version": "2.27.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 b78356180673f..9b4c9cb55c7e4 100644 --- a/packages/url/CHANGELOG.md +++ b/packages/url/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.28.0 (2023-02-15) + ## 3.27.0 (2023-02-01) ## 3.26.0 (2023-01-11) diff --git a/packages/url/package.json b/packages/url/package.json index 8f3711e2d3ff0..0bb8834615a57 100644 --- a/packages/url/package.json +++ b/packages/url/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/url", - "version": "3.27.0", + "version": "3.28.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 bfd8e4dba5a47..82ac9f3999844 100644 --- a/packages/viewport/CHANGELOG.md +++ b/packages/viewport/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 5.4.0 (2023-02-15) + ## 5.3.0 (2023-02-01) ## 5.2.0 (2023-01-11) diff --git a/packages/viewport/package.json b/packages/viewport/package.json index cc8cade22a7ee..8f035dd2e2da2 100644 --- a/packages/viewport/package.json +++ b/packages/viewport/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/viewport", - "version": "5.3.0", + "version": "5.4.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 ce1647f56ac11..2171f68874266 100644 --- a/packages/warning/CHANGELOG.md +++ b/packages/warning/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 2.27.0 (2023-02-15) + ## 2.26.0 (2023-02-01) ## 2.25.0 (2023-01-11) diff --git a/packages/warning/package.json b/packages/warning/package.json index cc7c617e3707f..67fdaf9966add 100644 --- a/packages/warning/package.json +++ b/packages/warning/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/warning", - "version": "2.26.0", + "version": "2.27.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 2176e83d86a75..d414c3f61fa4c 100644 --- a/packages/widgets/CHANGELOG.md +++ b/packages/widgets/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.4.0 (2023-02-15) + ## 3.3.0 (2023-02-01) ## 3.2.0 (2023-01-11) diff --git a/packages/widgets/package.json b/packages/widgets/package.json index 44dd50f3bb638..80244214bb3ce 100644 --- a/packages/widgets/package.json +++ b/packages/widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/widgets", - "version": "3.3.0", + "version": "3.4.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 7b7162c0c47b2..a79a78955f884 100644 --- a/packages/wordcount/CHANGELOG.md +++ b/packages/wordcount/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unreleased +## 3.27.0 (2023-02-15) + ## 3.26.0 (2023-02-01) ## 3.25.0 (2023-01-11) diff --git a/packages/wordcount/package.json b/packages/wordcount/package.json index de1334926227b..12bf382240ea6 100644 --- a/packages/wordcount/package.json +++ b/packages/wordcount/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/wordcount", - "version": "3.26.0", + "version": "3.27.0-prerelease", "description": "WordPress word count utility.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", From caab0febf95760b6e4de61cc7663d0d7fa5c149d Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Wed, 15 Feb 2023 20:35:25 +0000 Subject: [PATCH 58/76] chore(release): publish - @wordpress/a11y@3.27.0 - @wordpress/annotations@2.27.0 - @wordpress/api-fetch@6.24.0 - @wordpress/autop@3.27.0 - @wordpress/babel-plugin-import-jsx-pragma@4.10.0 - @wordpress/babel-plugin-makepot@5.11.0 - @wordpress/babel-preset-default@7.11.0 - @wordpress/base-styles@4.18.0 - @wordpress/blob@3.27.0 - @wordpress/block-directory@4.4.0 - @wordpress/block-editor@11.4.0 - @wordpress/block-library@8.4.0 - @wordpress/block-serialization-default-parser@4.27.0 - @wordpress/block-serialization-spec-parser@4.27.0 - @wordpress/blocks@12.4.0 - @wordpress/browserslist-config@5.10.0 - @wordpress/components@23.4.0 - @wordpress/compose@6.4.0 - @wordpress/core-data@6.4.0 - @wordpress/create-block-tutorial-template@2.15.0 - @wordpress/create-block@4.11.0 - @wordpress/custom-templated-path-webpack-plugin@2.11.0 - @wordpress/customize-widgets@4.4.0 - @wordpress/data-controls@2.27.0 - @wordpress/data@8.4.0 - @wordpress/date@4.27.0 - @wordpress/dependency-extraction-webpack-plugin@4.10.0 - @wordpress/deprecated@3.27.0 - @wordpress/docgen@1.36.0 - @wordpress/dom-ready@3.27.0 - @wordpress/dom@3.27.0 - @wordpress/e2e-test-utils@9.4.0 - @wordpress/e2e-tests@6.4.0 - @wordpress/edit-post@7.4.0 - @wordpress/edit-site@5.4.0 - @wordpress/edit-widgets@5.4.0 - @wordpress/editor@13.4.0 - @wordpress/element@5.4.0 - @wordpress/env@5.12.0 - @wordpress/escape-html@2.27.0 - @wordpress/eslint-plugin@14.0.0 - @wordpress/format-library@4.4.0 - @wordpress/hooks@3.27.0 - @wordpress/html-entities@3.27.0 - @wordpress/i18n@4.27.0 - @wordpress/icons@9.18.0 - @wordpress/interface@5.4.0 - @wordpress/is-shallow-equal@4.27.0 - @wordpress/jest-console@6.10.0 - @wordpress/jest-preset-default@10.8.0 - @wordpress/jest-puppeteer-axe@5.10.0 - @wordpress/keyboard-shortcuts@4.4.0 - @wordpress/keycodes@3.27.0 - @wordpress/lazy-import@1.14.0 - @wordpress/library-export-default-webpack-plugin@2.13.0 - @wordpress/list-reusable-blocks@4.4.0 - @wordpress/media-utils@4.18.0 - @wordpress/notices@3.27.0 - @wordpress/npm-package-json-lint-config@4.12.0 - @wordpress/plugins@5.4.0 - @wordpress/postcss-plugins-preset@4.11.0 - @wordpress/postcss-themes@5.10.0 - @wordpress/preferences-persistence@1.19.0 - @wordpress/preferences@3.4.0 - @wordpress/prettier-config@2.10.0 - @wordpress/primitives@3.25.0 - @wordpress/priority-queue@2.27.0 - @wordpress/private-apis@0.9.0 - @wordpress/project-management-automation@1.26.0 - @wordpress/react-i18n@3.25.0 - @wordpress/readable-js-assets-webpack-plugin@2.10.0 - @wordpress/redux-routine@4.27.0 - @wordpress/reusable-blocks@4.4.0 - @wordpress/rich-text@6.4.0 - @wordpress/scripts@25.4.0 - @wordpress/server-side-render@4.4.0 - @wordpress/shortcode@3.27.0 - @wordpress/style-engine@1.10.0 - @wordpress/stylelint-config@21.10.0 - @wordpress/token-list@2.27.0 - @wordpress/url@3.28.0 - @wordpress/viewport@5.4.0 - @wordpress/warning@2.27.0 - @wordpress/widgets@3.4.0 - @wordpress/wordcount@3.27.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/base-styles/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/custom-templated-path-webpack-plugin/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/env/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/lazy-import/package.json | 2 +- packages/library-export-default-webpack-plugin/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/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/private-apis/package.json | 2 +- packages/project-management-automation/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 +- 85 files changed, 85 insertions(+), 85 deletions(-) diff --git a/packages/a11y/package.json b/packages/a11y/package.json index 838291beb2688..a21ceb6a1ceaf 100644 --- a/packages/a11y/package.json +++ b/packages/a11y/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/a11y", - "version": "3.27.0-prerelease", + "version": "3.27.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 9883f2d235e2f..32bc5b386d21b 100644 --- a/packages/annotations/package.json +++ b/packages/annotations/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/annotations", - "version": "2.27.0-prerelease", + "version": "2.27.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 3a55abebb1c6f..81ccd648f3a41 100644 --- a/packages/api-fetch/package.json +++ b/packages/api-fetch/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/api-fetch", - "version": "6.24.0-prerelease", + "version": "6.24.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 0ac8aa079c538..f0365c7841f93 100644 --- a/packages/autop/package.json +++ b/packages/autop/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/autop", - "version": "3.27.0-prerelease", + "version": "3.27.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 7be7c82ac1286..afc65467414cc 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.10.0-prerelease", + "version": "4.10.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 822986745d3bf..f172ca8f270a9 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.11.0-prerelease", + "version": "5.11.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 4bf527e1c5de0..d7b6737d7f950 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.11.0-prerelease", + "version": "7.11.0", "description": "Default Babel preset for WordPress development.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/base-styles/package.json b/packages/base-styles/package.json index e8f711830bf3e..ed16d987fba50 100644 --- a/packages/base-styles/package.json +++ b/packages/base-styles/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/base-styles", - "version": "4.18.0-prerelease", + "version": "4.18.0", "description": "Base SCSS utilities and variables for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/blob/package.json b/packages/blob/package.json index e1c3861665f04..18569dcb97416 100644 --- a/packages/blob/package.json +++ b/packages/blob/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blob", - "version": "3.27.0-prerelease", + "version": "3.27.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 c6c806f7e43af..d051dcb44c83c 100644 --- a/packages/block-directory/package.json +++ b/packages/block-directory/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-directory", - "version": "4.4.0-prerelease", + "version": "4.4.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 daa1b0acc8d99..4cacc59299a63 100644 --- a/packages/block-editor/package.json +++ b/packages/block-editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-editor", - "version": "11.4.0-prerelease", + "version": "11.4.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 10900fb63c693..dd445c6b462b0 100644 --- a/packages/block-library/package.json +++ b/packages/block-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/block-library", - "version": "8.4.0-prerelease", + "version": "8.4.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 4c510774bb315..381d07c918f9a 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.27.0-prerelease", + "version": "4.27.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 4af6f8e911c25..a7bb45d218ca8 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.27.0-prerelease", + "version": "4.27.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 7c5c4984afec7..2cbd572c6d7a2 100644 --- a/packages/blocks/package.json +++ b/packages/blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/blocks", - "version": "12.4.0-prerelease", + "version": "12.4.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 98812b77a1dff..d43ea54c28b2a 100644 --- a/packages/browserslist-config/package.json +++ b/packages/browserslist-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/browserslist-config", - "version": "5.10.0-prerelease", + "version": "5.10.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 8f9cc1317acc2..df4f01273bedf 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/components", - "version": "23.4.0-prerelease", + "version": "23.4.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 aa548e7f1a463..e5ac5893ac72d 100644 --- a/packages/compose/package.json +++ b/packages/compose/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/compose", - "version": "6.4.0-prerelease", + "version": "6.4.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 db4362467c939..1bcb6eb473653 100644 --- a/packages/core-data/package.json +++ b/packages/core-data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/core-data", - "version": "6.4.0-prerelease", + "version": "6.4.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 d65f287b35b00..0b343a2fc2043 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.15.0-prerelease", + "version": "2.15.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 4f6516ccba2c7..56da4bec71603 100644 --- a/packages/create-block/package.json +++ b/packages/create-block/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/create-block", - "version": "4.11.0-prerelease", + "version": "4.11.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/custom-templated-path-webpack-plugin/package.json b/packages/custom-templated-path-webpack-plugin/package.json index e62dc25b28153..3551401eda52a 100644 --- a/packages/custom-templated-path-webpack-plugin/package.json +++ b/packages/custom-templated-path-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/custom-templated-path-webpack-plugin", - "version": "2.11.0-prerelease", + "version": "2.11.0", "description": "Webpack plugin for creating custom path template tags.", "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 d060382a15ea6..f601f60d30eb3 100644 --- a/packages/customize-widgets/package.json +++ b/packages/customize-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/customize-widgets", - "version": "4.4.0-prerelease", + "version": "4.4.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 71e70d2f436d7..c28c407053f38 100644 --- a/packages/data-controls/package.json +++ b/packages/data-controls/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data-controls", - "version": "2.27.0-prerelease", + "version": "2.27.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 9fc0d83d85a92..b75e2a8fca091 100644 --- a/packages/data/package.json +++ b/packages/data/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/data", - "version": "8.4.0-prerelease", + "version": "8.4.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 960d977c1f511..6a6dfc5af5fcd 100644 --- a/packages/date/package.json +++ b/packages/date/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/date", - "version": "4.27.0-prerelease", + "version": "4.27.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 b67e11fbcd634..d6ace91e05128 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.10.0-prerelease", + "version": "4.10.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 a85ee3fb1a833..2fc8cb1103cdc 100644 --- a/packages/deprecated/package.json +++ b/packages/deprecated/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/deprecated", - "version": "3.27.0-prerelease", + "version": "3.27.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 eabd167a9a597..fa0b973fb4203 100644 --- a/packages/docgen/package.json +++ b/packages/docgen/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/docgen", - "version": "1.36.0-prerelease", + "version": "1.36.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 05c468d2e7ae6..f76a3e038aefb 100644 --- a/packages/dom-ready/package.json +++ b/packages/dom-ready/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dom-ready", - "version": "3.27.0-prerelease", + "version": "3.27.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 2a5ae560ce906..745ad558ba518 100644 --- a/packages/dom/package.json +++ b/packages/dom/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/dom", - "version": "3.27.0-prerelease", + "version": "3.27.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 8a4fa15cb5ac6..74146ffea83a2 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": "9.4.0-prerelease", + "version": "9.4.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 61ed34b6a9765..e7d53a76d8e19 100644 --- a/packages/e2e-tests/package.json +++ b/packages/e2e-tests/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/e2e-tests", - "version": "6.4.0-prerelease", + "version": "6.4.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 d54f9e52cd8fa..30c5bdd88995a 100644 --- a/packages/edit-post/package.json +++ b/packages/edit-post/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-post", - "version": "7.4.0-prerelease", + "version": "7.4.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 f71f1f9740467..62044fe4511c0 100644 --- a/packages/edit-site/package.json +++ b/packages/edit-site/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-site", - "version": "5.4.0-prerelease", + "version": "5.4.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 b485ec1a80767..b4a54142c6e20 100644 --- a/packages/edit-widgets/package.json +++ b/packages/edit-widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/edit-widgets", - "version": "5.4.0-prerelease", + "version": "5.4.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 cba285b128579..e1bff5b5cabcc 100644 --- a/packages/editor/package.json +++ b/packages/editor/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/editor", - "version": "13.4.0-prerelease", + "version": "13.4.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 e0a17668b8fd2..4f334278fd8ca 100644 --- a/packages/element/package.json +++ b/packages/element/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/element", - "version": "5.4.0-prerelease", + "version": "5.4.0", "description": "Element React module for WordPress.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/env/package.json b/packages/env/package.json index 08a38c01e0f65..8380f8a882caf 100644 --- a/packages/env/package.json +++ b/packages/env/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/env", - "version": "5.12.0-prerelease", + "version": "5.12.0", "description": "A zero-config, self contained local WordPress environment for development and testing.", "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 acc7dfa79143f..61d8d73f95b2e 100644 --- a/packages/escape-html/package.json +++ b/packages/escape-html/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/escape-html", - "version": "2.27.0-prerelease", + "version": "2.27.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 75d8183b450ee..655e67eb02470 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/eslint-plugin", - "version": "14.0.0-prerelease", + "version": "14.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 cda9f9fa01a4e..838055313b41c 100644 --- a/packages/format-library/package.json +++ b/packages/format-library/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/format-library", - "version": "4.4.0-prerelease", + "version": "4.4.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 619caa59e01de..f849f4d0d9cc7 100644 --- a/packages/hooks/package.json +++ b/packages/hooks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/hooks", - "version": "3.27.0-prerelease", + "version": "3.27.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 e804847ac97ee..42ad8775828fb 100644 --- a/packages/html-entities/package.json +++ b/packages/html-entities/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/html-entities", - "version": "3.27.0-prerelease", + "version": "3.27.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 7bb4cf664e928..9ce751306a0af 100644 --- a/packages/i18n/package.json +++ b/packages/i18n/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/i18n", - "version": "4.27.0-prerelease", + "version": "4.27.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 0f61f8246688d..1df821be72c1a 100644 --- a/packages/icons/package.json +++ b/packages/icons/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/icons", - "version": "9.18.0-prerelease", + "version": "9.18.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 2d90f67fbcf02..33fc2cb24a3b1 100644 --- a/packages/interface/package.json +++ b/packages/interface/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/interface", - "version": "5.4.0-prerelease", + "version": "5.4.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 be9edae175792..996ab53a65286 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.27.0-prerelease", + "version": "4.27.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 86eccdce45032..1697365d5e35b 100644 --- a/packages/jest-console/package.json +++ b/packages/jest-console/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/jest-console", - "version": "6.10.0-prerelease", + "version": "6.10.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 7e2b9a7c0d868..e62ab618adbf8 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": "10.8.0-prerelease", + "version": "10.8.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 f355c571eb1cc..ff4172dcd8a7b 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.10.0-prerelease", + "version": "5.10.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 67d9b644fcbbe..42af4ea87d71c 100644 --- a/packages/keyboard-shortcuts/package.json +++ b/packages/keyboard-shortcuts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/keyboard-shortcuts", - "version": "4.4.0-prerelease", + "version": "4.4.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 55224b6eef763..d8df9014b298b 100644 --- a/packages/keycodes/package.json +++ b/packages/keycodes/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/keycodes", - "version": "3.27.0-prerelease", + "version": "3.27.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/lazy-import/package.json b/packages/lazy-import/package.json index 25463a7325518..f43ac29a44236 100644 --- a/packages/lazy-import/package.json +++ b/packages/lazy-import/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/lazy-import", - "version": "1.14.0-prerelease", + "version": "1.14.0", "description": "Lazily import a module, installing it automatically if missing.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/library-export-default-webpack-plugin/package.json b/packages/library-export-default-webpack-plugin/package.json index 0adb6bf4e9ee5..a2c767907798f 100644 --- a/packages/library-export-default-webpack-plugin/package.json +++ b/packages/library-export-default-webpack-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/library-export-default-webpack-plugin", - "version": "2.13.0-prerelease", + "version": "2.13.0", "description": "Webpack plugin for exporting default property for selected libraries.", "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 9fc36e167466c..20955742d6900 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": "4.4.0-prerelease", + "version": "4.4.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 b56b8781a83df..3b32aeaf0c149 100644 --- a/packages/media-utils/package.json +++ b/packages/media-utils/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/media-utils", - "version": "4.18.0-prerelease", + "version": "4.18.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 716d17fb64cf0..7de4e6e71910d 100644 --- a/packages/notices/package.json +++ b/packages/notices/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/notices", - "version": "3.27.0-prerelease", + "version": "3.27.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 77389d557cacb..e498709868b0d 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.12.0-prerelease", + "version": "4.12.0", "description": "WordPress npm-package-json-lint shareable configuration.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/plugins/package.json b/packages/plugins/package.json index d6a557fef6b3c..d6045d52a85a8 100644 --- a/packages/plugins/package.json +++ b/packages/plugins/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/plugins", - "version": "5.4.0-prerelease", + "version": "5.4.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 0dfbc08800051..0b60da5eef353 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.11.0-prerelease", + "version": "4.11.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 d9aa2c34b85ff..af38a968cc4ce 100644 --- a/packages/postcss-themes/package.json +++ b/packages/postcss-themes/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/postcss-themes", - "version": "5.10.0-prerelease", + "version": "5.10.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 20964fecb8815..cdbde59c155d8 100644 --- a/packages/preferences-persistence/package.json +++ b/packages/preferences-persistence/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/preferences-persistence", - "version": "1.19.0-prerelease", + "version": "1.19.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 6fee857385e3a..0491e4022db15 100644 --- a/packages/preferences/package.json +++ b/packages/preferences/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/preferences", - "version": "3.4.0-prerelease", + "version": "3.4.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 7b70ae5a934d5..90ed2076924ee 100644 --- a/packages/prettier-config/package.json +++ b/packages/prettier-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/prettier-config", - "version": "2.10.0-prerelease", + "version": "2.10.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 f54fd9c603444..ea22b6dff908e 100644 --- a/packages/primitives/package.json +++ b/packages/primitives/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/primitives", - "version": "3.25.0-prerelease", + "version": "3.25.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 f831f205179e2..ee07c0f9a89a0 100644 --- a/packages/priority-queue/package.json +++ b/packages/priority-queue/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/priority-queue", - "version": "2.27.0-prerelease", + "version": "2.27.0", "description": "Generic browser priority queue.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/private-apis/package.json b/packages/private-apis/package.json index 191384fba1ddb..3f13e7237d818 100644 --- a/packages/private-apis/package.json +++ b/packages/private-apis/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/private-apis", - "version": "0.9.0-prerelease", + "version": "0.9.0", "description": "Internal experimental APIs for WordPress core.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", diff --git a/packages/project-management-automation/package.json b/packages/project-management-automation/package.json index 64b3cdb72807d..7a636eaa76a15 100644 --- a/packages/project-management-automation/package.json +++ b/packages/project-management-automation/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/project-management-automation", - "version": "1.26.0-prerelease", + "version": "1.26.0", "description": "GitHub Action that implements various automation to assist with managing the Gutenberg GitHub repository.", "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 f5438aaf983af..c1e5797069e63 100644 --- a/packages/react-i18n/package.json +++ b/packages/react-i18n/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/react-i18n", - "version": "3.25.0-prerelease", + "version": "3.25.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 2fdaa4c315226..4b6cc5751a296 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.10.0-prerelease", + "version": "2.10.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 9fd275328633b..23591993b4589 100644 --- a/packages/redux-routine/package.json +++ b/packages/redux-routine/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/redux-routine", - "version": "4.27.0-prerelease", + "version": "4.27.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 4c81caa83dd5e..cdb1f39a87241 100644 --- a/packages/reusable-blocks/package.json +++ b/packages/reusable-blocks/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/reusable-blocks", - "version": "4.4.0-prerelease", + "version": "4.4.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 01e465f0872f3..a4325f5cbc0d2 100644 --- a/packages/rich-text/package.json +++ b/packages/rich-text/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/rich-text", - "version": "6.4.0-prerelease", + "version": "6.4.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 a1859d6fff4d9..74c5701b0c97f 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/scripts", - "version": "25.4.0-prerelease", + "version": "25.4.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 2324fca09224e..fbb229a4ddc9d 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": "4.4.0-prerelease", + "version": "4.4.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 9cf84fc6020da..699a0b1ebfdec 100644 --- a/packages/shortcode/package.json +++ b/packages/shortcode/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/shortcode", - "version": "3.27.0-prerelease", + "version": "3.27.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 de392ecb68194..b5694b39d49e4 100644 --- a/packages/style-engine/package.json +++ b/packages/style-engine/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/style-engine", - "version": "1.10.0-prerelease", + "version": "1.10.0", "description": "A suite of parsers and compilers for WordPress styles.", "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 fa8a23c295194..0df79865edf2e 100644 --- a/packages/stylelint-config/package.json +++ b/packages/stylelint-config/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/stylelint-config", - "version": "21.10.0-prerelease", + "version": "21.10.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 ec36c946c176d..eaab10e602f1d 100644 --- a/packages/token-list/package.json +++ b/packages/token-list/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/token-list", - "version": "2.27.0-prerelease", + "version": "2.27.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 0bb8834615a57..7b98dbaea07fe 100644 --- a/packages/url/package.json +++ b/packages/url/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/url", - "version": "3.28.0-prerelease", + "version": "3.28.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 8f035dd2e2da2..a9e4039b5f377 100644 --- a/packages/viewport/package.json +++ b/packages/viewport/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/viewport", - "version": "5.4.0-prerelease", + "version": "5.4.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 67fdaf9966add..530983d68905c 100644 --- a/packages/warning/package.json +++ b/packages/warning/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/warning", - "version": "2.27.0-prerelease", + "version": "2.27.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 80244214bb3ce..2b7068576db54 100644 --- a/packages/widgets/package.json +++ b/packages/widgets/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/widgets", - "version": "3.4.0-prerelease", + "version": "3.4.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 12bf382240ea6..cb39ce52874e9 100644 --- a/packages/wordcount/package.json +++ b/packages/wordcount/package.json @@ -1,6 +1,6 @@ { "name": "@wordpress/wordcount", - "version": "3.27.0-prerelease", + "version": "3.27.0", "description": "WordPress word count utility.", "author": "The WordPress Contributors", "license": "GPL-2.0-or-later", From 729efaa0bb8fa4bbff92453fefc12dfb48b3b038 Mon Sep 17 00:00:00 2001 From: Tonya Mork Date: Wed, 15 Feb 2023 15:03:50 -0600 Subject: [PATCH 59/76] Fonts API: Load missing deprecated files (#48108) * Add missing files to lib/load.php` * Guard loading the experimental files --- lib/load.php | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/load.php b/lib/load.php index 035fbe3740627..c99668ff3739c 100644 --- a/lib/load.php +++ b/lib/load.php @@ -109,15 +109,20 @@ function gutenberg_is_experiment_enabled( $name ) { require __DIR__ . '/experimental/kses.php'; // Fonts API. -require __DIR__ . '/experimental/fonts-api/class-wp-fonts-provider.php'; -require __DIR__ . '/experimental/fonts-api/deprecations/webfonts-deprecations.php'; -require __DIR__ . '/experimental/fonts-api/deprecations/class-wp-webfonts-provider.php'; -require __DIR__ . '/experimental/fonts-api/deprecations/class-wp-webfonts.php'; -require __DIR__ . '/experimental/fonts-api/class-wp-fonts-utils.php'; -require __DIR__ . '/experimental/fonts-api/register-fonts-from-theme-json.php'; -require __DIR__ . '/experimental/fonts-api/class-wp-fonts.php'; -require __DIR__ . '/experimental/fonts-api/class-wp-fonts-provider-local.php'; -require __DIR__ . '/experimental/fonts-api/fonts-api.php'; +if ( ! class_exists( 'WP_Fonts' ) ) { + require __DIR__ . '/experimental/fonts-api/class-wp-fonts-provider.php'; + require __DIR__ . '/experimental/fonts-api/deprecations/webfonts-deprecations.php'; + require __DIR__ . '/experimental/fonts-api/deprecations/class-wp-webfonts-utils.php'; + require __DIR__ . '/experimental/fonts-api/deprecations/class-wp-webfonts-provider.php'; + require __DIR__ . '/experimental/fonts-api/deprecations/class-wp-webfonts-provider-local.php'; + require __DIR__ . '/experimental/fonts-api/deprecations/class-wp-webfonts.php'; + require __DIR__ . '/experimental/fonts-api/deprecations/class-wp-web-fonts.php'; + require __DIR__ . '/experimental/fonts-api/class-wp-fonts-utils.php'; + require __DIR__ . '/experimental/fonts-api/register-fonts-from-theme-json.php'; + require __DIR__ . '/experimental/fonts-api/class-wp-fonts.php'; + require __DIR__ . '/experimental/fonts-api/class-wp-fonts-provider-local.php'; + require __DIR__ . '/experimental/fonts-api/fonts-api.php'; +} // Plugin specific code. require __DIR__ . '/class-wp-theme-json-gutenberg.php'; From 1d9ab8cf86f0e4a9c457e02104af3f99ea536118 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Wed, 15 Feb 2023 22:19:12 +0000 Subject: [PATCH 60/76] Navigation: Update the dependencies for the useEffect that handles notifications (#48066) * Navigation: Update the dependecies for the useEffect that handles notifications * also update deps for the usememo * update more deps * reorder code so dependencies are defined --- .../src/navigation/edit/index.js | 62 ++++++------ .../edit/navigation-menu-selector.js | 2 +- .../src/navigation/edit/placeholder/index.js | 2 +- .../navigation/edit/unsaved-inner-blocks.js | 2 + .../use-convert-classic-menu-to-block-menu.js | 99 ++++++++++--------- .../edit/use-create-navigation-menu.js | 2 +- .../use-generate-default-navigation-title.js | 2 +- 7 files changed, 91 insertions(+), 80 deletions(-) diff --git a/packages/block-library/src/navigation/edit/index.js b/packages/block-library/src/navigation/edit/index.js index e0f4da63c6e44..f3fe01508818b 100644 --- a/packages/block-library/src/navigation/edit/index.js +++ b/packages/block-library/src/navigation/edit/index.js @@ -148,34 +148,6 @@ function Navigation( { createNavigationMenu( '' ); }; - useEffect( () => { - hideNavigationMenuStatusNotice(); - - if ( isCreatingNavigationMenu ) { - speak( __( `Creating Navigation Menu.` ) ); - } - - if ( createNavigationMenuIsSuccess ) { - handleUpdateMenu( createNavigationMenuPost.id, { - focusNavigationBlock: true, - } ); - - showNavigationMenuStatusNotice( - __( `Navigation Menu successfully created.` ) - ); - } - - if ( createNavigationMenuIsError ) { - showNavigationMenuStatusNotice( - __( 'Failed to create Navigation Menu.' ) - ); - } - }, [ - createNavigationMenuStatus, - createNavigationMenuError, - createNavigationMenuPost, - ] ); - const { hasUncontrolledInnerBlocks, uncontrolledInnerBlocks, @@ -421,6 +393,40 @@ function Navigation( { handleUpdateMenu( menuId ); }; + useEffect( () => { + hideNavigationMenuStatusNotice(); + + if ( isCreatingNavigationMenu ) { + speak( __( `Creating Navigation Menu.` ) ); + } + + if ( createNavigationMenuIsSuccess ) { + handleUpdateMenu( createNavigationMenuPost.id, { + focusNavigationBlock: true, + } ); + + showNavigationMenuStatusNotice( + __( `Navigation Menu successfully created.` ) + ); + } + + if ( createNavigationMenuIsError ) { + showNavigationMenuStatusNotice( + __( 'Failed to create Navigation Menu.' ) + ); + } + }, [ + createNavigationMenuStatus, + createNavigationMenuError, + createNavigationMenuPost, + createNavigationMenuIsError, + createNavigationMenuIsSuccess, + handleUpdateMenu, + hideNavigationMenuStatusNotice, + isCreatingNavigationMenu, + showNavigationMenuStatusNotice, + ] ); + useEffect( () => { hideClassicMenuConversionNotice(); if ( classicMenuConversionStatus === CLASSIC_MENU_CONVERSION_PENDING ) { diff --git a/packages/block-library/src/navigation/edit/navigation-menu-selector.js b/packages/block-library/src/navigation/edit/navigation-menu-selector.js index 2914d4fae56de..94d1890af8420 100644 --- a/packages/block-library/src/navigation/edit/navigation-menu-selector.js +++ b/packages/block-library/src/navigation/edit/navigation-menu-selector.js @@ -65,7 +65,7 @@ function NavigationMenuSelector( { }; } ) || [] ); - }, [ currentMenuId, navigationMenus, actionLabel ] ); + }, [ currentMenuId, navigationMenus, actionLabel, isCreatingMenu ] ); const hasNavigationMenus = !! navigationMenus?.length; const hasClassicMenus = !! classicMenus?.length; diff --git a/packages/block-library/src/navigation/edit/placeholder/index.js b/packages/block-library/src/navigation/edit/placeholder/index.js index 68f81c4aed99d..9914f1a128b3e 100644 --- a/packages/block-library/src/navigation/edit/placeholder/index.js +++ b/packages/block-library/src/navigation/edit/placeholder/index.js @@ -38,7 +38,7 @@ export default function NavigationPlaceholder( { if ( hasResolvedMenus ) { speak( __( 'Navigation block setup options ready.' ) ); } - }, [ isResolvingMenus, isSelected ] ); + }, [ hasResolvedMenus, isResolvingMenus, isSelected ] ); const isResolvingActions = isResolvingMenus && isResolvingCanUserCreateNavigationMenu; diff --git a/packages/block-library/src/navigation/edit/unsaved-inner-blocks.js b/packages/block-library/src/navigation/edit/unsaved-inner-blocks.js index ec91f7aa68fa4..bb23db9c3bc8d 100644 --- a/packages/block-library/src/navigation/edit/unsaved-inner-blocks.js +++ b/packages/block-library/src/navigation/edit/unsaved-inner-blocks.js @@ -146,6 +146,8 @@ export default function UnsavedInnerBlocks( { createNavigationMenu( null, blocks ); }, [ + blocks, + createNavigationMenu, isDisabled, isSaving, hasResolvedDraftNavigationMenus, diff --git a/packages/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js b/packages/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js index 01eea8d0261aa..8731cb5c32045 100644 --- a/packages/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js +++ b/packages/block-library/src/navigation/edit/use-convert-classic-menu-to-block-menu.js @@ -120,56 +120,59 @@ function useConvertClassicToBlockMenu( clientId ) { return navigationMenu; } - const convert = useCallback( async ( menuId, menuName, postStatus ) => { - // Check whether this classic menu is being imported already. - if ( classicMenuBeingConvertedId === menuId ) { - return; - } - - // Set the ID for the currently importing classic menu. - classicMenuBeingConvertedId = menuId; - - if ( ! menuId || ! menuName ) { - setError( 'Unable to convert menu. Missing menu details.' ); - setStatus( CLASSIC_MENU_CONVERSION_ERROR ); - return; - } - - setStatus( CLASSIC_MENU_CONVERSION_PENDING ); - setError( null ); - - return await convertClassicMenuToBlockMenu( - menuId, - menuName, - postStatus - ) - .then( ( navigationMenu ) => { - setStatus( CLASSIC_MENU_CONVERSION_SUCCESS ); - // Reset the ID for the currently importing classic menu. - classicMenuBeingConvertedId = null; - return navigationMenu; - } ) - .catch( ( err ) => { - setError( err?.message ); - // Reset the ID for the currently importing classic menu. + const convert = useCallback( + async ( menuId, menuName, postStatus ) => { + // Check whether this classic menu is being imported already. + if ( classicMenuBeingConvertedId === menuId ) { + return; + } + + // Set the ID for the currently importing classic menu. + classicMenuBeingConvertedId = menuId; + + if ( ! menuId || ! menuName ) { + setError( 'Unable to convert menu. Missing menu details.' ); setStatus( CLASSIC_MENU_CONVERSION_ERROR ); + return; + } - // Reset the ID for the currently importing classic menu. - classicMenuBeingConvertedId = null; - - // Rethrow error for debugging. - throw new Error( - sprintf( - // translators: %s: the name of a menu (e.g. Header navigation). - __( `Unable to create Navigation Menu "%s".` ), - menuName - ), - { - cause: err, - } - ); - } ); - }, [] ); + setStatus( CLASSIC_MENU_CONVERSION_PENDING ); + setError( null ); + + return await convertClassicMenuToBlockMenu( + menuId, + menuName, + postStatus + ) + .then( ( navigationMenu ) => { + setStatus( CLASSIC_MENU_CONVERSION_SUCCESS ); + // Reset the ID for the currently importing classic menu. + classicMenuBeingConvertedId = null; + return navigationMenu; + } ) + .catch( ( err ) => { + setError( err?.message ); + // Reset the ID for the currently importing classic menu. + setStatus( CLASSIC_MENU_CONVERSION_ERROR ); + + // Reset the ID for the currently importing classic menu. + classicMenuBeingConvertedId = null; + + // Rethrow error for debugging. + throw new Error( + sprintf( + // translators: %s: the name of a menu (e.g. Header navigation). + __( `Unable to create Navigation Menu "%s".` ), + menuName + ), + { + cause: err, + } + ); + } ); + }, + [ convertClassicMenuToBlockMenu ] + ); return { convert, diff --git a/packages/block-library/src/navigation/edit/use-create-navigation-menu.js b/packages/block-library/src/navigation/edit/use-create-navigation-menu.js index 32b6f9c3925f5..79fcd7d692545 100644 --- a/packages/block-library/src/navigation/edit/use-create-navigation-menu.js +++ b/packages/block-library/src/navigation/edit/use-create-navigation-menu.js @@ -90,7 +90,7 @@ export default function useCreateNavigationMenu( clientId ) { } ); } ); }, - [ serialize, saveEntityRecord ] + [ serialize, saveEntityRecord, editEntityRecord, generateDefaultTitle ] ); return { diff --git a/packages/block-library/src/navigation/edit/use-generate-default-navigation-title.js b/packages/block-library/src/navigation/edit/use-generate-default-navigation-title.js index e268ed288f154..0a134a256e664 100644 --- a/packages/block-library/src/navigation/edit/use-generate-default-navigation-title.js +++ b/packages/block-library/src/navigation/edit/use-generate-default-navigation-title.js @@ -75,5 +75,5 @@ export default function useGenerateDefaultNavigationTitle( clientId ) { : title; return titleWithCount || ''; - }, [ isDisabled, area ] ); + }, [ isDisabled, area, registry ] ); } From 2cc9840908927faaa7fbeb5146197df34593caa7 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Wed, 15 Feb 2023 22:40:25 +0000 Subject: [PATCH 61/76] Update Changelog for 15.1.1 --- changelog.txt | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/changelog.txt b/changelog.txt index 262fd96c5dc35..46f339243bd08 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,29 @@ == Changelog == += 15.1.1 = + + + +## Changelog + +### Various + +- Fonts API: Add missing files to lib/load.php. ([48108](https://github.com/WordPress/gutenberg/pull/48108)) + + +## First time contributors + +The following PRs were merged by first time contributors: + + + +## Contributors + +The following contributors merged PRs in this release: + +@hellofromtonya + + = 15.2.0-rc.1 = From b87e855fbc717e3a1badf8f6c2c802cb9d71cc1d Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Thu, 16 Feb 2023 09:53:29 +1100 Subject: [PATCH 62/76] List View: Scroll selected block into view when single block selection changes (#46895) * List View: Try scrolling selected blocks into view when single block selection changes * Use getScrollContainer and calculate real top position of scrollable area instead of using a hard-coded value * Try rearranging things so that the ref is always attached at the row level * Move placeholder to its own file * Tidy up a little * Tidy comments * Remove unneeded optional chaining Co-authored-by: Kai Hao * Simplify and improve logic based on feedback Co-authored-by: Kai Hao * Remove unneeded optional chaining Co-authored-by: Kai Hao * Revert placeholder component, update showBlock logic so that selected blocks are rendered as real ListViewBlock components --------- Co-authored-by: Kai Hao --- .../src/components/list-view/block.js | 12 ++++ .../src/components/list-view/branch.js | 3 +- .../src/components/list-view/leaf.js | 72 +++++++++++-------- .../use-list-view-scroll-into-view.js | 48 +++++++++++++ 4 files changed, 104 insertions(+), 31 deletions(-) create mode 100644 packages/block-editor/src/components/list-view/use-list-view-scroll-into-view.js diff --git a/packages/block-editor/src/components/list-view/block.js b/packages/block-editor/src/components/list-view/block.js index e80d2a9348741..bf024b1fb758b 100644 --- a/packages/block-editor/src/components/list-view/block.js +++ b/packages/block-editor/src/components/list-view/block.js @@ -27,6 +27,7 @@ import { sprintf, __ } from '@wordpress/i18n'; * Internal dependencies */ import ListViewLeaf from './leaf'; +import useListViewScrollIntoView from './use-list-view-scroll-into-view'; import { BlockMoverUpButton, BlockMoverDownButton, @@ -57,6 +58,7 @@ function ListViewBlock( { isSyncedBranch, } ) { const cellRef = useRef( null ); + const rowRef = useRef( null ); const [ isHovered, setIsHovered ] = useState( false ); const { clientId } = block; @@ -220,6 +222,15 @@ function ListViewBlock( { ? selectedClientIds : [ clientId ]; + // Pass in a ref to the row, so that it can be scrolled + // into view when selected. For long lists, the placeholder for the + // selected block is also observed, within ListViewLeafPlaceholder. + useListViewScrollIntoView( { + isSelected, + rowItemRef: rowRef, + selectedClientIds, + } ); + return ( { showBlock && ( diff --git a/packages/block-editor/src/components/list-view/leaf.js b/packages/block-editor/src/components/list-view/leaf.js index 41bf4bc34cc66..63c154fd62037 100644 --- a/packages/block-editor/src/components/list-view/leaf.js +++ b/packages/block-editor/src/components/list-view/leaf.js @@ -8,6 +8,8 @@ import classnames from 'classnames'; * WordPress dependencies */ import { __experimentalTreeGridRow as TreeGridRow } from '@wordpress/components'; +import { useMergeRefs } from '@wordpress/compose'; +import { forwardRef } from '@wordpress/element'; /** * Internal dependencies @@ -16,33 +18,45 @@ import useMovingAnimation from '../use-moving-animation'; const AnimatedTreeGridRow = animated( TreeGridRow ); -export default function ListViewLeaf( { - isSelected, - position, - level, - rowCount, - children, - className, - path, - ...props -} ) { - const ref = useMovingAnimation( { - isSelected, - adjustScrolling: false, - enableAnimation: true, - triggerAnimationOnChange: path, - } ); +const ListViewLeaf = forwardRef( + ( + { + isSelected, + position, + level, + rowCount, + children, + className, + path, + ...props + }, + ref + ) => { + const animationRef = useMovingAnimation( { + isSelected, + adjustScrolling: false, + enableAnimation: true, + triggerAnimationOnChange: path, + } ); - return ( - - { children } - - ); -} + const mergedRef = useMergeRefs( [ ref, animationRef ] ); + + return ( + + { children } + + ); + } +); + +export default ListViewLeaf; diff --git a/packages/block-editor/src/components/list-view/use-list-view-scroll-into-view.js b/packages/block-editor/src/components/list-view/use-list-view-scroll-into-view.js new file mode 100644 index 0000000000000..bee9c3b87a729 --- /dev/null +++ b/packages/block-editor/src/components/list-view/use-list-view-scroll-into-view.js @@ -0,0 +1,48 @@ +/** + * WordPress dependencies + */ +import { getScrollContainer } from '@wordpress/dom'; +import { useLayoutEffect } from '@wordpress/element'; + +export default function useListViewScrollIntoView( { + isSelected, + selectedClientIds, + rowItemRef, +} ) { + const isSingleSelection = selectedClientIds.length === 1; + + useLayoutEffect( () => { + // Skip scrolling into view if this particular block isn't selected, + // or if more than one block is selected overall. This is to avoid + // scrolling the view in a multi selection where the user has intentionally + // selected multiple blocks within the list view, but the initially + // selected block may be out of view. + if ( ! isSelected || ! isSingleSelection || ! rowItemRef.current ) { + return; + } + + const scrollContainer = getScrollContainer( rowItemRef.current ); + const { ownerDocument } = rowItemRef.current; + + const windowScroll = + scrollContainer === ownerDocument.body || + scrollContainer === ownerDocument.documentElement; + + // If the there is no scroll container, of if the scroll container is the window, + // do not scroll into view, as the block is already in view. + if ( windowScroll || ! scrollContainer ) { + return; + } + + const rowRect = rowItemRef.current.getBoundingClientRect(); + const scrollContainerRect = scrollContainer.getBoundingClientRect(); + + // If the selected block is not currently visible, scroll to it. + if ( + rowRect.top < scrollContainerRect.top || + rowRect.bottom > scrollContainerRect.bottom + ) { + rowItemRef.current.scrollIntoView(); + } + }, [ isSelected, isSingleSelection, rowItemRef ] ); +} From 8f23e951a0e6a4ddbb022dca3dac2dece948ae38 Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Thu, 16 Feb 2023 13:07:32 +1100 Subject: [PATCH 63/76] Style Book: Allow button text labels for style book icon (#48088) * Global styles sidebar: Allow text labels on buttons * Simplify labels * Update e2e tests * Fix failing test Co-authored-by: Kai Hao --------- Co-authored-by: Kai Hao --- .../edit-site/src/components/global-styles/ui.js | 2 +- .../sidebar-edit-mode/global-styles-sidebar.js | 10 +++------- .../src/components/sidebar-edit-mode/style.scss | 16 ++++++++++++++++ test/e2e/specs/site-editor/style-book.spec.js | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/packages/edit-site/src/components/global-styles/ui.js b/packages/edit-site/src/components/global-styles/ui.js index 5372ce9e5fbd5..13c1d0f2067a1 100644 --- a/packages/edit-site/src/components/global-styles/ui.js +++ b/packages/edit-site/src/components/global-styles/ui.js @@ -68,7 +68,7 @@ function GlobalStylesActionMenu() { - + + { __( 'Styles' ) } + +
    + + ); +} diff --git a/packages/block-library/src/page-list/edit.js b/packages/block-library/src/page-list/edit.js index 6b525960db224..876496686929a 100644 --- a/packages/block-library/src/page-list/edit.js +++ b/packages/block-library/src/page-list/edit.js @@ -23,7 +23,6 @@ import { Notice, ComboboxControl, Button, - Modal, } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; import { useMemo, useState, useEffect } from '@wordpress/element'; @@ -34,16 +33,15 @@ import { useSelect } from '@wordpress/data'; * Internal dependencies */ import { useConvertToNavigationLinks } from './use-convert-to-navigation-links'; +import { + convertDescription, + ConvertToLinksModal, +} from './convert-to-links-modal'; // We only show the edit option when page count is <= MAX_PAGE_COUNT // Performance of Navigation Links is not good past this value. const MAX_PAGE_COUNT = 100; const NOOP = () => {}; - -const convertDescription = __( - 'This menu is automatically kept in sync with pages on your site. You can manage the menu yourself by clicking "Edit" below.' -); - function BlockContent( { blockProps, innerBlocksProps, @@ -113,7 +111,7 @@ function BlockContent( { } } -function ConvertToLinksModal( { onClick, disabled } ) { +function ConvertToLinks( { onClick, disabled } ) { const [ isOpen, setOpen ] = useState( false ); const openModal = () => setOpen( true ); const closeModal = () => setOpen( false ); @@ -126,30 +124,11 @@ function ConvertToLinksModal( { onClick, disabled } ) { { isOpen && ( - -

    - { convertDescription } -

    -
    - - -
    -
    + ) } ); @@ -344,7 +323,7 @@ export default function PageListEdit( { ) } { allowConvertToLinks && ( - From 11525f7c9ad1f0cb7f464d86cdc0b9e207bb3d45 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Thu, 16 Feb 2023 11:17:41 +0000 Subject: [PATCH 67/76] Navigation List View: Add block movers to the more menu (#48099) * Navigation List View: Add block movers to the more menu * add arrows * put the remove action in its own group --- .../off-canvas-editor/leaf-more-menu.js | 67 ++++++++++++++----- 1 file changed, 52 insertions(+), 15 deletions(-) diff --git a/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js b/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js index a266f0d9377c3..a3829998361bc 100644 --- a/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js +++ b/packages/block-editor/src/components/off-canvas-editor/leaf-more-menu.js @@ -2,9 +2,14 @@ * WordPress dependencies */ import { createBlock } from '@wordpress/blocks'; -import { addSubmenu, moreVertical } from '@wordpress/icons'; +import { + addSubmenu, + chevronUp, + chevronDown, + moreVertical, +} from '@wordpress/icons'; import { DropdownMenu, MenuItem, MenuGroup } from '@wordpress/components'; -import { useDispatch } from '@wordpress/data'; +import { useDispatch, useSelect } from '@wordpress/data'; import { __, sprintf } from '@wordpress/i18n'; /** @@ -80,14 +85,24 @@ function AddSubmenuItem( { block, onClose } ) { export default function LeafMoreMenu( props ) { const { clientId, block } = props; - const { removeBlocks } = useDispatch( blockEditorStore ); + const { moveBlocksDown, moveBlocksUp, removeBlocks } = + useDispatch( blockEditorStore ); - const label = sprintf( + const removeLabel = sprintf( /* translators: %s: block name */ __( 'Remove %s' ), BlockTitle( { clientId, maximumLength: 25 } ) ); + const rootClientId = useSelect( + ( select ) => { + const { getBlockRootClientId } = select( blockEditorStore ); + + return getBlockRootClientId( clientId ); + }, + [ clientId ] + ); + return ( { ( { onClose } ) => ( - - - { - removeBlocks( [ clientId ], false ); - onClose(); - } } - > - { label } - - + <> + + { + moveBlocksUp( [ clientId ], rootClientId ); + onClose(); + } } + > + { __( 'Move up' ) } + + { + moveBlocksDown( [ clientId ], rootClientId ); + onClose(); + } } + > + { __( 'Move down' ) } + + + + + { + removeBlocks( [ clientId ], false ); + onClose(); + } } + > + { removeLabel } + + + ) } ); From b9fb37a75b484eaefc81aababa95be2c83f68d4d Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Thu, 16 Feb 2023 17:26:57 +0000 Subject: [PATCH 68/76] Bump plugin version to 15.2.0-rc.2 --- gutenberg.php | 2 +- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gutenberg.php b/gutenberg.php index ca9be89162ebc..fe3e8669605eb 100644 --- a/gutenberg.php +++ b/gutenberg.php @@ -5,7 +5,7 @@ * Description: Printing since 1440. This is the development plugin for the block editor, site editor, and other future WordPress core functionality. * Requires at least: 6.0 * Requires PHP: 5.6 - * Version: 15.2.0-rc.1 + * Version: 15.2.0-rc.2 * Author: Gutenberg Team * Text Domain: gutenberg * diff --git a/package-lock.json b/package-lock.json index a59aa9f4bbae2..19fa9b1cf2bd3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "15.2.0-rc.1", + "version": "15.2.0-rc.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index cdac43e2d4ecb..50806050edf99 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gutenberg", - "version": "15.2.0-rc.1", + "version": "15.2.0-rc.2", "private": true, "description": "A new WordPress editor experience.", "author": "The WordPress Contributors", From 67fcff1789fa6d07eb28d0d6e03725f93d0f7c92 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Thu, 16 Feb 2023 19:21:05 +0000 Subject: [PATCH 69/76] Update Changelog for 15.2.0-rc.2 --- changelog.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/changelog.txt b/changelog.txt index 46f339243bd08..798ea972663f9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,18 @@ == Changelog == += 15.2.0-rc.2 = + +Various +Fonts API: Add missing files to lib/load.php. (https://github.com/WordPress/gutenberg/pull/48108) +First time contributors +The following PRs were merged by first time contributors: + +Contributors +The following contributors merged PRs in this release: + +@hellofromtonya + + = 15.1.1 = From eb7bafdc244bc207eb1f4d491bf61ee268b003ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Feb 2023 22:44:02 -0500 Subject: [PATCH 70/76] Bump actions/setup-java from 3.9.0 to 3.10.0 (#47877) Bumps [actions/setup-java](https://github.com/actions/setup-java) from 3.9.0 to 3.10.0. - [Release notes](https://github.com/actions/setup-java/releases) - [Commits](https://github.com/actions/setup-java/compare/1df8dbefe2a8cbc99770194893dd902763bee34b...3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98) --- updated-dependencies: - dependency-name: actions/setup-java dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/rnmobile-android-runner.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index fc019dfa5d504..b319f3bddea53 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -26,7 +26,7 @@ jobs: uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - name: Use desired version of Java - uses: actions/setup-java@1df8dbefe2a8cbc99770194893dd902763bee34b # v3.9.0 + uses: actions/setup-java@3f07048e3d294f56e9b90ac5ea2c6f74e9ad0f98 # v3.10.0 with: distribution: 'temurin' java-version: '11' From b9e5514d1b899ca7125f6d2768e3a19d59c470aa Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Feb 2023 22:44:33 -0500 Subject: [PATCH 71/76] Bump @sideway/formula from 3.0.0 to 3.0.1 (#47894) Bumps [@sideway/formula](https://github.com/sideway/formula) from 3.0.0 to 3.0.1. - [Release notes](https://github.com/sideway/formula/releases) - [Commits](https://github.com/sideway/formula/compare/v3.0.0...v3.0.1) --- updated-dependencies: - dependency-name: "@sideway/formula" dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 19fa9b1cf2bd3..1ec271075a176 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9242,9 +9242,9 @@ } }, "@sideway/formula": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.0.tgz", - "integrity": "sha512-vHe7wZ4NOXVfkoRb8T5otiENVlT7a3IAiw7H5M2+GO+9CDgcVUUsX1zalAztCmwyOr2RUTGJdgB+ZvSVqmdHmg==" + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/@sideway/formula/-/formula-3.0.1.tgz", + "integrity": "sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==" }, "@sideway/pinpoint": { "version": "2.0.0", From 75054160e4e0462b1b801ec892e688d35a9800ac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 16 Feb 2023 22:44:51 -0500 Subject: [PATCH 72/76] Bump actions/cache from 3.2.4 to 3.2.5 (#47970) Bumps [actions/cache](https://github.com/actions/cache) from 3.2.4 to 3.2.5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/627f0f41f6904a5b1efbaed9f96d9eb58e92e920...6998d139ddd3e68c71e9e398d8e40b71a2f39812) --- updated-dependencies: - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/pull-request-automation.yml | 2 +- .github/workflows/rnmobile-android-runner.yml | 2 +- .github/workflows/rnmobile-ios-runner.yml | 4 ++-- .github/workflows/unit-test.yml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pull-request-automation.yml b/.github/workflows/pull-request-automation.yml index 6219c5ae3c848..5163ae3f0ea0c 100644 --- a/.github/workflows/pull-request-automation.yml +++ b/.github/workflows/pull-request-automation.yml @@ -25,7 +25,7 @@ jobs: node-version: ${{ matrix.node }} - name: Cache NPM packages - uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4 + uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5 with: # npm cache files are stored in `~/.npm` on Linux/macOS path: ~/.npm diff --git a/.github/workflows/rnmobile-android-runner.yml b/.github/workflows/rnmobile-android-runner.yml index b319f3bddea53..033789ee30a92 100644 --- a/.github/workflows/rnmobile-android-runner.yml +++ b/.github/workflows/rnmobile-android-runner.yml @@ -43,7 +43,7 @@ jobs: uses: gradle/gradle-build-action@3fbe033aaae657f011f88f29be9e65ed26bd29ef # v2.3.3 - name: AVD cache - uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4 + uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5 id: avd-cache with: path: | diff --git a/.github/workflows/rnmobile-ios-runner.yml b/.github/workflows/rnmobile-ios-runner.yml index 6d497491bdf9c..52fab007b1917 100644 --- a/.github/workflows/rnmobile-ios-runner.yml +++ b/.github/workflows/rnmobile-ios-runner.yml @@ -37,7 +37,7 @@ jobs: run: find package-lock.json packages/react-native-editor/ios packages/react-native-aztec/ios packages/react-native-bridge/ios -type f -print0 | sort -z | xargs -0 shasum | tee ios-checksums.txt - name: Restore build cache - uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4 + uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5 with: path: | packages/react-native-editor/ios/build/GutenbergDemo/Build/Products/Release-iphonesimulator/GutenbergDemo.app @@ -45,7 +45,7 @@ jobs: key: ${{ runner.os }}-ios-build-${{ matrix.xcode }}-${{ matrix.device }}-${{ hashFiles('ios-checksums.txt') }} - name: Restore pods cache - uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.2.4 + uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.2.5 with: path: | packages/react-native-editor/ios/Pods diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 8b1884835f416..6552f2ecf6a2b 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -182,7 +182,7 @@ jobs: run: echo "date=$(/bin/date -u --date='last Mon' "+%F")" >> $GITHUB_OUTPUT - name: Cache PHPCS scan cache - uses: actions/cache@627f0f41f6904a5b1efbaed9f96d9eb58e92e920 # v3.0.11 + uses: actions/cache@6998d139ddd3e68c71e9e398d8e40b71a2f39812 # v3.0.11 with: path: .cache/phpcs.json key: ${{ runner.os }}-date-${{ steps.get-date.outputs.date }}-phpcs-cache-${{ hashFiles('**/composer.json', 'phpcs.xml.dist') }} From 05d3575c66d86299f668b2fcbf04107a668094fb Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Fri, 17 Feb 2023 11:19:53 +0100 Subject: [PATCH 73/76] Fix the Publish region position and focus style. (#48102) --- .../higher-order/navigate-regions/style.scss | 3 ++- .../edit-post/src/components/layout/index.js | 16 +++++++++------- .../edit-site/src/components/editor/style.scss | 6 ------ .../edit-site/src/components/layout/style.scss | 9 ++++++++- .../src/components/save-panel/index.js | 9 ++++++++- .../components/interface-skeleton/style.scss | 18 +++++++++++------- 6 files changed, 38 insertions(+), 23 deletions(-) diff --git a/packages/components/src/higher-order/navigate-regions/style.scss b/packages/components/src/higher-order/navigate-regions/style.scss index 6e66c854dd70e..f146413a09dc9 100644 --- a/packages/components/src/higher-order/navigate-regions/style.scss +++ b/packages/components/src/higher-order/navigate-regions/style.scss @@ -24,13 +24,14 @@ // visible. For the future, it's important to take into consideration that // the navigable regions should always have a computed size. For now, we can // fix some edge cases but these CSS rules should be later removed in favor of - // a more abstracted approach to make the navigabel regions focus style work + // a more abstracted approach to make the navigable regions focus style work // regardles of the CSS used on other components. // Header top bar when Distraction free mode is on. &.is-distraction-free .interface-interface-skeleton__header .edit-post-header, .interface-interface-skeleton__sidebar .edit-post-layout__toggle-sidebar-panel, .interface-interface-skeleton__actions .edit-post-layout__toggle-publish-panel, + .interface-interface-skeleton__actions .edit-post-layout__toggle-entities-saved-states-panel, .editor-post-publish-panel { outline: 4px solid $components-color-accent; outline-offset: -4px; diff --git a/packages/edit-post/src/components/layout/index.js b/packages/edit-post/src/components/layout/index.js index 8353b4ed6b15e..3fe02dbe5004f 100644 --- a/packages/edit-post/src/components/layout/index.js +++ b/packages/edit-post/src/components/layout/index.js @@ -128,13 +128,6 @@ function Layout( { styles } ) { const isDistractionFree = isDistractionFreeMode && isLargeViewport; - const className = classnames( 'edit-post-layout', 'is-mode-' + mode, { - 'is-sidebar-opened': sidebarIsOpened, - 'has-fixed-toolbar': hasFixedToolbar, - 'has-metaboxes': hasActiveMetaboxes, - 'show-icon-labels': showIconLabels, - 'is-distraction-free': isDistractionFree, - } ); const openSidebarPanel = () => openGeneralSidebar( hasBlockSelected ? 'edit-post/block' : 'edit-post/document' @@ -166,6 +159,15 @@ function Layout( { styles } ) { [ entitiesSavedStatesCallback ] ); + const className = classnames( 'edit-post-layout', 'is-mode-' + mode, { + 'is-sidebar-opened': sidebarIsOpened, + 'has-fixed-toolbar': hasFixedToolbar, + 'has-metaboxes': hasActiveMetaboxes, + 'show-icon-labels': showIconLabels, + 'is-distraction-free': isDistractionFree, + 'is-entity-save-view-open': !! entitiesSavedStatesCallback, + } ); + const secondarySidebarLabel = isListViewOpened ? __( 'Document Overview' ) : __( 'Block Library' ); diff --git a/packages/edit-site/src/components/editor/style.scss b/packages/edit-site/src/components/editor/style.scss index c63a0dcb954d2..1a24d3ee1475e 100644 --- a/packages/edit-site/src/components/editor/style.scss +++ b/packages/edit-site/src/components/editor/style.scss @@ -6,12 +6,6 @@ padding: $grid-unit-30; display: flex; justify-content: center; - - .edit-site-layout__actions:focus &, - .edit-site-layout__actions:focus-within & { - top: auto; - bottom: 0; - } } // Adjust the position of the notices diff --git a/packages/edit-site/src/components/layout/style.scss b/packages/edit-site/src/components/layout/style.scss index f9837e5fa3c84..5e47588369c80 100644 --- a/packages/edit-site/src/components/layout/style.scss +++ b/packages/edit-site/src/components/layout/style.scss @@ -207,10 +207,17 @@ &:focus, &:focus-within { - top: 0; + top: auto; bottom: 0; } + &.is-entity-save-view-open { + &:focus, + &:focus-within { + top: 0; + } + } + @include break-medium { border-left: $border-width solid $gray-300; } diff --git a/packages/edit-site/src/components/save-panel/index.js b/packages/edit-site/src/components/save-panel/index.js index 0c3a2083af696..7b8993c0be495 100644 --- a/packages/edit-site/src/components/save-panel/index.js +++ b/packages/edit-site/src/components/save-panel/index.js @@ -1,3 +1,8 @@ +/** + * External dependencies + */ +import classnames from 'classnames'; + /** * WordPress dependencies */ @@ -46,7 +51,9 @@ export default function SavePanel() { return ( { isSaveViewOpen ? ( diff --git a/packages/interface/src/components/interface-skeleton/style.scss b/packages/interface/src/components/interface-skeleton/style.scss index 57d88626636dd..a45239b529ddd 100644 --- a/packages/interface/src/components/interface-skeleton/style.scss +++ b/packages/interface/src/components/interface-skeleton/style.scss @@ -184,16 +184,20 @@ html.interface-interface-skeleton__html-container { &:focus, &:focus-within { - top: $admin-bar-height-big; + top: auto; + bottom: 0; - @include break-medium() { - border-left: $border-width solid $gray-300; - top: $admin-bar-height; + .is-entity-save-view-open & { + top: $admin-bar-height-big; - .is-fullscreen-mode & { - top: 0; + @include break-medium() { + border-left: $border-width solid $gray-300; + top: $admin-bar-height; + + .is-fullscreen-mode & { + top: 0; + } } } - bottom: 0; } } From 0b5ca2239f012e676d70d5011f9f96c503cc8220 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Fri, 17 Feb 2023 11:46:28 +0100 Subject: [PATCH 74/76] Fix site editor switch mode message. (#48136) --- packages/edit-site/src/store/actions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/edit-site/src/store/actions.js b/packages/edit-site/src/store/actions.js index a535d9916b2d2..48ac0a343a59f 100644 --- a/packages/edit-site/src/store/actions.js +++ b/packages/edit-site/src/store/actions.js @@ -526,7 +526,7 @@ export const switchEditorMode = if ( mode === 'visual' ) { speak( __( 'Visual editor selected' ), 'assertive' ); - } else if ( mode === 'mosaic' ) { - speak( __( 'Mosaic view selected' ), 'assertive' ); + } else if ( mode === 'text' ) { + speak( __( 'Code editor selected' ), 'assertive' ); } }; From 0414d3a1b35e564b7c407c3018c55e49c1aaa660 Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Fri, 17 Feb 2023 16:07:31 +0000 Subject: [PATCH 75/76] Fix: Multiple overwrites on rest_controller_class for wp_template/wp_template_part. (#48078) --- ...utenberg-rest-templates-controller-6-3.php | 61 +++++++++++++++ ...gutenberg-rest-template-revision-count.php | 75 ------------------- lib/experimental/rest-api.php | 21 ------ lib/load.php | 1 - ...tenberg-rest-templates-controller-test.php | 2 +- 5 files changed, 62 insertions(+), 98 deletions(-) delete mode 100644 lib/experimental/class-gutenberg-rest-template-revision-count.php diff --git a/lib/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php b/lib/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php index f857cedd37f9a..2f9bd7a8cd9e4 100644 --- a/lib/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php +++ b/lib/compat/wordpress-6.3/class-gutenberg-rest-templates-controller-6-3.php @@ -65,4 +65,65 @@ public function get_template_fallback( $request ) { $response = $this->prepare_item_for_response( $fallback_template, $request ); return rest_ensure_response( $response ); } + + /** + * Add revisions to the response. + * + * @param WP_Block_Template $item Template instance. + * @param WP_REST_Request $request Request object. + * @return WP_REST_Response Response object. + */ + public function prepare_item_for_response( $item, $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable + $template = $item; + + $fields = $this->get_fields_for_response( $request ); + + $response = parent::prepare_item_for_response( $item, $request ); + + if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) { + $links = $this->prepare_revision_links( $template ); + $response->add_links( $links ); + if ( ! empty( $links['self']['href'] ) ) { + $actions = $this->get_available_actions(); + $self = $links['self']['href']; + foreach ( $actions as $rel ) { + $response->add_link( $rel, $self ); + } + } + } + + return $response; + } + + /** + * Adds revisions to links. + * + * @since 6.2.0 + * + * @param WP_Block_Template $template Template instance. + * @return array Links for the given post. + */ + protected function prepare_revision_links( $template ) { + $links = array(); + + if ( post_type_supports( $this->post_type, 'revisions' ) && (int) $template->wp_id ) { + $revisions = wp_get_latest_revision_id_and_total_count( (int) $template->wp_id ); + $revisions_count = ! is_wp_error( $revisions ) ? $revisions['count'] : 0; + $revisions_base = sprintf( '/%s/%s/%s/revisions', $this->namespace, $this->rest_base, $template->id ); + + $links['version-history'] = array( + 'href' => rest_url( $revisions_base ), + 'count' => $revisions_count, + ); + + if ( $revisions_count > 0 ) { + $links['predecessor-version'] = array( + 'href' => rest_url( $revisions_base . '/' . $revisions['latest_id'] ), + 'id' => $revisions['latest_id'], + ); + } + } + + return $links; + } } diff --git a/lib/experimental/class-gutenberg-rest-template-revision-count.php b/lib/experimental/class-gutenberg-rest-template-revision-count.php deleted file mode 100644 index 82bedd6e0c8ff..0000000000000 --- a/lib/experimental/class-gutenberg-rest-template-revision-count.php +++ /dev/null @@ -1,75 +0,0 @@ -get_fields_for_response( $request ); - - $response = parent::prepare_item_for_response( $item, $request ); - - if ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) { - $links = $this->prepare_revision_links( $template ); - $response->add_links( $links ); - if ( ! empty( $links['self']['href'] ) ) { - $actions = $this->get_available_actions(); - $self = $links['self']['href']; - foreach ( $actions as $rel ) { - $response->add_link( $rel, $self ); - } - } - } - - return $response; - } - - /** - * Adds revisions to links. - * - * @since 6.2.0 - * - * @param WP_Block_Template $template Template instance. - * @return array Links for the given post. - */ - protected function prepare_revision_links( $template ) { - $links = array(); - - if ( post_type_supports( $this->post_type, 'revisions' ) && (int) $template->wp_id ) { - $revisions = wp_get_latest_revision_id_and_total_count( (int) $template->wp_id ); - $revisions_count = ! is_wp_error( $revisions ) ? $revisions['count'] : 0; - $revisions_base = sprintf( '/%s/%s/%s/revisions', $this->namespace, $this->rest_base, $template->id ); - - $links['version-history'] = array( - 'href' => rest_url( $revisions_base ), - 'count' => $revisions_count, - ); - - if ( $revisions_count > 0 ) { - $links['predecessor-version'] = array( - 'href' => rest_url( $revisions_base . '/' . $revisions['latest_id'] ), - 'id' => $revisions['latest_id'], - ); - } - } - - return $links; - } -} diff --git a/lib/experimental/rest-api.php b/lib/experimental/rest-api.php index 31a96b6572f26..77f7d091d2655 100644 --- a/lib/experimental/rest-api.php +++ b/lib/experimental/rest-api.php @@ -29,27 +29,6 @@ function gutenberg_register_block_editor_settings() { add_action( 'rest_api_init', 'gutenberg_register_block_editor_settings' ); -/** - * Hook in to the template and template part post types and decorate - * the rest endpoint with the revision count. - * - * When merging to core, this can be removed once Gutenberg_REST_Template_Revision_Count is - * merged with WP_REST_Template_Controller. - * - * @param array $args Current registered post type args. - * @param string $post_type Name of post type. - * - * @return array - */ -function wp_api_template_revision_args( $args, $post_type ) { - if ( 'wp_template' === $post_type || 'wp_template_part' === $post_type ) { - $args['rest_controller_class'] = 'Gutenberg_REST_Template_Revision_Count'; - } - - return $args; -} -add_filter( 'register_post_type_args', 'wp_api_template_revision_args', 10, 2 ); - /** * Shim for get_sample_permalink() to add support for auto-draft status. * diff --git a/lib/load.php b/lib/load.php index c99668ff3739c..e00c20286d4e7 100644 --- a/lib/load.php +++ b/lib/load.php @@ -57,7 +57,6 @@ function gutenberg_is_experiment_enabled( $name ) { if ( ! class_exists( 'WP_Rest_Customizer_Nonces' ) ) { require_once __DIR__ . '/experimental/class-wp-rest-customizer-nonces.php'; } - require_once __DIR__ . '/experimental/class-gutenberg-rest-template-revision-count.php'; require_once __DIR__ . '/experimental/rest-api.php'; } diff --git a/phpunit/class-gutenberg-rest-templates-controller-test.php b/phpunit/class-gutenberg-rest-templates-controller-test.php index 81d7f2758c643..d8447704bd373 100644 --- a/phpunit/class-gutenberg-rest-templates-controller-test.php +++ b/phpunit/class-gutenberg-rest-templates-controller-test.php @@ -59,7 +59,7 @@ public function test_get_template_fallback() { $request->set_param( 'is_custom', false ); $request->set_param( 'template_prefix', 'tag' ); $response = rest_get_server()->dispatch( $request ); - $this->assertSame( 'tag', $response->get_data()['slug'], 'Should fallback to `index.html`.' ); + $this->assertSame( 'index', $response->get_data()['slug'], 'Should fallback to `index.html`.' ); } public function test_context_param() { From 356a1b1555ab7302a6e17d88c32abcace6feb1e7 Mon Sep 17 00:00:00 2001 From: Rich Tabor Date: Fri, 17 Feb 2023 22:41:13 -0500 Subject: [PATCH 76/76] Remove "& Shadow" from ScreenHeader (#48043) --- .../edit-site/src/components/global-styles/screen-border.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/edit-site/src/components/global-styles/screen-border.js b/packages/edit-site/src/components/global-styles/screen-border.js index 8312483cce6b2..6a5578e20fcef 100644 --- a/packages/edit-site/src/components/global-styles/screen-border.js +++ b/packages/edit-site/src/components/global-styles/screen-border.js @@ -16,7 +16,7 @@ function ScreenBorder( { name, variation = '' } ) { const variationClassName = getVariationClassName( variation ); return ( <> - + { hasBorderPanel && (