Skip to content

Commit

Permalink
🐛 fix(PdfMobileViewer): compatible with old browsers (#2119)
Browse files Browse the repository at this point in the history
* 🐛 fix(PdfMobileViewer): compatible with old browsers

* build js
  • Loading branch information
capdiem authored Aug 27, 2024
1 parent 5a0095d commit 8e9e46d
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 31 deletions.
6 changes: 3 additions & 3 deletions src/Masa.Blazor.JS/rollup.config.pdfjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import typescript from "@rollup/plugin-typescript";
export default defineConfig({
input: [
"./src/proxies/pdf.js/mobile-viewer.ts",
"pdfjs-dist/build/pdf.worker.min.mjs",
"./src/proxies/pdf.js/pdf.worker.js",
],
output: [
{
Expand All @@ -21,11 +21,11 @@ export default defineConfig({
],
plugins: [
typescript(),
resolve(),
commonjs(),
getBabelOutputPlugin({
presets: ["@babel/preset-env"],
}),
resolve(),
commonjs(),
terser(),
],
watch: {
Expand Down
2 changes: 1 addition & 1 deletion src/Masa.Blazor.JS/src/proxies/pdf.js/mobile-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ function init(
);

GlobalWorkerOptions.workerSrc = new URL(
"./pdf.worker.min.js",
"./pdf.worker.js",
import.meta.url
).toString();
pdfViewerApp.initUI();
Expand Down
7 changes: 7 additions & 0 deletions src/Masa.Blazor.JS/src/proxies/pdf.js/pdf.worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import "core-js/modules/es.array.at.js";
import "core-js/modules/es.string.replace-all";
import "core-js/modules/web.structured-clone.js";
import "core-js/proposals/promise-with-resolvers";

import * as pdfworker from "pdfjs-dist/build/pdf.worker.mjs";
export default pdfworker;

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions src/Masa.Blazor/wwwroot/js/proxies/pdf-mobile-viewer/pdf.worker.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

This file was deleted.

0 comments on commit 8e9e46d

Please sign in to comment.