Skip to content

Commit de70ff3

Browse files
fix: display SVG emojis in the picker (#16492)
Fix #16263
1 parent 6a67e2e commit de70ff3

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

site/src/components/IconField/EmojiPicker.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
import data from "@emoji-mart/data/sets/15/apple.json";
22
import EmojiMart from "@emoji-mart/react";
3-
import type { ComponentProps, FC } from "react";
3+
import {
4+
type ComponentProps,
5+
type FC,
6+
useEffect,
7+
useLayoutEffect,
8+
} from "react";
49
import icons from "theme/icons.json";
510

611
const custom = [
@@ -26,6 +31,23 @@ type EmojiPickerProps = Omit<
2631
>;
2732

2833
const EmojiPicker: FC<EmojiPickerProps> = (props) => {
34+
/**
35+
* Workaround for a bug in the emoji-mart library where custom emoji images render improperly.
36+
* Setting the image width to 100% ensures they display correctly.
37+
*
38+
* Issue: https://github.com/missive/emoji-mart/issues/805
39+
* Open PR: https://github.com/missive/emoji-mart/pull/806
40+
*/
41+
useEffect(() => {
42+
const picker = document.querySelector("em-emoji-picker")?.shadowRoot;
43+
if (!picker) {
44+
return;
45+
}
46+
const css = document.createElement("style");
47+
css.textContent = ".emoji-mart-emoji img { width: 100% }";
48+
picker.appendChild(css);
49+
}, []);
50+
2951
return (
3052
<EmojiMart
3153
theme="dark"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy