From 7a419796e3362bf66ce36b66a4ba0d8e7e675117 Mon Sep 17 00:00:00 2001 From: Kavin Venkatachalam <50441969+kavinvenkatachalam@users.noreply.github.com> Date: Mon, 30 May 2022 14:06:10 +0530 Subject: [PATCH] PDF url null check added (#3142) --- frontend/src/Editor/Components/PDF.jsx | 71 +++++++++++++------------- 1 file changed, 35 insertions(+), 36 deletions(-) diff --git a/frontend/src/Editor/Components/PDF.jsx b/frontend/src/Editor/Components/PDF.jsx index 442c4e7b75..de749705f4 100644 --- a/frontend/src/Editor/Components/PDF.jsx +++ b/frontend/src/Editor/Components/PDF.jsx @@ -46,46 +46,45 @@ export const PDF = React.memo(({ styles, properties, width, height }) => { [pageNumber] ); + const renderPDF = () => ( + + {Array.from(new Array(numPages), (el, index) => ( + (pageRef.current[index] = el)} + /> + ))} + {pageControls && ( + <> +
+ + + {pageNumber} of {numPages} + + +
+ + )} +
+ ); + return (
- - {Array.from(new Array(numPages), (el, index) => ( - (pageRef.current[index] = el)} - /> - ))} - {pageControls && ( - <> -
- - - {pageNumber} of {numPages} - - -
- - )} -
+ {url === '' ? 'No PDF file specified' : renderPDF()}