Change URL truncation to account for ellipses (#33229)
This commit is contained in:
parent
2131e61548
commit
c8c916e657
2 changed files with 27 additions and 1 deletions
|
@ -68,6 +68,12 @@ class TextFormatter
|
|||
suffix = url[prefix.length + 30..]
|
||||
cutoff = url[prefix.length..].length > 30
|
||||
|
||||
if suffix && suffix.length == 1 # revert truncation to account for ellipsis
|
||||
display_url += suffix
|
||||
suffix = nil
|
||||
cutoff = false
|
||||
end
|
||||
|
||||
tag.a href: url, target: '_blank', rel: rel.join(' '), translate: 'no' do
|
||||
tag.span(prefix, class: 'invisible') +
|
||||
tag.span(display_url, class: (cutoff ? 'ellipsis' : '')) +
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue