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

URL: Enhance the way long URLs are handled in filterURLForDisplay #27530

Merged
merged 4 commits into from
Dec 22, 2020

Conversation

hsingyuc
Copy link
Contributor

@hsingyuc hsingyuc commented Dec 6, 2020

Description

Fix #21100
Add an argument to truncate the URL by max length.

How has this been tested?

Additional tests were added to the url/src/test/index.tests.js file.

Screenshots

truncated url

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Dec 6, 2020
@gziolo gziolo added [Package] Url /packages/url [Type] Enhancement A suggestion for improvement. labels Dec 6, 2020
@gziolo
Copy link
Member

gziolo commented Dec 21, 2020

Thank you for your contribution. I like this proposal, it improves the experience when presenting the URL.

Could you refresh this branch because I see some CI checks failing. I hope it was only intermittent failures inherited from the main development branch. I see that all newly added unit tests pass so this should be good to go. By the way, excellent job covering new functionality with tests.

@gziolo gziolo changed the title Fix/21100 URL: Enhance the way long URLs are handled in filterURLForDisplay Dec 21, 2020
Copy link
Member

@gziolo gziolo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I must admit that the logic introduced is very complex, but the issue isn't simple as well. Fortunately, the tests added made me comfortable accepting this PR.

Let's land this enhancement. Thank you 🎉

@gziolo gziolo merged commit f2f89ed into WordPress:master Dec 22, 2020
@github-actions
Copy link

Congratulations on your first merged pull request, @hsingyuc! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 9.7 milestone Dec 22, 2020
lipemat added a commit to lipemat/types-js-boilerplate that referenced this pull request Jan 7, 2021
@wordpress/url: Add a maxLength argument to filterURLForDisplay. (27530)

WordPress/gutenberg#27530
@hsingyuc hsingyuc deleted the fix/21100 branch March 17, 2021 21:56
@Mamaduka Mamaduka mentioned this pull request Sep 7, 2021
3 tasks
@kvf420
Copy link

kvf420 commented May 25, 2023

This improvement should be extended to other file types. Currently, any long URL that isn't an image creates horizontal scrolling in the popover making edit button inaccessible.

Screenshot 2023-05-25 at 10 39 36 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Package] Url /packages/url [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ MediaReplaceFlow ] Truncate the URL in the middle
3 participants