From b2505826534c9d808cba78dd502cc0dc33d448ef Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 13 Jul 2023 13:00:10 +0100 Subject: [PATCH 1/2] Allow emoji presentation selector to not break BigEmoji styling --- src/HtmlUtils.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/HtmlUtils.tsx b/src/HtmlUtils.tsx index dc5f5f273b3..b62d07666ab 100644 --- a/src/HtmlUtils.tsx +++ b/src/HtmlUtils.tsx @@ -52,8 +52,10 @@ const SURROGATE_PAIR_PATTERN = /([\ud800-\udbff])([\udc00-\udfff])/; // (with plenty of false positives, but that's OK) const SYMBOL_PATTERN = /([\u2100-\u2bff])/; -// Regex pattern for non-emoji characters that can appear in an "all-emoji" message (Zero-Width Joiner, Zero-Width Space, other whitespace) -const EMOJI_SEPARATOR_REGEX = /[\u200D\u200B\s]/g; +// Regex pattern for non-emoji characters that can appear in an "all-emoji" message +// (Zero-Width Joiner, Zero-Width Space, Emoji presentation character, other whitespace) +// eslint-disable-next-line no-misleading-character-class +const EMOJI_SEPARATOR_REGEX = /[\u200D\u200B\uFE0F\s]/g; const BIGEMOJI_REGEX = new RegExp(`^(${EMOJIBASE_REGEX.source})+$`, "i"); From f7f55ae8efc6a1fece4ab88e37b13c8b7be0ac11 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Thu, 13 Jul 2023 14:09:51 +0100 Subject: [PATCH 2/2] Tweak regex to make sonar & lint happy --- src/HtmlUtils.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/HtmlUtils.tsx b/src/HtmlUtils.tsx index b62d07666ab..158345903b7 100644 --- a/src/HtmlUtils.tsx +++ b/src/HtmlUtils.tsx @@ -54,8 +54,7 @@ const SYMBOL_PATTERN = /([\u2100-\u2bff])/; // Regex pattern for non-emoji characters that can appear in an "all-emoji" message // (Zero-Width Joiner, Zero-Width Space, Emoji presentation character, other whitespace) -// eslint-disable-next-line no-misleading-character-class -const EMOJI_SEPARATOR_REGEX = /[\u200D\u200B\uFE0F\s]/g; +const EMOJI_SEPARATOR_REGEX = /[\u200D\u200B\s]|\uFE0F/g; const BIGEMOJI_REGEX = new RegExp(`^(${EMOJIBASE_REGEX.source})+$`, "i");