From d72fb64d9b13b2db0a1d44fa885b8e282381abf5 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Fri, 8 Nov 2024 14:54:02 +0100 Subject: [PATCH 1/2] fix: set listeners only to editable messages, remove listeners when unmount Signed-off-by: Maksim Sukharev --- .../MessagesGroup/Message/MessagePart/MessageBody.vue | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/MessagesList/MessagesGroup/Message/MessagePart/MessageBody.vue b/src/components/MessagesList/MessagesGroup/Message/MessagePart/MessageBody.vue index 4e689df0c3b..2dce7185fe9 100644 --- a/src/components/MessagesList/MessagesGroup/Message/MessagePart/MessageBody.vue +++ b/src/components/MessagesList/MessagesGroup/Message/MessagePart/MessageBody.vue @@ -322,7 +322,10 @@ export default { }, mounted() { - EventBus.on('editing-message-processing', this.setIsEditing) + if (this.isEditable) { + EventBus.on('editing-message-processing', this.setIsEditing) + } + if (!this.containsCodeBlocks) { return } @@ -330,6 +333,10 @@ export default { this.codeBlocks = Array.from(this.$refs.messageMain?.querySelectorAll('pre')) }, + beforeDestroy() { + EventBus.off('editing-message-processing', this.setIsEditing) + }, + methods: { t, handleMarkdownMouseOver(event) { From b639c955b0feb9618ba28307d9342896b2054734 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Fri, 8 Nov 2024 16:30:29 +0100 Subject: [PATCH 2/2] fix: do not listen to highlight event, togle CSS class instead Signed-off-by: Maksim Sukharev --- .../MessagesGroup/Message/Message.vue | 19 ++++--------------- src/components/MessagesList/MessagesList.vue | 14 ++++++++------ 2 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/components/MessagesList/MessagesGroup/Message/Message.vue b/src/components/MessagesList/MessagesGroup/Message/Message.vue index 0654a776cd3..69e9a71d415 100644 --- a/src/components/MessagesList/MessagesGroup/Message/Message.vue +++ b/src/components/MessagesList/MessagesGroup/Message/Message.vue @@ -11,9 +11,9 @@ :data-next-message-id="nextMessageId" :data-previous-message-id="previousMessageId" class="message" - :class="{'message--highlighted': isHighlighted, 'message--hovered': showMessageButtonsBar}" + :class="{'message--hovered': showMessageButtonsBar}" tabindex="0" - @animationend="isHighlighted = false" + @animationend="clearHighlightedClass" @mouseover="handleMouseover" @mouseleave="handleMouseleave">