make emoji-only messages larger for 1-5 emojis

This commit is contained in:
or-else
2024-05-08 13:39:10 -07:00
parent a4befc4cd3
commit ed34a46865
7 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -178,7 +178,7 @@ class BaseChatMessage extends React.PureComponent {
} else if (typeof content == 'string') {
// Make font bigger for emoji-only messages.
// Must use 'new RegExp(...)' because React does not like /{1-5}/.
if (new RegExp('^[\p{RGI_Emoji}]{1-5}$', 'v').test(content || '')) {
if (new RegExp('^\\p{RGI_Emoji}{1,5}$', 'v').test(content || '')) {
// Content consists of 1-5 emoji characters. Count how many and use it to increase the font size.
textSizeClass += ' emoji-' + (content || '').match(/\p{RGI_Emoji}/vg).length;
}