Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 3cd045e

Browse files
authored
Merge pull request #4807 from withspectrum/fix-title-wrapping
Fix title wrapping
2 parents 2b8afd9 + ed55b3c commit 3cd045e

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

shared/truncate.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ function truncate(str /*: string */, length /*: number */) {
1515
return str;
1616
}
1717
var subString = str.substr(0, length);
18+
19+
// if the title doesn't have any spaces in it, just break at the normal length
20+
if (subString.indexOf(' ') < 0) return subString + '…';
21+
22+
// if the title has a space character, attempt to break between words
1823
return (
1924
subString.substr(0, subString.lastIndexOf(' ')).replace(/\n/, ' ') + '…'
2025
);

src/views/thread/style.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ export const ThreadContent = styled.div`
183183
export const ThreadHeading = styled(H1)`
184184
font-size: 28px;
185185
font-weight: 600;
186+
word-break: break-word;
186187
`;
187188

188189
export const A = styled.a`

0 commit comments

Comments
 (0)