Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Link UI briefly shows unwanted rich preview for internal URLs #32657

Closed
getdave opened this issue Jun 14, 2021 · 1 comment · Fixed by #32658
Closed

Link UI briefly shows unwanted rich preview for internal URLs #32657

getdave opened this issue Jun 14, 2021 · 1 comment · Fixed by #32658
Assignees
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Type] Bug An existing feature does not function as intended

Comments

@getdave
Copy link
Contributor

getdave commented Jun 14, 2021

Description

Due to the introduction of loading placeholders towards the end of #31464, internal URLs will now briefly showing a "loading" state. This is not desirable.

This PR fixes this by testing against a base URL which is used to test if the URL being previewed is an internal URL. If it is then we bail out.

This baseURL has been added to the @wordpress/editor block editor settings as we cannot apply the test directly in as this must remain WordPress agnostic. Note however, that the concept of a internal URL applies to all types of application.

Step-by-step reproduction instructions

  1. Create link to internal URL (ie: a Page or Post).
  2. Click on link again to see preview.
  3. See brief loading UI flash up.

Expected behaviour

Should not show any rich preview loading state (or otherwise) for internal URLs.

Actual behaviour

Shows a briefly "loading" UI for rich previews even if the URL is internal.

Screenshots or screen recording (optional)

Screen Capture on 2021-06-11 at 09-30-22

Code snippet (optional)

WordPress information

  • WordPress version:
  • Gutenberg version:
  • Are all plugins except Gutenberg deactivated?
  • Are you using a default theme (e.g. Twenty Twenty-One)?

Device information

  • Device:
  • Operating system:
  • Browser:
@getdave getdave self-assigned this Jun 14, 2021
@getdave getdave added [Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Type] Bug An existing feature does not function as intended labels Jun 14, 2021
@getdave
Copy link
Contributor Author

getdave commented Jun 14, 2021

One means to solve this - which I'm currently working on - is to make the whole concept of "rich previews" less focused on external URLs and more just a generic thing for all types of URLs.

By doing this we can abstract away some of the complexity and it will make the previews easier to extend to support internal previews in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Link Editing Link components (LinkControl, URLInput) and integrations (RichText link formatting) [Type] Bug An existing feature does not function as intended
Projects
None yet
1 participant