From 306471be60d3db74a67106028b97f7c40008e5c6 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 9 Feb 2022 15:50:38 -0500 Subject: [PATCH] fix(ChatInput): fix clicking on emoji suggestion Fixes #4768 --- ui/imports/shared/status/StatusChatInput.qml | 8 ++++++++ ui/imports/shared/status/StatusEmojiSuggestionPopup.qml | 4 +--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ui/imports/shared/status/StatusChatInput.qml b/ui/imports/shared/status/StatusChatInput.qml index 4b5e7d0240..19c336fbab 100644 --- a/ui/imports/shared/status/StatusChatInput.qml +++ b/ui/imports/shared/status/StatusChatInput.qml @@ -618,6 +618,14 @@ Rectangle { StatusEmojiSuggestionPopup { id: emojiSuggestions messageInput: messageInput + onClicked: function (index) { + if (index === undefined) { + index = emojiSuggestions.listView.currentIndex + } + + const unicode = emojiSuggestions.modelList[index].unicode_alternates || emojiSuggestions.modelList[index].unicode + replaceWithEmoji(extrapolateCursorPosition(), emojiSuggestions.shortname, unicode); + } } SuggestionBoxPanel { diff --git a/ui/imports/shared/status/StatusEmojiSuggestionPopup.qml b/ui/imports/shared/status/StatusEmojiSuggestionPopup.qml index 807fc3e390..702af03564 100644 --- a/ui/imports/shared/status/StatusEmojiSuggestionPopup.qml +++ b/ui/imports/shared/status/StatusEmojiSuggestionPopup.qml @@ -8,6 +8,7 @@ import shared 1.0 StatusInputListPopup { id: emojiSuggestions + property string shortname property string unicode: { if(listView.currentIndex < 0 || listView.currentIndex >= emojiSuggestions.modelList.count) @@ -26,9 +27,6 @@ StatusInputListPopup { getId: function (modelData) { return modelData.unicode } - onClicked: function (index) { - emojiSuggestions.addEmoji(index) - } function openPopup(emojisParam, shortnameParam) { modelList = emojisParam