fix: twemoji in emoji board preview

This commit is contained in:
sup39 2024-01-16 10:24:46 +09:00
parent 4e58dbda99
commit d4174ac449
Signed by: sup39
GPG key ID: 111C00916C1641E5

View file

@ -280,6 +280,7 @@ export const EmojiGroup = as<
const NativeEmoji = (emoji: IEmoji) =>
isUsingTwemoji() ? <img
loading="lazy"
className={css.EmoticonImg}
src={getEmojiUrl(emoji.unicode)}
alt={emoji.shortcode}
@ -740,7 +741,16 @@ export function EmojiBoard({
const emojiInfo = getEmojiItemInfo(element);
if (!emojiInfo || !emojiPreviewTextRef.current) return;
if (emojiInfo.type === EmojiType.Emoji && emojiPreviewRef.current) {
emojiPreviewRef.current.textContent = emojiInfo.data;
if (isUsingTwemoji()) {
const img = document.createElement('img');
img.className = css.CustomEmojiImg;
img.setAttribute('src', getEmojiUrl(emojiInfo.data));
img.setAttribute('alt', emojiInfo.shortcode);
emojiPreviewRef.current.textContent = '';
emojiPreviewRef.current.appendChild(img);
} else {
emojiPreviewRef.current.textContent = emojiInfo.data;
}
} else if (emojiInfo.type === EmojiType.CustomEmoji && emojiPreviewRef.current) {
const img = document.createElement('img');
img.className = css.CustomEmojiImg;