зеркало из https://github.com/mozilla/hubs.git
fix for emojis crash
This commit is contained in:
Родитель
63572ed145
Коммит
bce34c111a
|
@ -39,7 +39,7 @@
|
|||
"detect-browser": "^3.0.1",
|
||||
"downshift": "^6.0.5",
|
||||
"draft-js": "^0.11.7",
|
||||
"emoji-mart": "^5.5.2",
|
||||
"emoji-picker-react": "^4.4.9",
|
||||
"event-target-shim": "^3.0.1",
|
||||
"form-data": "^3.0.0",
|
||||
"form-urlencoded": "^2.0.4",
|
||||
|
@ -13515,10 +13515,19 @@
|
|||
"url": "https://github.com/sindresorhus/emittery?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/emoji-mart": {
|
||||
"version": "5.5.2",
|
||||
"resolved": "https://registry.npmjs.org/emoji-mart/-/emoji-mart-5.5.2.tgz",
|
||||
"integrity": "sha512-Sqc/nso4cjxhOwWJsp9xkVm8OF5c+mJLZJFoFfzRuKO+yWiN7K8c96xmtughYb0d/fZ8UC6cLIQ/p4BR6Pv3/A=="
|
||||
"node_modules/emoji-picker-react": {
|
||||
"version": "4.4.9",
|
||||
"resolved": "https://registry.npmjs.org/emoji-picker-react/-/emoji-picker-react-4.4.9.tgz",
|
||||
"integrity": "sha512-ef9MfzSJy5xrzihLLv0e1zZmiNtcekubctTBQVfIpvKfsfu4iLBBzcHCmOC2IaUVBCZuUw+GM24BAPj1MdCQXQ==",
|
||||
"dependencies": {
|
||||
"clsx": "^1.2.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": ">=16"
|
||||
}
|
||||
},
|
||||
"node_modules/emoji-regex": {
|
||||
"version": "6.5.1",
|
||||
|
|
|
@ -94,7 +94,7 @@
|
|||
"detect-browser": "^3.0.1",
|
||||
"downshift": "^6.0.5",
|
||||
"draft-js": "^0.11.7",
|
||||
"emoji-mart": "^5.5.2",
|
||||
"emoji-picker-react": "^4.4.9",
|
||||
"event-target-shim": "^3.0.1",
|
||||
"form-data": "^3.0.0",
|
||||
"form-urlencoded": "^2.0.4",
|
||||
|
|
|
@ -61,9 +61,10 @@ export const EmojiPickerPopoverButton = React.memo(({ onSelectEmoji, disabled })
|
|||
title=""
|
||||
content={({ closePopover }) => (
|
||||
<EmojiPicker
|
||||
onSelect={emoji => {
|
||||
onEmojiClick={emoji => {
|
||||
console.log(emoji);
|
||||
const keepPickerOpen = shiftKeyDown.current;
|
||||
onSelectEmoji({ emoji, pickerRemainedOpen: keepPickerOpen });
|
||||
onSelectEmoji({ emoji: emoji.emoji, pickerRemainedOpen: keepPickerOpen });
|
||||
// Keep the picker open if the Shift key was held down to allow
|
||||
// for multiple emoji selections.
|
||||
if (!keepPickerOpen) closePopover();
|
||||
|
|
|
@ -118,7 +118,7 @@ export function ChatSidebarContainer({
|
|||
|
||||
const onSelectEmoji = useCallback(
|
||||
({ emoji, pickerRemainedOpen }) => {
|
||||
setMessage(message => message + emoji.native);
|
||||
setMessage(message => message + emoji);
|
||||
// If the picker remained open, avoid selecting the input so that the
|
||||
// user can keep picking emojis.
|
||||
if (!pickerRemainedOpen) inputRef.current.select();
|
||||
|
|
|
@ -1,28 +1,8 @@
|
|||
import React from "react";
|
||||
import { Picker } from "emoji-mart";
|
||||
// Twitter emoji sheets downloaded from unpkg.com provided by https://github.com/missive/emoji-mart
|
||||
import emojiIcons16 from "../../assets/images/emoji-picker-16.png";
|
||||
import emojiIcons20 from "../../assets/images/emoji-picker-20.png";
|
||||
import emojiIcons32 from "../../assets/images/emoji-picker-32.png";
|
||||
import emojiIcons64 from "../../assets/images/emoji-picker-64.png";
|
||||
import Picker from "emoji-picker-react";
|
||||
|
||||
import "./EmojiPicker.scss";
|
||||
|
||||
const iconSheet = {
|
||||
16: emojiIcons16,
|
||||
20: emojiIcons20,
|
||||
32: emojiIcons32,
|
||||
64: emojiIcons64
|
||||
};
|
||||
|
||||
export function EmojiPicker(props) {
|
||||
return (
|
||||
<Picker
|
||||
title="Pick an emoji!"
|
||||
color="var(--tab-highlight-color)"
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
backgroundImageFn={(set, sheetSize) => iconSheet[sheetSize]}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
return <Picker {...props} />;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче