mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
Disable blockquotes height calculation for #902
This commit is contained in:
parent
e65dcc1d79
commit
a6e8e5cb82
1 changed files with 12 additions and 8 deletions
|
|
@ -14,18 +14,22 @@ const
|
||||||
"'": '''
|
"'": '''
|
||||||
},
|
},
|
||||||
|
|
||||||
hcont = Element.fromHTML('<div area="hidden" style="position:absolute;left:-200vw;width:max(50vw,400px)"></div>'),
|
// eslint-disable-next-line max-len
|
||||||
getRealHeight = el => {
|
hcont = Element.fromHTML('<div area="hidden" style="position:absolute;top:0;left:-200vw;max-width:max(50vw,400px);max-height:50vh"></div>'),
|
||||||
hcont.innerHTML = el.outerHTML;
|
|
||||||
const result = hcont.clientHeight;
|
|
||||||
hcont.innerHTML = '';
|
|
||||||
return result;
|
|
||||||
},
|
|
||||||
blockquoteSwitcher = () => {
|
blockquoteSwitcher = () => {
|
||||||
SettingsUserStore.collapseBlockquotes() &&
|
SettingsUserStore.collapseBlockquotes() &&
|
||||||
// tpl.content.querySelectorAll('blockquote').forEach(node => {
|
// tpl.content.querySelectorAll('blockquote').forEach(node => {
|
||||||
[...tpl.content.querySelectorAll('blockquote')].reverse().forEach(node => {
|
[...tpl.content.querySelectorAll('blockquote')].reverse().forEach(node => {
|
||||||
let h = node.clientHeight || getRealHeight(node);
|
let h = node.scrollHeight;
|
||||||
|
/*
|
||||||
|
if (!h) {
|
||||||
|
// Attempt to get height
|
||||||
|
hcont.innerHTML = node.outerHTML;
|
||||||
|
h = hcont.scrollHeight;
|
||||||
|
hcont.innerHTML = '';
|
||||||
|
}
|
||||||
|
*/
|
||||||
if (0 === h || 100 < h) {
|
if (0 === h || 100 < h) {
|
||||||
const el = Element.fromHTML('<details class="sm-bq-switcher"><summary>•••</summary></details>');
|
const el = Element.fromHTML('<details class="sm-bq-switcher"><summary>•••</summary></details>');
|
||||||
node.replaceWith(el);
|
node.replaceWith(el);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue