From cc265f760ee9fc18cdd10e6c0eed7d75a51609aa Mon Sep 17 00:00:00 2001 From: mogaminsk Date: Wed, 1 Nov 2023 16:22:02 +0900 Subject: [PATCH] [Glitch] Fix inserting emojis from emoji picker fails with TypeError Port ac8e4ed38db2f391f7f8749a8e3afe265deeae72 to glitch-soc Signed-off-by: Claire --- .../glitch/features/compose/components/compose_form.jsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx b/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx index bd1cfb2e61..47b070da24 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.jsx @@ -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); } };