Browse Source

Fix paused pip on peer changing

Fix revealing spoiler in media viewer
master
Eduard Kuzmenko 2 years ago
parent
commit
b8c715638e
  1. 4
      src/components/appMediaViewer.ts
  2. 10
      src/components/chat/chat.ts

4
src/components/appMediaViewer.ts

@ -7,6 +7,7 @@ @@ -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 @@ -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;

10
src/components/chat/chat.ts

@ -7,7 +7,7 @@ @@ -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<{ @@ -439,10 +439,10 @@ export default class Chat extends EventListenerBase<{
this.inited = true;
}
const appMediaViewer = (window as any).appMediaViewer as AppMediaViewerBase<any, any, any>;
if(appMediaViewer) {
appMediaViewer.close();
}
// const appMediaViewer = (window as any).appMediaViewer as AppMediaViewerBase<any, any, any>;
// if(appMediaViewer) {
// appMediaViewer.close();
// }
const samePeer = this.peerId === peerId;
if(!samePeer) {

Loading…
Cancel
Save