[Glitch] Fix inserting emojis from emoji picker fails with TypeError

Port ac8e4ed38d to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
mogaminsk 2023-11-01 16:22:02 +09:00 committed by Claire
parent bb4fa0c374
commit cc265f760e
1 changed files with 4 additions and 4 deletions

View File

@ -160,10 +160,10 @@ class ComposeForm extends ImmutablePureComponent {
// Inserts an emoji at the caret.
handleEmojiPick = (data) => {
const { textarea: { selectionStart } } = this;
const { onPickEmoji } = this.props;
if (onPickEmoji) {
onPickEmoji(selectionStart, data);
const position = this.textareaRef.current.selectionStart;
if (this.props.onPickEmoji) {
this.props.onPickEmoji(position, data);
}
};