Skip to content

Commit

Permalink
fix: make demos work
Browse files Browse the repository at this point in the history
  • Loading branch information
Priestch committed Mar 25, 2024
1 parent 88ded71 commit 3f2074f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion demos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"dev": "vite",
"dev": "vite --force",
"build": "vite build",
"preview": "vite preview"
},
Expand Down
1 change: 0 additions & 1 deletion demos/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import vue from "@vitejs/plugin-vue";
// https://vitejs.dev/config/
export default defineConfig(({ command, mode, ssrBuild }) => {
const base = command === "build" ? "/document-viewer/demos/" : "/";
console.log("base", base);
return {
base,
plugins: [
Expand Down
9 changes: 4 additions & 5 deletions packages/document-viewer/src/app_manager.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { PDFViewerApplication } from "./app.js";
import { AppOptions } from "../pdf.js/web/app_options";
import { injectLocaleResource } from "./utils";
import getViewerTemplate from "./viewer_template";
import { ApplicationOptions } from "./application_options";

let activeApp;
let manager = null;
Expand Down Expand Up @@ -151,7 +151,7 @@ function getViewerConfiguration(el) {
* @ignore
*
* @see https://github.com/mozilla/pdf.js/blob/master/web/app_options.js
* @typedef {object} ApplicationOptions
* @typedef {object} AppOptions
*/

/**
Expand All @@ -163,7 +163,7 @@ function getViewerConfiguration(el) {
* @property {string} resourcePath - The resource path of pdf.js.
* @property {boolean} [disableCORSCheck=false] - Disable CORS check of pdf.js.
* @property {boolean} [disableAutoSetTitle=false] - Disable auto-set title of document caused by pdf.js.
* @property {ApplicationOptions} [appOptions={}] - Default app options of pdf.js.
* @property {AppOptions} [appOptions={}] - Default app options of pdf.js.
*/

/**
Expand All @@ -184,7 +184,7 @@ function createViewerApp(options) {
} = options;
const workerSrc = `${resourcePath}/build/pdf.worker.js`;

const viewerOptions = new ApplicationOptions();
const viewerOptions = AppOptions;
Object.keys(appOptions).forEach(function (key) {
viewerOptions.set(key, appOptions[key]);
});
Expand All @@ -196,7 +196,6 @@ function createViewerApp(options) {

// set disablePreferences to enable custom appOptions work
viewerOptions.set("disablePreferences", true);
console["log"]("createViewerApp", viewerOptions.get("defaultUrl"));

const localeUrl = `${resourcePath}/web/locale/locale.properties`;
injectLocaleResource(localeUrl);
Expand Down

0 comments on commit 3f2074f

Please sign in to comment.