From a17fa129d40050d703550527016069f6c3219d57 Mon Sep 17 00:00:00 2001 From: tellthemachines Date: Tue, 9 Apr 2024 14:59:03 +1000 Subject: [PATCH] Cherry-picked bug fixes for 6.5.1 (#60577) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Font Library: Reset notices when navigating away from the collection (#59981) Co-authored-by: Mamaduka Co-authored-by: mikachan Co-authored-by: annezazu Co-authored-by: madhusudhand * Pattern Explorer: Pass 'rootClientId' to the pattern list (#60014) Co-authored-by: Mamaduka Co-authored-by: t-hamano Co-authored-by: dsas * Fix lightbox UI disallow editing (#59890) * Check that lightbox can be edited before rendering lightbox UI * Refactor to reduce duplicate code * Fix and clarify component rendering logic Fix issue wherein lightbox popover was rendering erroneously when a link had been configured. * Reset lightbox attributes when removing link * Show lightbox UI if block-level override differs from default In some cases, such as when lightbox settings already exist for a block when global lightbox settings in theme.json change, we should allow users to see the lightbox UI and change the settings if they conflict with the global settings, even if the lightbox UI is disabled globally. This prevents a block from getting stuck with legacy lightbox settings and allows users to reset the block-level lightbox settings if need be in these edge cases. Note: We do not display the UI if the block-level settings exist and match the global settings, as the block will behave as expected in those circumstances and showing the UI in those circumstances would likely just be confusing. * Handle edge case of removing existing link when lightbox is fully enabled * Fix focus loss preventing end-to-end test from passing * Add link to PR in comment Co-authored-by: artemiomorales Co-authored-by: michalczaplinski Co-authored-by: justintadlock Co-authored-by: annezazu Co-authored-by: gziolo Co-authored-by: t-hamano Co-authored-by: jeherve * Only show inserter in document tools if DFM is off (#60426) Co-authored-by: draganescu Co-authored-by: youknowriad * only show inserter in document tools if DFM is off * remove useless CSS hiding the inserter in DFM whcih is not rendered anymore * Fix don't close overlay menu when focus leaves submenu (#60406) Co-authored-by: fabiankaegy Co-authored-by: c4rl0sbr4v0 Co-authored-by: Mamaduka Co-authored-by: annezazu * Fix experimental useHasRecursion deprecation (#60451) Unlinked contributors: albanyacademy. Co-authored-by: talldan Co-authored-by: andrewserong Co-authored-by: ramonjd * Fix pattern block recursion handling (#60452) - Trigger recursion short circuit as early as possible before any other effects that can reason about inner blocks have run. - Use separate wrapper components to do this to satisfy the rule of hooks. Co-authored-by: talldan Co-authored-by: ramonjd Co-authored-by: andrewserong * remove alpha from edit post header (#60431) * Update the query block to permit non-core interactive blocks (#60006) * updated the query block to permit non-core interactive blocks * updated logic to correctly check all blocks inside the query support interactivity * removed check for core blocks * updated variable names and modal message per feedback * renamed variable blockSupportsInteractivityBool to blockSupportsInteractivity Unlinked contributors: poof86. Co-authored-by: colinduwe Co-authored-by: cbravobernal Co-authored-by: gziolo Co-authored-by: sethrubenstein Co-authored-by: colorful-tones * Add context to 'Library' string (#60520) Co-authored-by: ocean90 Co-authored-by: t-hamano * DateTimePicker: Change day button size back from 32px to 28px (#59990) * DateTimePicker: Change day button size back from 32px to 28px * Update changelog Co-authored-by: t-hamano Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: annezazu Co-authored-by: getdave * Avoid overriding custom settings on font library save (#60438) Co-authored-by: matiasbenedetto Co-authored-by: youknowriad Co-authored-by: mikachan Co-authored-by: creativecoder Co-authored-by: desrosj Co-authored-by: estelaris Co-authored-by: YanCol --------- Co-authored-by: George Mamadashvili Co-authored-by: Mamaduka Co-authored-by: mikachan Co-authored-by: annezazu Co-authored-by: madhusudhand Co-authored-by: t-hamano Co-authored-by: dsas Co-authored-by: Artemio Morales Co-authored-by: artemiomorales Co-authored-by: michalczaplinski Co-authored-by: justintadlock Co-authored-by: gziolo Co-authored-by: jeherve Co-authored-by: Andrei Draganescu Co-authored-by: Fabian Kägy Co-authored-by: fabiankaegy Co-authored-by: c4rl0sbr4v0 Co-authored-by: Daniel Richards Co-authored-by: talldan Co-authored-by: andrewserong Co-authored-by: ramonjd Co-authored-by: colinduwe Co-authored-by: colinduwe Co-authored-by: sethrubenstein Co-authored-by: colorful-tones Co-authored-by: Dominik Schilling Co-authored-by: ocean90 Co-authored-by: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Co-authored-by: mirka <0mirka00@git.wordpress.org> Co-authored-by: getdave Co-authored-by: Matias Benedetto Co-authored-by: matiasbenedetto Co-authored-by: youknowriad Co-authored-by: creativecoder Co-authored-by: desrosj Co-authored-by: estelaris Co-authored-by: YanCol --- .../inserter/block-patterns-explorer/index.js | 1 + .../block-patterns-explorer/pattern-list.js | 8 +- .../components/recursion-provider/index.js | 4 +- .../url-popover/image-url-input-ui.js | 119 ++++++++++-------- packages/block-library/src/block/edit.js | 44 +++++-- packages/block-library/src/image/image.js | 22 +++- packages/block-library/src/navigation/view.js | 5 +- .../query/edit/enhanced-pagination-modal.js | 2 +- packages/block-library/src/query/utils.js | 25 +++- packages/components/CHANGELOG.md | 7 ++ .../components/src/date-time/date/styles.ts | 4 +- .../src/components/header/style.scss | 4 +- .../font-library-modal/context.js | 107 ++++++++++------ .../font-library-modal/font-collection.js | 1 + .../global-styles/font-library-modal/index.js | 4 +- .../font-library-modal/installed-fonts.js | 5 +- .../push-changes-to-global-styles/index.js | 41 +----- .../edit-site/src/utils/set-nested-value.js | 39 ++++++ .../src/components/document-tools/index.js | 30 ++--- 19 files changed, 297 insertions(+), 175 deletions(-) create mode 100644 packages/edit-site/src/utils/set-nested-value.js diff --git a/packages/block-editor/src/components/inserter/block-patterns-explorer/index.js b/packages/block-editor/src/components/inserter/block-patterns-explorer/index.js index 82e8a4435b032..bd4bccffd4e81 100644 --- a/packages/block-editor/src/components/inserter/block-patterns-explorer/index.js +++ b/packages/block-editor/src/components/inserter/block-patterns-explorer/index.js @@ -41,6 +41,7 @@ function PatternsExplorer( { initialCategory, rootClientId } ) { selectedCategory={ selectedCategory } patternCategories={ patternCategories } patternSourceFilter={ patternSourceFilter } + rootClientId={ rootClientId } /> ); diff --git a/packages/block-editor/src/components/inserter/block-patterns-explorer/pattern-list.js b/packages/block-editor/src/components/inserter/block-patterns-explorer/pattern-list.js index 217f3f21b573d..a5e43c2c6bf87 100644 --- a/packages/block-editor/src/components/inserter/block-patterns-explorer/pattern-list.js +++ b/packages/block-editor/src/components/inserter/block-patterns-explorer/pattern-list.js @@ -47,10 +47,16 @@ function PatternsListHeader( { filterValue, filteredBlockPatternsLength } ) { ); } -function PatternList( { searchValue, selectedCategory, patternCategories } ) { +function PatternList( { + searchValue, + selectedCategory, + patternCategories, + rootClientId, +} ) { const container = useRef(); const debouncedSpeak = useDebounce( speak, 500 ); const [ destinationRootClientId, onInsertBlocks ] = useInsertionPoint( { + rootClientId, shouldFocusBlock: true, } ); const [ patterns, , onClickPattern ] = usePatternsState( diff --git a/packages/block-editor/src/components/recursion-provider/index.js b/packages/block-editor/src/components/recursion-provider/index.js index 4f462cb33ef2a..98a2b5c546f2b 100644 --- a/packages/block-editor/src/components/recursion-provider/index.js +++ b/packages/block-editor/src/components/recursion-provider/index.js @@ -92,10 +92,10 @@ export const DeprecatedExperimentalRecursionProvider = ( props ) => { return ; }; -export const DeprecatedExperimentalUseHasRecursion = ( props ) => { +export const DeprecatedExperimentalUseHasRecursion = ( ...args ) => { deprecated( 'wp.blockEditor.__experimentalUseHasRecursion', { since: '6.5', alternative: 'wp.blockEditor.useHasRecursion', } ); - return useHasRecursion( ...props ); + return useHasRecursion( ...args ); }; diff --git a/packages/block-editor/src/components/url-popover/image-url-input-ui.js b/packages/block-editor/src/components/url-popover/image-url-input-ui.js index ae59daa1f502b..a7b40b42f6dd7 100644 --- a/packages/block-editor/src/components/url-popover/image-url-input-ui.js +++ b/packages/block-editor/src/components/url-popover/image-url-input-ui.js @@ -46,6 +46,7 @@ const ImageURLInputUI = ( { showLightboxSetting, lightboxEnabled, onSetLightbox, + resetLightbox, } ) => { const [ isOpen, setIsOpen ] = useState( false ); // Use internal state instead of a ref to make sure that the component @@ -241,7 +242,9 @@ const ImageURLInputUI = ( { ); const linkEditorValue = urlInput !== null ? urlInput : url; - const showLinkEditor = ( ! linkEditorValue && ! lightboxEnabled ) === true; + const hideLightboxPanel = + ! lightboxEnabled || ( lightboxEnabled && ! showLightboxSetting ); + const showLinkEditor = ! linkEditorValue && hideLightboxPanel; const urlLabel = ( getLinkDestinations().find( @@ -249,6 +252,65 @@ const ImageURLInputUI = ( { ) || {} ).title; + const PopoverChildren = () => { + if ( + lightboxEnabled && + showLightboxSetting && + ! url && + ! isEditingLink + ) { + return ( +
+ +
+

{ __( 'Expand on click' ) }

+

+ { __( 'Scales the image with a lightbox effect' ) } +

+
+
+ ); + } else if ( ! url || isEditingLink ) { + return ( + + ); + } else if ( url && ! isEditingLink ) { + return ( + <> + +