diff --git a/src/components/appMediaViewer.ts b/src/components/appMediaViewer.ts index 73021873..122b762e 100644 --- a/src/components/appMediaViewer.ts +++ b/src/components/appMediaViewer.ts @@ -7,6 +7,7 @@ import MEDIA_MIME_TYPES_SUPPORTED from "../environment/mediaMimeTypesSupport"; import cancelEvent from "../helpers/dom/cancelEvent"; import { attachClickEvent, detachClickEvent } from "../helpers/dom/clickEvent"; +import findUpClassName from "../helpers/dom/findUpClassName"; import findUpTag from "../helpers/dom/findUpTag"; import setInnerHTML from "../helpers/dom/setInnerHTML"; import mediaSizes from "../helpers/mediaSizes"; @@ -131,7 +132,8 @@ export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delet const onCaptionClick = (e: MouseEvent) => { const a = findUpTag(e.target, 'A'); - if(a instanceof HTMLAnchorElement) { // close viewer if it's t.me/ redirect + const spoiler = findUpClassName(e.target, 'spoiler'); + if(a instanceof HTMLAnchorElement && (!spoiler || this.content.caption.classList.contains('is-spoiler-visible'))) { // close viewer if it's t.me/ redirect const onclick = a.getAttribute('onclick'); if(!onclick || onclick.includes('showMaskedAlert')) { return; diff --git a/src/components/chat/chat.ts b/src/components/chat/chat.ts index d858ef40..96a951df 100644 --- a/src/components/chat/chat.ts +++ b/src/components/chat/chat.ts @@ -7,7 +7,7 @@ import type { ChatRights } from "../../lib/appManagers/appChatsManager"; import type { AppImManager } from "../../lib/appManagers/appImManager"; import type { MessagesStorageKey } from "../../lib/appManagers/appMessagesManager"; -import type AppMediaViewerBase from "../appMediaViewerBase"; +// import type AppMediaViewerBase from "../appMediaViewerBase"; import EventListenerBase from "../../helpers/eventListenerBase"; import { logger, LogTypes } from "../../lib/logger"; import rootScope from "../../lib/rootScope"; @@ -439,10 +439,10 @@ export default class Chat extends EventListenerBase<{ this.inited = true; } - const appMediaViewer = (window as any).appMediaViewer as AppMediaViewerBase; - if(appMediaViewer) { - appMediaViewer.close(); - } + // const appMediaViewer = (window as any).appMediaViewer as AppMediaViewerBase; + // if(appMediaViewer) { + // appMediaViewer.close(); + // } const samePeer = this.peerId === peerId; if(!samePeer) {