From 614e0355500793190d7a94f66a5d4646318abd99 Mon Sep 17 00:00:00 2001 From: Rich Tabor Date: Tue, 23 Jan 2024 14:24:31 -0500 Subject: [PATCH] Reduce LinkControl preview (#57775) * Add offset to LinkControl Popover * Remove additionalControls from preview * Simplify preview * Remove unused test * Revert "Remove unused test" This reverts commit 33491f0ea7a575f8a288b6872c4682dc8be1c4f1. * Add back the new tab control * Tweak offset * fix unit test --------- Co-authored-by: MaggieCabrera --- .../components/link-control/link-preview.js | 65 ++--------- .../src/components/link-control/style.scss | 105 +++++------------- .../src/components/link-control/test/index.js | 3 +- packages/format-library/src/link/inline.js | 1 + 4 files changed, 41 insertions(+), 133 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 && (