From 026179d9aab86fee74e36c6f6c1053d076387060 Mon Sep 17 00:00:00 2001 From: Rich Tabor Date: Thu, 11 Jan 2024 13:47:37 -0500 Subject: [PATCH 1/8] Add offset to LinkControl Popover --- packages/format-library/src/link/inline.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/format-library/src/link/inline.js b/packages/format-library/src/link/inline.js index 58da13eb51ab6b..0486bb36f97781 100644 --- a/packages/format-library/src/link/inline.js +++ b/packages/format-library/src/link/inline.js @@ -257,6 +257,7 @@ function InlineLinkUI( { onClose={ stopAddingLink } onFocusOutside={ () => stopAddingLink( false ) } placement="bottom" + offset={ 8 } shift > Date: Thu, 11 Jan 2024 13:48:03 -0500 Subject: [PATCH 2/8] Remove additionalControls from preview --- .../src/components/link-control/index.js | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/packages/block-editor/src/components/link-control/index.js b/packages/block-editor/src/components/link-control/index.js index a208fa20d242ff..824bf4aaced465 100644 --- a/packages/block-editor/src/components/link-control/index.js +++ b/packages/block-editor/src/components/link-control/index.js @@ -427,25 +427,6 @@ function LinkControl( { onEditClick={ () => setIsEditingLink( true ) } hasRichPreviews={ hasRichPreviews } hasUnlinkControl={ shownUnlinkControl } - additionalControls={ () => { - // Expose the "Opens in new tab" settings in the preview - // as it is the most common setting to change. - if ( - settings?.find( - ( setting ) => setting.id === 'opensInNewTab' - ) - ) { - return ( - id === 'opensInNewTab' - ) } - onChange={ onChange } - /> - ); - } - } } onRemove={ () => { onRemove(); setIsEditingLink( true ); From 41cd291d6856841879502dfafbeaca54fffd34db Mon Sep 17 00:00:00 2001 From: Rich Tabor Date: Thu, 11 Jan 2024 13:55:43 -0500 Subject: [PATCH 3/8] Simplify preview --- .../components/link-control/link-preview.js | 65 ++--------- .../src/components/link-control/style.scss | 105 +++++------------- 2 files changed, 38 insertions(+), 132 deletions(-) diff --git a/packages/block-editor/src/components/link-control/link-preview.js b/packages/block-editor/src/components/link-control/link-preview.js index 04a67d44789948..5a5a30969d013c 100644 --- a/packages/block-editor/src/components/link-control/link-preview.js +++ b/packages/block-editor/src/components/link-control/link-preview.js @@ -10,7 +10,7 @@ import { __ } from '@wordpress/i18n'; import { Button, ExternalLink, - __experimentalText as Text, + __experimentalTruncate as Truncate, Tooltip, } from '@wordpress/components'; import { filterURLForDisplay, safeDecodeURI } from '@wordpress/url'; @@ -41,7 +41,7 @@ export default function LinkPreview( { const hasRichData = richData && Object.keys( richData ).length; const displayURL = - ( value && filterURLForDisplay( safeDecodeURI( value.url ), 16 ) ) || + ( value && filterURLForDisplay( safeDecodeURI( value.url ), 24 ) ) || ''; // url can be undefined if the href attribute is unset @@ -88,21 +88,21 @@ export default function LinkPreview( { { ! isEmptyURL ? ( <> - + - { displayTitle } + + { displayTitle } + - { value?.url && displayTitle !== displayURL && ( - { displayURL } + + { displayURL } + ) } @@ -119,7 +119,7 @@ export default function LinkPreview( { label={ __( 'Edit' ) } className="block-editor-link-control__search-item-action" onClick={ onEditClick } - iconSize={ 24 } + size="compact" /> { hasUnlinkControl && (