From 16237112e98f2b3f1db6179026f7a0d469b42ee7 Mon Sep 17 00:00:00 2001 From: Jerry Jones Date: Tue, 14 Jan 2025 09:33:03 -0600 Subject: [PATCH 1/7] Navigation Link UI: Remove onClose from onSelectBlock (#67760) onSelectBlock was being called after from the QuickInserter even if the link ui had already been closed. This results in some weird states due to the function containing old states. There have been updates to this flow around closing the link ui since the code was originally written, and the onClose should be handled by the popover already. Co-authored-by: jeryj Co-authored-by: Mamaduka Co-authored-by: darnado --- packages/block-library/src/navigation-link/link-ui.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/block-library/src/navigation-link/link-ui.js b/packages/block-library/src/navigation-link/link-ui.js index a6c709f260b037..47a8cb99ffdb24 100644 --- a/packages/block-library/src/navigation-link/link-ui.js +++ b/packages/block-library/src/navigation-link/link-ui.js @@ -78,7 +78,7 @@ export function getSuggestionsQuery( type, kind ) { } } -function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) { +function LinkUIBlockInserter( { clientId, onBack } ) { const { rootBlockClientId } = useSelect( ( select ) => { const { getBlockRootClientId } = select( blockEditorStore ); @@ -140,7 +140,6 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) { prioritizePatterns={ false } selectBlockOnInsert hasSearch={ false } - onSelect={ onSelectBlock } /> ); @@ -203,10 +202,6 @@ function UnforwardedLinkUI( props, ref ) { `link-ui-link-control__description` ); - // Selecting a block should close the popover and also remove the (previously) automatically inserted - // link block so that the newly selected block can be inserted in its place. - const { onClose: onSelectBlock } = props; - return ( ) } From 7b6e775e6b557d176e81b0597c4feca665d6dcf4 Mon Sep 17 00:00:00 2001 From: Dhananjay Kuber Date: Wed, 15 Jan 2025 09:22:43 +0530 Subject: [PATCH 2/7] Fix: Site Editor Template part is missing an icon in the sidebar (#68653) Co-authored-by: dhananjaykuber Co-authored-by: Mamaduka Co-authored-by: im3dabasia --- .../editor/src/store/private-selectors.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/packages/editor/src/store/private-selectors.js b/packages/editor/src/store/private-selectors.js index 56fa6728371489..73bf19f3d99937 100644 --- a/packages/editor/src/store/private-selectors.js +++ b/packages/editor/src/store/private-selectors.js @@ -26,6 +26,7 @@ import { getEntityFields as _getEntityFields, isEntityReady as _isEntityReady, } from '../dataviews/store/private-selectors'; +import { getTemplatePartIcon } from '../utils'; const EMPTY_INSERTION_POINT = { rootClientId: undefined, @@ -97,15 +98,21 @@ export const getPostIcon = createRegistrySelector( postType === 'wp_template_part' || postType === 'wp_template' ) { - return ( - ( - select( coreStore ).getEntityRecord( - 'root', - '__unstableBase' - )?.default_template_part_areas || [] - ).find( ( item ) => options.area === item.area )?.icon || - layout + const templateAreas = + select( coreStore ).getEntityRecord( + 'root', + '__unstableBase' + )?.default_template_part_areas || []; + + const areaData = templateAreas.find( + ( item ) => options.area === item.area ); + + if ( areaData?.icon ) { + return getTemplatePartIcon( areaData.icon ); + } + + return layout; } if ( CARD_ICONS[ postType ] ) { return CARD_ICONS[ postType ]; From 8ba15b197b469fe40541eb1174f163c2640afe89 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 15 Jan 2025 09:19:41 +0400 Subject: [PATCH 3/7] Social Links: Don't prepend URL fragments (#68655) Co-authored-by: Mamaduka Co-authored-by: t-hamano --- packages/block-library/src/social-link/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/social-link/index.php b/packages/block-library/src/social-link/index.php index da28034f5a55d2..f241daff2a11a8 100644 --- a/packages/block-library/src/social-link/index.php +++ b/packages/block-library/src/social-link/index.php @@ -42,9 +42,9 @@ function render_block_core_social_link( $attributes, $content, $block ) { /** * Prepend URL with https:// if it doesn't appear to contain a scheme - * and it's not a relative link starting with //. + * and it's not a relative link or a fragment. */ - if ( ! parse_url( $url, PHP_URL_SCHEME ) && ! str_starts_with( $url, '//' ) ) { + if ( ! parse_url( $url, PHP_URL_SCHEME ) && ! str_starts_with( $url, '//' ) && ! str_starts_with( $url, '#' ) ) { $url = 'https://' . $url; } From 184f179674b6ddc154092b640b84dad6e156b1fa Mon Sep 17 00:00:00 2001 From: Yogesh Bhutkar Date: Wed, 15 Jan 2025 13:05:43 +0530 Subject: [PATCH 4/7] Duotone: Fix scrollbars displayed on Duotone Control (#67187) Co-authored-by: yogeshbhutkar Co-authored-by: Mamaduka Co-authored-by: t-hamano --- .../block-editor/src/components/duotone-control/style.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/duotone-control/style.scss b/packages/block-editor/src/components/duotone-control/style.scss index 3a3a5a143289b8..35808339462392 100644 --- a/packages/block-editor/src/components/duotone-control/style.scss +++ b/packages/block-editor/src/components/duotone-control/style.scss @@ -4,11 +4,11 @@ $swatch-size: 28px; $swatch-gap: 12px; $popover-width: 260px; -$popover-padding: $grid-unit-20; +$popover-padding: $grid-unit-10; $swatch-columns: math.floor(math.div($popover-width + $swatch-gap - 2 * $popover-padding, $swatch-size + $swatch-gap)); -.block-editor-duotone-control__popover { +.block-editor-duotone-control__popover.components-popover { > .components-popover__content { padding: $popover-padding; width: $popover-width; From 6940e888cbbee17b0f4d9569d473f1604f7896a5 Mon Sep 17 00:00:00 2001 From: Eshaan Dabasiya <76681468+im3dabasia@users.noreply.github.com> Date: Wed, 15 Jan 2025 13:55:46 +0530 Subject: [PATCH 5/7] Nux: Standardize reduced motion handling using media queries (#68423) * Nux: Standardize reduced motion handling using media queries * style: Remove unwanted CSS changes Co-authored-by: im3dabasia Co-authored-by: t-hamano --- packages/nux/src/components/dot-tip/style.scss | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/nux/src/components/dot-tip/style.scss b/packages/nux/src/components/dot-tip/style.scss index 3ab0c1a540fd5a..87b4546b64f62c 100644 --- a/packages/nux/src/components/dot-tip/style.scss +++ b/packages/nux/src/components/dot-tip/style.scss @@ -12,7 +12,6 @@ $dot-scale: 3; // How much the pulse animation should scale up by in size } &::before { - animation: nux-pulse 1.6s infinite cubic-bezier(0.17, 0.67, 0.92, 0.62); background: rgba(#00739c, 0.9); opacity: 0.9; height: $dot-size * $dot-scale; @@ -20,6 +19,10 @@ $dot-scale: 3; // How much the pulse animation should scale up by in size top: -($dot-size * $dot-scale) * 0.5; transform: scale(math.div(1, $dot-scale)); width: $dot-size * $dot-scale; + + @media not (prefers-reduced-motion) { + animation: nux-pulse 1.6s infinite cubic-bezier(0.17, 0.67, 0.92, 0.62); + } } &::after { From 4085555f8acb3d827539507810ebfc7d1f6d76f1 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Wed, 15 Jan 2025 18:35:58 +0900 Subject: [PATCH 6/7] Fix flaky navigation-frontend-interactivity e2e tests (#68667) Co-authored-by: t-hamano Co-authored-by: Mamaduka --- .../src/admin/visit-site-editor.ts | 27 ++++++++++++------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts b/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts index 1e79a30306e4c7..bc6e3e23d078b5 100644 --- a/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts +++ b/packages/e2e-test-utils-playwright/src/admin/visit-site-editor.ts @@ -61,15 +61,22 @@ export async function visitSiteEditor( '.edit-site-canvas-loader, .edit-site-canvas-spinner' ); - // Wait for the canvas loader to appear first, so that the locator that - // waits for the hidden state doesn't resolve prematurely. - await canvasLoader.waitFor( { state: 'visible', timeout: 60_000 } ); - await canvasLoader.waitFor( { - state: 'hidden', - // Bigger timeout is needed for larger entities, like the Large Post - // HTML fixture that we load for performance tests, which often - // doesn't make it under the default timeout value. - timeout: 60_000, - } ); + try { + // Wait for the canvas loader to appear first, so that the locator that + // waits for the hidden state doesn't resolve prematurely. + await canvasLoader.waitFor( { state: 'visible', timeout: 60_000 } ); + await canvasLoader.waitFor( { + state: 'hidden', + // Bigger timeout is needed for larger entities, like the Large Post + // HTML fixture that we load for performance tests, which often + // doesn't make it under the default timeout value. + timeout: 60_000, + } ); + } catch ( error ) { + // If the canvas loader is already disappeared, skip the waiting. + await this.page + .getByRole( 'region', { name: 'Editor content' } ) + .waitFor(); + } } } From 5a5455cb6f7633ececc00559b7a407b42f4874d6 Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Wed, 15 Jan 2025 13:41:25 +0400 Subject: [PATCH 7/7] Editor: Update data selector in 'PostPreviewButton' (#68678) Co-authored-by: Mamaduka Co-authored-by: t-hamano Co-authored-by: im3dabasia Co-authored-by: dhananjaykuber --- packages/editor/src/components/post-preview-button/index.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/editor/src/components/post-preview-button/index.js b/packages/editor/src/components/post-preview-button/index.js index d1755f96b68615..0429ce691b4f17 100644 --- a/packages/editor/src/components/post-preview-button/index.js +++ b/packages/editor/src/components/post-preview-button/index.js @@ -129,13 +129,17 @@ export default function PostPreviewButton( { const postType = core.getPostType( editor.getCurrentPostType( 'type' ) ); + const canView = postType?.viewable ?? false; + if ( ! canView ) { + return { isViewable: canView }; + } return { postId: editor.getCurrentPostId(), currentPostLink: editor.getCurrentPostAttribute( 'link' ), previewLink: editor.getEditedPostPreviewLink(), isSaveable: editor.isEditedPostSaveable(), - isViewable: postType?.viewable ?? false, + isViewable: canView, }; }, [] );