Skip to content

Commit

Permalink
🐛 fix(PdfMobileViewer): compatible with old browsers (#2112)
Browse files Browse the repository at this point in the history
  • Loading branch information
capdiem authored Aug 22, 2024
1 parent d7f2a1e commit e73d943
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/Masa.Blazor.JS/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@
"author": "",
"license": "MIT",
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@microsoft/dotnet-js-interop": "6.0.11",
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-json": "^5.0.1",
"@rollup/plugin-node-resolve": "^15.0.1",
Expand All @@ -49,6 +52,7 @@
"@types/echarts": "^4.9.16",
"@types/node": "^18.7.14",
"@types/sortablejs": "^1.15.8",
"core-js": "3",
"drawflow": "^0.0.59",
"gridstack": "^7.2.1",
"just-debounce-it": "^3.2.0",
Expand Down
8 changes: 7 additions & 1 deletion src/Masa.Blazor.JS/rollup.config.pdfjs.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import { defineConfig } from "rollup";
import { terser } from "rollup-plugin-terser";

import { getBabelOutputPlugin } from "@rollup/plugin-babel";
import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";
import typescript from "@rollup/plugin-typescript";

export default defineConfig({
input: [
"./src/proxies/pdf.js/mobile-viewer.ts",
"pdfjs-dist/legacy/build/pdf.worker.min.mjs"
"pdfjs-dist/build/pdf.worker.min.mjs",
],
output: [
{
Expand All @@ -20,6 +22,10 @@ export default defineConfig({
plugins: [
typescript(),
resolve(),
commonjs(),
getBabelOutputPlugin({
presets: ["@babel/preset-env"],
}),
terser(),
],
watch: {
Expand Down
7 changes: 6 additions & 1 deletion src/Masa.Blazor.JS/src/proxies/pdf.js/mobile-viewer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
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 {
build, getDocument, GlobalWorkerOptions, InvalidPDFException, MissingPDFException,
PDFDocumentProxy, UnexpectedResponseException, version
} from "pdfjs-dist";
import * as pdfjsViewer from "pdfjs-dist/legacy/web/pdf_viewer.mjs";
import * as pdfjsViewer from "pdfjs-dist/web/pdf_viewer.mjs";

const TEXT_LAYER_MODE = 0; // DISABLE
const MAX_IMAGE_SIZE = 1024 * 1024;
Expand Down

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.

0 comments on commit e73d943

Please sign in to comment.