fix(ChatInput): fix clicking on emoji suggestion

Fixes #4768
This commit is contained in:
Jonathan Rainville 2022-02-09 15:50:38 -05:00
parent b7bfd334f3
commit 306471be60
2 changed files with 9 additions and 3 deletions

View File

@ -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 {

View File

@ -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