mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-24 00:27:40 +00:00
fix(webui): ensure pdf.worker path is root-relative
This commit is contained in:
@@ -9,7 +9,13 @@ import { PdfControlBar } from './pdf-control-bar'
|
||||
import pdfworker from '@/ui/public/pdf.worker.min.mjs' with { type: 'file' }
|
||||
|
||||
if (typeof window !== 'undefined' && pdfjsLib.GlobalWorkerOptions) {
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = pdfworker
|
||||
const workerPath =
|
||||
typeof pdfworker === 'string'
|
||||
? pdfworker.startsWith('/')
|
||||
? pdfworker
|
||||
: '/' + pdfworker.replace(/^\.\//, '')
|
||||
: pdfworker
|
||||
pdfjsLib.GlobalWorkerOptions.workerSrc = workerPath
|
||||
}
|
||||
|
||||
export const PdfViewer = React.forwardRef<MediaController, FileViewerProps>(
|
||||
|
||||
Reference in New Issue
Block a user