mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Drop windowResize/windowResizeCallback in favor of ResizeObservable
This commit is contained in:
parent
e192b60d69
commit
7a21694396
14 changed files with 25 additions and 110 deletions
|
|
@ -14,7 +14,6 @@ import {
|
|||
delegateRunOnDestroy,
|
||||
computedPagenatorHelper,
|
||||
trim,
|
||||
windowResizeCallback,
|
||||
isNonEmptyArray,
|
||||
fakeMd5,
|
||||
pInt
|
||||
|
|
@ -155,9 +154,6 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
this.reloadContactList();
|
||||
});
|
||||
|
||||
this.contacts.subscribe(windowResizeCallback);
|
||||
this.viewProperties.subscribe(windowResizeCallback);
|
||||
|
||||
this.contactsChecked = ko.computed(() => this.contacts().filter(item => item.checked()));
|
||||
|
||||
this.contactsCheckedOrSelected = ko.computed(() => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { windowResize } from 'Common/Utils';
|
||||
import { Capa, Focused, Layout, KeyState, EventKeyCode } from 'Common/Enums';
|
||||
import { $htmlCL, leftPanelDisabled, moveAction } from 'Common/Globals';
|
||||
import { mailBox, settings } from 'Common/Links';
|
||||
|
|
@ -198,7 +197,6 @@ class FolderListMailBoxUserView extends AbstractViewNext {
|
|||
this.iDropOverTimer = setTimeout(() => {
|
||||
folder.collapsed(false);
|
||||
getApp().setExpandedFolder(folder.fullNameHash, true);
|
||||
windowResize();
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,6 @@ import { $htmlCL, leftPanelDisabled, keyScopeReal, useKeyboardShortcuts, moveAct
|
|||
|
||||
import {
|
||||
isNonEmptyArray,
|
||||
windowResize,
|
||||
windowResizeCallback,
|
||||
inFocus,
|
||||
removeSelection,
|
||||
removeInFocus,
|
||||
|
|
@ -316,11 +314,8 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
|
||||
this.fullScreenMode.subscribe((value) => {
|
||||
$htmlCL.toggle('rl-message-fullscreen', value);
|
||||
windowResize();
|
||||
});
|
||||
|
||||
this.messageLoadingThrottle.subscribe(windowResizeCallback);
|
||||
|
||||
this.messageFocused = ko.computed(() => Focused.MessageView === AppStore.focusedState());
|
||||
|
||||
this.messageListAndMessageViewLoading = ko.computed(
|
||||
|
|
@ -405,19 +400,16 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
|
||||
fullScreen() {
|
||||
this.fullScreenMode(true);
|
||||
windowResize();
|
||||
}
|
||||
|
||||
unFullScreen() {
|
||||
this.fullScreenMode(false);
|
||||
windowResize();
|
||||
}
|
||||
|
||||
toggleFullScreen() {
|
||||
removeSelection();
|
||||
|
||||
this.fullScreenMode(!this.fullScreenMode());
|
||||
windowResize();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -431,15 +423,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
checkHeaderHeight() {
|
||||
if (this.oHeaderDom) {
|
||||
this.viewBodyTopValue(
|
||||
this.message()
|
||||
? this.oHeaderDom.height() +
|
||||
20 /* padding-(top/bottom): 20px */ +
|
||||
1 /* borded-bottom: 1px */
|
||||
: 0
|
||||
);
|
||||
}
|
||||
this.oHeaderDom && this.viewBodyTopValue(this.message() ? this.oHeaderDom.offsetHeight : 0);
|
||||
}
|
||||
|
||||
// displayMailToPopup(sMailToUrl) {
|
||||
|
|
@ -523,8 +507,7 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
onBuild(dom) {
|
||||
const self = this,
|
||||
fCheckHeaderHeight = this.checkHeaderHeight.bind(this);
|
||||
const self = this;
|
||||
|
||||
this.oDom = dom;
|
||||
|
||||
|
|
@ -534,28 +517,19 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
}
|
||||
});
|
||||
|
||||
this.showAttachmnetControls.subscribe(fCheckHeaderHeight);
|
||||
this.fullScreenMode.subscribe(fCheckHeaderHeight);
|
||||
this.showFullInfo.subscribe(fCheckHeaderHeight);
|
||||
this.message.subscribe(fCheckHeaderHeight);
|
||||
|
||||
addEventListener(
|
||||
'resize',
|
||||
(()=>{
|
||||
setTimeout(fCheckHeaderHeight, 1);
|
||||
setTimeout(fCheckHeaderHeight, 200);
|
||||
setTimeout(fCheckHeaderHeight, 500);
|
||||
}).throttle(50)
|
||||
);
|
||||
|
||||
this.showFullInfo.subscribe((value) => {
|
||||
windowResize();
|
||||
windowResize(200);
|
||||
Local.set(ClientSideKeyName.MessageHeaderFullInfo, value ? '1' : '0');
|
||||
});
|
||||
|
||||
this.oHeaderDom = jQuery('.messageItemHeader', dom);
|
||||
this.oHeaderDom = this.oHeaderDom[0] ? this.oHeaderDom : null;
|
||||
this.oHeaderDom = dom[0].querySelector('.messageItemHeader');
|
||||
if (this.oHeaderDom) {
|
||||
if (!this.resizeObserver) {
|
||||
this.resizeObserver = new ResizeObserver(this.checkHeaderHeight.throttle(50).bind(this));
|
||||
}
|
||||
this.resizeObserver.observe(this.oHeaderDom);
|
||||
} else if (this.resizeObserver) {
|
||||
this.resizeObserver.disconnect();
|
||||
}
|
||||
|
||||
if (this.mobile) {
|
||||
dom.on('click', () => {
|
||||
|
|
@ -865,15 +839,12 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
} else {
|
||||
this.oMessageScrollerDom.scrollTop = 0;
|
||||
}
|
||||
|
||||
windowResize();
|
||||
}
|
||||
}
|
||||
|
||||
scrollMessageToLeft() {
|
||||
if (this.oMessageScrollerDom) {
|
||||
this.oMessageScrollerDom.scrollLeft = 0;
|
||||
windowResize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -909,8 +880,6 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
if (message && message.showExternalImages) {
|
||||
message.showExternalImages(true);
|
||||
}
|
||||
|
||||
this.checkHeaderHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -942,8 +911,6 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
|
||||
getApp().reloadFlagsCurrentMessageListAndMessageFromCache();
|
||||
}
|
||||
|
||||
this.checkHeaderHeight();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue