Moves height calculation logic to Vue side
This commit is contained in:
parent
cbe255555e
commit
61c8b8a24f
2 changed files with 7 additions and 9 deletions
|
@ -183,16 +183,12 @@ export const IFrameHelper = {
|
||||||
updateIframeHeight: message => {
|
updateIframeHeight: message => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const iframe = IFrameHelper.getAppFrame();
|
const iframe = IFrameHelper.getAppFrame();
|
||||||
const unreadMessageWrap = iframe.contentWindow.document.querySelector(
|
|
||||||
'.unread-messages'
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!unreadMessageWrap) return;
|
|
||||||
const { extraHeight = 0 } = message;
|
const { extraHeight = 0 } = message;
|
||||||
let scrollableMessageHeight =
|
if (!extraHeight) return;
|
||||||
unreadMessageWrap.scrollHeight + extraHeight;
|
|
||||||
const updatedIframeHeight = message.isFixedHeight
|
const updatedIframeHeight = message.isFixedHeight
|
||||||
? `${scrollableMessageHeight}px`
|
? `${extraHeight}px`
|
||||||
: '100%';
|
: '100%';
|
||||||
iframe.setAttribute(
|
iframe.setAttribute(
|
||||||
'style',
|
'style',
|
||||||
|
|
|
@ -274,11 +274,13 @@ export default {
|
||||||
// This function calculates the extra space needed for the view to
|
// This function calculates the extra space needed for the view to
|
||||||
// accomodate the height of close button + height of
|
// accomodate the height of close button + height of
|
||||||
// read messages button. So that scrollbar won't appear
|
// read messages button. So that scrollbar won't appear
|
||||||
|
const unreadMessageWrap = document.querySelector('.unread-messages');
|
||||||
const unreadCloseWrap = document.querySelector('.close-unread-wrap');
|
const unreadCloseWrap = document.querySelector('.close-unread-wrap');
|
||||||
const readViewWrap = document.querySelector('.open-read-view-wrap');
|
const readViewWrap = document.querySelector('.open-read-view-wrap');
|
||||||
|
|
||||||
let extraHeight = 0;
|
if (!unreadMessageWrap) return 0;
|
||||||
|
|
||||||
|
let extraHeight = unreadMessageWrap.scrollHeight;
|
||||||
if (unreadCloseWrap) extraHeight += unreadCloseWrap.scrollHeight;
|
if (unreadCloseWrap) extraHeight += unreadCloseWrap.scrollHeight;
|
||||||
if (readViewWrap) extraHeight += readViewWrap.scrollHeight;
|
if (readViewWrap) extraHeight += readViewWrap.scrollHeight;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue