Skip to content

Commit

Permalink
Fix link control link preview when it displays long URLs. (#60890)
Browse files Browse the repository at this point in the history
* Fix link control link preview when it displays long URLs.

* Add changelog entry.

* Fix changelot entry reference.

Co-authored-by: afercia <afercia@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
  • Loading branch information
3 people authored Apr 19, 2024
1 parent 058cc37 commit 8ff4af6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/components/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

### Bug Fix

- `Truncate`: Fix link control link preview when it displays long URLs ([#60890](https://github.com/WordPress/gutenberg/pull/60890)).

- `ProgressBar`: Fix CSS variable with invalid value ([#60576](https://github.com/WordPress/gutenberg/pull/60576)).

### Experimental
Expand Down
4 changes: 4 additions & 0 deletions packages/components/src/truncate/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ export default function useTruncate(
!! childrenAsText && ellipsizeMode === TRUNCATE_TYPE.auto;

const classes = useMemo( () => {
// The `word-break: break-all` property first makes sure a text line
// breaks even when it contains 'unbreakable' content such as long URLs.
// See https://github.com/WordPress/gutenberg/issues/60860.
const truncateLines = css`
word-break: break-all;
-webkit-box-orient: vertical;
-webkit-line-clamp: ${ numberOfLines };
display: -webkit-box;
Expand Down

0 comments on commit 8ff4af6

Please sign in to comment.