mirror of
https://github.com/lunaisnotaboy/mastodon.git
synced 2024-12-23 05:37:47 +00:00
Simplify web UI character counter logic (#4463)
This commit is contained in:
parent
82b4cf4acb
commit
c7cc806251
|
@ -2,6 +2,6 @@ const urlPlaceholder = 'xxxxxxxxxxxxxxxxxxxxxxx';
|
||||||
|
|
||||||
export function countableText(inputText) {
|
export function countableText(inputText) {
|
||||||
return 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');
|
.replace(/(?:^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+)/ig, '@$2');
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue