Blur sending thumb if photo isn't fit
Do not show 'Copy' if message is equal to link
This commit is contained in:
parent
3f5f3f2cf4
commit
46ff2ee5fc
@ -218,7 +218,7 @@ export default class ChatContextMenu {
|
|||||||
icon: 'copy',
|
icon: 'copy',
|
||||||
text: 'Copy',
|
text: 'Copy',
|
||||||
onClick: this.onCopyClick,
|
onClick: this.onCopyClick,
|
||||||
verify: () => !!this.message.message && !this.isTextSelected
|
verify: () => !!this.message.message && !this.isTextSelected && (!this.isAnchorTarget || this.message.message !== this.target.innerText)
|
||||||
}, {
|
}, {
|
||||||
icon: 'copy',
|
icon: 'copy',
|
||||||
text: 'Chat.CopySelectedText',
|
text: 'Chat.CopySelectedText',
|
||||||
|
@ -43,6 +43,7 @@ import { attachClickEvent, simulateClickEvent } from '../helpers/dom/clickEvent'
|
|||||||
import isInDOM from '../helpers/dom/isInDOM';
|
import isInDOM from '../helpers/dom/isInDOM';
|
||||||
import lottieLoader from '../lib/lottieLoader';
|
import lottieLoader from '../lib/lottieLoader';
|
||||||
import { clearBadCharsAndTrim } from '../helpers/cleanSearchText';
|
import { clearBadCharsAndTrim } from '../helpers/cleanSearchText';
|
||||||
|
import blur from '../helpers/blur';
|
||||||
|
|
||||||
const MAX_VIDEO_AUTOPLAY_SIZE = 50 * 1024 * 1024; // 50 MB
|
const MAX_VIDEO_AUTOPLAY_SIZE = 50 * 1024 * 1024; // 50 MB
|
||||||
|
|
||||||
@ -707,7 +708,7 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS
|
|||||||
return img;
|
return img;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
export function wrapPhoto({photo, message, container, boxWidth, boxHeight, withTail, isOut, lazyLoadQueue, middleware, size, withoutPreloader, loadPromises, noAutoDownload, noBlur, noThumb, noFadeIn}: {
|
export function wrapPhoto({photo, message, container, boxWidth, boxHeight, withTail, isOut, lazyLoadQueue, middleware, size, withoutPreloader, loadPromises, noAutoDownload, noBlur, noThumb, noFadeIn, blurAfter}: {
|
||||||
photo: MyPhoto | MyDocument,
|
photo: MyPhoto | MyDocument,
|
||||||
message?: any,
|
message?: any,
|
||||||
container: HTMLElement,
|
container: HTMLElement,
|
||||||
@ -724,6 +725,7 @@ export function wrapPhoto({photo, message, container, boxWidth, boxHeight, withT
|
|||||||
noBlur?: boolean,
|
noBlur?: boolean,
|
||||||
noThumb?: boolean,
|
noThumb?: boolean,
|
||||||
noFadeIn?: boolean,
|
noFadeIn?: boolean,
|
||||||
|
blurAfter?: boolean,
|
||||||
}) {
|
}) {
|
||||||
if(!((photo as MyPhoto).sizes || (photo as MyDocument).thumbs)) {
|
if(!((photo as MyPhoto).sizes || (photo as MyDocument).thumbs)) {
|
||||||
if(boxWidth && boxHeight && !size && photo._ === 'document') {
|
if(boxWidth && boxHeight && !size && photo._ === 'document') {
|
||||||
@ -797,6 +799,7 @@ export function wrapPhoto({photo, message, container, boxWidth, boxHeight, withT
|
|||||||
noAutoDownload,
|
noAutoDownload,
|
||||||
noBlur,
|
noBlur,
|
||||||
noThumb: true,
|
noThumb: true,
|
||||||
|
blurAfter: true
|
||||||
//noFadeIn: true
|
//noFadeIn: true
|
||||||
});
|
});
|
||||||
const thumbImage = res.images.full;
|
const thumbImage = res.images.full;
|
||||||
@ -851,10 +854,20 @@ export function wrapPhoto({photo, message, container, boxWidth, boxHeight, withT
|
|||||||
return promise;
|
return promise;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const renderOnLoad = (url: string) => {
|
||||||
|
return renderImageWithFadeIn(container, image, url, needFadeIn, aspecter, thumbImage);
|
||||||
|
};
|
||||||
|
|
||||||
const onLoad = (): Promise<void> => {
|
const onLoad = (): Promise<void> => {
|
||||||
if(middleware && !middleware()) return Promise.resolve();
|
if(middleware && !middleware()) return Promise.resolve();
|
||||||
|
|
||||||
return renderImageWithFadeIn(container, image, cacheContext.url, needFadeIn, aspecter, thumbImage);
|
if(blurAfter) {
|
||||||
|
return blur(cacheContext.url, 12).then(url => {
|
||||||
|
return renderOnLoad(url);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return renderOnLoad(cacheContext.url);
|
||||||
};
|
};
|
||||||
|
|
||||||
let loadPromise: Promise<any>;
|
let loadPromise: Promise<any>;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user