Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions shared/truncate.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ function truncate(str /*: string */, length /*: number */) {
return str;
}
var subString = str.substr(0, length);

// if the title doesn't have any spaces in it, just break at the normal length
if (subString.indexOf(' ') < 0) return subString + '…';

// if the title has a space character, attempt to break between words
return (
subString.substr(0, subString.lastIndexOf(' ')).replace(/\n/, ' ') + '…'
);
Expand Down
1 change: 1 addition & 0 deletions src/views/thread/style.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@ export const ThreadContent = styled.div`
export const ThreadHeading = styled(H1)`
font-size: 28px;
font-weight: 600;
word-break: break-word;
`;

export const A = styled.a`
Expand Down