Skip to content

Commit

Permalink
Fix potential problem with multiple content iframes
Browse files Browse the repository at this point in the history
  • Loading branch information
pabzm committed Jan 14, 2025
1 parent 5c83d26 commit 00cd506
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions program/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10681,19 +10681,19 @@ function rcube_webmail() {

this.resize_preview_iframe = function (iframe) {
// Cancel runs that we're scheduled ealier but didn't run yet.
if (this.resizePreviewIframeTimer) {
clearTimeout(this.resizePreviewIframeTimer);
if (iframe.resizePreviewIframeTimer) {
clearTimeout(iframe.resizePreviewIframeTimer);
}
// Using setTimeout to put this at the end of the call stack.
this.resizePreviewIframeTimer = setTimeout(() => {
iframe.resizePreviewIframeTimer = setTimeout(() => {
// Reset the height to avoid growing it bigger and bigger (due to
// our adding of 20 pixels, and 8 extra pixels of unknown origin,
// which are always added.
iframe.style.height = '';
var wantedHeight = iframe.contentDocument.firstChild.scrollHeight;
// Add a few pixels to avoid problems with wrapped lines.
iframe.style.height = wantedHeight + 20 + 'px';
this.resizePreviewIframeTimer = null;
iframe.resizePreviewIframeTimer = null;
}, 50);
};
} // end object rcube_webmail
Expand Down

0 comments on commit 00cd506

Please sign in to comment.