From b211d7c4abd3b901e92ca853721b3f70693608a8 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 3 Jun 2015 12:29:58 +0000 Subject: [PATCH] Fix mail display print with IE load issue --- mail/js/app.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index c53b4199f3..07df2b56d6 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -177,7 +177,16 @@ app.classes.mail = AppJS.extend( // Prepare display dialog for printing // copies iframe content to a DIV, as iframe causes // trouble for multipage printing - jQuery('#mail-display_mailDisplayBodySrc').one('load', function(){self.mail_prepare_print();}); + jQuery('#mail-display_mailDisplayBodySrc').on('load', function(){ + self.mail_prepare_print(); + // Trigger print command if the mail oppend for printing porpuse + // load event fires twice in IE and the first time the content is not ready + // Check if the iframe content is loaded then trigger the print command + if (window.location.search.search('&print=') >= 0 && jQuery(this.contentWindow.document.body).children().length >0 ) + { + self.mail_print(); + } + }); this.mail_isMainWindow = false; this.mail_display(); @@ -775,14 +784,6 @@ app.classes.mail = AppJS.extend( var toolbaractions = ((typeof dataElem != 'undefined' && typeof dataElem.data != 'undefined' && typeof dataElem.data.displayToolbaractions != 'undefined')?JSON.parse(dataElem.data.displayToolbaractions):undefined); if (toolbaractions) this.et2.getWidgetById('displayToolbar').set_actions(toolbaractions); } - - // Trigger print command if the mail oppend for printing porpuse - if (window.location.search.search('&print=') >= 0) - { - var that = this; - jQuery('#mail-display_mailDisplayBodySrc').one('load',function(){that.mail_print();}); - } - }, /**