LinkControl: refine the display of the link preview title and url #60900
Labels
[Feature] Link Editing
Link components (LinkControl, URLInput) and integrations (RichText link formatting)
[Package] Block editor
/packages/block-editor
[Status] In Progress
Tracking issues with work in progress
[Type] Enhancement
A suggestion for improvement.
Description
Normally, the LinkControl 'link preview' displayes two lines:
displayTitle
, which can be a few things:displayURL
which is the link URL, with the protocol part stripped out.When the rich data info can not be fetched, the 'title' is, normally, the linked text. Screenshot:
When the link text is the same as the
displayURL
, there is some logic in place to avoid to display two lines with the same identical information. That makes totally sense, and only one line is displayed. Screenshot:Without this logic, there would be two lines that would repeat the same, identical, information. Screenshot:
So far, so good.
However, the logic in place doesn't take into account the case when the link text contains the protocol. In this case, the preview displayes both lines and they contain the same information, the only difference is the displayed protocol. Screenshot:
Visually and semantically, in this case the repeated information is redundant. It would be best to show only the
displayTitle
.Step-by-step reproduction instructions
test.org
.test.org
and add a link totest.org
without the protocol part.test.org
.https://test.org
within the text. The pasted link should be automatically transformed to a link. If not, make sure to add a link to it with the valuehttps://test.org
. It doesn't matter whether the URL contains the protocol part.https://test.org
andtest.org
.Screenshots, screen recording, code snippet
No response
Environment info
No response
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: