diff --git a/imports/NeoChat/Component/ChatBox/ChatBar.qml b/imports/NeoChat/Component/ChatBox/ChatBar.qml index 52a08de3a..572f85fb9 100644 --- a/imports/NeoChat/Component/ChatBox/ChatBar.qml +++ b/imports/NeoChat/Component/ChatBox/ChatBar.qml @@ -33,7 +33,11 @@ ToolBar { property alias isCompleting: completionMenu.visible - onInputFieldForceActiveFocusTriggered: inputField.forceActiveFocus() + onInputFieldForceActiveFocusTriggered: { + inputField.forceActiveFocus(); + // set the cursor to the end of the text + inputField.cursorPosition = inputField.length; + } position: ToolBar.Footer diff --git a/imports/NeoChat/Component/ChatBox/ChatBox.qml b/imports/NeoChat/Component/ChatBox/ChatBox.qml index 465280e5d..076da2428 100644 --- a/imports/NeoChat/Component/ChatBox/ChatBox.qml +++ b/imports/NeoChat/Component/ChatBox/ChatBox.qml @@ -100,6 +100,9 @@ Item { easing.type: Easing.OutCubic } } + onReplyCancelled: { + root.focusInputField() + } } Kirigami.Separator { diff --git a/imports/NeoChat/Component/ChatBox/ReplyPane.qml b/imports/NeoChat/Component/ChatBox/ReplyPane.qml index ede35a3c5..d283fe06f 100644 --- a/imports/NeoChat/Component/ChatBox/ReplyPane.qml +++ b/imports/NeoChat/Component/ChatBox/ReplyPane.qml @@ -16,6 +16,8 @@ Loader { property var user: null property string avatarMediaUrl: user ? "image://mxc/" + user.avatarMediaId : "" + signal replyCancelled() + active: visible sourceComponent: Pane { id: replyPane @@ -99,7 +101,10 @@ Loader { icon.name: "dialog-cancel" text: i18n("Cancel") display: AbstractButton.IconOnly - onClicked: ChatBoxHelper.clearEditReply() + onClicked: { + ChatBoxHelper.clearEditReply(); + root.replyCancelled(); + } ToolTip.text: text ToolTip.visible: hovered } diff --git a/imports/NeoChat/Page/RoomPage.qml b/imports/NeoChat/Page/RoomPage.qml index 6d70811a2..c602e3dbf 100644 --- a/imports/NeoChat/Page/RoomPage.qml +++ b/imports/NeoChat/Page/RoomPage.qml @@ -167,6 +167,7 @@ Kirigami.ScrollablePage { id: emojiDialog onReact: { page.currentRoom.toggleReaction(hoverActions.event.eventId, emoji); + chatBox.focusInputField(); } } } @@ -179,6 +180,7 @@ Kirigami.ScrollablePage { if (hoverActions.showEdit) { ChatBoxHelper.edit(hoverActions.event.message, hoverActions.event.formattedBody, hoverActions.event.eventId) } + chatBox.focusInputField(); } } QQC2.Button { @@ -187,6 +189,7 @@ Kirigami.ScrollablePage { icon.name: "mail-replied-symbolic" onClicked: { ChatBoxHelper.replyToMessage(hoverActions.event.eventId, hoverActions.event.message, hoverActions.event.author); + chatBox.focusInputField(); } } } @@ -668,6 +671,7 @@ Kirigami.ScrollablePage { const targetMessage = messageEventModel.getLastLocalUserMessageEventId(); if (targetMessage) { ChatBoxHelper.edit(targetMessage["body"], targetMessage["body"], targetMessage["event_id"]); + chatBox.focusInputField(); } } onReplyPreviousUserMessage: {