]> cat aescling's git repositories - mastodon.git/commitdiff
Simplify web UI character counter logic (#4463)
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 31 Jul 2017 13:19:48 +0000 (15:19 +0200)
committerGitHub <noreply@github.com>
Mon, 31 Jul 2017 13:19:48 +0000 (15:19 +0200)
app/javascript/mastodon/features/compose/util/counter.js

index 589e854605e3eb577fadd0172e0677a2f05e518f..f0fea1a0e5ee4f167b7b6bc3757793a7e126c775 100644 (file)
@@ -2,6 +2,6 @@ const urlPlaceholder = 'xxxxxxxxxxxxxxxxxxxxxxx';
 
 export function countableText(inputText) {
   return inputText
-    .replace(/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g, urlPlaceholder)
+    .replace(/https?:\/\/\S+/g, urlPlaceholder)
     .replace(/(?:^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+)/ig, '@$2');
 };