Fix emoji message rendering (#938)

Signed-off-by: Wes <wesbillman@users.noreply.github.com>
Co-authored-by: Pinky <44b8e82baa6e0e254e0208d68f335c283c94e7b78dd1fa10d5a49d3f13dd0435@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
Wes
2026-06-09 20:52:37 -07:00
committed by GitHub
co-authored by Pinky
parent ba2fdbf697
commit e08937cdde
6 changed files with 244 additions and 14 deletions
@@ -195,8 +195,7 @@ export const CustomEmojiNode = Node.create<CustomEmojiNodeOptions>({
"data-shortcode": shortcode,
draggable: "false",
// Match the message-view <img data-custom-emoji> sizing exactly.
class:
"mx-px inline-block h-[1.25em] w-auto max-w-none align-text-bottom",
class: "mx-px inline-block h-[1.25em] w-auto max-w-none align-middle",
}),
];
},
@@ -11,6 +11,7 @@ import { UserAvatar } from "@/shared/ui/UserAvatar";
import { useChannelNavigation } from "@/shared/context/ChannelNavigationContext";
import { parseImetaTags } from "@/features/messages/lib/parseImeta";
import { customEmojiFromTags } from "@/shared/api/customEmoji";
import { isEmojiOnlyMessage } from "@/shared/lib/emojiOnly";
import {
resolveMentionNames,
resolveMentionPubkeysByName,
@@ -95,6 +96,10 @@ export const MessageRow = React.memo(
() => (message.tags ? customEmojiFromTags(message.tags) : undefined),
[message.tags],
);
const emojiOnly = React.useMemo(
() => isEmojiOnlyMessage(message.body, customEmoji),
[message.body, customEmoji],
);
const { channels } = useChannelNavigation();
const channelNames = React.useMemo(
@@ -151,7 +156,11 @@ export const MessageRow = React.memo(
return (
<Markdown
channelNames={channelNames}
className="max-w-full text-[15px] leading-6"
className={cn(
"max-w-full text-[15px] leading-6",
emojiOnly &&
"text-4xl leading-tight [&_img[data-custom-emoji]]:h-[1.45em] [&_img[data-custom-emoji]]:align-middle [&_button:has(img[data-custom-emoji])]:align-middle",
)}
content={message.body}
customEmoji={customEmoji}
imetaByUrl={imetaByUrl}