From 48fe3e6b8692b1dcdcdf9f2b189db738e23874ae Mon Sep 17 00:00:00 2001 From: yuri Date: Wed, 7 Mar 2018 16:15:26 +0200 Subject: [PATCH] fix email size --- client/src/views/fields/wysiwyg.js | 35 +++++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/client/src/views/fields/wysiwyg.js b/client/src/views/fields/wysiwyg.js index 3346977753..53a97abb5d 100644 --- a/client/src/views/fields/wysiwyg.js +++ b/client/src/views/fields/wysiwyg.js @@ -199,14 +199,21 @@ Espo.define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], fun } }; - var processHeight = function () { - $iframe.css({ - overflowY: 'hidden', - overflowX: 'hidden' - }); - $iframe.attr('scrolling', 'no'); + var processHeight = function (isOnLoad) { + if (!isOnLoad) { + $iframe.css({ + overflowY: 'hidden', + overflowX: 'hidden' + }); + $iframe.attr('scrolling', 'no'); + + iframeElement.style.height = '0px'; + } else { + if (iframeElement.scrollHeight >= $document.height()) { + return; + } + } - iframeElement.style.height = '0px'; var $body = $iframe.contents().find('html body'); var height = $body.height(); if (height === 0) { @@ -217,11 +224,13 @@ Espo.define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], fun processIncreaseHeight(); - $iframe.css({ - overflowY: 'hidden', - overflowX: 'scroll' - }); - $iframe.attr('scrolling', 'yes'); + if (!isOnLoad) { + $iframe.css({ + overflowY: 'hidden', + overflowX: 'scroll' + }); + $iframe.attr('scrolling', 'yes'); + } }; $iframe.css({ @@ -233,7 +242,7 @@ Espo.define('views/fields/wysiwyg', ['views/fields/text', 'lib!Summernote'], fun visibility: 'visible' }); $iframe.load(function () { - processHeight(); + processHeight(true); }); }, 40);