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 => {
|
||||
setTimeout(() => {
|
||||
const iframe = IFrameHelper.getAppFrame();
|
||||
const unreadMessageWrap = iframe.contentWindow.document.querySelector(
|
||||
'.unread-messages'
|
||||
);
|
||||
|
||||
if (!unreadMessageWrap) return;
|
||||
const { extraHeight = 0 } = message;
|
||||
let scrollableMessageHeight =
|
||||
unreadMessageWrap.scrollHeight + extraHeight;
|
||||
if (!extraHeight) return;
|
||||
|
||||
const updatedIframeHeight = message.isFixedHeight
|
||||
? `${scrollableMessageHeight}px`
|
||||
? `${extraHeight}px`
|
||||
: '100%';
|
||||
iframe.setAttribute(
|
||||
'style',
|
||||
|
|
|
@ -274,11 +274,13 @@ export default {
|
|||
// This function calculates the extra space needed for the view to
|
||||
// accomodate the height of close button + height of
|
||||
// read messages button. So that scrollbar won't appear
|
||||
|
||||
const unreadMessageWrap = document.querySelector('.unread-messages');
|
||||
const unreadCloseWrap = document.querySelector('.close-unread-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 (readViewWrap) extraHeight += readViewWrap.scrollHeight;
|
||||
|
||||
|
|
Loading…
Reference in a new issue