showMessageDetail: Add a backup in addition to transitionend handler
This commit is contained in:
parent
06a8362541
commit
f273333046
1 changed files with 17 additions and 2 deletions
|
@ -114,6 +114,7 @@ import { LinkPreviewSourceType } from '../types/LinkPreview';
|
|||
import { closeLightbox, showLightbox } from '../util/showLightbox';
|
||||
import { saveAttachment } from '../util/saveAttachment';
|
||||
import { sendDeleteForEveryoneMessage } from '../util/sendDeleteForEveryoneMessage';
|
||||
import { SECOND } from '../util/durations';
|
||||
|
||||
type AttachmentOptions = {
|
||||
messageId: string;
|
||||
|
@ -2179,14 +2180,28 @@ export class ConversationView extends window.Backbone.View<ConversationModel> {
|
|||
}
|
||||
|
||||
if (panel) {
|
||||
panel.view.$el.addClass('panel--remove').one('transitionend', () => {
|
||||
let timeout: ReturnType<typeof setTimeout> | undefined;
|
||||
const removePanel = () => {
|
||||
if (!timeout) {
|
||||
return;
|
||||
}
|
||||
|
||||
clearTimeout(timeout);
|
||||
timeout = undefined;
|
||||
|
||||
panel.view.remove();
|
||||
|
||||
if (this.panels.length === 0) {
|
||||
// Make sure poppers are positioned properly
|
||||
window.dispatchEvent(new Event('resize'));
|
||||
}
|
||||
});
|
||||
};
|
||||
panel.view.$el
|
||||
.addClass('panel--remove')
|
||||
.one('transitionend', removePanel);
|
||||
|
||||
// Backup, in case things go wrong with the transitionend event
|
||||
timeout = setTimeout(removePanel, SECOND);
|
||||
}
|
||||
|
||||
window.reduxActions.conversations.setSelectedConversationPanelDepth(
|
||||
|
|
Loading…
Reference in a new issue