mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-02-24 23:08:08 +08:00
Bugfix: e-mail compose modal resizeObserver wrong height
This commit is contained in:
parent
eb5fb5342e
commit
0309879d6b
1 changed files with 17 additions and 15 deletions
|
@ -728,6 +728,10 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
onShow(type, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText) {
|
onShow(type, oMessageOrArray, aToEmails, aCcEmails, aBccEmails, sCustomSubject, sCustomPlainText) {
|
||||||
routeOff();
|
routeOff();
|
||||||
|
|
||||||
|
const ro = this.resizeObserver;
|
||||||
|
ro.observe(ro.compose);
|
||||||
|
ro.observe(ro.header);
|
||||||
|
|
||||||
this.autosaveStart();
|
this.autosaveStart();
|
||||||
|
|
||||||
if (AppStore.composeInEdit()) {
|
if (AppStore.composeInEdit()) {
|
||||||
|
@ -1050,12 +1054,6 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
if (identity) {
|
if (identity) {
|
||||||
this.currentIdentity(identity);
|
this.currentIdentity(identity);
|
||||||
}
|
}
|
||||||
|
|
||||||
let el = document.querySelector('.b-compose');
|
|
||||||
this.resizeObserver.compose = el;
|
|
||||||
this.resizeObserver.els = [el.querySelector('.textAreaParent'), el.querySelector('.attachmentAreaParent')];
|
|
||||||
this.resizeObserver.observe(el);
|
|
||||||
this.resizeObserver.observe(el.querySelector('.b-header'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMessageUploadAttachments(sResult, oData) {
|
onMessageUploadAttachments(sResult, oData) {
|
||||||
|
@ -1109,7 +1107,7 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onBuild() {
|
onBuild(dom) {
|
||||||
this.initUploader();
|
this.initUploader();
|
||||||
|
|
||||||
key('ctrl+q, command+q, ctrl+w, command+w', KeyState.Compose, ()=>false);
|
key('ctrl+q, command+q, ctrl+w, command+w', KeyState.Compose, ()=>false);
|
||||||
|
@ -1153,6 +1151,12 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const ro = this.resizeObserver;
|
||||||
|
ro.compose = dom.querySelector('.b-compose');
|
||||||
|
ro.header = dom.querySelector('.b-header');
|
||||||
|
ro.toolbar = dom.querySelector('.b-header-toolbar');
|
||||||
|
ro.els = [dom.querySelector('.textAreaParent'), dom.querySelector('.attachmentAreaParent')];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1508,14 +1512,12 @@ class ComposePopupView extends AbstractViewNext {
|
||||||
}
|
}
|
||||||
|
|
||||||
resizerTrigger() {
|
resizerTrigger() {
|
||||||
let top = 0, ro = this.resizeObserver;
|
let ro = this.resizeObserver,
|
||||||
ro.els.forEach(element => top = Math.max(top, element.getBoundingClientRect().top));
|
height = Math.max(200, ro.compose.clientHeight - ro.header.offsetHeight - ro.toolbar.offsetHeight) + 'px';
|
||||||
if (0 < top) {
|
if (ro.height !== height) {
|
||||||
top = ro.compose.clientHeight - top;
|
ro.height = height;
|
||||||
ro.els.forEach(element => element.style.height = Math.max(top, 200) + 'px');
|
ro.els.forEach(element => element.style.height = height);
|
||||||
if (this.oEditor) {
|
this.oEditor && this.oEditor.resize();
|
||||||
this.oEditor.resize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue