fix: twemoji in emoji board preview
This commit is contained in:
parent
36fae9bb1e
commit
a754fd02c9
1 changed files with 11 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue