UX: Truncate topic link title/URL on desktop to prevent overflow.

This commit is contained in:
Guo Xiang Tan 2017-01-12 12:24:39 +08:00
parent 38496985ef
commit 0f574f641e
1 changed files with 8 additions and 1 deletions

View File

@ -116,7 +116,14 @@ createWidget('topic-map-link', {
}, },
html(attrs) { html(attrs) {
return attrs.title ? replaceEmoji(attrs.title) : attrs.url; let content = attrs.title || attrs.url;
const truncateLength = 85;
if (content.length > truncateLength) {
content = `${content.substr(0, truncateLength).trim()}...`;
}
return attrs.title ? replaceEmoji(content) : content;
} }
}); });