parent
a0bebeb78b
commit
12cb76699c
|
@ -379,13 +379,39 @@ Item {
|
|||
anchors.right: parent.right
|
||||
anchors.rightMargin: chatHorizontalPadding
|
||||
height: (item !== null && typeof(item)!== 'undefined')? item.height: 0
|
||||
property string sourceText
|
||||
sourceComponent: Item {
|
||||
id: editText
|
||||
height: childrenRect.height
|
||||
|
||||
onActiveChanged: {
|
||||
if (!active) {
|
||||
return
|
||||
property bool suggestionsOpened: false
|
||||
Keys.onEscapePressed: {
|
||||
if (!suggestionsOpened) {
|
||||
cancelBtn.clicked()
|
||||
}
|
||||
suggestionsOpened = false
|
||||
}
|
||||
|
||||
StatusChatInput {
|
||||
id: editTextInput
|
||||
|
||||
store: root.store
|
||||
usersStore: root.usersStore
|
||||
|
||||
chatInputPlaceholder: qsTrId("type-a-message-")
|
||||
chatType: messageStore.getChatType()
|
||||
isEdit: true
|
||||
emojiPopup: root.emojiPopup
|
||||
messageContextMenu: root.messageContextMenu
|
||||
onSendMessage: {
|
||||
saveBtn.clicked(null)
|
||||
}
|
||||
suggestions.onVisibleChanged: {
|
||||
if (suggestions.visible) {
|
||||
editText.suggestionsOpened = true
|
||||
}
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
let mentionsMap = new Map()
|
||||
let index = 0
|
||||
while (true) {
|
||||
|
@ -418,43 +444,12 @@ Item {
|
|||
index += linkTag.length
|
||||
}
|
||||
|
||||
sourceText = message
|
||||
var text = message
|
||||
for (let [key, value] of mentionsMap) {
|
||||
sourceText = sourceText.replace(new RegExp(key, 'g'), value)
|
||||
}
|
||||
}
|
||||
|
||||
sourceComponent: Item {
|
||||
id: editText
|
||||
height: childrenRect.height
|
||||
|
||||
property bool suggestionsOpened: false
|
||||
Keys.onEscapePressed: {
|
||||
if (!suggestionsOpened) {
|
||||
cancelBtn.clicked()
|
||||
}
|
||||
suggestionsOpened = false
|
||||
}
|
||||
|
||||
StatusChatInput {
|
||||
id: editTextInput
|
||||
|
||||
store: root.store
|
||||
usersStore: root.usersStore
|
||||
|
||||
chatInputPlaceholder: qsTrId("type-a-message-")
|
||||
chatType: messageStore.getChatType()
|
||||
isEdit: true
|
||||
emojiPopup: root.emojiPopup
|
||||
textInput.text: editMessageLoader.sourceText
|
||||
messageContextMenu: root.messageContextMenu
|
||||
onSendMessage: {
|
||||
saveBtn.clicked(null)
|
||||
}
|
||||
suggestions.onVisibleChanged: {
|
||||
if (suggestions.visible) {
|
||||
editText.suggestionsOpened = true
|
||||
text = text.replace(new RegExp(key, 'g'), value)
|
||||
}
|
||||
editTextInput.textInput.text = text
|
||||
editTextInput.textInput.cursorPosition = editTextInput.textInput.length
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue