mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-10-04 02:15:57 +08:00
When messages must scroll horizontally, add 20px to the computed height for scrollbar #1762
This commit is contained in:
parent
4133537ddc
commit
86ed6db088
1 changed files with 9 additions and 0 deletions
|
@ -153,16 +153,25 @@ export default class EmailFrame extends React.Component<EmailFrameProps> {
|
||||||
// If documentElement has a scroll height, prioritize that as height
|
// If documentElement has a scroll height, prioritize that as height
|
||||||
// If not, fall back to body scroll height by setting it to auto
|
// If not, fall back to body scroll height by setting it to auto
|
||||||
let height = 0;
|
let height = 0;
|
||||||
|
let width = 0;
|
||||||
if (doc && doc.documentElement && doc.documentElement.scrollHeight > 0) {
|
if (doc && doc.documentElement && doc.documentElement.scrollHeight > 0) {
|
||||||
|
width = doc.documentElement.scrollWidth;
|
||||||
height = doc.documentElement.scrollHeight;
|
height = doc.documentElement.scrollHeight;
|
||||||
} else if (doc && doc.body) {
|
} else if (doc && doc.body) {
|
||||||
const style = window.getComputedStyle(doc.body);
|
const style = window.getComputedStyle(doc.body);
|
||||||
if (style.height === '0px') {
|
if (style.height === '0px') {
|
||||||
doc.body.style.height = 'auto';
|
doc.body.style.height = 'auto';
|
||||||
}
|
}
|
||||||
|
width = doc.body.scrollWidth;
|
||||||
height = doc.body.scrollHeight;
|
height = doc.body.scrollHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (width > iframeEl.clientWidth) {
|
||||||
|
// the message will scroll horizontally, and we need to add 20px to the height of
|
||||||
|
// the iframe to allow for it's scrollbar. Otherwise it covers the last line of text.
|
||||||
|
height += 20;
|
||||||
|
}
|
||||||
|
|
||||||
this._iframeComponent.setHeightQuietly(height);
|
this._iframeComponent.setHeightQuietly(height);
|
||||||
this._iframeWrapperEl.style.height = `${height}px`;
|
this._iframeWrapperEl.style.height = `${height}px`;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue