Skip to content

Commit

Permalink
fix: #947 print - chromium browser
Browse files Browse the repository at this point in the history
  • Loading branch information
JiHong88 committed Apr 11, 2022
1 parent b774c84 commit d1c05cf
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions src/lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,15 @@ const util = {
isIE: null,
isIE_Edge: null,
isOSX_IOS: null,
isChromium: null,
_propertiesInit: function () {
if (this._d) return;
this._d = document;
this._w = window;
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',
Expand Down

0 comments on commit d1c05cf

Please sign in to comment.