Documents: add preview to lazy load queue
This commit is contained in:
parent
69394fe3ac
commit
60b8e88b09
@ -508,7 +508,8 @@ export default class AppSearchSuper {
|
|||||||
fontWeight: 400,
|
fontWeight: 400,
|
||||||
voiceAsMusic: true,
|
voiceAsMusic: true,
|
||||||
showSender: showSender,
|
showSender: showSender,
|
||||||
searchContext: this.copySearchContext(inputFilter)
|
searchContext: this.copySearchContext(inputFilter),
|
||||||
|
lazyLoadQueue: this.lazyLoadQueue
|
||||||
});
|
});
|
||||||
|
|
||||||
if(['audio', 'voice'].includes(message.media.document.type)) {
|
if(['audio', 'voice'].includes(message.media.document.type)) {
|
||||||
|
@ -2537,6 +2537,7 @@ export default class ChatBubbles {
|
|||||||
const docDiv = wrapDocument({
|
const docDiv = wrapDocument({
|
||||||
message,
|
message,
|
||||||
noAutoDownload: this.chat.noAutoDownloadMedia,
|
noAutoDownload: this.chat.noAutoDownloadMedia,
|
||||||
|
lazyLoadQueue: this.lazyLoadQueue
|
||||||
});
|
});
|
||||||
preview.append(docDiv);
|
preview.append(docDiv);
|
||||||
preview.classList.add('preview-with-document');
|
preview.classList.add('preview-with-document');
|
||||||
@ -2594,7 +2595,7 @@ export default class ChatBubbles {
|
|||||||
if(size.w === size.h && t) {
|
if(size.w === size.h && t) {
|
||||||
bubble.classList.add('is-square-photo');
|
bubble.classList.add('is-square-photo');
|
||||||
isSquare = true;
|
isSquare = true;
|
||||||
this.appPhotosManager.setAttachmentSize(photo, preview, 32, 32, false);
|
this.appPhotosManager.setAttachmentSize(photo, preview, 48, 48, false);
|
||||||
|
|
||||||
/* if(t) {
|
/* if(t) {
|
||||||
t.append(timeSpan);
|
t.append(timeSpan);
|
||||||
@ -2717,7 +2718,8 @@ export default class ChatBubbles {
|
|||||||
messageDiv,
|
messageDiv,
|
||||||
chat: this.chat,
|
chat: this.chat,
|
||||||
loadPromises,
|
loadPromises,
|
||||||
noAutoDownload: this.chat.noAutoDownloadMedia
|
noAutoDownload: this.chat.noAutoDownloadMedia,
|
||||||
|
lazyLoadQueue: this.lazyLoadQueue
|
||||||
});
|
});
|
||||||
|
|
||||||
if(newNameContainer) {
|
if(newNameContainer) {
|
||||||
|
@ -445,7 +445,7 @@ export const formatDate = (timestamp: number, monthShort = false, withYear = tru
|
|||||||
return str + ' at ' + date.getHours() + ':' + ('0' + date.getMinutes()).slice(-2);
|
return str + ' at ' + date.getHours() + ':' + ('0' + date.getMinutes()).slice(-2);
|
||||||
};
|
};
|
||||||
|
|
||||||
export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showSender, searchContext, loadPromises, noAutoDownload}: {
|
export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showSender, searchContext, loadPromises, noAutoDownload, lazyLoadQueue}: {
|
||||||
message: any,
|
message: any,
|
||||||
withTime?: boolean,
|
withTime?: boolean,
|
||||||
fontWeight?: number,
|
fontWeight?: number,
|
||||||
@ -454,6 +454,7 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS
|
|||||||
searchContext?: SearchSuperContext,
|
searchContext?: SearchSuperContext,
|
||||||
loadPromises?: Promise<any>[],
|
loadPromises?: Promise<any>[],
|
||||||
noAutoDownload?: boolean,
|
noAutoDownload?: boolean,
|
||||||
|
lazyLoadQueue?: LazyLoadQueue
|
||||||
}): HTMLElement {
|
}): HTMLElement {
|
||||||
if(!fontWeight) fontWeight = 500;
|
if(!fontWeight) fontWeight = 500;
|
||||||
|
|
||||||
@ -470,10 +471,7 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS
|
|||||||
if(voiceAsMusic) audioElement.voiceAsMusic = voiceAsMusic;
|
if(voiceAsMusic) audioElement.voiceAsMusic = voiceAsMusic;
|
||||||
if(searchContext) audioElement.searchContext = searchContext;
|
if(searchContext) audioElement.searchContext = searchContext;
|
||||||
if(showSender) audioElement.showSender = showSender;
|
if(showSender) audioElement.showSender = showSender;
|
||||||
|
if(uploading) audioElement.preloader = message.media.preloader;
|
||||||
if(uploading) {
|
|
||||||
audioElement.preloader = message.media.preloader;
|
|
||||||
}
|
|
||||||
|
|
||||||
audioElement.dataset.fontWeight = '' + fontWeight;
|
audioElement.dataset.fontWeight = '' + fontWeight;
|
||||||
audioElement.render();
|
audioElement.render();
|
||||||
@ -507,7 +505,8 @@ export function wrapDocument({message, withTime, fontWeight, voiceAsMusic, showS
|
|||||||
boxWidth: 54,
|
boxWidth: 54,
|
||||||
boxHeight: 54,
|
boxHeight: 54,
|
||||||
loadPromises,
|
loadPromises,
|
||||||
withoutPreloader: true
|
withoutPreloader: true,
|
||||||
|
lazyLoadQueue
|
||||||
});
|
});
|
||||||
icoDiv.style.width = icoDiv.style.height = '';
|
icoDiv.style.width = icoDiv.style.height = '';
|
||||||
if(wrapped.images.thumb) imgs.push(wrapped.images.thumb);
|
if(wrapped.images.thumb) imgs.push(wrapped.images.thumb);
|
||||||
@ -1444,7 +1443,7 @@ export function wrapAlbum({groupId, attachmentDiv, middleware, uploading, lazyLo
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function wrapGroupedDocuments({albumMustBeRenderedFull, message, bubble, messageDiv, chat, loadPromises, noAutoDownload}: {
|
export function wrapGroupedDocuments({albumMustBeRenderedFull, message, bubble, messageDiv, chat, loadPromises, noAutoDownload, lazyLoadQueue}: {
|
||||||
albumMustBeRenderedFull: boolean,
|
albumMustBeRenderedFull: boolean,
|
||||||
message: any,
|
message: any,
|
||||||
messageDiv: HTMLElement,
|
messageDiv: HTMLElement,
|
||||||
@ -1453,6 +1452,7 @@ export function wrapGroupedDocuments({albumMustBeRenderedFull, message, bubble,
|
|||||||
chat: Chat,
|
chat: Chat,
|
||||||
loadPromises?: Promise<any>[],
|
loadPromises?: Promise<any>[],
|
||||||
noAutoDownload?: boolean,
|
noAutoDownload?: boolean,
|
||||||
|
lazyLoadQueue?: LazyLoadQueue
|
||||||
}) {
|
}) {
|
||||||
let nameContainer: HTMLElement;
|
let nameContainer: HTMLElement;
|
||||||
const mids = albumMustBeRenderedFull ? chat.getMidsByMid(message.mid) : [message.mid];
|
const mids = albumMustBeRenderedFull ? chat.getMidsByMid(message.mid) : [message.mid];
|
||||||
@ -1465,7 +1465,8 @@ export function wrapGroupedDocuments({albumMustBeRenderedFull, message, bubble,
|
|||||||
const div = wrapDocument({
|
const div = wrapDocument({
|
||||||
message,
|
message,
|
||||||
loadPromises,
|
loadPromises,
|
||||||
noAutoDownload
|
noAutoDownload,
|
||||||
|
lazyLoadQueue
|
||||||
});
|
});
|
||||||
|
|
||||||
const container = document.createElement('div');
|
const container = document.createElement('div');
|
||||||
|
@ -12,7 +12,6 @@ import rootScope from "../rootScope";
|
|||||||
import apiManager from "../mtproto/mtprotoworker";
|
import apiManager from "../mtproto/mtprotoworker";
|
||||||
import { deferredPromise, CancellablePromise } from "../../helpers/cancellablePromise";
|
import { deferredPromise, CancellablePromise } from "../../helpers/cancellablePromise";
|
||||||
import { InputFile } from "../../layer";
|
import { InputFile } from "../../layer";
|
||||||
import referenceDatabase, {ReferenceBytes} from "../mtproto/referenceDatabase";
|
|
||||||
import { getFileNameByLocation } from "../../helpers/fileName";
|
import { getFileNameByLocation } from "../../helpers/fileName";
|
||||||
import CacheStorageController from "../cacheStorage";
|
import CacheStorageController from "../cacheStorage";
|
||||||
import { MOUNT_CLASS_TO } from "../../config/debug";
|
import { MOUNT_CLASS_TO } from "../../config/debug";
|
||||||
|
@ -915,15 +915,16 @@ $bubble-margin: .25rem;
|
|||||||
|
|
||||||
.preview-resizer {
|
.preview-resizer {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
width: 2rem;
|
width: 3rem;
|
||||||
height: 2rem;
|
height: 3rem;
|
||||||
float: right;
|
float: right;
|
||||||
margin-left: .625rem;
|
margin-left: .625rem;
|
||||||
|
margin-top: .1875rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.preview {
|
.preview {
|
||||||
max-width: unquote('min(2rem, 100%)');
|
max-width: unquote('min(3rem, 100%)');
|
||||||
max-height: unquote('min(2rem, 100%)');
|
max-height: unquote('min(3rem, 100%)');
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user