Skip to content

Commit

Permalink
Merge pull request #297 from gregnb/v2.10.1
Browse files Browse the repository at this point in the history
v2.10.1
  • Loading branch information
MatthewHerbst authored Oct 15, 2020
2 parents 83f352a + 7835e83 commit 11fe469
Show file tree
Hide file tree
Showing 4 changed files with 284 additions and 186 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# CHANGELOG

## 2.10.1 (October 15th, 2020)

- FIX [296](https://github.com/gregnb/react-to-print/pull/296): Ensure `bodyClass` can handle multiple class names instead of just a single class name. Thanks [seanblonien](https://github.com/seanblonien)
- CHORE: update patch and minor `devDependencies`, `dedupe`, and `audit fix`

## 2.10.0 (August 23rd, 2020)

- FEATURE [272](https://github.com/gregnb/react-to-print/pull/272): a new prop `print` has been added. This can be used to override the default browser [`Window.print`](https://developer.mozilla.org/en-US/docs/Web/API/Window/print). This can be useful if you want to print in an alternative environment such as Electron. As part of this change, `onPrintError` will now report if an error occurs in a passed in `print` method. Thanks to [Ririshi](https://github.com/Ririshi) for this idea
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ The component accepts the following props:

| Name | Type | Description |
| :-------------------: | :------- | :---------------------------------------------------------------------------------------------------------------------------------- |
| **`bodyClass?`** | `string` | Class to pass to the print window |
| **`bodyClass?`** | `string` | One or more class names to pass to the print window, separated by spaces |
| **`content`** | `function` | A function that returns a component reference value. The content of this reference value is then used for print |
| **`copyStyles?`** | `boolean` | Copy all `<style>` and `<link type="stylesheet" />` tags from `<head>` inside the parent window into the print window. (default: `true`) |
| **`documentTitle?`** | `string` | Set the title for printing when saving as a file |
Expand Down Expand Up @@ -239,7 +239,7 @@ const Example = () => {
```

## Pattern for Page-Breaking Dynamic React Content
In HTML (e.g., JSX), define a page-break class to apply to elements which could be sensibly split into a following page.
In HTML (e.g., JSX), define a page-break class to apply to elements which could be sensibly split into a following page.
```
<div className="print-container" style={{margin: "0", padding: "0"}}>
{_.map(listOfContent, yourContent => (
Expand Down Expand Up @@ -279,14 +279,14 @@ In corresponding style files, define your `media print` styles, including: setti
```

## Troubleshooting Page Breaks
If your content rendered as print media does not automatically break multipage content into multiple pages, the issue may be
1) style incompatibilities with print media rendering, **or**
If your content rendered as print media does not automatically break multipage content into multiple pages, the issue may be
1) style incompatibilities with print media rendering, **or**
2) a need to assign `CSS page-break-` properties to define how your document should behave when printed.

### Common Style Pitfalls
- A style of `overflow: scroll`, when rendered to print, will result in cut off content instead of page breaks to include the content.
- A style of `position: absolute`, when rendered to print, may result in reformatted, rotated, or re-scaled content, causing unintended affects to print page layout and page breaks.
- A style of `position: absolute`, when rendered to print, may result in reformatted, rotated, or re-scaled content, causing unintended affects to print page layout and page breaks.

## Running locally

*NOTE*: Node ^10 is required to build the library locally. We use Node ^10 for our CLI checks.
Expand Down
Loading

0 comments on commit 11fe469

Please sign in to comment.