From f64e44ffadea33aeb818176ce85cb49a86d89de8 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 3 Jun 2015 10:48:43 +0000 Subject: [PATCH] Fix mail display print with IE load issue --- mail/js/app.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mail/js/app.js b/mail/js/app.js index fe17f1bc14..aa61c278b2 100644 --- a/mail/js/app.js +++ b/mail/js/app.js @@ -185,11 +185,19 @@ app.classes.mail = AppJS.extend( // copies iframe content to a DIV, as iframe causes // trouble for multipage printing - jQuery('iframe#mail-display_mailDisplayBodySrc').one('load', function(e) + jQuery('iframe#mail-display_mailDisplayBodySrc').on('load', function(e) { // encrypt body if mailvelope is available self.mailvelopeAvailable(self.mailvelopeDisplay); 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; @@ -794,14 +802,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('iFrame#mail-display_mailDisplayBodySrc').one('load',function(){that.mail_print();}); - } - }, /**