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:
commit
cc142d16ed
@ -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',
|
||||
|
@ -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) => (
|
||||
|
Loading…
Reference in New Issue
Block a user