From 80cefd5b3cd9c8efa435f684a33fe1562696b74a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 24 Jan 2017 17:05:44 +0100 Subject: Fix #204, fix #515 - URL truncating is now a style so copypasting is not affected, replaced onClick handler with onMouseUp/Down to detect text selection not trigger onClick handler then --- app/lib/formatter.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'app/lib') diff --git a/app/lib/formatter.rb b/app/lib/formatter.rb index 3565611bc..1fa5b83fb 100644 --- a/app/lib/formatter.rb +++ b/app/lib/formatter.rb @@ -65,8 +65,11 @@ class Formatter end def link_html(url) - link_text = truncate(url.gsub(/\Ahttps?:\/\/(www\.)?/, ''), length: 30) - "#{link_text}" + prefix = url.match(/\Ahttps?:\/\/(www\.)?/).to_s + text = url[prefix.length, 30] + suffix = url[prefix.length + 30..-1] + + "#{prefix}#{text}#{suffix}" end def hashtag_html(match) -- cgit