From 97613920bf3cefd561038e2af5d6709452407957 Mon Sep 17 00:00:00 2001 From: Matthew Herbst Date: Tue, 30 Jul 2019 12:52:04 -0700 Subject: [PATCH] Version 2.3.0 --- CHANGELOG.md | 4 ++++ README.md | 6 +++--- package-lock.json | 2 +- package.json | 2 +- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e49eee..d0d5c21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # CHANGELOG +## 2.3.0 (July 30th, 2019) + +- FEATURE [152](https://github.com/gregnb/react-to-print/pull/152): Previously, this library used a window rather than an `iframe` to handle printing. That was changed some time ago, however, the `closeAfterPrint` prop was never removed from the documentation (though it was removed from the code). This release restores similar functionality, in a new `removeAfterPrint` prop. Passing this prop will ensure that `react-to-print` removes the `iframe` it uses to print from the DOM after printing (something that it currently does not do). NOTE: the `iframe` is removed after the call to `onAfterPrint` (if provided) has completed. We will likely make this the default functionality in version 3, but are keeping it like this for now to ensure anyone relying on the `iframe` does not face issues. Thanks [aviklai](https://github.com/aviklai) + ## 2.2.1 (July 22nd, 2019) - FIX [149](https://github.com/gregnb/react-to-print/pull/149): Print window would not open if `onBeforePrint` was not given. Thanks [aviklai](https://github.com/aviklai) diff --git a/README.md b/README.md index 05c30e9..b63b822 100644 --- a/README.md +++ b/README.md @@ -135,9 +135,9 @@ The component accepts the following props: | **`trigger`** | function | A function that returns a React Component or HTML element | | **`content`** | function | A function that returns a component reference value. The content of this reference value is then used for print | | **`copyStyles`** | boolean | Copies all <style> and <link type="stylesheet" /> from inside the parent window into the print window. (default: true) | -| **`onBeforePrint`** | function | A callback function that triggers before print. Either returns void or a Promise. If the function returns a Promise the content will be printed when the Promise is resolved. Users are responsible for catching the Promise rejecting. | -| **`onAfterPrint`** | function | A callback function that triggers after print | -| **`removeAfterPrint`** | boolean | Remove the print iframe after action | +| **`onBeforePrint`** | function | Optional callback function that triggers before print. Either returns void or a Promise. If the function returns a Promise the content will be printed when the Promise is resolved. Users are responsible for catching the Promise rejecting. | +| **`onAfterPrint`** | function | Optional callback function that triggers after print | +| **`removeAfterPrint`** | boolean | Remove the print iframe after action. Defaults to `false`. | | **`pageStyle`** | string | Override default print window styling | | **`bodyClass`** | string | Optional class to pass to the print window body | diff --git a/package-lock.json b/package-lock.json index ef0d687..7c003d3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "react-to-print", - "version": "2.2.1", + "version": "2.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 8ae4cf8..806bb93 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-to-print", - "version": "2.2.1", + "version": "2.3.0", "description": "Print React components in the browser", "main": "lib/index.js", "types": "lib/index.d.ts",