From 911a5a5638644bf99e8ade3421e07d85c8351a25 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 19 Oct 2023 14:04:02 -0400 Subject: [PATCH] strip trailing punctuation --- src/view/com/composer/TagInput/index.tsx | 5 ++++- src/view/com/composer/TagInput/index.web.tsx | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/view/com/composer/TagInput/index.tsx b/src/view/com/composer/TagInput/index.tsx index 64565c2530..afd6569cb0 100644 --- a/src/view/com/composer/TagInput/index.tsx +++ b/src/view/com/composer/TagInput/index.tsx @@ -28,7 +28,10 @@ function uniq(tags: string[]) { } function sanitize(tagString: string) { - return tagString.trim().replace(/^#/, '') + return tagString + .trim() + .replace(/^#/, '') + .replace(/\p{P}+$/gu, '') } export function TagInput({ diff --git a/src/view/com/composer/TagInput/index.web.tsx b/src/view/com/composer/TagInput/index.web.tsx index 44f5cdfd85..76406945c9 100644 --- a/src/view/com/composer/TagInput/index.web.tsx +++ b/src/view/com/composer/TagInput/index.web.tsx @@ -27,7 +27,10 @@ function uniq(tags: string[]) { } function sanitize(tagString: string) { - return tagString.trim().replace(/^#/, '') + return tagString + .trim() + .replace(/^#/, '') + .replace(/\p{P}+$/gu, '') } export function TagInput({