Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 fix(PdfMobileViewer): compatible with old browsers #2112

Merged
merged 1 commit into from
Aug 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading