From b8e3ce1e4d5b3939572250706d6c50ad6da617d1 Mon Sep 17 00:00:00 2001 From: Eduard Kuzmenko Date: Sat, 14 Nov 2020 01:00:04 +0200 Subject: [PATCH] Fix bubble group after last item delete from album Fix delete whole album by context menu --- src/components/chat/contextMenu.ts | 2 +- src/lib/appManagers/appImManager.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/components/chat/contextMenu.ts b/src/components/chat/contextMenu.ts index 58eecf1c..0d324f08 100644 --- a/src/components/chat/contextMenu.ts +++ b/src/components/chat/contextMenu.ts @@ -295,7 +295,7 @@ export default class ChatContextMenu { if(appImManager.chatSelection.isSelecting) { appImManager.chatSelection.selectionDeleteBtn.click(); } else { - new PopupDeleteMessages([this.msgID]); + new PopupDeleteMessages(this.isTargetAnAlbumItem ? [this.msgID] : appMessagesManager.getMidsByMid(this.msgID)); } }; } \ No newline at end of file diff --git a/src/lib/appManagers/appImManager.ts b/src/lib/appManagers/appImManager.ts index be2430a0..54732c89 100644 --- a/src/lib/appManagers/appImManager.ts +++ b/src/lib/appManagers/appImManager.ts @@ -750,7 +750,7 @@ export class AppImManager { return; } - if(e.target != this.chatInputC.messageInput && target.tagName != 'INPUT') { + if(e.target != this.chatInputC.messageInput && target.tagName != 'INPUT' && !target.hasAttribute('contenteditable')) { this.chatInputC.messageInput.focus(); placeCaretAtEnd(this.chatInputC.messageInput); } @@ -1724,7 +1724,16 @@ export class AppImManager { bubble.classList.add('is-first-unread'); } + // * Нужно очистить прошлую информацию, полезно если удалить последний элемент из альбома в ПОСЛЕДНЕМ БАББЛЕ ГРУППЫ (видно по аватару) const originalMid = +bubble.dataset.mid; + if(+message.mid != originalMid) { + this.bubbleGroups.removeBubble(bubble, originalMid); + + if(!updatePosition) { + this.bubbleGroups.addBubble(bubble, message, reverse); + } + } + delete this.bubbles[originalMid]; //bubble.innerHTML = ''; }