From acdc792b0fac5a43b2a02414fd3bdbd6475e6438 Mon Sep 17 00:00:00 2001 From: horkimsereirith Date: Wed, 29 Mar 2023 15:12:25 +0700 Subject: [PATCH 1/5] Fixed safari blank page --- README.md | 6 +++--- package.json | 2 +- src/js/print.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9cf97e8f..9c945a8a 100644 --- a/README.md +++ b/README.md @@ -16,19 +16,19 @@ You can download the latest version of Print.js from the [GitHub releases](https To install via npm: ```bash -npm install print-js --save +npm install custom-print-js --save ``` To install via yarn: ```bash -yarn add print-js +yarn add custom-print-js ``` Import the library into your project: ```js -import printJS from 'print-js' +import printJS from 'custom-print-js' ``` ## Documentation diff --git a/package.json b/package.json index 225fb7d2..bb87eea8 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "print-js", + "name": "custom-print-js", "homepage": "http://printjs.crabbly.com", "description": "A tiny javascript library to help printing from the web.", "version": "1.6.0", diff --git a/src/js/print.js b/src/js/print.js index 40f96293..e072354d 100644 --- a/src/js/print.js +++ b/src/js/print.js @@ -13,7 +13,7 @@ const Print = { iframeElement.onload = () => { if (params.type === 'pdf') { // Add a delay for Firefox. In my tests, 1000ms was sufficient but 100ms was not - if (Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) { + if ((Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) || Browser.isSafari()) { setTimeout(() => performPrint(iframeElement, params), 1000) } else { performPrint(iframeElement, params) @@ -72,7 +72,7 @@ function performPrint (iframeElement, params) { } catch (error) { params.onError(error) } finally { - if (Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) { + if ((Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) || Browser.isSafari()) { // Move the iframe element off-screen and make it invisible iframeElement.style.visibility = 'hidden' iframeElement.style.left = '-1px' From d71884f8508d4ab5146cc72acf79b04828e3d923 Mon Sep 17 00:00:00 2001 From: horkimsereirith Date: Wed, 29 Mar 2023 15:36:24 +0700 Subject: [PATCH 2/5] Revert "Fixed safari blank page" This reverts commit acdc792b0fac5a43b2a02414fd3bdbd6475e6438. --- README.md | 6 +++--- package.json | 2 +- src/js/print.js | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 9c945a8a..9cf97e8f 100644 --- a/README.md +++ b/README.md @@ -16,19 +16,19 @@ You can download the latest version of Print.js from the [GitHub releases](https To install via npm: ```bash -npm install custom-print-js --save +npm install print-js --save ``` To install via yarn: ```bash -yarn add custom-print-js +yarn add print-js ``` Import the library into your project: ```js -import printJS from 'custom-print-js' +import printJS from 'print-js' ``` ## Documentation diff --git a/package.json b/package.json index bb87eea8..225fb7d2 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "custom-print-js", + "name": "print-js", "homepage": "http://printjs.crabbly.com", "description": "A tiny javascript library to help printing from the web.", "version": "1.6.0", diff --git a/src/js/print.js b/src/js/print.js index e072354d..40f96293 100644 --- a/src/js/print.js +++ b/src/js/print.js @@ -13,7 +13,7 @@ const Print = { iframeElement.onload = () => { if (params.type === 'pdf') { // Add a delay for Firefox. In my tests, 1000ms was sufficient but 100ms was not - if ((Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) || Browser.isSafari()) { + if (Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) { setTimeout(() => performPrint(iframeElement, params), 1000) } else { performPrint(iframeElement, params) @@ -72,7 +72,7 @@ function performPrint (iframeElement, params) { } catch (error) { params.onError(error) } finally { - if ((Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) || Browser.isSafari()) { + if (Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) { // Move the iframe element off-screen and make it invisible iframeElement.style.visibility = 'hidden' iframeElement.style.left = '-1px' From c242cecbda62e184b23852cc148d96fbcdeb786e Mon Sep 17 00:00:00 2001 From: horkimsereirith Date: Wed, 29 Mar 2023 15:37:45 +0700 Subject: [PATCH 3/5] Fixed printing on safari show blank page --- src/js/print.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/js/print.js b/src/js/print.js index 40f96293..e072354d 100644 --- a/src/js/print.js +++ b/src/js/print.js @@ -13,7 +13,7 @@ const Print = { iframeElement.onload = () => { if (params.type === 'pdf') { // Add a delay for Firefox. In my tests, 1000ms was sufficient but 100ms was not - if (Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) { + if ((Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) || Browser.isSafari()) { setTimeout(() => performPrint(iframeElement, params), 1000) } else { performPrint(iframeElement, params) @@ -72,7 +72,7 @@ function performPrint (iframeElement, params) { } catch (error) { params.onError(error) } finally { - if (Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) { + if ((Browser.isFirefox() && Browser.getFirefoxMajorVersion() < 110) || Browser.isSafari()) { // Move the iframe element off-screen and make it invisible iframeElement.style.visibility = 'hidden' iframeElement.style.left = '-1px' From b25ccc610b9d87dd8125f1ef62bab578d88dda27 Mon Sep 17 00:00:00 2001 From: horkimsereirith Date: Wed, 29 Mar 2023 15:38:59 +0700 Subject: [PATCH 4/5] Rename package and readme --- README.md | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 9cf97e8f..9c945a8a 100644 --- a/README.md +++ b/README.md @@ -16,19 +16,19 @@ You can download the latest version of Print.js from the [GitHub releases](https To install via npm: ```bash -npm install print-js --save +npm install custom-print-js --save ``` To install via yarn: ```bash -yarn add print-js +yarn add custom-print-js ``` Import the library into your project: ```js -import printJS from 'print-js' +import printJS from 'custom-print-js' ``` ## Documentation diff --git a/package.json b/package.json index 225fb7d2..bb87eea8 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "print-js", + "name": "custom-print-js", "homepage": "http://printjs.crabbly.com", "description": "A tiny javascript library to help printing from the web.", "version": "1.6.0", From 9404ed6940edb902c78f419b06acd9695b3cccf3 Mon Sep 17 00:00:00 2001 From: horkimsereirith Date: Wed, 29 Mar 2023 16:23:58 +0700 Subject: [PATCH 5/5] Update release version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bb87eea8..16aee05d 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "custom-print-js", "homepage": "http://printjs.crabbly.com", "description": "A tiny javascript library to help printing from the web.", - "version": "1.6.0", + "version": "1.6.1", "main": "dist/print.js", "types": "src/index.d.ts", "repository": "https://github.com/crabbly/Print.js",