Fix search reset

Fix search in media viewer
Maybe fixed blinking in media viewer
This commit is contained in:
Eduard Kuzmenko 2021-01-26 03:26:28 +02:00
parent ed8c34bef3
commit b023ee340d
5 changed files with 22 additions and 11 deletions

View File

@ -895,17 +895,22 @@ class AppMediaViewerBase<ContentAdditionType extends string, ButtonsAdditionType
let thumbPromise: Promise<any> = Promise.resolve();
if(useContainerAsTarget) {
const cacheContext = appPhotosManager.getCacheContext(media);
let img: HTMLImageElement;
if(cacheContext.downloaded) {
const img = new Image();
img = new Image();
img.src = cacheContext.url;
container.append(img);
} else {
const gotThumb = appPhotosManager.getStrippedThumbIfNeeded(media);
if(gotThumb) {
thumbPromise = gotThumb.loadPromise;
container.append(gotThumb.image);
img = gotThumb.image;
}
}
if(img) {
img.classList.add('thumbnail');
container.append(img);
}
}
const size = appPhotosManager.setAttachmentSize(media, container, maxWidth, maxHeight, mediaSizes.isMobile ? false : true);
@ -1106,6 +1111,7 @@ class AppMediaViewerBase<ContentAdditionType extends string, ButtonsAdditionType
const haveImage = div.firstElementChild?.tagName === 'IMG' ? div.firstElementChild as HTMLImageElement : null;
if(!haveImage || haveImage.src !== url) {
let image = new Image();
image.classList.add('thumbnail');
//this.log('will renderImageFromUrl:', image, div, target);
@ -1300,9 +1306,9 @@ export default class AppMediaViewer extends AppMediaViewerBase<'caption', 'delet
minDate: this.searchContext.minDate,
maxDate: this.searchContext.maxDate
}).then(value => {
/* if(DEBUG) {
if(DEBUG) {
this.log('loaded more media by maxId:', maxId, value, older, this.reverse);
} */
}
if(value.next_rate) {
this.searchContext.nextRate = value.next_rate;

View File

@ -738,16 +738,20 @@ export default class ChatBubbles {
ids.forEach(id => {
let withTail = this.bubbles[id].classList.contains('with-media-tail');
let str = '.album-item img, .album-item video, .preview img, .preview video, ';
let str = '.album-item video, .album-item img, .preview video, .preview img, ';
if(withTail) {
str += '.bubble__media-container';
} else {
str += '.attachment img, .attachment video';
str += '.attachment video, .attachment img';
}
let elements = this.bubbles[id].querySelectorAll(str) as NodeListOf<HTMLElement>;
const parents: Set<HTMLElement> = new Set();
Array.from(elements).forEach((element: HTMLElement) => {
let albumItem = findUpClassName(element, 'album-item');
const parent = albumItem || element.parentElement;
if(parents.has(parent)) return;
parents.add(parent);
targets.push({
element,
mid: +albumItem?.dataset.mid || id,

View File

@ -401,8 +401,8 @@ export class AppSidebarLeft extends SidebarSlider {
if(hideNewBtnMenuTimeout) clearTimeout(hideNewBtnMenuTimeout);
if(id === 0) {
searchSuper.selectTab(0, false);
this.inputSearch.onClearClick();
resetSearch();
hideNewBtnMenuTimeout = window.setTimeout(() => {
hideNewBtnMenuTimeout = 0;
this.newBtnMenu.classList.remove('is-hidden');

View File

@ -2933,7 +2933,7 @@ export class AppMessagesManager {
if(!peerId) peerId = 0;
if(!query) query = '';
if(!inputFilter) inputFilter = {_: 'inputMessagesFilterEmpty'};
if(!limit) limit = 20;
if(limit === undefined) limit = 20;
if(!nextRate) nextRate = 0;
if(!backLimit) backLimit = 0;

View File

@ -257,6 +257,7 @@
object-fit: cover;
//object-fit: contain;
opacity: 1;
transition: var(--open-duration) opacity;
/* border-radius: inherit;
transition: var(--open-duration) border-radius; */
@ -350,7 +351,6 @@
&.hiding {
img, video {
transition: var(--open-duration) opacity;
opacity: 0;
}
}
@ -360,9 +360,10 @@
&-aspecter {
width: 100%;
height: 100%;
transform: scale(1);
transform: scale3d(1, 1, 1);
//overflow: hidden; // WARNING
position: absolute;
border-radius: 0;
display: flex;
align-items: center;