From d1c05cf4028de6bcedd5dfdc11d1264a772c5d54 Mon Sep 17 00:00:00 2001 From: JiHong88 <0125ses@hanmail.net> Date: Tue, 12 Apr 2022 03:56:26 +0900 Subject: [PATCH] fix: #947 print - chromium browser --- src/lib/core.js | 4 ++-- src/lib/util.js | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/core.js b/src/lib/core.js index 28578255f..a3d030819 100755 --- a/src/lib/core.js +++ b/src/lib/core.js @@ -4711,8 +4711,8 @@ export default function (context, pluginCallButtons, plugins, lang, options, _re _w.setTimeout(function () { try { iframe.focus(); - // IE or Edge - if (util.isIE_Edge || !!_d.documentMode || !!_w.StyleMedia) { + // IE or Edge, Chromium + if (util.isIE_Edge || util.isChromium || !!_d.documentMode || !!_w.StyleMedia) { try { iframe.contentWindow.document.execCommand('print', false, null); } catch (e) { diff --git a/src/lib/util.js b/src/lib/util.js index fe1dfa3bb..871808bfe 100755 --- a/src/lib/util.js +++ b/src/lib/util.js @@ -16,6 +16,7 @@ const util = { isIE: null, isIE_Edge: null, isOSX_IOS: null, + isChromium: null, _propertiesInit: function () { if (this._d) return; this._d = document; @@ -23,6 +24,7 @@ const util = { this.isIE = navigator.userAgent.indexOf('Trident') > -1; this.isIE_Edge = (navigator.userAgent.indexOf('Trident') > -1) || (navigator.appVersion.indexOf('Edge') > -1); this.isOSX_IOS = /(Mac|iPhone|iPod|iPad)/.test(navigator.platform); + this.isChromium = !!window.chrome; }, _allowedEmptyNodeList: '.se-component, pre, blockquote, hr, li, table, img, iframe, video, audio, canvas',