11// eslint-disable-next-line import/extensions
22import pdfWorkerSource from 'pdfjs-dist/build/pdf.worker.min.mjs' ;
33// eslint-disable-next-line import/extensions
4- import pdfWorkerLegacySource from 'pdfjs-dist/legacy/build/pdf.worker.mjs' ;
54import React , { memo , useCallback , useLayoutEffect , useRef , useState } from 'react' ;
65import type { CSSProperties , ReactNode } from 'react' ;
76import times from 'lodash/times' ;
@@ -15,7 +14,7 @@ import {pdfPreviewerStyles as styles} from './styles';
1514import PDFPasswordForm , { type PDFPasswordFormProps } from './PDFPasswordForm' ;
1615import PageRenderer from './PageRenderer' ;
1716import { PAGE_BORDER , LARGE_SCREEN_SIDE_SPACING , DEFAULT_DOCUMENT_OPTIONS , DEFAULT_EXTERNAL_LINK_TARGET , PDF_PASSWORD_FORM_RESPONSES } from './constants' ;
18- import { isMobileSafari , isModernSafari , setListAttributes } from './helpers' ;
17+ import { setListAttributes } from './helpers' ;
1918
2019type Props = {
2120 file : string ;
@@ -35,11 +34,7 @@ type Props = {
3534
3635type OnPasswordCallback = ( password : string | null ) => void ;
3736
38- const shouldUseLegacyWorker = isMobileSafari ( ) && ! isModernSafari ( ) ;
39- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
40- const pdfWorker = shouldUseLegacyWorker ? pdfWorkerLegacySource : pdfWorkerSource ;
41-
42- pdfjs . GlobalWorkerOptions . workerSrc = URL . createObjectURL ( new Blob ( [ pdfWorker ] , { type : 'text/javascript' } ) ) ;
37+ pdfjs . GlobalWorkerOptions . workerSrc = URL . createObjectURL ( new Blob ( [ pdfWorkerSource ] , { type : 'text/javascript' } ) ) ;
4338
4439const DefaultLoadingComponent = < p > Loading...</ p > ;
4540const DefaultErrorComponent = < p > Failed to load the PDF file :(</ p > ;
0 commit comments