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

Break long URLs in blog post show #3018

Merged
merged 1 commit into from Dec 28, 2020

Conversation

tordans
Copy link
Contributor

@tordans tordans commented Dec 27, 2020

This uses https://getbootstrap.com/docs/4.4/utilities/text/#word-break to break long URLs on the blog post show view.

Example case: https://www.openstreetmap.org/user/tordans/diary/395215

Screenshot before:

Bildschirmfoto 2020-12-27 um 14 16 15 Kopie

Screenshot after:

Bildschirmfoto 2020-12-27 um 14 20 40 Kopie

An alternativ solution would be this custom CSS:

.diary_post .richtext {
    margin-top: $lineheight;
    // Prevent long URLs from breaking out of the container
    // https://css-tricks.com/snippets/css/prevent-long-urls-from-breaking-out-of-container/
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;  
  }

For example on the blog post show page.

This uses https://getbootstrap.com/docs/4.4/utilities/text/#word-break to break long URLs on the blog post show view.
@tordans
Copy link
Contributor Author

tordans commented Dec 27, 2020

JFYI, I noticed that I committed only one case where .richtext was used; I updated the PR to add the helper class to all cases. IMO there is no downside to this since all those places could have too long URLs

@gravitystorm
Copy link
Collaborator

JFYI, I noticed that I committed only one case where .richtext was used; I updated the PR to add the helper class to all cases.

Excellent, thank you! This is exactly what I would look for in a PR like this - figuring out the correct bootstrap class to us (in preference to custom CSS) and also applying the same solution to all similar situations elsewhere in the codebase.

@gravitystorm gravitystorm merged commit 4189e15 into openstreetmap:master Dec 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants