diff options
author | Claire <claire.github-309c@sitedethib.com> | 2022-10-11 11:51:15 +0200 |
---|---|---|
committer | Claire <claire.github-309c@sitedethib.com> | 2022-10-11 12:15:08 +0200 |
commit | 0f4a4d7527433eef6e95c51edea47bcfa33bbf7c (patch) | |
tree | 5b936105aa4f776356921b30953f3b25cd5d7cf4 /app/javascript/flavours/glitch/features/compose/util/counter.js | |
parent | 7097a459be125f0c18bc4c2c77a00ba92c408bf9 (diff) |
Move some modules from flavours/glitch/utils/ back to flavours/glitch/features/compose/util/
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose/util/counter.js')
-rw-r--r-- | app/javascript/flavours/glitch/features/compose/util/counter.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/util/counter.js b/app/javascript/flavours/glitch/features/compose/util/counter.js new file mode 100644 index 000000000..7aa9e87b1 --- /dev/null +++ b/app/javascript/flavours/glitch/features/compose/util/counter.js @@ -0,0 +1,9 @@ +import { urlRegex } from './url_regex'; + +const urlPlaceholder = '$2xxxxxxxxxxxxxxxxxxxxxxx'; + +export function countableText(inputText) { + return inputText + .replace(urlRegex, urlPlaceholder) + .replace(/(^|[^\/\w])@(([a-z0-9_]+)@[a-z0-9\.\-]+[a-z0-9]+)/ig, '$1@$3'); +}; |