Fixed issue with ellipsis at the end of urls

• Fixed:
- issue with ellipsis at the end of urls after someone edits a post.

• Updated:
- Text content ellipsis to :after ellipsis content that does not show up when editing
- Min Url ellipsis from 30 -> 45
This commit is contained in:
mgabdev 2020-06-05 16:28:38 -04:00
parent 35c5608e1a
commit 40a8667611
2 changed files with 10 additions and 4 deletions

View File

@ -875,6 +875,12 @@ body {
user-select: none;
}
:global(.ellipsis):after {
display: inline;
content: '…';
position: relative;
}
/* .videoPlayerVolume:before {
content: '';
display: block;

View File

@ -305,11 +305,11 @@ class Formatter
def link_html(url)
url = Addressable::URI.parse(url).to_s
prefix = url.match(/\Ahttps?:\/\/(www\.)?/).to_s
text = url[prefix.length, 30]
suffix = url[prefix.length + 30..-1]
cutoff = url[prefix.length..-1].length > 30
text = url[prefix.length, 45]
suffix = url[prefix.length + 45..-1]
cutoff = url[prefix.length..-1].length > 45
"<span aria-hidden=\"true\" class=\"invisible\">#{encode(prefix)}</span>#{encode(text)}<span aria-hidden=\"true\" class=\"invisible\">#{encode(suffix)}</span>" + (cutoff ? "<span aria-hidden=\"true\" class=\"ellipsis\"></span>" : "")
"<span aria-hidden=\"true\" class=\"invisible\">#{encode(prefix)}</span>#{encode(text)}<span aria-hidden=\"true\" class=\"invisible\">#{encode(suffix)}</span>" + (cutoff ? "<span aria-hidden=\"true\" class=\"ellipsis\"></span>" : "")
end
def hashtag_html(tag)