emoji-picker-react 4.20.6 → 4.20.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/emoji-picker-react.cjs.development.js +13 -2
- package/dist/emoji-picker-react.cjs.development.js.map +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js +1 -1
- package/dist/emoji-picker-react.cjs.production.min.js.map +1 -1
- package/dist/emoji-picker-react.esm.js +13 -2
- package/dist/emoji-picker-react.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useSetVariationPicker.ts +17 -2
package/package.json
CHANGED
|
@@ -1,13 +1,28 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
allUnifiedFromEmojiElement,
|
|
3
|
+
NullableElement,
|
|
4
|
+
} from '../DomUtils/selectors';
|
|
2
5
|
import { useSetAnchoredEmojiRef } from '../components/context/ElementRefContext';
|
|
3
6
|
import { useEmojiVariationPickerState } from '../components/context/PickerContext';
|
|
7
|
+
import { usePickerDataContext } from '../components/context/PickerDataContext';
|
|
4
8
|
|
|
5
9
|
export default function useSetVariationPicker() {
|
|
6
10
|
const setAnchoredEmojiRef = useSetAnchoredEmojiRef();
|
|
7
11
|
const [, setEmojiVariationPicker] = useEmojiVariationPickerState();
|
|
12
|
+
// Context-aware lookup: respects the `emojiData` prop (e.g. translations).
|
|
13
|
+
// The legacy global lookup only knows the default English dataset.
|
|
14
|
+
// https://github.com/ealush/emoji-picker-react/issues/503
|
|
15
|
+
const { emojiByUnified } = usePickerDataContext();
|
|
8
16
|
|
|
9
17
|
return function setVariationPicker(element: NullableElement) {
|
|
10
|
-
const
|
|
18
|
+
const { unified, originalUnified } = allUnifiedFromEmojiElement(element);
|
|
19
|
+
const resolvedUnified = unified ?? originalUnified;
|
|
20
|
+
|
|
21
|
+
if (!resolvedUnified) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const emoji = emojiByUnified(resolvedUnified);
|
|
11
26
|
|
|
12
27
|
if (emoji) {
|
|
13
28
|
setAnchoredEmojiRef(element);
|