From f2cef4a9744418174de32b9974f347a839041511 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Wed, 17 Jul 2024 15:55:39 +0200 Subject: [PATCH 1/5] Improve PostURL terminology and accessibility. --- .../editor/src/components/post-url/index.js | 145 ++++++++++-------- .../editor/src/components/post-url/panel.js | 85 ++++++---- .../editor/src/components/post-url/style.scss | 24 ++- 3 files changed, 155 insertions(+), 99 deletions(-) diff --git a/packages/editor/src/components/post-url/index.js b/packages/editor/src/components/post-url/index.js index 8d072fa2eeb5d2..1f86bade40279e 100644 --- a/packages/editor/src/components/post-url/index.js +++ b/packages/editor/src/components/post-url/index.js @@ -17,7 +17,7 @@ import { import { store as noticesStore } from '@wordpress/notices'; import { copySmall } from '@wordpress/icons'; import { store as coreStore } from '@wordpress/core-data'; -import { useCopyToClipboard } from '@wordpress/compose'; +import { useCopyToClipboard, useInstanceId } from '@wordpress/compose'; /** * Internal dependencies @@ -70,87 +70,96 @@ export default function PostURL( { onClose } ) { const { createNotice } = useDispatch( noticesStore ); const [ forceEmptyField, setForceEmptyField ] = useState( false ); const copyButtonRef = useCopyToClipboard( permalink, () => { - createNotice( 'info', __( 'Copied URL to clipboard.' ), { + createNotice( 'info', __( 'Copied Permalink to clipboard.' ), { isDismissible: true, type: 'snackbar', } ); } ); + const postUrlSlugDescriptionId = + 'editor-post-url__slug-descriotion-' + useInstanceId( PostURL ); + return (
{ isEditable && ( -
- { createInterpolateElement( - __( - 'Customize the last part of the URL. Learn more.' - ), - { - a: ( - - ), - } - ) } -
+

+ + { __( + 'Customize the last part of the Permalink.' + ) } + + + { __( 'Learn more.' ) } + +

) }
{ isEditable && ( - - / - - } - suffix={ - - ); } + +function FrontPageLink() { + const { postLink } = useSelect( ( select ) => { + const { getCurrentPost } = select( editorStore ); + return { + postLink: getCurrentPost()?.link, + }; + }, [] ); + + return ( + + { postLink } + + ); +} diff --git a/packages/editor/src/components/post-url/style.scss b/packages/editor/src/components/post-url/style.scss index c815f89682cb2d..b6e9c510d2bc4b 100644 --- a/packages/editor/src/components/post-url/style.scss +++ b/packages/editor/src/components/post-url/style.scss @@ -9,14 +9,19 @@ } /* rtl:begin:ignore */ -.editor-post-url__link { +.editor-post-url__link, +.editor-post-url__front-page-link { direction: ltr; word-break: break-word; - margin-top: $grid-unit-05; - color: $gray-700; } /* rtl:end:ignore */ +.editor-post-url__front-page-link { + // Match padding on tertiary buttons for alignment. + padding: $grid-unit-15 * 0.5 0 $grid-unit-15 * 0.5 $grid-unit-15; +} + + .editor-post-url__link-slug { font-weight: 600; } @@ -30,3 +35,16 @@ .editor-post-url__panel-toggle { word-break: break-word; } + +.editor-post-url__intro { + margin-bottom: 0; +} + +.editor-post-url__permalink { + margin-top: $grid-unit-10; + margin-bottom: 0; + + &-visual-label { + display: block; + } +} From f259d6a791de5f5eefa027e3f980618e2c8d15de Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 10 Sep 2024 15:57:08 +0200 Subject: [PATCH 2/5] Restore createInterpolateElement after rebase. --- .../editor/src/components/post-url/index.js | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/packages/editor/src/components/post-url/index.js b/packages/editor/src/components/post-url/index.js index 1f86bade40279e..55e2f953cf00a7 100644 --- a/packages/editor/src/components/post-url/index.js +++ b/packages/editor/src/components/post-url/index.js @@ -87,18 +87,21 @@ export default function PostURL( { onClose } ) { { isEditable && (

- - { __( - 'Customize the last part of the Permalink.' - ) } - - - { __( 'Learn more.' ) } - + { createInterpolateElement( + __( + 'Customize the last part of the URL. Learn more.' + ), + { + span: , + a: ( + + ), + } + ) }

) }
From 3b181284d15dfd86cfbf4f874b5a806f01c074d9 Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Tue, 10 Sep 2024 15:59:08 +0200 Subject: [PATCH 3/5] Remove value truncation after PR 64053. --- packages/editor/src/components/post-url/panel.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/editor/src/components/post-url/panel.js b/packages/editor/src/components/post-url/panel.js index a824f3d92d24e4..a5d3ddeb77f846 100644 --- a/packages/editor/src/components/post-url/panel.js +++ b/packages/editor/src/components/post-url/panel.js @@ -3,12 +3,7 @@ */ import { useMemo, useState } from '@wordpress/element'; import { useSelect } from '@wordpress/data'; -import { - Dropdown, - Button, - ExternalLink, - __experimentalTruncate as Truncate, -} from '@wordpress/components'; +import { Dropdown, Button, ExternalLink } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; import { safeDecodeURIComponent } from '@wordpress/url'; import { store as coreStore } from '@wordpress/core-data'; @@ -102,7 +97,7 @@ function PostURLToggle( { isOpen, onClick } ) { aria-label={ sprintf( __( 'Change link: %s' ), decodedSlug ) } onClick={ onClick } > - { decodedSlug } + <>{ decodedSlug } ); } From 85579bf7ad7ce759752323f4d8f6db475679a4eb Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Fri, 4 Oct 2024 14:19:12 +0200 Subject: [PATCH 4/5] Replace term URL with Permalink. --- packages/editor/src/components/post-url/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/components/post-url/index.js b/packages/editor/src/components/post-url/index.js index 55e2f953cf00a7..c7dc5712dcac4a 100644 --- a/packages/editor/src/components/post-url/index.js +++ b/packages/editor/src/components/post-url/index.js @@ -89,7 +89,7 @@ export default function PostURL( { onClose } ) {

{ createInterpolateElement( __( - 'Customize the last part of the URL. Learn more.' + 'Customize the last part of the Permalink. Learn more.' ), { span: , From 6c16cec0b33d933861d4383e28f245516a9954ea Mon Sep 17 00:00:00 2001 From: Andrea Fercia Date: Mon, 14 Oct 2024 12:08:50 +0200 Subject: [PATCH 5/5] Reduce post url intro text top margin. --- packages/editor/src/components/post-url/style.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/editor/src/components/post-url/style.scss b/packages/editor/src/components/post-url/style.scss index b6e9c510d2bc4b..f8a70f5fdf760b 100644 --- a/packages/editor/src/components/post-url/style.scss +++ b/packages/editor/src/components/post-url/style.scss @@ -37,7 +37,7 @@ } .editor-post-url__intro { - margin-bottom: 0; + margin: 0; } .editor-post-url__permalink {