Make PDF Viewer a native feature
- Move the PDF Viewer plugin into src/lib/features/pdf/ with pdfjs-dist 6.4.299 (minified builds). - A static pdf document type marks PDF files and opens them as tabs. The first PDF tab loads the module. - The worker, the character maps, the fonts, and the decoders come from the app. One worker for each tab. - The toolbar uses IconButton and the shared tooltip, with the new zoom-in, zoom-out, fit-width, and rotate icons. - Add THIRD_PARTY_NOTICES.md for PDF.js and xterm. - Update the tests, the menu inventory, the docs, and UI-059.
This commit is contained in:
@@ -105,6 +105,17 @@ export default defineConfig(() => ({
|
||||
worker: {
|
||||
format: /** @type {"es"} */ ("es"),
|
||||
},
|
||||
optimizeDeps: {
|
||||
// The minified PDF.js build is one ES module without imports. The dev server serves it as it is. Without this, the
|
||||
// first PDF tab finds a new dependency and the dev server reloads the page.
|
||||
exclude: ["pdfjs-dist"],
|
||||
},
|
||||
build: {
|
||||
// The PDF Viewer reads the data files of PDF.js with fetch (src/lib/features/pdf/engine.ts). Keep them as files of
|
||||
// the app, because the content security policy permits no data: address for fetch.
|
||||
/** @param {string} file */
|
||||
assetsInlineLimit: file => file.replaceAll("\\", "/").includes("/pdfjs-dist/") ? false : undefined,
|
||||
},
|
||||
|
||||
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user