fix(frontend): PDF viewer version mismatch — use CDN worker matching react-pdf bundled version
pdfjs-dist 5.6.205 was installed separately from react-pdf's bundled 5.4.296. Change workerSrc from local pdfjs-dist import to unpkg CDN with dynamic version. Uses pdfjs.version from react-pdf to ensure API/worker version match. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
60fd37c90a
commit
7a89651512
|
|
@ -5,10 +5,7 @@ import { ArrowLeft, ChevronLeft, ChevronRight, ZoomIn, ZoomOut } from 'lucide-re
|
||||||
import 'react-pdf/dist/Page/AnnotationLayer.css'
|
import 'react-pdf/dist/Page/AnnotationLayer.css'
|
||||||
import 'react-pdf/dist/Page/TextLayer.css'
|
import 'react-pdf/dist/Page/TextLayer.css'
|
||||||
|
|
||||||
pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/build/pdf.worker.min.mjs`
|
||||||
'pdfjs-dist/build/pdf.worker.min.mjs',
|
|
||||||
import.meta.url,
|
|
||||||
).toString()
|
|
||||||
|
|
||||||
const ZOOM_LEVELS = [0.5, 0.75, 1, 1.25, 1.5, 2]
|
const ZOOM_LEVELS = [0.5, 0.75, 1, 1.25, 1.5, 2]
|
||||||
const DEFAULT_ZOOM_INDEX = 2
|
const DEFAULT_ZOOM_INDEX = 2
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue