From 9c459852f9dc498e0856c622cc28785b7830a045 Mon Sep 17 00:00:00 2001 From: Ramon Date: Fri, 6 Sep 2024 01:07:40 +1000 Subject: [PATCH 01/12] Page editor: double-click to edit template part (#65024) Adds a doubleclick handler to template part block if the content has `contentOnly` editing mode. Also tighten up the doubleclick handler that triggers the edit template modal. It should not trigger when clicking on template parts now that there's a second double click handler. Co-authored-by: ramonjd Co-authored-by: andrewserong Co-authored-by: jameskoster Co-authored-by: richtabor Co-authored-by: noisysocks --- .../src/template-part/edit/inner-blocks.js | 21 ++++++++++++++++++- .../edit-template-blocks-notification.js | 5 ++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/template-part/edit/inner-blocks.js b/packages/block-library/src/template-part/edit/inner-blocks.js index 2c246809ab2d49..8582caba4cde47 100644 --- a/packages/block-library/src/template-part/edit/inner-blocks.js +++ b/packages/block-library/src/template-part/edit/inner-blocks.js @@ -100,6 +100,12 @@ function EditableTemplatePartInnerBlocks( { tagName: TagName, blockProps, } ) { + const onNavigateToEntityRecord = useSelect( + ( select ) => + select( blockEditorStore ).getSettings().onNavigateToEntityRecord, + [] + ); + const [ blocks, onInput, onChange ] = useEntityBlockEditor( 'postType', 'wp_template_part', @@ -114,7 +120,20 @@ function EditableTemplatePartInnerBlocks( { layout: useLayout( layout ), } ); - return ; + const blockEditingMode = useBlockEditingMode(); + + const customProps = + blockEditingMode === 'contentOnly' && onNavigateToEntityRecord + ? { + onDoubleClick: () => + onNavigateToEntityRecord( { + postId: id, + postType: 'wp_template_part', + } ), + } + : {}; + + return ; } export default function TemplatePartInnerBlocks( { diff --git a/packages/editor/src/components/visual-editor/edit-template-blocks-notification.js b/packages/editor/src/components/visual-editor/edit-template-blocks-notification.js index 449834e3ab61cf..3ccbe79127c013 100644 --- a/packages/editor/src/components/visual-editor/edit-template-blocks-notification.js +++ b/packages/editor/src/components/visual-editor/edit-template-blocks-notification.js @@ -55,7 +55,10 @@ export default function EditTemplateBlocksNotification( { contentRef } ) { return; } - if ( ! event.target.classList.contains( 'is-root-container' ) ) { + if ( + ! event.target.classList.contains( 'is-root-container' ) || + event.target.dataset?.type === 'core/template-part' + ) { return; } setIsDialogOpen( true ); From 2fe092ebcc901d0da4062e162d0723f4bd75b34b Mon Sep 17 00:00:00 2001 From: Marco Ciampini Date: Thu, 5 Sep 2024 17:36:36 +0200 Subject: [PATCH 02/12] Composite: deprecate legacy, unstable version (#63572) * Add deprecated tags to JSDocs * Add deprecated console warnings * Update unit tests to expect the warnings * CHANGELOG * Remove mention of store hook --- Co-authored-by: ciampo Co-authored-by: tyxla --- packages/components/CHANGELOG.md | 4 + .../components/src/composite/legacy/index.tsx | 73 +++++++++++++++++-- .../src/composite/legacy/test/index.tsx | 58 ++++++++++++++- 3 files changed, 126 insertions(+), 9 deletions(-) diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 499a3b69c06a2b..35549e8cb77998 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Deprecations + +- Deprecate `__unstableComposite`, `__unstableCompositeGroup`, `__unstableCompositeItem` and `__unstableUseCompositeState`. Consumers of the package should use the stable `Composite` component instead ([#63572](https://github.com/WordPress/gutenberg/pull/63572)). + ### New Features - `Composite`: add stable version of the component ([#63569](https://github.com/WordPress/gutenberg/pull/63569)). diff --git a/packages/components/src/composite/legacy/index.tsx b/packages/components/src/composite/legacy/index.tsx index cff564af1f8e7a..22ddff6572dd01 100644 --- a/packages/components/src/composite/legacy/index.tsx +++ b/packages/components/src/composite/legacy/index.tsx @@ -22,12 +22,13 @@ import * as Ariakit from '@ariakit/react'; * WordPress dependencies */ import { forwardRef } from '@wordpress/element'; +import { useInstanceId } from '@wordpress/compose'; +import deprecated from '@wordpress/deprecated'; /** * Internal dependencies */ import { Composite as Current } from '..'; -import { useInstanceId } from '@wordpress/compose'; type Orientation = 'horizontal' | 'vertical'; @@ -123,12 +124,31 @@ function mapLegacyStatePropsToComponentProps( return legacyProps; } +const LEGACY_TO_NEW_DISPLAY_NAME = { + __unstableComposite: 'Composite', + __unstableCompositeGroup: 'Composite.Group or Composite.Row', + __unstableCompositeItem: 'Composite.Item', + __unstableUseCompositeState: 'Composite', +}; + function proxyComposite< C extends Component >( ProxiedComponent: C | React.ForwardRefExoticComponent< C >, propMap: Record< string, string > = {} ): CompositeComponent< C > { - const displayName = ProxiedComponent.displayName; + const displayName = ProxiedComponent.displayName ?? ''; + const Component = ( legacyProps: CompositeStateProps ) => { + deprecated( `wp.components.${ displayName }`, { + since: '6.7', + alternative: LEGACY_TO_NEW_DISPLAY_NAME.hasOwnProperty( + displayName + ) + ? LEGACY_TO_NEW_DISPLAY_NAME[ + displayName as keyof typeof LEGACY_TO_NEW_DISPLAY_NAME + ] + : undefined, + } ); + const { store, ...rest } = mapLegacyStatePropsToComponentProps( legacyProps ); const props = rest as ComponentProps< C >; @@ -153,7 +173,7 @@ function proxyComposite< C extends Component >( // `CompositeRow`, but this has been split into two different // components. We handle that difference by checking on the // provided role, and returning the appropriate component. -const unproxiedCompositeGroup = forwardRef< +const UnproxiedCompositeGroup = forwardRef< any, React.ComponentPropsWithoutRef< typeof Current.Group | typeof Current.Row > >( ( { role, ...props }, ref ) => { @@ -161,15 +181,52 @@ const unproxiedCompositeGroup = forwardRef< return ; } ); -export const Composite = proxyComposite( Current, { baseId: 'id' } ); -export const CompositeGroup = proxyComposite( unproxiedCompositeGroup ); -export const CompositeItem = proxyComposite( Current.Item, { - focusable: 'accessibleWhenDisabled', -} ); +/** + * _Note: please use the `Composite` component instead._ + * + * @deprecated + */ +export const Composite = proxyComposite( + Object.assign( Current, { displayName: '__unstableComposite' } ), + { baseId: 'id' } +); +/** + * _Note: please use the `Composite.Row` or `Composite.Group` components instead._ + * + * @deprecated + */ +export const CompositeGroup = proxyComposite( + Object.assign( UnproxiedCompositeGroup, { + displayName: '__unstableCompositeGroup', + } ) +); +/** + * _Note: please use the `Composite.Item` component instead._ + * + * @deprecated + */ +export const CompositeItem = proxyComposite( + Object.assign( Current.Item, { + displayName: '__unstableCompositeItem', + } ), + { + focusable: 'accessibleWhenDisabled', + } +); +/** + * _Note: please use the `Composite` component instead._ + * + * @deprecated + */ export function useCompositeState( legacyStateOptions: LegacyStateOptions = {} ): CompositeState { + deprecated( `wp.components.__unstableUseCompositeState`, { + since: '6.7', + alternative: LEGACY_TO_NEW_DISPLAY_NAME.__unstableUseCompositeState, + } ); + const { baseId, currentId: defaultActiveId, diff --git a/packages/components/src/composite/legacy/test/index.tsx b/packages/components/src/composite/legacy/test/index.tsx index 07398e54b27ca3..c034d31442ca8d 100644 --- a/packages/components/src/composite/legacy/test/index.tsx +++ b/packages/components/src/composite/legacy/test/index.tsx @@ -1,7 +1,12 @@ /** * External dependencies */ -import { queryByAttribute, render, screen } from '@testing-library/react'; +import { + queryByAttribute, + render, + screen, + renderHook, +} from '@testing-library/react'; import { press, waitFor } from '@ariakit/test'; /** @@ -156,6 +161,57 @@ function getShiftTestItems() { }; } +// Checking for deprecation warnings before other tests because the `deprecated` +// utility only fires a console.warn the first time a component is rendered. +describe( 'Shows a deprecation warning', () => { + it( 'useCompositeState', () => { + renderHook( () => useCompositeState() ); + expect( console ).toHaveWarnedWith( + 'wp.components.__unstableUseCompositeState is deprecated since version 6.7. Please use Composite instead.' + ); + } ); + it( 'Composite', () => { + const Test = () => { + const props = useCompositeState(); + return ; + }; + render( ); + expect( console ).toHaveWarnedWith( + 'wp.components.__unstableComposite is deprecated since version 6.7. Please use Composite instead.' + ); + } ); + it( 'CompositeItem', () => { + const Test = () => { + const props = useCompositeState(); + return ( + + + + ); + }; + render( ); + expect( console ).toHaveWarnedWith( + 'wp.components.__unstableCompositeItem is deprecated since version 6.7. Please use Composite.Item instead.' + ); + } ); + it( 'CompositeGroup', () => { + const Test = () => { + const props = useCompositeState(); + return ( + + + + + + ); + }; + render( ); + expect( console ).toHaveWarnedWith( + 'wp.components.__unstableCompositeGroup is deprecated since version 6.7. Please use Composite.Group or Composite.Row instead.' + ); + } ); +} ); + describe.each( [ [ 'With "spread" state', From bc96d19a2d87a268a12efde0acbc2fbe028701b5 Mon Sep 17 00:00:00 2001 From: Rafael Gallani Date: Thu, 5 Sep 2024 13:34:18 -0300 Subject: [PATCH 03/12] Site Title, Post Title: Fix typography for blocks with `a` children (#64911) * Apply styles for element + `a` child when present * Inherit styles from parent element when present * Add missing `-font-family` attribute selector --- .../block-library/src/post-title/block.json | 5 +++- .../block-library/src/post-title/style.scss | 24 +++++++++++++++++++ .../block-library/src/site-title/block.json | 5 +++- .../block-library/src/site-title/style.scss | 24 +++++++++++++++++++ 4 files changed, 56 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/post-title/block.json b/packages/block-library/src/post-title/block.json index ecb5053d6cd39e..5e7d3eee9dd11d 100644 --- a/packages/block-library/src/post-title/block.json +++ b/packages/block-library/src/post-title/block.json @@ -80,5 +80,8 @@ } } }, - "style": "wp-block-post-title" + "style": "wp-block-post-title", + "selectors": { + "typography": ".wp-block-post-title, .wp-block-post-title > a" + } } diff --git a/packages/block-library/src/post-title/style.scss b/packages/block-library/src/post-title/style.scss index abeb4454bcb2c5..5d0e3407105bd4 100644 --- a/packages/block-library/src/post-title/style.scss +++ b/packages/block-library/src/post-title/style.scss @@ -3,6 +3,30 @@ // This block has customizable padding, border-box makes that more predictable. box-sizing: border-box; + &[style*="font-weight"] :where(a) { + font-weight: inherit; + } + &[class*="-font-family"] :where(a), + &[style*="font-family"] :where(a) { + font-family: inherit; + } + &[class*="-font-size"] :where(a), + &[style*="font-size"] :where(a) { + font-size: inherit; + } + &[style*="line-height"] :where(a) { + line-height: inherit; + } + &[style*="font-style"] :where(a) { + font-style: inherit; + } + &[style*="letter-spacing"] :where(a) { + letter-spacing: inherit; + } + &[style*="text-decoration"] :where(a) { + text-decoration: inherit; + } + a { display: inline-block; } diff --git a/packages/block-library/src/site-title/block.json b/packages/block-library/src/site-title/block.json index c75b1bc229beb9..dbb484c74a1e45 100644 --- a/packages/block-library/src/site-title/block.json +++ b/packages/block-library/src/site-title/block.json @@ -75,5 +75,8 @@ } }, "editorStyle": "wp-block-site-title-editor", - "style": "wp-block-site-title" + "style": "wp-block-site-title", + "selectors": { + "typography": ".wp-block-site-title > span, .wp-block-site-title > a" + } } diff --git a/packages/block-library/src/site-title/style.scss b/packages/block-library/src/site-title/style.scss index f292326cc3259f..8647f3d9b2947c 100644 --- a/packages/block-library/src/site-title/style.scss +++ b/packages/block-library/src/site-title/style.scss @@ -2,6 +2,30 @@ // This block has customizable padding, border-box makes that more predictable. box-sizing: border-box; + &[style*="font-weight"] :where(a) { + font-weight: inherit; + } + &[class*="-font-family"] :where(a), + &[style*="font-family"] :where(a) { + font-family: inherit; + } + &[class*="-font-size"] :where(a), + &[style*="font-size"] :where(a) { + font-size: inherit; + } + &[style*="line-height"] :where(a) { + line-height: inherit; + } + &[style*="font-style"] :where(a) { + font-style: inherit; + } + &[style*="letter-spacing"] :where(a) { + letter-spacing: inherit; + } + &[style*="text-decoration"] :where(a) { + text-decoration: inherit; + } + :where(a) { color: inherit; } From e40447e274390fa76ae01d2db19be2dc7db6504f Mon Sep 17 00:00:00 2001 From: David Arenas Date: Thu, 5 Sep 2024 18:35:24 +0200 Subject: [PATCH 04/12] Interactivity API: Prevent calling `proxifyContext` over an already-proxified context inside the `wp-context` directive (#65090) * Do not store the proxified context inside `currentValue.current`. * Update changelog Co-authored-by: DAreRodz Co-authored-by: gziolo --- packages/interactivity/CHANGELOG.md | 4 ++++ packages/interactivity/src/directives.tsx | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/interactivity/CHANGELOG.md b/packages/interactivity/CHANGELOG.md index b410eb270358f0..b888f159c00867 100644 --- a/packages/interactivity/CHANGELOG.md +++ b/packages/interactivity/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Bug Fixes + +- Prevent calling `proxifyContext` over an already-proxified context inside `wp-context` ([#65090](https://github.com/WordPress/gutenberg/pull/65090)). + ## 6.7.0 (2024-09-05) ### Enhancements diff --git a/packages/interactivity/src/directives.tsx b/packages/interactivity/src/directives.tsx index 715bc2ea7b16b6..b41d50722e3765 100644 --- a/packages/interactivity/src/directives.tsx +++ b/packages/interactivity/src/directives.tsx @@ -290,11 +290,10 @@ export default () => { currentValue.current, deepClone( value ) as object ); - currentValue.current = proxifyContext( + result[ namespace ] = proxifyContext( currentValue.current, inheritedValue[ namespace ] ); - result[ namespace ] = currentValue.current; } return result; }, [ defaultEntry, inheritedValue ] ); From d2db0f982268598b5efbd5306d5f410b529dc3d1 Mon Sep 17 00:00:00 2001 From: Gutenberg Repository Automation Date: Thu, 5 Sep 2024 17:24:54 +0000 Subject: [PATCH 05/12] Update Changelog for 19.2.0-rc.1 --- changelog.txt | 356 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 356 insertions(+) diff --git a/changelog.txt b/changelog.txt index 0fb2b93056b9bc..dc0a2487f725ff 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,361 @@ == Changelog == += 19.2.0-rc.1 = + + +## Changelog + +### Enhancements + +- Add: Reorder control at the field level on the new view configuration UI. ([64381](https://github.com/WordPress/gutenberg/pull/64381)) +- Core Data Types: `recordId` can be a number. ([64796](https://github.com/WordPress/gutenberg/pull/64796)) +- Core Data: Derive collection totals for unbound queries. ([64772](https://github.com/WordPress/gutenberg/pull/64772)) +- Create Block: Set minimum supported WordPress version to 6.6. ([64920](https://github.com/WordPress/gutenberg/pull/64920)) +- Dataviews Filter search widget: Do not use Composite store. ([64985](https://github.com/WordPress/gutenberg/pull/64985)) +- Dataviews list view: Do not use Composite store. ([64987](https://github.com/WordPress/gutenberg/pull/64987)) +- Move bulk actions menu to the Footer, consolidate with floating toolbar and total items display. ([64268](https://github.com/WordPress/gutenberg/pull/64268)) +- Try: Update block warnings. ([64997](https://github.com/WordPress/gutenberg/pull/64997)) + +#### Components +- Add variants to InputControl prefix/suffix wrappers. ([64824](https://github.com/WordPress/gutenberg/pull/64824)) +- AlignmentMatrixControl: Do not use Composite store. ([64850](https://github.com/WordPress/gutenberg/pull/64850)) +- CircularOptionPicker: Stop using composite store. ([64833](https://github.com/WordPress/gutenberg/pull/64833)) +- Composite: Accept store props on top level component. ([64832](https://github.com/WordPress/gutenberg/pull/64832)) +- DataViews: Adds two new stories for edge cases. ([64975](https://github.com/WordPress/gutenberg/pull/64975)) +- Decrease standard padding to 12px. ([64708](https://github.com/WordPress/gutenberg/pull/64708)) +- DropdownMenuV2: Add GroupLabel subcomponent. ([64854](https://github.com/WordPress/gutenberg/pull/64854)) +- DropdownMenuV2: Update animation. ([64868](https://github.com/WordPress/gutenberg/pull/64868)) +- DropdownMenuV2: Use overloaded naming conventions. ([64654](https://github.com/WordPress/gutenberg/pull/64654)) +- InputControl: Tighten gap between input and prefix/suffix. ([64908](https://github.com/WordPress/gutenberg/pull/64908)) +- Navigator: Polish Storybook examples. ([64798](https://github.com/WordPress/gutenberg/pull/64798)) +- Navigator: Remove location history, simplify internal logic. ([64675](https://github.com/WordPress/gutenberg/pull/64675)) +- UnitControl: Update unit select styles. ([64712](https://github.com/WordPress/gutenberg/pull/64712)) +- Update hard-coded border-radius instances. ([64693](https://github.com/WordPress/gutenberg/pull/64693)) +- Update modal animation. ([64580](https://github.com/WordPress/gutenberg/pull/64580)) + +#### Block bindings +- Add warning in attributes connected to invalid sources. ([65002](https://github.com/WordPress/gutenberg/pull/65002)) +- Allow only admin users to create and modify bindings by default. ([64570](https://github.com/WordPress/gutenberg/pull/64570)) +- Lock editing in fields in editor if meta fields panel is opened. ([64738](https://github.com/WordPress/gutenberg/pull/64738)) +- Rely on `Text` component instead of `Truncate` in bindings panel. ([65007](https://github.com/WordPress/gutenberg/pull/65007)) +- Remove `getPlaceholder` API and rely on `key` argument or source label. ([64910](https://github.com/WordPress/gutenberg/pull/64910)) + +#### Block Editor +- Add 'Reset' option to MediaReplaceFlow component. ([64826](https://github.com/WordPress/gutenberg/pull/64826)) +- Block Patterns List: Do not use Composite store. ([64983](https://github.com/WordPress/gutenberg/pull/64983)) +- Remove the Shuffle block toolbar button. ([64954](https://github.com/WordPress/gutenberg/pull/64954)) +- Show block icon in contentOnly toolbar. ([64694](https://github.com/WordPress/gutenberg/pull/64694)) + +#### Block Library +- Cover Block: Move Clear Media button from Inspector Controls to Block Controls. ([64630](https://github.com/WordPress/gutenberg/pull/64630)) +- Improve Social Icons setup and appending. ([64877](https://github.com/WordPress/gutenberg/pull/64877)) +- Pagination Block: Fix inconsistent margins between editor and frontend. ([64874](https://github.com/WordPress/gutenberg/pull/64874)) +- Tag Cloud: Improve state of block with no tags. ([63774](https://github.com/WordPress/gutenberg/pull/63774)) + +#### Block Locking +- ContentOnly: Add support for block styles on top-level contentOnly locked blocks. ([64872](https://github.com/WordPress/gutenberg/pull/64872)) +- Only show title in content only toolbar if has title value. ([64840](https://github.com/WordPress/gutenberg/pull/64840)) +- Remove ability to crop image if content only mode. ([64838](https://github.com/WordPress/gutenberg/pull/64838)) +- Rename Alt to Alternative Text in content only image toolbar. ([64841](https://github.com/WordPress/gutenberg/pull/64841)) + +#### Interactivity API +- Categories Block: Add iAPI directive for client-side routing. ([64907](https://github.com/WordPress/gutenberg/pull/64907)) +- Improve internal `deepMerge` function. ([64879](https://github.com/WordPress/gutenberg/pull/64879)) + +#### Global Styles +- Hide typeset button when there are no typesets available. ([64515](https://github.com/WordPress/gutenberg/pull/64515)) +- Use four color palette colors instead of five for useStylesPreviewColors. ([64700](https://github.com/WordPress/gutenberg/pull/64700)) + +#### Zoom Out +- Add "Edit" button to Zoom Out mode toolbar. ([64571](https://github.com/WordPress/gutenberg/pull/64571)) +- Double click block to exit zoom out mode. ([64573](https://github.com/WordPress/gutenberg/pull/64573)) + +#### Design Tools +- Comment Edit Link: Add Border Block Support. ([64239](https://github.com/WordPress/gutenberg/pull/64239)) +- Comment Reply Link: Add border support. ([64271](https://github.com/WordPress/gutenberg/pull/64271)) + +#### Icons +- Add thumbs up and down icons. ([65004](https://github.com/WordPress/gutenberg/pull/65004)) + +#### Site Editor +- Apply radius scale in the editor. ([64930](https://github.com/WordPress/gutenberg/pull/64930)) + +#### Post Editor +- Post publish upload media dialog: Handle upload errors. ([64823](https://github.com/WordPress/gutenberg/pull/64823)) + +#### Typography +- Fluid typography: Allow individual preset overrides. ([64790](https://github.com/WordPress/gutenberg/pull/64790)) + +#### Media +- Add experiment for client-side media processing. ([64650](https://github.com/WordPress/gutenberg/pull/64650)) + +#### REST API +- Core Data: Resolve entity collection user permissions. ([64504](https://github.com/WordPress/gutenberg/pull/64504)) + +#### Block Transforms +- Details block: Add transform from any block type. ([63422](https://github.com/WordPress/gutenberg/pull/63422)) + + +### New APIs + +#### Extensibility +- Editor: Add extensibility to PreviewOptions v2. ([64644](https://github.com/WordPress/gutenberg/pull/64644)) + + +### Bug Fixes + +- Add safeguard to `mediaUploadMiddleware`. ([64843](https://github.com/WordPress/gutenberg/pull/64843)) +- Allow multi-select on iOS Safari/touch devices. ([63671](https://github.com/WordPress/gutenberg/pull/63671)) +- Fix Modify content-locked menu item not showing if the block is not selected. ([61605](https://github.com/WordPress/gutenberg/pull/61605)) +- Fix editor error in Safari due to availability of checkVisibility method. ([65069](https://github.com/WordPress/gutenberg/pull/65069)) +- Fix: Pagination arrows are pointing in the wrong direction in RTL languages. ([64962](https://github.com/WordPress/gutenberg/pull/64962)) +- Footnotes: Only replace attribute if footnotes were detected. ([63935](https://github.com/WordPress/gutenberg/pull/63935)) +- Paste: Fix image paste from Google Forms. ([64502](https://github.com/WordPress/gutenberg/pull/64502)) +- Revert Focus pattern inserter search when activating zoom out inserter. ([64748](https://github.com/WordPress/gutenberg/pull/64748)) + +#### Block Library +- De-duplicate block toolbar icons for patterns. ([65054](https://github.com/WordPress/gutenberg/pull/65054)) +- Fix: Page list: Pages without a title has no link text. ([64297](https://github.com/WordPress/gutenberg/pull/64297)) +- Position BlockToolbar below all of the selected block's descendants. ([62711](https://github.com/WordPress/gutenberg/pull/62711)) +- Site Logo Block: Fix non-admin users seeing zero character. ([65010](https://github.com/WordPress/gutenberg/pull/65010)) +- Site Logo: Fix loader alignment issue. ([64919](https://github.com/WordPress/gutenberg/pull/64919)) +- Template Part: Hide Advanced panel for non-admin users. ([64721](https://github.com/WordPress/gutenberg/pull/64721)) +- Video Block: Fix layout issue. ([64834](https://github.com/WordPress/gutenberg/pull/64834)) + +#### Components +- ColorPalette utils: Do not normalize undefined color values. ([64969](https://github.com/WordPress/gutenberg/pull/64969)) +- DatePicker: Restore round radius for event dot. ([65031](https://github.com/WordPress/gutenberg/pull/65031)) +- DropdownMenuV2: Fix active and focus-visible item glitches. ([64942](https://github.com/WordPress/gutenberg/pull/64942)) +- DropdownMenuV2: Remove flashing styles when moving focus with keyboard. ([64873](https://github.com/WordPress/gutenberg/pull/64873)) +- Fixes "delete" action in DataViews' storybook. ([64901](https://github.com/WordPress/gutenberg/pull/64901)) +- Navigator: Fix isInitial, refine focusSelector logic. ([64786](https://github.com/WordPress/gutenberg/pull/64786)) +- Range control: Restore bottom margin rule. ([65035](https://github.com/WordPress/gutenberg/pull/65035)) + +#### Post Editor +- Add back editor-post-locked-modal to post lock component. ([64257](https://github.com/WordPress/gutenberg/pull/64257)) +- Add context to `View` string in post actions. ([65046](https://github.com/WordPress/gutenberg/pull/65046)) +- Apply space below content using a pseudo-element instead of padding-bottom. ([64639](https://github.com/WordPress/gutenberg/pull/64639)) +- Post Title: Fix pasting in Safari. ([64671](https://github.com/WordPress/gutenberg/pull/64671)) +- Post Title: Move selection at the end after pasting over the text. ([64665](https://github.com/WordPress/gutenberg/pull/64665)) +- Post publish upload media dialog: Fix silent failure. ([64741](https://github.com/WordPress/gutenberg/pull/64741)) + +#### Data Views +- DataViews: Fix field reordering and visibility logic. ([64999](https://github.com/WordPress/gutenberg/pull/64999)) +- Fix actions scrim in list layout. ([64696](https://github.com/WordPress/gutenberg/pull/64696)) +- Fix data views style inheritance. ([64933](https://github.com/WordPress/gutenberg/pull/64933)) +- Fix: Impossible to see pagination on viewports between small and medium. ([64844](https://github.com/WordPress/gutenberg/pull/64844)) +- List layout: Update broken styles. ([64837](https://github.com/WordPress/gutenberg/pull/64837)) + +#### Block Editor +- Add conditions when the Shuffle button can be displayed. ([64888](https://github.com/WordPress/gutenberg/pull/64888)) +- Inserter: Fix subtle media insertion error. ([65057](https://github.com/WordPress/gutenberg/pull/65057)) +- Post Editor: Fix click space after post content to append. ([64992](https://github.com/WordPress/gutenberg/pull/64992)) +- Writing flow: Fix triple click inside text blocks. ([64928](https://github.com/WordPress/gutenberg/pull/64928)) + +#### Global Styles +- Adjust spacing of background panel. ([64880](https://github.com/WordPress/gutenberg/pull/64880)) +- Cast globalFluid value to boolean. ([64882](https://github.com/WordPress/gutenberg/pull/64882)) +- Fix site editor broken when fontWeight is not defined or is an integer in theme.json or theme styles. ([64953](https://github.com/WordPress/gutenberg/pull/64953)) +- Fixes the default fluid value on the UI based on the global typography fluid value. ([64803](https://github.com/WordPress/gutenberg/pull/64803)) + +#### Block bindings +- Change placeholder when attribute is bound. ([64903](https://github.com/WordPress/gutenberg/pull/64903)) +- Fix empty custom fields not being editable in bindings. ([64881](https://github.com/WordPress/gutenberg/pull/64881)) + +#### CSS & Styling +- Featured Image Block: Reduce CSS specificity. ([64463](https://github.com/WordPress/gutenberg/pull/64463)) +- Retain the same specificity for non iframed selectors. ([64534](https://github.com/WordPress/gutenberg/pull/64534)) + +#### Patterns +- Pass 'blocks' as inner blocks value. ([65029](https://github.com/WordPress/gutenberg/pull/65029)) + +#### Synced Patterns +- Pattern: Don't render block controls when an entity is missing. ([65028](https://github.com/WordPress/gutenberg/pull/65028)) + +#### Site Editor +- DataViews: Fix pattern title direction in RTL languages. ([64967](https://github.com/WordPress/gutenberg/pull/64967)) + +#### NUX +- Fix visibility of the template Welcome Guide in the Site Editor. ([64789](https://github.com/WordPress/gutenberg/pull/64789)) + +#### Document Settings +- Fix: Adjust Site URL Styles to Prevent Overflow in Pre-Publish Component. ([64745](https://github.com/WordPress/gutenberg/pull/64745)) + +#### Zoom Out +- Focus selected block in editor canvas when clicking edit button on zoom out mode toolbar. ([64725](https://github.com/WordPress/gutenberg/pull/64725)) + +#### Templates API +- Make plugin-registered templates overriden by themes to fall back to plugin-registered title and description. ([64610](https://github.com/WordPress/gutenberg/pull/64610)) + +#### Block Style Variations +- Block Styles: Ensure unique classname generation for variations. ([64511](https://github.com/WordPress/gutenberg/pull/64511)) + +#### Distraction Free +- Make Distraction Free not conditional on viewport width. ([63949](https://github.com/WordPress/gutenberg/pull/63949)) + +#### Media +- Limit the max width of image to its container size. ([63341](https://github.com/WordPress/gutenberg/pull/63341)) + + +### Accessibility + +#### Components +- AlignmentMatrixControl: Simplify styles and markup. ([64827](https://github.com/WordPress/gutenberg/pull/64827)) +- TimePicker: Use ToggleGroupControl for AM/PM toggle. ([64800](https://github.com/WordPress/gutenberg/pull/64800)) + +#### Block Editor +- Layout content and wide width controls: Remove confusing icon and clarify labels. ([64891](https://github.com/WordPress/gutenberg/pull/64891)) + +#### Font Library +- Font Library Modal: Group font variations as a list. ([64029](https://github.com/WordPress/gutenberg/pull/64029)) + +#### Post Editor +- Fix the post summary Status toggle button accessibility. ([63988](https://github.com/WordPress/gutenberg/pull/63988)) + + +### Performance + +- Core Data: Avoid loops in 'registry.batch' calls. ([64955](https://github.com/WordPress/gutenberg/pull/64955)) +- Core data: Performance: Fix receive user permissions. ([64894](https://github.com/WordPress/gutenberg/pull/64894)) +- Reusable blocks: Fix performance of __experimentalGetAllowedPatterns. ([64871](https://github.com/WordPress/gutenberg/pull/64871)) + +#### Site Editor +- Add 'OPTIONS /page' to preloaded paths. ([64890](https://github.com/WordPress/gutenberg/pull/64890)) +- Editor: Don't use selector shortcuts for the Site data. ([64884](https://github.com/WordPress/gutenberg/pull/64884)) + +#### Block Library +- Media & Text: Don't use background-image. ([64981](https://github.com/WordPress/gutenberg/pull/64981)) + +#### Post Editor +- Editor: Remove create template permission check in 'VisualEditor'. ([64905](https://github.com/WordPress/gutenberg/pull/64905)) + +#### Block Editor +- Inserter: Use lighter grammar parse to check allowed status. ([64902](https://github.com/WordPress/gutenberg/pull/64902)) + +#### Patterns +- Shuffle: Don't call '__experimentalGetAllowedPatterns' for every block. ([64736](https://github.com/WordPress/gutenberg/pull/64736)) + + +### Experiments + +#### Zoom Out +- Add new zoom out experiment. ([65048](https://github.com/WordPress/gutenberg/pull/65048)) +- Remove the experiment that connects zoom out to the pattern inserter. ([65045](https://github.com/WordPress/gutenberg/pull/65045)) + + +### Documentation + +- Add a new section to the SlotFill reference to show how to conditionally render Fills. ([64807](https://github.com/WordPress/gutenberg/pull/64807)) +- Added Global Documentation in several php file. ([64956](https://github.com/WordPress/gutenberg/pull/64956)) +- Components: Move displayName assignment to top-level files. ([64793](https://github.com/WordPress/gutenberg/pull/64793)) +- Composite: Add context-forwarding with SlotFill example. ([65051](https://github.com/WordPress/gutenberg/pull/65051)) +- Composite: Fix Storybook docgen. ([64682](https://github.com/WordPress/gutenberg/pull/64682)) +- Corrected HTML Syntax for Closing Tags in api-reference.md file. ([64778](https://github.com/WordPress/gutenberg/pull/64778)) +- DataViews docs: Fix typo in `direction` values. ([64973](https://github.com/WordPress/gutenberg/pull/64973)) +- DataViews: Add story about combining fields. ([64984](https://github.com/WordPress/gutenberg/pull/64984)) +- DataViews: Document combined fields. ([64904](https://github.com/WordPress/gutenberg/pull/64904)) +- Dataviews docs: Layout properties checks and link. ([64918](https://github.com/WordPress/gutenberg/pull/64918)) +- Docs/iAPI: Fix wrong code snippets in API reference. ([64416](https://github.com/WordPress/gutenberg/pull/64416)) +- Docs: Update design resources to indicate edit isn't free. ([64792](https://github.com/WordPress/gutenberg/pull/64792)) +- PluginSidebarMoreMenuItem: Update example, screenshot and description. ([64761](https://github.com/WordPress/gutenberg/pull/64761)) +- Provide better examples and remove outdating site edit references for the MainDashboardButton SlotFill. ([64753](https://github.com/WordPress/gutenberg/pull/64753)) +- Removing ryanwelcher as a documentation codeowner because my inbox is dead. ([64762](https://github.com/WordPress/gutenberg/pull/64762)) +- Storybook: Hide deprecated `__next36pxDefaultSize` prop. ([64806](https://github.com/WordPress/gutenberg/pull/64806)) +- Update screenshot and description for PluginSidebar slot. ([64759](https://github.com/WordPress/gutenberg/pull/64759)) +- Update text to match code examples. ([64751](https://github.com/WordPress/gutenberg/pull/64751)) +- Update the import for PluginBlockSettingsMenuItem. ([64758](https://github.com/WordPress/gutenberg/pull/64758)) +- Updated Several Typos in Doc files. ([64787](https://github.com/WordPress/gutenberg/pull/64787)) +- [Docs]: Update Usage Example for block variation picker: Fix Import from Wrong Package. ([55555](https://github.com/WordPress/gutenberg/pull/55555)) + + +### Code Quality + +- Button: Add lint rule for 40px size prop usage. ([64835](https://github.com/WordPress/gutenberg/pull/64835)) +- Dataviews filter: Move resetValueOnSelect prop to combobox item. ([64852](https://github.com/WordPress/gutenberg/pull/64852)) +- Rename refs to fix tons of 'Mutating a value' errors in react-compiler. ([64718](https://github.com/WordPress/gutenberg/pull/64718)) +- Rich text: Add comment on placeholder approach. ([64945](https://github.com/WordPress/gutenberg/pull/64945)) +- SelectControl: Fix remaining 40px size violations. ([64831](https://github.com/WordPress/gutenberg/pull/64831)) +- Simplify useResizeObserver. ([64820](https://github.com/WordPress/gutenberg/pull/64820)) +- Typography: Backport comment changes only. ([64859](https://github.com/WordPress/gutenberg/pull/64859)) +- UnitControl: Add lint rule for 40px size prop usage. ([64520](https://github.com/WordPress/gutenberg/pull/64520)) +- UnitControl: Move to stricter lint rule for 40px size adherence. ([65017](https://github.com/WordPress/gutenberg/pull/65017)) +- Use rectIntersect instead of a custom argument to rectUnion. ([64855](https://github.com/WordPress/gutenberg/pull/64855)) + +#### Site Editor +- Add Custom Template modal: Do not use Composite store. ([65044](https://github.com/WordPress/gutenberg/pull/65044)) +- Add units to avoid console warning. ([64810](https://github.com/WordPress/gutenberg/pull/64810)) +- Edit Site Layout: Remove redundant fullResizer. ([64821](https://github.com/WordPress/gutenberg/pull/64821)) +- Remove unused 'useSiteEditorSettings' hook. ([64892](https://github.com/WordPress/gutenberg/pull/64892)) +- Style Book: Do not use Composite store. ([65047](https://github.com/WordPress/gutenberg/pull/65047)) + +#### Block Editor +- Block Inserter Listbox: Do not use Composite store. ([65042](https://github.com/WordPress/gutenberg/pull/65042)) +- Block Inserter Media List: Do not use Composite store. ([65043](https://github.com/WordPress/gutenberg/pull/65043)) +- Block Pattern Setup: Do not use Composite store. ([65039](https://github.com/WordPress/gutenberg/pull/65039)) +- Global Styles Shadow Panel: Do not use Composite store. ([65041](https://github.com/WordPress/gutenberg/pull/65041)) +- Pattern Transformations Menu: Do not use Composite store. ([65040](https://github.com/WordPress/gutenberg/pull/65040)) + +#### Zoom Out +- Add selector for getting section root clientId. ([65001](https://github.com/WordPress/gutenberg/pull/65001)) +- Don't pass 'rootClientId' to block lock selectors. ([64887](https://github.com/WordPress/gutenberg/pull/64887)) +- Fix error and improve privacy of sectionRootClientId setting. ([65000](https://github.com/WordPress/gutenberg/pull/65000)) + +#### Components +- AlignmentMatrixControl: Promote to stable. ([60913](https://github.com/WordPress/gutenberg/pull/60913)) +- Deprecate `DimensionControl`. ([64951](https://github.com/WordPress/gutenberg/pull/64951)) + +#### Block Library +- Block Bindings: Fix ESLint warnings. ([64684](https://github.com/WordPress/gutenberg/pull/64684)) +- Video Block: Remove custom CSS code for placeholder style. ([64861](https://github.com/WordPress/gutenberg/pull/64861)) + +#### Global Styles +- Allow referenced zero value and simplify getValueFromObjectPath calls. ([64836](https://github.com/WordPress/gutenberg/pull/64836)) +- Navigator: Replace deprecated NavigatorToParentButton with NavigatorBackButton. ([64775](https://github.com/WordPress/gutenberg/pull/64775)) + +#### Block Directory +- Downloadable Block List: Do not use composite store. ([65038](https://github.com/WordPress/gutenberg/pull/65038)) + +#### Design Tools +- Color panel hook: Rename to remove ambiguity. ([64993](https://github.com/WordPress/gutenberg/pull/64993)) + + +### Tools + +- Add remaining i18n rules to recommended ESLint ruleset. ([64710](https://github.com/WordPress/gutenberg/pull/64710)) +- Scripts: Added chunk filename in webpack configuration to avoid reading stale files. ([58176](https://github.com/WordPress/gutenberg/pull/58176)) +- Scripts: Import CSS files before optimization. ([61121](https://github.com/WordPress/gutenberg/pull/61121)) +- Scripts: Update `puppeteer-core` dependency. ([64597](https://github.com/WordPress/gutenberg/pull/64597)) + +#### Testing +- Flaky Test: Fix "Sorting" test in new-templates-list.spec.js. ([64776](https://github.com/WordPress/gutenberg/pull/64776)) +- Revert "Downgrade node 22(.5) unit tests to 22.4 (#63728)". ([63758](https://github.com/WordPress/gutenberg/pull/63758)) + + +### Various + +- Dataviews docs: Fixed property name for defaultLayouts settings. ([64897](https://github.com/WordPress/gutenberg/pull/64897)) +- task: Remove dcalhoun code owner. ([64886](https://github.com/WordPress/gutenberg/pull/64886)) + + +## First-time contributors + +The following PRs were merged by first-time contributors: + +- @Imran92: Fix site editor broken when fontWeight is not defined or is an integer in theme.json or theme styles. ([64953](https://github.com/WordPress/gutenberg/pull/64953)) +- @jacobcassidy: Scripts: Update `puppeteer-core` dependency. ([64597](https://github.com/WordPress/gutenberg/pull/64597)) +- @jawadmalikdev: [Docs]: Update Usage Example for block variation picker: Fix Import from Wrong Package. ([55555](https://github.com/WordPress/gutenberg/pull/55555)) +- @lezama: Editor: Add extensibility to PreviewOptions v2. ([64644](https://github.com/WordPress/gutenberg/pull/64644)) +- @rithik56: Scripts: Added chunk filename in webpack configuration to avoid reading stale files. ([58176](https://github.com/WordPress/gutenberg/pull/58176)) +- @rohitmathur-7: Cover Block: Move Clear Media button from Inspector Controls to Block Controls. ([64630](https://github.com/WordPress/gutenberg/pull/64630)) + + +## Contributors + +The following contributors merged PRs in this release: + +@aaronrobertshaw @afercia @akasunil @Aljullu @andrewserong @atachibana @benoitchantre @carolinan @cbravobernal @ciampo @DAreRodz @dcalhoun @desrosj @dsas @ellatrix @fullofcaffeine @getdave @gziolo @Imran92 @imrraaj @jacobcassidy @jameskoster @jasmussen @jawadmalikdev @jeryj @jorgefilipecosta @jsnajdr @juanmaguitar @kevin940726 @lezama @Mamaduka @matiasbenedetto @mirka @noisysocks @ntsekouras @oandregal @ockham @ramonjd @richtabor @rithik56 @rohitmathur-7 @ryanwelcher @SantosGuillamot @scruffian @sgomes @shail-mehta @spacedmonkey @stokesman @swissspidy @t-hamano @talldan @tjcafferkey @tyxla + + = 19.1.0 = ## Changelog From 57c59d1109f8c475eb2899dd7a4b1d5061a1df69 Mon Sep 17 00:00:00 2001 From: Devansh Chaudhary <58871818+devansh016@users.noreply.github.com> Date: Thu, 5 Sep 2024 23:07:57 +0530 Subject: [PATCH 06/12] Automatically add tel to phone number when linking url (#64865) Co-authored-by: devansh016 Co-authored-by: jeryj Co-authored-by: ajlende --- packages/format-library/src/link/index.js | 9 ++++- packages/url/README.md | 18 +++++++++ packages/url/src/index.js | 1 + packages/url/src/is-phone-number.js | 19 +++++++++ packages/url/src/test/index.js | 47 +++++++++++++++++++++++ 5 files changed, 93 insertions(+), 1 deletion(-) create mode 100644 packages/url/src/is-phone-number.js diff --git a/packages/format-library/src/link/index.js b/packages/format-library/src/link/index.js index ce1af0a36268ec..ef7008451698ae 100644 --- a/packages/format-library/src/link/index.js +++ b/packages/format-library/src/link/index.js @@ -12,7 +12,7 @@ import { insert, create, } from '@wordpress/rich-text'; -import { isURL, isEmail } from '@wordpress/url'; +import { isURL, isEmail, isPhoneNumber } from '@wordpress/url'; import { RichTextToolbarButton, RichTextShortcut, @@ -104,6 +104,13 @@ function Edit( { attributes: { url: `mailto:${ text }` }, } ) ); + } else if ( ! isActive && text && isPhoneNumber( text ) ) { + onChange( + applyFormat( value, { + type: name, + attributes: { url: `tel:${ text.replace( /\D/g, '' ) }` }, + } ) + ); } else { if ( target ) { setOpenedBy( { diff --git a/packages/url/README.md b/packages/url/README.md index 70e8579acc5182..0e4628669d11f2 100644 --- a/packages/url/README.md +++ b/packages/url/README.md @@ -322,6 +322,24 @@ _Returns_ - `boolean`: Whether or not it looks like an email. +### isPhoneNumber + +Determines whether the given string looks like a phone number. + +_Usage_ + +```js +const isPhoneNumber = isPhoneNumber( '+1 (555) 123-4567' ); // true +``` + +_Parameters_ + +- _phoneNumber_ `string`: The string to scrutinize. + +_Returns_ + +- `boolean`: Whether or not it looks like a phone number. + ### isURL Determines whether the given string looks like a URL. diff --git a/packages/url/src/index.js b/packages/url/src/index.js index 141e19d3fa55fd..378334ba131a6a 100644 --- a/packages/url/src/index.js +++ b/packages/url/src/index.js @@ -1,5 +1,6 @@ export { isURL } from './is-url'; export { isEmail } from './is-email'; +export { isPhoneNumber } from './is-phone-number'; export { getProtocol } from './get-protocol'; export { isValidProtocol } from './is-valid-protocol'; export { getAuthority } from './get-authority'; diff --git a/packages/url/src/is-phone-number.js b/packages/url/src/is-phone-number.js new file mode 100644 index 00000000000000..857b468bc52398 --- /dev/null +++ b/packages/url/src/is-phone-number.js @@ -0,0 +1,19 @@ +const PHONE_REGEXP = /^(tel:)?(\+)?\d{6,15}$/; + +/** + * Determines whether the given string looks like a phone number. + * + * @param {string} phoneNumber The string to scrutinize. + * + * @example + * ```js + * const isPhoneNumber = isPhoneNumber('+1 (555) 123-4567'); // true + * ``` + * + * @return {boolean} Whether or not it looks like a phone number. + */ +export function isPhoneNumber( phoneNumber ) { + // Remove any seperator from phone number. + phoneNumber = phoneNumber.replace( /[-.() ]/g, '' ); + return PHONE_REGEXP.test( phoneNumber ); +} diff --git a/packages/url/src/test/index.js b/packages/url/src/test/index.js index bd48105baed96d..4fc3d5e2970d67 100644 --- a/packages/url/src/test/index.js +++ b/packages/url/src/test/index.js @@ -17,6 +17,7 @@ import { hasQueryArg, isEmail, isURL, + isPhoneNumber, isValidAuthority, isValidFragment, isValidPath, @@ -73,6 +74,52 @@ describe( 'isEmail', () => { ); } ); +describe( 'isPhoneNumber', () => { + it.each( [ + '+1 (555) 123-4567', + '(555) 123-4567', + '555-123-4567', + '5551234567', + '+91 987 654 3210', + '123-456-7890', + '(123) 456-7890', + '123 456 7890', + '123.456.7890', + '+1 123 456 7890', + '1234567890', + '+44 791 112 3456', + '(123) 4567', + '+1 (123) 45678901', + '12-34-56', + '123456789012345', + '+12 3456789012345', + 'tel:+1-123-456-7890', + ] )( + 'returns true when given things that look like a phone number: %s', + ( phoneNumber ) => { + expect( isPhoneNumber( phoneNumber ) ).toBe( true ); + } + ); + + it.each( [ + 'not a phone number', + '123', + '1234', + '12345', + '+91 123', + 'abc-def-ghij', + 'a123456789b', + '12-34-5', + 'tel:911', + 'tel:12345', + ] )( + "returns false when given things that don't look like a phone number: %s", + ( phoneNumber ) => { + expect( isPhoneNumber( phoneNumber ) ).toBe( false ); + } + ); +} ); + describe( 'getProtocol', () => { it( 'returns the protocol part of a URL', () => { expect( From 9523fb4a6d568f34a217c9cab45f29413c4904f7 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Thu, 5 Sep 2024 21:24:58 +0200 Subject: [PATCH 07/12] Add new Media section to preferences modal (#64846) --- packages/edit-post/src/index.js | 7 + packages/edit-site/src/index.js | 7 + .../src/components/preferences-modal/index.js | 386 ++++++++++-------- 3 files changed, 228 insertions(+), 172 deletions(-) diff --git a/packages/edit-post/src/index.js b/packages/edit-post/src/index.js index 10f4a9838c8dad..51abac654da295 100644 --- a/packages/edit-post/src/index.js +++ b/packages/edit-post/src/index.js @@ -73,6 +73,13 @@ export function initializeEditor( isPublishSidebarEnabled: true, } ); + if ( window.__experimentalMediaProcessing ) { + dispatch( preferencesStore ).setDefaults( 'core/media', { + requireApproval: true, + optimizeOnUpload: true, + } ); + } + dispatch( blocksStore ).reapplyBlockTypeFilters(); // Check if the block list view should be open by default. diff --git a/packages/edit-site/src/index.js b/packages/edit-site/src/index.js index 9face28c1bfe19..4ed5b96e3844d1 100644 --- a/packages/edit-site/src/index.js +++ b/packages/edit-site/src/index.js @@ -81,6 +81,13 @@ export function initializeEditor( id, settings ) { showListViewByDefault: false, } ); + if ( window.__experimentalMediaProcessing ) { + dispatch( preferencesStore ).setDefaults( 'core/media', { + requireApproval: true, + optimizeOnUpload: true, + } ); + } + dispatch( editSiteStore ).updateSettings( settings ); // Keep the defaultTemplateTypes in the core/editor settings too, diff --git a/packages/editor/src/components/preferences-modal/index.js b/packages/editor/src/components/preferences-modal/index.js index f3378d76d994b2..e7cc637dd0aed0 100644 --- a/packages/editor/src/components/preferences-modal/index.js +++ b/packages/editor/src/components/preferences-modal/index.js @@ -59,212 +59,254 @@ export default function EditorPreferencesModal( { extraSections = {} } ) { const { set: setPreference } = useDispatch( preferencesStore ); const sections = useMemo( - () => [ - { - name: 'general', - tabLabel: __( 'General' ), - content: ( - <> - - - { showBlockBreadcrumbsOption && ( + () => + [ + { + name: 'general', + tabLabel: __( 'General' ), + content: ( + <> + - ) } - - - - - ( - ) } - /> - - - - - - - - - - - - - - { isLargeViewport && ( + - + ( + ) } - label={ __( 'Enable pre-publish checks' ) } /> + + + + + + + + + + + + - ) } - { extraSections?.general } - - ), - }, - { - name: 'appearance', - tabLabel: __( 'Appearance' ), - content: ( - - - setPreference( - 'core', - 'distractionFree', - false - ) - } - help={ __( - 'Access all block and document tools in a single place.' - ) } - label={ __( 'Top toolbar' ) } - /> - { - setPreference( 'core', 'fixedToolbar', true ); - setIsInserterOpened( false ); - setIsListViewOpened( false ); - } } - help={ __( - 'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.' - ) } - label={ __( 'Distraction free' ) } - /> - + + ) } - label={ __( 'Spotlight mode' ) } - /> - { extraSections?.appearance } - - ), - }, - { - name: 'accessibility', - tabLabel: __( 'Accessibility' ), - content: ( - <> + { extraSections?.general } + + ), + }, + { + name: 'appearance', + tabLabel: __( 'Appearance' ), + content: ( + setPreference( + 'core', + 'distractionFree', + false + ) + } help={ __( - 'Keeps the text cursor within the block boundaries, aiding users with screen readers by preventing unintentional cursor movement outside the block.' - ) } - label={ __( - 'Contain text cursor inside block' + 'Access all block and document tools in a single place.' ) } + label={ __( 'Top toolbar' ) } /> - - { + setPreference( + 'core', + 'fixedToolbar', + true + ); + setIsInserterOpened( false ); + setIsListViewOpened( false ); + } } help={ __( - 'Show text instead of icons on buttons across the interface.' + 'Reduce visual distractions by hiding the toolbar and other elements to focus on writing.' ) } + label={ __( 'Distraction free' ) } /> - - - ), - }, - { - name: 'blocks', - tabLabel: __( 'Blocks' ), - content: ( - <> - + { extraSections?.appearance } - - - - - ), - }, - ], + ), + }, + { + name: 'accessibility', + tabLabel: __( 'Accessibility' ), + content: ( + <> + + + + + + + + ), + }, + { + name: 'blocks', + tabLabel: __( 'Blocks' ), + content: ( + <> + + + + + + + + ), + }, + window.__experimentalMediaProcessing && { + name: 'media', + tabLabel: __( 'Media' ), + content: ( + <> + + + + + + ), + }, + ].filter( Boolean ), [ showBlockBreadcrumbsOption, extraSections, From 1a8aa20d057e6bd623d3ff8178b2d67de2845dcc Mon Sep 17 00:00:00 2001 From: Andrew Serong <14988353+andrewserong@users.noreply.github.com> Date: Fri, 6 Sep 2024 16:45:26 +1000 Subject: [PATCH 08/12] Cover: Explicitly set isUserOverlayColor to false when media is updated (#65105) Co-authored-by: andrewserong Co-authored-by: Mamaduka Co-authored-by: talldan Co-authored-by: huubl Co-authored-by: richtabor Co-authored-by: ajlende --- packages/block-library/src/cover/deprecated.js | 5 +++-- packages/block-library/src/cover/edit/index.js | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/block-library/src/cover/deprecated.js b/packages/block-library/src/cover/deprecated.js index c5f430eead685f..5e5fc64d12c16f 100644 --- a/packages/block-library/src/cover/deprecated.js +++ b/packages/block-library/src/cover/deprecated.js @@ -400,8 +400,9 @@ const v12 = { supports: v12BlockSupports, isEligible( attributes ) { return ( - attributes.customOverlayColor !== undefined || - attributes.overlayColor !== undefined + ( attributes.customOverlayColor !== undefined || + attributes.overlayColor !== undefined ) && + attributes.isUserOverlayColor === undefined ); }, migrate( attributes ) { diff --git a/packages/block-library/src/cover/edit/index.js b/packages/block-library/src/cover/edit/index.js index 3f68c08b632ace..ec62bd58a2c33a 100644 --- a/packages/block-library/src/cover/edit/index.js +++ b/packages/block-library/src/cover/edit/index.js @@ -143,7 +143,10 @@ function CoverEdit( { averageBackgroundColor ); __unstableMarkNextChangeAsNotPersistent(); - setAttributes( { isDark: newIsDark } ); + setAttributes( { + isDark: newIsDark, + isUserOverlayColor: isUserOverlayColor || false, + } ); } )(); // Disable reason: Update the block only when the featured image changes. // eslint-disable-next-line react-hooks/exhaustive-deps @@ -201,6 +204,7 @@ function CoverEdit( { useFeaturedImage: undefined, dimRatio: newDimRatio, isDark: newIsDark, + isUserOverlayColor: isUserOverlayColor || false, } ); }; From db44c137bcf9d848f8f95c6a34fd3540866b6006 Mon Sep 17 00:00:00 2001 From: "Joen A." <1204802+jasmussen@users.noreply.github.com> Date: Fri, 6 Sep 2024 09:56:26 +0200 Subject: [PATCH 09/12] Update: Rephrase "Force page reload" and move to Advanced (#65081) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update: Rephrase "Force page reload" and move to Advanced * Linting. * Update help text. * Update packages/block-library/src/query/edit/inspector-controls/enhanced-pagination-control.js Co-authored-by: Greg Ziółkowski * Update packages/block-library/src/query/edit/inspector-controls/enhanced-pagination-control.js --------- Co-authored-by: Greg Ziółkowski Unlinked contributors: jarekmorawski, michaelpick. Co-authored-by: jasmussen Co-authored-by: gziolo Co-authored-by: jameskoster Co-authored-by: richtabor Co-authored-by: carolinan Co-authored-by: afercia Co-authored-by: SantosGuillamot Co-authored-by: luisherranz Co-authored-by: joedolson --- .../src/query/edit/enhanced-pagination-modal.js | 4 ++-- .../inspector-controls/enhanced-pagination-control.js | 6 +++--- .../src/query/edit/inspector-controls/index.js | 11 ++--------- .../block-library/src/query/edit/query-content.js | 7 +++++++ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/block-library/src/query/edit/enhanced-pagination-modal.js b/packages/block-library/src/query/edit/enhanced-pagination-modal.js index f33c45646e536b..38167f7259380c 100644 --- a/packages/block-library/src/query/edit/enhanced-pagination-modal.js +++ b/packages/block-library/src/query/edit/enhanced-pagination-modal.js @@ -42,7 +42,7 @@ export default function EnhancedPaginationModal( { }; let notice = __( - 'If you still want to prevent full page reloads, remove that block, then disable "Force page reload" again in the Query Block settings.' + 'If you still want to prevent full page reloads, remove that block, then disable "Reload full page" again in the Query Block settings.' ); if ( hasBlocksFromPlugins ) { notice = @@ -63,7 +63,7 @@ export default function EnhancedPaginationModal( { return ( isOpen && ( ) } - ) } { ! inherit && showDisplayPanel && ( diff --git a/packages/block-library/src/query/edit/query-content.js b/packages/block-library/src/query/edit/query-content.js index 949ffc653420fe..4624b3b96049e9 100644 --- a/packages/block-library/src/query/edit/query-content.js +++ b/packages/block-library/src/query/edit/query-content.js @@ -18,6 +18,7 @@ import { store as coreStore } from '@wordpress/core-data'; /** * Internal dependencies */ +import EnhancedPaginationControl from './inspector-controls/enhanced-pagination-control'; import QueryToolbar from './query-toolbar'; import QueryInspectorControls from './inspector-controls'; import EnhancedPaginationModal from './enhanced-pagination-modal'; @@ -36,6 +37,7 @@ export default function QueryContent( { queryId, query, displayLayout, + enhancedPagination, tagName: TagName = 'div', query: { inherit } = {}, } = attributes; @@ -161,6 +163,11 @@ export default function QueryContent( { } help={ htmlElementMessages[ TagName ] } /> + From 6bbdd1e649ad5c12f62f2d42c1d22e50e1fc84c5 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Fri, 6 Sep 2024 08:57:59 +0100 Subject: [PATCH 10/12] Zoom Out: Force device type to Desktop whenever zoom out is invoked (#64476) --- packages/editor/src/store/selectors.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/store/selectors.js b/packages/editor/src/store/selectors.js index 8b0dfd4b370c41..f890dcac397326 100644 --- a/packages/editor/src/store/selectors.js +++ b/packages/editor/src/store/selectors.js @@ -1276,9 +1276,15 @@ export function getRenderingMode( state ) { * * @return {string} Device type. */ -export function getDeviceType( state ) { - return state.deviceType; -} +export const getDeviceType = createRegistrySelector( + ( select ) => ( state ) => { + const editorMode = select( blockEditorStore ).__unstableGetEditorMode(); + if ( editorMode === 'zoom-out' ) { + return 'Desktop'; + } + return state.deviceType; + } +); /** * Returns true if the list view is opened. From 7051a8f23d8c2b39a7c6cdc1536ad498d6ce39b0 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Fri, 6 Sep 2024 12:25:28 +0400 Subject: [PATCH 11/12] Block Editor: Remove the 'PrivateInserter' component (#65111) Co-authored-by: Mamaduka Co-authored-by: youknowriad --- .../block-editor/src/components/inserter/index.js | 14 ++++---------- packages/block-editor/src/private-apis.js | 2 -- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/block-editor/src/components/inserter/index.js b/packages/block-editor/src/components/inserter/index.js index d3e7dba0df6838..1af81d0231a1a8 100644 --- a/packages/block-editor/src/components/inserter/index.js +++ b/packages/block-editor/src/components/inserter/index.js @@ -9,7 +9,7 @@ import clsx from 'clsx'; import { speak } from '@wordpress/a11y'; import { __, _x, sprintf } from '@wordpress/i18n'; import { Dropdown, Button } from '@wordpress/components'; -import { forwardRef, Component } from '@wordpress/element'; +import { Component } from '@wordpress/element'; import { withDispatch, withSelect } from '@wordpress/data'; import { compose, ifCondition } from '@wordpress/compose'; import { createBlock, store as blocksStore } from '@wordpress/blocks'; @@ -76,7 +76,7 @@ const defaultRenderToggle = ( { ); }; -class PrivateInserter extends Component { +class Inserter extends Component { constructor() { super( ...arguments ); @@ -222,7 +222,7 @@ class PrivateInserter extends Component { } } -export const ComposedPrivateInserter = compose( [ +export default compose( [ withSelect( ( select, { clientId, rootClientId, shouldDirectInsert = true } ) => { const { @@ -418,10 +418,4 @@ export const ComposedPrivateInserter = compose( [ ( { hasItems, isAppender, rootClientId, clientId } ) => hasItems || ( ! isAppender && ! rootClientId && ! clientId ) ), -] )( PrivateInserter ); - -const Inserter = forwardRef( ( props, ref ) => { - return ; -} ); - -export default Inserter; +] )( Inserter ); diff --git a/packages/block-editor/src/private-apis.js b/packages/block-editor/src/private-apis.js index 404c94940058ad..12f477a95a196b 100644 --- a/packages/block-editor/src/private-apis.js +++ b/packages/block-editor/src/private-apis.js @@ -6,7 +6,6 @@ import { ExperimentalBlockEditorProvider } from './components/provider'; import { lock } from './lock-unlock'; import { getRichTextValues } from './components/rich-text/get-rich-text-values'; import ResizableBoxPopover from './components/resizable-box-popover'; -import { ComposedPrivateInserter as PrivateInserter } from './components/inserter'; import { default as PrivateQuickInserter } from './components/inserter/quick-inserter'; import { extractWords, @@ -60,7 +59,6 @@ lock( privateApis, { ExperimentalBlockEditorProvider, getDuotoneFilter, getRichTextValues, - PrivateInserter, PrivateQuickInserter, extractWords, getNormalizedSearchTerms, From 0fc06de23449b518fa8412d7dcab738c0805df45 Mon Sep 17 00:00:00 2001 From: Vipul Gupta <55375170+vipul0425@users.noreply.github.com> Date: Fri, 6 Sep 2024 14:27:46 +0530 Subject: [PATCH 12/12] Fix: Button Replace remaining 40px default size violations [Block Editor 1]. (#65034) * feat: Adds 40px height in multiple usage warning. * feat: Adds 4px size in invalid warining. * feat: Adds the 40px size in block compare component. * feat: Makes the __next40pxDefaultSize true in block mover and breadcrumbs. * fix: block compare default size. * fix: Invlid warning button size. * fix: Adds size prop to breadcrumb buttons. * fix: Updates the snapshot. * refactor: Removes extra button [custom styles. --- Co-authored-by: vipul0425 Co-authored-by: tyxla Co-authored-by: ciampo Co-authored-by: jameskoster Co-authored-by: jasmussen --- .../src/components/block-breadcrumb/index.js | 8 ++--- .../components/block-breadcrumb/style.scss | 31 +------------------ .../components/block-compare/block-view.js | 3 +- .../test/__snapshots__/block-view.js.snap | 2 +- .../block-edit/multiple-usage-warning.js | 6 ++-- .../block-list/block-invalid-warning.js | 3 +- .../src/components/block-mover/button.js | 3 +- .../src/components/block-mover/index.js | 3 +- 8 files changed, 10 insertions(+), 49 deletions(-) diff --git a/packages/block-editor/src/components/block-breadcrumb/index.js b/packages/block-editor/src/components/block-breadcrumb/index.js index 8a70616d358d9e..440d9611d278be 100644 --- a/packages/block-editor/src/components/block-breadcrumb/index.js +++ b/packages/block-editor/src/components/block-breadcrumb/index.js @@ -66,10 +66,8 @@ function BlockBreadcrumb( { rootLabelText } ) { > { hasSelection && ( ,