fix IE printing
authorCornelius Weiß <c.weiss@metaways.de>
Thu, 27 Jul 2017 10:49:25 +0000 (12:49 +0200)
committerCornelius Weiss <c.weiss@metaways.de>
Thu, 27 Jul 2017 10:47:49 +0000 (12:47 +0200)
Change-Id: Ibe29cf5219ee12719aac7be304f46bfa7be0d384
Reviewed-on: http://gerrit.tine20.com/customers/5339
Reviewed-by: Cornelius Weiss <c.weiss@metaways.de>
Tested-by: Cornelius Weiss <c.weiss@metaways.de>
tine20/Tinebase/js/ux/Printer/renderers/Base.js

index e41db9b..8d7e47d 100644 (file)
@@ -142,7 +142,7 @@ Ext.ux.Printer.BaseRenderer = Ext.extend(Object, {
      */
     doPrintOnStylesheetLoad: function(win, component) {
         var me = this;
-        var styleLoaded = new Promise(function (fulfill, reject) {
+        return new Promise(function (fulfill, reject) {
             var checkcss = function(win, component) {
                 var el = win.document.getElementById('csscheck'),
                     comp = el.currentStyle || getComputedStyle(el, null);
@@ -153,12 +153,13 @@ Ext.ux.Printer.BaseRenderer = Ext.extend(Object, {
                 fulfill();
             };
             checkcss(win, component);
-        });
-
-        return styleLoaded.then(function() {
-            me.onBeforePrint(win.document, component);
-            return me.doPrint(win);
-        });
+        })
+            .then(function() {
+                me.onBeforePrint(win.document, component);
+            })
+            .then(function() {
+                return me.doPrint(win);
+            });
     },
 
     doPrint: function(win) {
@@ -188,7 +189,11 @@ Ext.ux.Printer.BaseRenderer = Ext.extend(Object, {
                 }, 'Tinebase/js/html2canvas');
 
             } else {
-                win.print();
+                try {
+                    win.document.execCommand('print', false, null);
+                } catch(e) {
+                    win.print();
+                }
                 if (!me.debug) {
                     win.close();
                 }