feat: enable adding the clicked emoji to the chat input

This commit is contained in:
Jonathan Rainville 2020-07-02 14:49:02 -04:00 committed by Iuri Matias
parent 8aa8474cb1
commit 6e8c371063
4 changed files with 15 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import "../components"
Item {
property int iconPadding: 6
property var addToChat: function () {}
id: chatButtonsContainer
@ -149,6 +150,7 @@ Item {
height: 440
x: parent.width - width - 8
y: parent.height - sendBtns.height - height - 8
addToChat: chatButtonsContainer.addToChat
}
}
/*##^##

View File

@ -9,7 +9,7 @@ import "../../../../imports"
Rectangle {
border.width: 0
visible: chatsModel.activeChannel.chatType != Constants.chatTypePrivateGroupChat || chatsModel.activeChannel.isMember(profileModel.profile.pubKey)
visible: chatsModel.activeChannel.chatType !== Constants.chatTypePrivateGroupChat || chatsModel.activeChannel.isMember(profileModel.profile.pubKey)
Audio {
id: sendMessageSound
@ -17,7 +17,7 @@ Rectangle {
}
function onEnter(event){
if (event.modifiers == Qt.NoModifier && (event.key == Qt.Key_Enter || event.key == Qt.Key_Return)) {
if (event.modifiers === Qt.NoModifier && (event.key === Qt.Key_Enter || event.key === Qt.Key_Return)) {
if(txtData.text.trim().length > 0){
chatsModel.sendMessage(txtData.text.trim());
txtData.text = "";
@ -65,6 +65,9 @@ Rectangle {
Layout.preferredWidth: 30 + Style.current.padding
Layout.minimumWidth: 30 + Style.current.padding
Layout.maximumWidth: 200
addToChat: function (text) {
txtData.append(text)
}
}
}

View File

@ -9,6 +9,8 @@ import "../ChatColumn/samples"
import "./emojiList.js" as EmojiJSON
Popup {
property var addToChat: function () {}
id: popup
modal: false
property int selectedPackId
@ -79,8 +81,8 @@ Popup {
cursorShape: Qt.PointingHandCursor
anchors.fill: parent
onClicked: {
console.log('SELECT')
// chatsModel.sendSticker(hash, popup.selectedPackId)
const encodedIcon = Emoji.fromCodePoint(filename.replace(".svg", ""))
popup.addToChat(encodedIcon)
popup.close()
}
}

View File

@ -11,4 +11,7 @@ QtObject {
Twemoji.twemoji.size = size
return Twemoji.twemoji.parse(text)
}
function fromCodePoint(value) {
return Twemoji.twemoji.convert.fromCodePoint(value)
}
}