From 1d457f7ae78121cb0c2924e2863abd42bf8c5818 Mon Sep 17 00:00:00 2001 From: zubiden <19638254+zubiden@users.noreply.github.com> Date: Tue, 11 Nov 2025 14:37:42 +0100 Subject: [PATCH] Composer: Fix custom emoji playback after replacement (#6456) --- src/components/middle/composer/hooks/useCustomEmojiTooltip.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/middle/composer/hooks/useCustomEmojiTooltip.ts b/src/components/middle/composer/hooks/useCustomEmojiTooltip.ts index e94327a01..63ae174d8 100644 --- a/src/components/middle/composer/hooks/useCustomEmojiTooltip.ts +++ b/src/components/middle/composer/hooks/useCustomEmojiTooltip.ts @@ -85,7 +85,8 @@ export default function useCustomEmojiTooltip( const regex = new RegExp(`(${regexText})\\1*$`, ''); const matched = htmlBeforeSelection.match(regex)![0]; const count = matched.length / lastEmoji.length; - const newHtml = htmlBeforeSelection.replace(regex, buildCustomEmojiHtml(emoji).repeat(count)); + const htmlCustomEmojis = Array.from({ length: count }, () => buildCustomEmojiHtml(emoji)); + const newHtml = htmlBeforeSelection.replace(regex, htmlCustomEmojis.join('')); const htmlAfterSelection = inputEl.innerHTML.substring(htmlBeforeSelection.length); setHtml(`${newHtml}${htmlAfterSelection}`);