From 656f115fac42ed94bc7c65f4a80020cd48cbd3cd Mon Sep 17 00:00:00 2001 From: Ayke Halder Date: Tue, 3 May 2022 20:28:50 +0200 Subject: [PATCH] (feature) emit new signal reset-message This enables two use cases: * Handle message content before it is gone. * Make changes to the UI e.g. in case there is no message typing anymore. --- src/lib/ChatWindow.vue | 5 +++++ src/lib/Room/Room.vue | 2 ++ src/lib/Room/RoomFooter/RoomFooter.vue | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/src/lib/ChatWindow.vue b/src/lib/ChatWindow.vue index efc22942..570877f6 100644 --- a/src/lib/ChatWindow.vue +++ b/src/lib/ChatWindow.vue @@ -69,6 +69,7 @@ @fetch-messages="fetchMessages" @send-message="sendMessage" @edit-message="editMessage" + @reset-message="resetMessage" @delete-message="deleteMessage" @open-file="openFile" @open-user-tag="openUserTag" @@ -207,6 +208,7 @@ export default { 'fetch-messages', 'send-message', 'edit-message', + 'reset-message', 'delete-message', 'open-file', 'open-user-tag', @@ -367,6 +369,9 @@ export default { editMessage(message) { this.$emit('edit-message', { ...message, roomId: this.room.roomId }) }, + resetMessage(message) { + this.$emit('reset-message', { ...message, roomId: this.room.roomId }) + }, deleteMessage(message) { this.$emit('delete-message', { message, roomId: this.room.roomId }) }, diff --git a/src/lib/Room/Room.vue b/src/lib/Room/Room.vue index 80017ae6..6003fb42 100644 --- a/src/lib/Room/Room.vue +++ b/src/lib/Room/Room.vue @@ -147,6 +147,7 @@ :init-edit-message="initEditMessage" @update-edited-message-id="editedMessageId = $event" @edit-message="$emit('edit-message', $event)" + @reset-message="$emit('reset-message', $event)" @send-message="$emit('send-message', $event)" @typing-message="$emit('typing-message', $event)" @textarea-action-handler="$emit('textarea-action-handler', $event)" @@ -220,6 +221,7 @@ export default { 'menu-action-handler', 'message-selection-action-handler', 'edit-message', + 'reset-message', 'send-message', 'delete-message', 'message-action-handler', diff --git a/src/lib/Room/RoomFooter/RoomFooter.vue b/src/lib/Room/RoomFooter/RoomFooter.vue index 2f13a04e..b91d65a2 100644 --- a/src/lib/Room/RoomFooter/RoomFooter.vue +++ b/src/lib/Room/RoomFooter/RoomFooter.vue @@ -246,6 +246,7 @@ export default { emits: [ 'edit-message', + 'reset-message', 'send-message', 'update-edited-message-id', 'textarea-action-handler', @@ -779,6 +780,12 @@ export default { if (!initRoom) { this.$emit('typing-message', null) } + this.$emit('reset-message', { + content: this.message, + files: this.files, + replyMessage: this.messageReply, + usersTag: this.selectedUsersTag + }) this.selectedUsersTag = [] this.resetFooterList()