Fix cursor position when inserting emoji
BUG: 456641
This commit is contained in:
@@ -15,6 +15,7 @@ QQC2.ToolBar {
|
|||||||
property alias inputFieldText: inputField.text
|
property alias inputFieldText: inputField.text
|
||||||
property alias textField: inputField
|
property alias textField: inputField
|
||||||
property alias emojiPaneOpened: emojiButton.checked
|
property alias emojiPaneOpened: emojiButton.checked
|
||||||
|
property alias cursorPosition: inputField.cursorPosition
|
||||||
|
|
||||||
signal closeAllTriggered()
|
signal closeAllTriggered()
|
||||||
signal inputFieldForceActiveFocusTriggered()
|
signal inputFieldForceActiveFocusTriggered()
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ ColumnLayout {
|
|||||||
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
Kirigami.Theme.colorSet: Kirigami.Theme.View
|
||||||
contentItem: EmojiPicker {
|
contentItem: EmojiPicker {
|
||||||
textArea: chatBar.textField
|
textArea: chatBar.textField
|
||||||
onChosen: addText(emoji)
|
onChosen: insertText(emoji)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,12 +128,10 @@ ColumnLayout {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addText(text) {
|
|
||||||
chatBox.inputFieldText = inputFieldText + text
|
|
||||||
}
|
|
||||||
|
|
||||||
function insertText(str) {
|
function insertText(str) {
|
||||||
chatBox.inputFieldText = inputFieldText.substr(0, inputField.cursorPosition) + str + inputFieldText.substr(inputField.cursorPosition)
|
let index = chatBar.cursorPosition;
|
||||||
|
chatBox.inputFieldText = inputFieldText.substr(0, chatBar.cursorPosition) + str + inputFieldText.substr(chatBar.cursorPosition);
|
||||||
|
chatBar.cursorPosition = index + str.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusInputField() {
|
function focusInputField() {
|
||||||
|
|||||||
Reference in New Issue
Block a user