1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-12-01 21:42:08 +03:00

Merge pull request #186 from hxuanhung/bugfix/Appear-children-disappear-when-export-pdf

PDF export ignores Appear component #121
This commit is contained in:
Brent Jackson 2018-11-27 10:25:13 -05:00 committed by GitHub
commit cc142d16ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 0 deletions

View File

@ -6,6 +6,10 @@ const puppeteer = require('puppeteer')
module.exports = async (opts = {}) => {
const browser = await puppeteer.launch()
const page = await browser.newPage()
// This can be used to control some UI components's visibility like: Appear,...
page.setUserAgent('MDX-Deck/1.7.7 Print/PDF')
const {
outDir,
outFile = 'presentation.pdf',

View File

@ -29,6 +29,10 @@ export default withDeck(class Appear extends React.Component {
return children
}
if (window.navigator.userAgent.includes('Print/PDF')) {
return children;
}
return (
<React.Fragment>
{children.map((child, i) => (