Commit 35640c43 authored by Audrey Hamelers's avatar Audrey Hamelers
parent 0805f7c3
Pipeline #13061 passed with stages
in 5 minutes and 39 seconds
......@@ -187,6 +187,7 @@ class PDFViewer extends React.Component {
<Viewer
fitWidth={this.setFit}
loading={loading}
maxPages={this.props.maxPages}
onScroll={this.countPages}
pdf={pdf}
scale={scale}
......
......@@ -14,7 +14,7 @@ const Pane = styled.div`
class Viewer extends React.PureComponent {
render() {
const { pdf, loading, ...props } = this.props
const { pdf, loading, maxPages, ...props } = this.props
const numPages = pdf && pdf._pdfInfo ? pdf._pdfInfo.numPages : 0
return (
<Pane className="pdf-viewer-pane" onScroll={props.onScroll}>
......@@ -30,7 +30,7 @@ class Viewer extends React.PureComponent {
/>
) : (
<React.Fragment>
{numPages < 51 ? (
{!maxPages || numPages < maxPages ? (
[...Array(numPages)].map((v, i) => (
<Page
index={i + 1}
......@@ -43,7 +43,7 @@ class Viewer extends React.PureComponent {
))
) : (
<React.Fragment>
{[...Array(51)].map((v, i) => (
{[...Array(maxPages + 1)].map((v, i) => (
<Page
index={i + 1}
key={`document-page-${Math.round(
......
......@@ -55,7 +55,13 @@ class ManuscriptPreview extends React.Component {
</Doc>
)
} else if (file.mimeType === 'application/pdf') {
return <PDFViewer textContent={this.props.textContent} url={file.url} />
return (
<PDFViewer
maxPages={50}
textContent={this.props.textContent}
url={file.url}
/>
)
}
return (
<Notification type="info">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment