Set user typing state when using the SendBox
This commit is contained in:
@@ -33,6 +33,8 @@ Rectangle {
|
||||
clip: true
|
||||
|
||||
TextArea {
|
||||
property string typedText: text
|
||||
|
||||
id: textArea
|
||||
placeholderText: qsTr("Type a message...")
|
||||
wrapMode: TextEdit.Wrap
|
||||
@@ -41,6 +43,14 @@ Rectangle {
|
||||
font.pixelSize: 16
|
||||
focus: true
|
||||
|
||||
function set_typing(typing) {
|
||||
Backend.clientManager.clients[chatPage.user_id]
|
||||
.setTypingState(chatPage.room.room_id, typing)
|
||||
}
|
||||
|
||||
onTypedTextChanged: set_typing(Boolean(text))
|
||||
onEditingFinished: set_typing(false) // when lost focus
|
||||
|
||||
Keys.onReturnPressed: {
|
||||
event.accepted = true
|
||||
|
||||
@@ -57,6 +67,7 @@ Rectangle {
|
||||
.sendMarkdown(chatPage.room.room_id, textArea.text)
|
||||
textArea.clear()
|
||||
}
|
||||
|
||||
Keys.onEnterPressed: Keys.onReturnPressed(event) // numpad enter
|
||||
}
|
||||
}
|
||||
|
@@ -133,7 +133,10 @@ function get_typing_users_text(account_id, room_id) {
|
||||
.getWhere("room_id", room_id)
|
||||
|
||||
for (var i = 0; i < room.typing_users.length; i++) {
|
||||
names.push(Backend.getUser(room.typing_users[i]).display_name)
|
||||
if (room.typing_users[i] !== account_id) {
|
||||
names.push(Backend.getUserDisplayName(room.typing_users[i], false)
|
||||
.result())
|
||||
}
|
||||
}
|
||||
|
||||
if (names.length < 1) { return "" }
|
||||
|
Reference in New Issue
Block a user