Skip to content

Commit 0e574a4

Browse files
refactor: remove @emoji-mart/react dependency (#1484)
1 parent 75c9a70 commit 0e574a4

File tree

4 files changed

+26
-12
lines changed

4 files changed

+26
-12
lines changed

package-lock.json

+1-10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@
5454
"dependencies": {
5555
"@blocknote/core": "^0.24.2",
5656
"@emoji-mart/data": "^1.2.1",
57-
"@emoji-mart/react": "^1.1.1",
5857
"@floating-ui/react": "^0.26.4",
5958
"@tiptap/core": "^2.7.1",
6059
"@tiptap/react": "^2.7.1",
6160
"@tiptap/pm": "^2.7.1",
61+
"emoji-mart": "^5.6.0",
6262
"lodash.merge": "^4.6.2",
6363
"react-icons": "^5.2.1"
6464
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// From https://github.com/missive/emoji-mart/blob/main/packages/emoji-mart-react/react.tsx
2+
import React, { useEffect, useRef } from "react";
3+
import { Picker } from "emoji-mart";
4+
5+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
6+
export default function EmojiPicker(props: any) {
7+
const ref = useRef(null);
8+
const instance = useRef(null) as any;
9+
10+
if (instance.current) {
11+
instance.current.update(props);
12+
}
13+
14+
useEffect(() => {
15+
instance.current = new Picker({ ...props, ref });
16+
17+
return () => {
18+
instance.current = null;
19+
};
20+
}, []); // eslint-disable-line react-hooks/exhaustive-deps
21+
22+
return React.createElement("div", { ref });
23+
}

packages/react/src/components/Comments/EmojiPicker.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import Picker from "@emoji-mart/react";
21
import { ReactNode, useState } from "react";
32

43
import { useComponentsContext } from "../../editor/ComponentsContext.js";
54
import { useBlockNoteContext } from "../../editor/BlockNoteContext.js";
5+
import Picker from "./EmojiMartPicker.js";
66

77
export const EmojiPicker = (props: {
88
onEmojiSelect: (emoji: { native: string }) => void;

0 commit comments

Comments
 (0)