react-to-print
Advanced tools
Comparing version 2.1.1 to 2.1.2
# CHANGELOG | ||
## 2.1.2 (May 3rd, 2019) | ||
- FIX [118](https://github.com/gregnb/react-to-print/issues/118): Ensure fonts have time to load before printing, thanks [aviklai](https://github.com/aviklai) | ||
## 2.1.1 (April 13th, 2019) | ||
@@ -4,0 +8,0 @@ |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define("lib",["react","react-dom"],t):"object"==typeof exports?exports.lib=t(require("react"),require("react-dom")):e.lib=t(e.react,e["react-dom"])}("undefined"!=typeof self?self:this,function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(3),a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.removeWindow=function(e){setTimeout(function(){e.parentNode.removeChild(e)},0)},t.triggerPrint=function(e){var n=t.props,r=n.onBeforePrint,o=n.onAfterPrint;r&&r(),setTimeout(function(){e.contentWindow.focus(),e.contentWindow.print(),t.removeWindow(e),o&&o()},0)},t.handlePrint=function(){var e=t.props,n=e.bodyClass,r=void 0===n?"":n,o=e.content,a=e.copyStyles,u=void 0===a||a,c=e.pageStyle,l=o();if(void 0!==l){var f=document.createElement("iframe");f.style.position="absolute",f.style.top="-1000px",f.style.left="-1000px";var s=i.findDOMNode(l),d=document.querySelectorAll("link[rel='stylesheet']");t.linkTotal=d.length||0,t.linksLoaded=[],t.linksErrored=[];var p=function(e,n){n?t.linksLoaded.push(e):(console.error('"react-to-print" was unable to load a link. It may be invalid. "react-to-print" will continue attempting to print the page. The link the errored was:',e),t.linksErrored.push(e)),t.linksLoaded.length+t.linksErrored.length===t.linkTotal&&t.triggerPrint(f)};f.onload=function(){window.navigator&&window.navigator.userAgent.indexOf("Trident/7.0")>-1&&(f.onload=null);var e=f.contentDocument||f.contentWindow.document,n=s.querySelectorAll("canvas");e.open(),e.write(s.outerHTML),e.close();var o=void 0===c?"@page { size: auto; margin: 0mm; } @media print { body { -webkit-print-color-adjust: exact; } }":c,i=e.createElement("style");i.appendChild(e.createTextNode(o)),e.head.appendChild(i),r.length&&e.body.classList.add(r);for(var a=e.querySelectorAll("canvas"),l=0,d=a.length;l<d;++l){(h=a[l]).getContext("2d").drawImage(n[l],0,0)}if(!1!==u){var y=document.querySelectorAll("style, link[rel='stylesheet']");for(l=0,d=y.length;l<d;++l){var h;if("STYLE"===(h=y[l]).tagName){var b=e.createElement(h.tagName),v=h.sheet;if(v){for(var m="",_=0;_<v.cssRules.length;_++)"string"==typeof v.cssRules[_].cssText&&(m+=v.cssRules[_].cssText+"\r\n");b.setAttribute("id","react-to-print-"+l),b.appendChild(e.createTextNode(m)),e.head.appendChild(b)}}else if(h.hasAttribute("href")&&h.getAttribute("href")){b=e.createElement(h.tagName),_=0;for(var g=h.attributes.length;_<g;++_){var w=h.attributes[_];b.setAttribute(w.nodeName,w.nodeValue)}b.onload=p.bind(null,b,!0),b.onerror=p.bind(null,b,!1),e.head.appendChild(b)}else console.warn('"react-to-print" encountered a <link> tag with an empty "href" attribute. In addition to being invalid HTML, this can cause problems in many browsers, and so the <link> was not loaded. The <link> is:',h),p(h,!0)}}0!==t.linkTotal&&!1!==u||t.triggerPrint(f)},document.body.appendChild(f)}else console.error('Refs are not available for stateless components. For "react-to-print" to work only Class based components can be printed')},t.setRef=function(e){t.triggerRef=e},t}return r.__extends(t,e),t.prototype.render=function(){var e=this.props.trigger;return o.cloneElement(e(),{onClick:this.handlePrint,ref:this.setRef})},t}(o.Component);t.default=a},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",function(){return o}),n.d(t,"__assign",function(){return i}),n.d(t,"__rest",function(){return a}),n.d(t,"__decorate",function(){return u}),n.d(t,"__param",function(){return c}),n.d(t,"__metadata",function(){return l}),n.d(t,"__awaiter",function(){return f}),n.d(t,"__generator",function(){return s}),n.d(t,"__exportStar",function(){return d}),n.d(t,"__values",function(){return p}),n.d(t,"__read",function(){return y}),n.d(t,"__spread",function(){return h}),n.d(t,"__await",function(){return b}),n.d(t,"__asyncGenerator",function(){return v}),n.d(t,"__asyncDelegator",function(){return m}),n.d(t,"__asyncValues",function(){return _}),n.d(t,"__makeTemplateObject",function(){return g}),n.d(t,"__importStar",function(){return w}),n.d(t,"__importDefault",function(){return x}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("react"),require("react-dom")):"function"==typeof define&&define.amd?define("lib",["react","react-dom"],t):"object"==typeof exports?exports.lib=t(require("react"),require("react-dom")):e.lib=t(e.react,e["react-dom"])}("undefined"!=typeof self?self:this,function(e,t){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(3),a=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.removeWindow=function(e){setTimeout(function(){e.parentNode.removeChild(e)},500)},t.triggerPrint=function(e){var n=t.props,r=n.onBeforePrint,o=n.onAfterPrint;r&&r(),setTimeout(function(){e.contentWindow.focus(),e.contentWindow.print(),t.removeWindow(e),o&&o()},500)},t.handlePrint=function(){var e=t.props,n=e.bodyClass,r=void 0===n?"":n,o=e.content,a=e.copyStyles,u=void 0===a||a,c=e.pageStyle,l=o();if(void 0!==l){var f=document.createElement("iframe");f.style.position="absolute",f.style.top="-1000px",f.style.left="-1000px";var s=i.findDOMNode(l),d=document.querySelectorAll("link[rel='stylesheet']");t.linkTotal=d.length||0,t.linksLoaded=[],t.linksErrored=[];var p=function(e,n){n?t.linksLoaded.push(e):(console.error('"react-to-print" was unable to load a link. It may be invalid. "react-to-print" will continue attempting to print the page. The link the errored was:',e),t.linksErrored.push(e)),t.linksLoaded.length+t.linksErrored.length===t.linkTotal&&t.triggerPrint(f)};f.onload=function(){window.navigator&&window.navigator.userAgent.indexOf("Trident/7.0")>-1&&(f.onload=null);var e=f.contentDocument||f.contentWindow.document,n=s.querySelectorAll("canvas");e.open(),e.write(s.outerHTML),e.close();var o=void 0===c?"@page { size: auto; margin: 0mm; } @media print { body { -webkit-print-color-adjust: exact; } }":c,i=e.createElement("style");i.appendChild(e.createTextNode(o)),e.head.appendChild(i),r.length&&e.body.classList.add(r);for(var a=e.querySelectorAll("canvas"),l=0,d=a.length;l<d;++l){(h=a[l]).getContext("2d").drawImage(n[l],0,0)}if(!1!==u){var y=document.querySelectorAll("style, link[rel='stylesheet']");for(l=0,d=y.length;l<d;++l){var h;if("STYLE"===(h=y[l]).tagName){var b=e.createElement(h.tagName),v=h.sheet;if(v){for(var m="",_=0;_<v.cssRules.length;_++)"string"==typeof v.cssRules[_].cssText&&(m+=v.cssRules[_].cssText+"\r\n");b.setAttribute("id","react-to-print-"+l),b.appendChild(e.createTextNode(m)),e.head.appendChild(b)}}else if(h.hasAttribute("href")&&h.getAttribute("href")){b=e.createElement(h.tagName),_=0;for(var g=h.attributes.length;_<g;++_){var w=h.attributes[_];b.setAttribute(w.nodeName,w.nodeValue)}b.onload=p.bind(null,b,!0),b.onerror=p.bind(null,b,!1),e.head.appendChild(b)}else console.warn('"react-to-print" encountered a <link> tag with an empty "href" attribute. In addition to being invalid HTML, this can cause problems in many browsers, and so the <link> was not loaded. The <link> is:',h),p(h,!0)}}0!==t.linkTotal&&!1!==u||t.triggerPrint(f)},document.body.appendChild(f)}else console.error('Refs are not available for stateless components. For "react-to-print" to work only Class based components can be printed')},t.setRef=function(e){t.triggerRef=e},t}return r.__extends(t,e),t.prototype.render=function(){var e=this.props.trigger;return o.cloneElement(e(),{onClick:this.handlePrint,ref:this.setRef})},t}(o.Component);t.default=a},function(e,t,n){"use strict";n.r(t),n.d(t,"__extends",function(){return o}),n.d(t,"__assign",function(){return i}),n.d(t,"__rest",function(){return a}),n.d(t,"__decorate",function(){return u}),n.d(t,"__param",function(){return c}),n.d(t,"__metadata",function(){return l}),n.d(t,"__awaiter",function(){return f}),n.d(t,"__generator",function(){return s}),n.d(t,"__exportStar",function(){return d}),n.d(t,"__values",function(){return p}),n.d(t,"__read",function(){return y}),n.d(t,"__spread",function(){return h}),n.d(t,"__await",function(){return b}),n.d(t,"__asyncGenerator",function(){return v}),n.d(t,"__asyncDelegator",function(){return m}),n.d(t,"__asyncValues",function(){return _}),n.d(t,"__makeTemplateObject",function(){return g}),n.d(t,"__importStar",function(){return w}),n.d(t,"__importDefault",function(){return x}); | ||
/*! ***************************************************************************** | ||
@@ -3,0 +3,0 @@ Copyright (c) Microsoft Corporation. All rights reserved. |
{ | ||
"name": "react-to-print", | ||
"version": "2.1.1", | ||
"version": "2.1.2", | ||
"description": "Print React components in the browser", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -8,2 +8,3 @@ <div align="center"> | ||
[![Build Status](https://travis-ci.org/gregnb/react-to-print.svg?branch=master)](https://travis-ci.org/gregnb/react-to-print) | ||
[![NPM Downloads](https://img.shields.io/npm/dt/react-to-print.svg?style=flat)](https://npmcharts.com/compare/react-to-print?minimal=true) | ||
[![dependencies Status](https://david-dm.org/gregnb/react-to-print/status.svg)](https://david-dm.org/gregnb/react-to-print) | ||
@@ -10,0 +11,0 @@ [![npm version](https://badge.fury.io/js/react-to-print.svg)](https://badge.fury.io/js/react-to-print) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
20482
148
0