Skip to content

Commit 7338be2

Browse files
committed
fix(Message rederer): jumbo emojis for messages sent with a Per-Message-Profile
added a RegEx to match emoticons, if a message contains 1 to 20 emoticons
1 parent 0fcc38c commit 7338be2

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
default: patch
3+
---
4+
5+
fix the display of jumbo emojis on messages sent with a persona

src/app/components/message/MsgTypeRenderers.tsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ export function MText({ edited, content, renderBody, renderUrlsPreview, style }:
121121

122122
const isJumbo = useMemo(() => {
123123
if (!trimmedBody || trimmedBody.length >= 500) return false;
124+
if (
125+
(unwrappedPerMessageProfileMessage ?? safeCustomBody)?.match(
126+
/^(<img[^>]*data-mx-emoticon[^>]*\/>){1,20}$/i
127+
)
128+
)
129+
return true;
124130
if (!JUMBO_EMOJI_REG.test(trimmedBody)) return false;
125131

126132
if (trimmedBody.includes(':')) {
@@ -129,7 +135,7 @@ export function MText({ edited, content, renderBody, renderUrlsPreview, style }:
129135
}
130136

131137
return true;
132-
}, [trimmedBody, safeCustomBody]);
138+
}, [unwrappedPerMessageProfileMessage, trimmedBody, safeCustomBody]);
133139

134140
if (!body && !customBody) return <BrokenContent body={customBody ?? body} />;
135141

@@ -139,7 +145,11 @@ export function MText({ edited, content, renderBody, renderUrlsPreview, style }:
139145
if ((content['com.beeper.per_message_profile'] as PerMessageProfileBeeperFormat)?.has_fallback) {
140146
// unwrap per-message profile fallback if present
141147
return (
142-
<MessageTextBody preWrap={typeof customBody !== 'string'} style={style}>
148+
<MessageTextBody
149+
preWrap={typeof customBody !== 'string'}
150+
style={style}
151+
jumboEmoji={isJumbo ? jumboEmojiSize : 'none'}
152+
>
143153
{renderBody({
144154
body: trimmedBody,
145155
customBody: unwrappedPerMessageProfileMessage,

0 commit comments

Comments
 (0)