feat: enable adding the clicked emoji to the chat input
This commit is contained in:
parent
8aa8474cb1
commit
6e8c371063
|
@ -6,6 +6,7 @@ import "../components"
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
property int iconPadding: 6
|
property int iconPadding: 6
|
||||||
|
property var addToChat: function () {}
|
||||||
|
|
||||||
id: chatButtonsContainer
|
id: chatButtonsContainer
|
||||||
|
|
||||||
|
@ -149,6 +150,7 @@ Item {
|
||||||
height: 440
|
height: 440
|
||||||
x: parent.width - width - 8
|
x: parent.width - width - 8
|
||||||
y: parent.height - sendBtns.height - height - 8
|
y: parent.height - sendBtns.height - height - 8
|
||||||
|
addToChat: chatButtonsContainer.addToChat
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*##^##
|
/*##^##
|
||||||
|
|
|
@ -9,7 +9,7 @@ import "../../../../imports"
|
||||||
Rectangle {
|
Rectangle {
|
||||||
border.width: 0
|
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 {
|
Audio {
|
||||||
id: sendMessageSound
|
id: sendMessageSound
|
||||||
|
@ -17,7 +17,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onEnter(event){
|
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){
|
if(txtData.text.trim().length > 0){
|
||||||
chatsModel.sendMessage(txtData.text.trim());
|
chatsModel.sendMessage(txtData.text.trim());
|
||||||
txtData.text = "";
|
txtData.text = "";
|
||||||
|
@ -65,6 +65,9 @@ Rectangle {
|
||||||
Layout.preferredWidth: 30 + Style.current.padding
|
Layout.preferredWidth: 30 + Style.current.padding
|
||||||
Layout.minimumWidth: 30 + Style.current.padding
|
Layout.minimumWidth: 30 + Style.current.padding
|
||||||
Layout.maximumWidth: 200
|
Layout.maximumWidth: 200
|
||||||
|
addToChat: function (text) {
|
||||||
|
txtData.append(text)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,8 @@ import "../ChatColumn/samples"
|
||||||
import "./emojiList.js" as EmojiJSON
|
import "./emojiList.js" as EmojiJSON
|
||||||
|
|
||||||
Popup {
|
Popup {
|
||||||
|
property var addToChat: function () {}
|
||||||
|
|
||||||
id: popup
|
id: popup
|
||||||
modal: false
|
modal: false
|
||||||
property int selectedPackId
|
property int selectedPackId
|
||||||
|
@ -79,8 +81,8 @@ Popup {
|
||||||
cursorShape: Qt.PointingHandCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
onClicked: {
|
onClicked: {
|
||||||
console.log('SELECT')
|
const encodedIcon = Emoji.fromCodePoint(filename.replace(".svg", ""))
|
||||||
// chatsModel.sendSticker(hash, popup.selectedPackId)
|
popup.addToChat(encodedIcon)
|
||||||
popup.close()
|
popup.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,4 +11,7 @@ QtObject {
|
||||||
Twemoji.twemoji.size = size
|
Twemoji.twemoji.size = size
|
||||||
return Twemoji.twemoji.parse(text)
|
return Twemoji.twemoji.parse(text)
|
||||||
}
|
}
|
||||||
}
|
function fromCodePoint(value) {
|
||||||
|
return Twemoji.twemoji.convert.fromCodePoint(value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue