Skip to content

Commit

Permalink
add pdf.css to the Preview
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob Ellison committed May 9, 2023
1 parent 56ead17 commit dc20698
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion layouts/PrintSlide.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default dynamic(() => Promise.resolve(PrintSlide), {
});

function PrintSlide({ children, next }) {
console.log('PrintSlide:children : ', children)
// console.log('PrintSlide:children : ', children)
let generatedSlides = [];
let generatorCount = 0;
// Filter down children by only Slides
Expand Down
11 changes: 8 additions & 3 deletions pages/files/[format]/[file].js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import fs from 'fs'
import path from 'path'
import Head from 'next/head';
import Script from 'next/script';
import dynamic from 'next/dynamic'

const glob = require('glob')

Expand Down Expand Up @@ -126,7 +127,11 @@ export async function getStaticProps(context) {
}
}

export default function Pad({ source, format }) {
export default dynamic(() => Promise.resolve(Pad), {
ssr: false,
});

function Pad({ source, format }) {
const mdxContainer = useRef(null);
const previewContainer = useRef(null);
let contentMdx = ``;
Expand All @@ -136,7 +141,7 @@ export default function Pad({ source, format }) {
contentMdx = `${mdxContainer.current?.innerHTML}`;
paged
.preview(contentMdx,
[],
['/pdf.css'],
previewContainer.current
)
.then((flow) => {
Expand All @@ -159,7 +164,7 @@ export default function Pad({ source, format }) {
return (
<>
<Head>
<Script src="https://unpkg.com/pagedjs/dist/paged.polyfill.js"></Script>
{/* <Script src="https://unpkg.com/pagedjs/dist/paged.polyfill.js"></Script> */}
</Head>
<div ref={mdxContainer} style={{ display: 'none' }}>
{/* style={{ display: 'none' }}> */}
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
{
"name": "next"
}
]
],
"incremental": true
},
"include": [
"next-env.d.ts",
Expand All @@ -38,4 +39,4 @@
"exclude": [
"node_modules"
]
}
}

0 comments on commit dc20698

Please sign in to comment.