@flyfish-group/file-viewer3 1.0.21 → 1.0.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +372 -0
- package/README.md +26 -24
- package/dist/components/3MFLoader.js +1 -1
- package/dist/components/AMFLoader.js +1 -1
- package/dist/components/ArchiveViewer.js +1 -1
- package/dist/components/AudioViewer.js +1 -1
- package/dist/components/CadViewer.js +1 -1
- package/dist/components/CodeViewer.js +1 -1
- package/dist/components/ColladaLoader.js +1 -1
- package/dist/components/DrawingViewer.js +1 -1
- package/dist/components/EdaViewer.js +1 -1
- package/dist/components/EmailViewer.js +1 -1
- package/dist/components/EpubViewer.js +1 -1
- package/dist/components/FBXLoader.js +1 -1
- package/dist/components/GLTFLoader.js +1 -1
- package/dist/components/ImageViewer.js +1 -1
- package/dist/components/KMZLoader.js +1 -1
- package/dist/components/MarkdownViewer.js +1 -1
- package/dist/components/ModelViewer.js +1 -1
- package/dist/components/OBJLoader.js +1 -1
- package/dist/components/OfdViewer.js +1 -1
- package/dist/components/PCDLoader.js +1 -1
- package/dist/components/PLYLoader.js +1 -1
- package/dist/components/PdfView.js +5619 -5067
- package/dist/components/PptxRender.js +1 -1
- package/dist/components/STLLoader.js +1 -1
- package/dist/components/TDSLoader.js +1 -1
- package/dist/components/TypstViewer.js +3 -3
- package/dist/components/USDLoader.js +1 -1
- package/dist/components/UmdViewer.js +1 -1
- package/dist/components/VRMLLoader.js +1 -1
- package/dist/components/VTKLoader.js +1 -1
- package/dist/components/XYZLoader.js +1 -1
- package/dist/components/XlsxTable.js +1 -1
- package/dist/components/__vite-browser-external.js +1 -1
- package/dist/components/_plugin-vue_export-helper.js +1 -1
- package/dist/components/ar-SA-G6X2FPQ2.js +1 -1
- package/dist/components/arc.js +1 -1
- package/dist/components/architecture-7EHR7CIX.js +1 -1
- package/dist/components/architectureDiagram-3BPJPVTR.js +1 -1
- package/dist/components/archive.js +1 -1
- package/dist/components/asyncToGenerator.js +1 -1
- package/dist/components/audio.js +1 -1
- package/dist/components/az-AZ-76LH7QW2.js +1 -1
- package/dist/components/bash.js +1 -1
- package/dist/components/bg-BG-XCXSNQG7.js +1 -1
- package/dist/components/blockDiagram-GPEHLZMM.js +1 -1
- package/dist/components/bn-BD-2XOGV67Q.js +1 -1
- package/dist/components/c4Diagram-AAUBKEIU.js +1 -1
- package/dist/components/ca-ES-6MX7JW3Y.js +1 -1
- package/dist/components/cad.js +1 -1
- package/dist/components/cfb.js +1 -1
- package/dist/components/channel.js +1 -1
- package/dist/components/chunk-2J33WTMH.js +1 -1
- package/dist/components/chunk-3OPIFGDE.js +1 -1
- package/dist/components/chunk-4BX2VUAB.js +1 -1
- package/dist/components/chunk-55IACEB6.js +1 -1
- package/dist/components/chunk-5ZQYHXKU.js +1 -1
- package/dist/components/chunk-6U3AYISY.js +1 -1
- package/dist/components/chunk-727SXJPM.js +1 -1
- package/dist/components/chunk-AGHRB4JF.js +1 -1
- package/dist/components/chunk-AQP2D5EJ.js +1 -1
- package/dist/components/chunk-BSJP7CBP.js +1 -1
- package/dist/components/chunk-CSCIHK7Q.js +1 -1
- package/dist/components/chunk-EIO257PC.js +563 -564
- package/dist/components/chunk-FMBD7UC4.js +1 -1
- package/dist/components/chunk-K2UTITRG.js +1 -1
- package/dist/components/chunk-KSCS5N6A.js +1 -1
- package/dist/components/chunk-L5ZTLDWV.js +1 -1
- package/dist/components/chunk-LZXEDZCA.js +1 -1
- package/dist/components/chunk-ND2GUHAM.js +1 -1
- package/dist/components/chunk-NNHCCRGN.js +1 -0
- package/dist/components/chunk-NZK2D7GU.js +1 -1
- package/dist/components/chunk-O5CBEL6O.js +1 -1
- package/dist/components/chunk-QZHKN3VN.js +1 -1
- package/dist/components/chunk-SRAX5OIU.js +1 -1
- package/dist/components/chunk-WU5MYG2G.js +1 -1
- package/dist/components/chunk-XPW4576I.js +1 -1
- package/dist/components/chunk-Z3N5DIM6.js +1 -1
- package/dist/components/chunk-ZUYEQ4TG.js +1 -1
- package/dist/components/chunk.js +1 -1
- package/dist/components/classDiagram-4FO5ZUOK.js +1 -1
- package/dist/components/classDiagram-v2-Q7XG4LA2.js +1 -1
- package/dist/components/compiler.js +1 -1
- package/dist/components/core.js +1 -1
- package/dist/components/cose-bilkent-S5V4N54A.js +1 -1
- package/dist/components/cpp.js +1 -1
- package/dist/components/cs-CZ-2BRQDIVT.js +1 -1
- package/dist/components/csharp.js +1 -1
- package/dist/components/css.js +1 -1
- package/dist/components/cytoscape.esm.js +1 -1
- package/dist/components/da-DK-5WZEPLOC.js +1 -1
- package/dist/components/dagre-BM42HDAG.js +1 -1
- package/dist/components/dagre.js +1 -1
- package/dist/components/de-DE-XR44H4JA.js +1 -1
- package/dist/components/defaultLocale.js +1 -1
- package/dist/components/defineProperty.js +1 -1
- package/dist/components/diagram-2AECGRRQ.js +1 -1
- package/dist/components/diagram-5GNKFQAL.js +1 -1
- package/dist/components/diagram-KO2AKTUF.js +1 -1
- package/dist/components/diagram-LMA3HP47.js +1 -1
- package/dist/components/diagram-OG6HWLK6.js +1 -1
- package/dist/components/diff.js +1 -1
- package/dist/components/directory-open-01563666.js +1 -1
- package/dist/components/directory-open-4ed118d0.js +1 -1
- package/dist/components/dist.js +1 -1
- package/dist/components/dist2.js +1 -1
- package/dist/components/dist3.js +1 -1
- package/dist/components/documentSearch.js +1 -0
- package/dist/components/docx-preview.js +1 -1
- package/dist/components/drawing.js +1 -1
- package/dist/components/ebook.js +1 -1
- package/dist/components/eda.js +1 -1
- package/dist/components/el-GR-BZB4AONW.js +1 -1
- package/dist/components/email.js +1 -1
- package/dist/components/en-B4ZKOASM.js +1 -1
- package/dist/components/erDiagram-TEJ5UH35.js +1 -1
- package/dist/components/es-ES-U4NZUMDT.js +1 -1
- package/dist/components/eu-ES-A7QVB2H4.js +1 -1
- package/dist/components/eventmodeling-FCH6USID.js +1 -1
- package/dist/components/fa-IR-HGAKTJCU.js +1 -1
- package/dist/components/fflate.module.js +1 -1
- package/dist/components/fi-FI-Z5N7JZ37.js +1 -1
- package/dist/components/file-open-002ab408.js +1 -1
- package/dist/components/file-open-7c801643.js +1 -1
- package/dist/components/file-save-3189631c.js +1 -1
- package/dist/components/file-save-745eba88.js +1 -1
- package/dist/components/flowDiagram-I6XJVG4X.js +1 -1
- package/dist/components/fr-FR-RHASNOE6.js +1 -1
- package/dist/components/ganttDiagram-6RSMTGT7.js +1 -1
- package/dist/components/gitGraph-WXDBUCRP.js +1 -1
- package/dist/components/gitGraphDiagram-PVQCEYII.js +1 -1
- package/dist/components/gl-ES-HMX3MZ6V.js +1 -1
- package/dist/components/global-compiler.js +1 -1
- package/dist/components/global-renderer.js +1 -1
- package/dist/components/go.js +1 -1
- package/dist/components/graphlib.js +1 -1
- package/dist/components/he-IL-6SHJWFNN.js +1 -1
- package/dist/components/hi-IN-IWLTKZ5I.js +1 -1
- package/dist/components/hu-HU-A5ZG7DT2.js +1 -1
- package/dist/components/id-ID-SAP4L64H.js +1 -1
- package/dist/components/image-GAAHSSAO.js +1 -1
- package/dist/components/image-blob-reduce.esm.js +1 -1
- package/dist/components/image.js +1 -1
- package/dist/components/info-J43DQDTF.js +1 -1
- package/dist/components/infoDiagram-5YYISTIA.js +1 -1
- package/dist/components/ini.js +1 -1
- package/dist/components/init.js +1 -1
- package/dist/components/ishikawaDiagram-YF4QCWOH.js +1 -1
- package/dist/components/it-IT-JPQ66NNP.js +1 -1
- package/dist/components/ja-JP-DBVTYXUO.js +1 -1
- package/dist/components/java.js +1 -1
- package/dist/components/javascript.js +1 -1
- package/dist/components/journeyDiagram-JHISSGLW.js +1 -1
- package/dist/components/json.js +1 -1
- package/dist/components/jszip.min.js +1 -1
- package/dist/components/kaa-6HZHGXH3.js +1 -1
- package/dist/components/kab-KAB-ZGHBKWFO.js +1 -1
- package/dist/components/kanban-definition-UN3LZRKU.js +1 -1
- package/dist/components/katex.js +1 -1
- package/dist/components/kk-KZ-P5N5QNE5.js +1 -1
- package/dist/components/km-KH-HSX4SM5Z.js +1 -1
- package/dist/components/ko-KR-MTYHY66A.js +1 -1
- package/dist/components/ku-TR-6OUDTVRD.js +1 -1
- package/dist/components/lib.js +1 -1
- package/dist/components/libarchive.js +1 -1
- package/dist/components/linear.js +1 -1
- package/dist/components/lt-LT-XHIRWOB4.js +1 -1
- package/dist/components/lv-LV-5QDEKY6T.js +1 -1
- package/dist/components/markdown.js +1 -1
- package/dist/components/md.js +1 -1
- package/dist/components/mermaid-parser.core.js +1 -1
- package/dist/components/mindmap-definition-RKZ34NQL.js +1 -1
- package/dist/components/model.js +1 -1
- package/dist/components/mp4.js +1 -1
- package/dist/components/mr-IN-CRQNXWMA.js +1 -1
- package/dist/components/my-MM-5M5IBNSE.js +1 -1
- package/dist/components/nb-NO-T6EIAALU.js +1 -1
- package/dist/components/nestedRender.js +1 -1
- package/dist/components/nl-NL-IS3SIHDZ.js +1 -1
- package/dist/components/nn-NO-6E72VCQL.js +1 -1
- package/dist/components/objectSpread2.js +1 -1
- package/dist/components/objectWithoutProperties.js +1 -1
- package/dist/components/oc-FR-POXYY2M6.js +1 -1
- package/dist/components/ofd.js +1 -1
- package/dist/components/ofd2.js +1 -1
- package/dist/components/ordinal.js +1 -1
- package/dist/components/pa-IN-N4M65BXN.js +1 -1
- package/dist/components/packet-YPE3B663.js +1 -1
- package/dist/components/pdf.js +1 -1
- package/dist/components/percentages-BXMCSKIN.js +1 -1
- package/dist/components/php.js +1 -1
- package/dist/components/pica.js +1 -1
- package/dist/components/pie-LRSECV5Y.js +1 -1
- package/dist/components/pie.js +1 -1
- package/dist/components/pieDiagram-4H26LBE5.js +1 -1
- package/dist/components/pl-PL-T2D74RX3.js +1 -1
- package/dist/components/postal-mime.js +1 -1
- package/dist/components/pptx.js +1 -1
- package/dist/components/printLayout.js +1 -1
- package/dist/components/prod.js +1 -1
- package/dist/components/pt-BR-5N22H2LF.js +1 -1
- package/dist/components/pt-PT-UZXXM6DQ.js +1 -1
- package/dist/components/python.js +1 -1
- package/dist/components/quadrantDiagram-W4KKPZXB.js +1 -1
- package/dist/components/radar-GUYGQ44K.js +1 -1
- package/dist/components/renderer.js +1 -1
- package/dist/components/requirementDiagram-4Y6WPE33.js +1 -1
- package/dist/components/ro-RO-JPDTUUEW.js +1 -1
- package/dist/components/rough.esm.js +1 -1
- package/dist/components/roundRect.js +1 -1
- package/dist/components/ru-RU-B4JR7IUQ.js +1 -1
- package/dist/components/rust.js +1 -1
- package/dist/components/sankeyDiagram-5OEKKPKP.js +1 -1
- package/dist/components/sequenceDiagram-3UESZ5HK.js +1 -1
- package/dist/components/shared.js +1 -1
- package/dist/components/shared2.js +1 -1
- package/dist/components/si-LK-N5RQ5JYF.js +1 -1
- package/dist/components/sk-SK-C5VTKIMK.js +1 -1
- package/dist/components/sl-SI-NN7IZMDC.js +1 -1
- package/dist/components/sourceLoading.js +1 -1
- package/dist/components/sql.js +1 -1
- package/dist/components/src.js +1 -1
- package/dist/components/src2.js +1 -1
- package/dist/components/stateDiagram-AJRCARHV.js +1 -1
- package/dist/components/stateDiagram-v2-BHNVJYJU.js +1 -1
- package/dist/components/subset-shared.chunk.js +1 -1
- package/dist/components/subset-worker.chunk.js +1 -1
- package/dist/components/sv-SE-XGPEYMSR.js +1 -1
- package/dist/components/ta-IN-2NMHFXQM.js +1 -1
- package/dist/components/text.js +1 -1
- package/dist/components/th-TH-HPSO5L25.js +1 -1
- package/dist/components/three.module.js +1 -1
- package/dist/components/time.js +1 -1
- package/dist/components/timeline-definition-PNZ67QCA.js +1 -1
- package/dist/components/tr-TR-DEFEU3FU.js +1 -1
- package/dist/components/treeView-BLDUP644.js +1 -1
- package/dist/components/treemap-LRROVOQU.js +1 -1
- package/dist/components/typescript.js +1 -1
- package/dist/components/typst.js +1 -1
- package/dist/components/uk-UA-QMV73CPH.js +1 -1
- package/dist/components/umd.js +1 -1
- package/dist/components/use.js +1 -1
- package/dist/components/util.js +1 -1
- package/dist/components/vennDiagram-CIIHVFJN.js +1 -1
- package/dist/components/vi-VN-M7AON7JQ.js +1 -1
- package/dist/components/wardley-L42UT6IY.js +1 -1
- package/dist/components/wardleyDiagram-YWT4CUSO.js +1 -1
- package/dist/components/wasm-pack-shim.js +1 -1
- package/dist/components/wasm-pack-shim2.js +1 -1
- package/dist/components/wasm.js +1 -1
- package/dist/components/word.js +1 -1
- package/dist/components/worker-ref.js +1 -1
- package/dist/components/xlsx.js +1 -1
- package/dist/components/xml.js +1 -1
- package/dist/components/xychartDiagram-2RQKCTM6.js +1 -1
- package/dist/components/yaml.js +1 -1
- package/dist/components/zh-CN-LNUGB5OW.js +1 -1
- package/dist/components/zh-HK-E62DVLB3.js +1 -1
- package/dist/components/zh-TW-RAJ6MFWO.js +1 -1
- package/dist/file-viewer3.css +1 -1
- package/dist/index.mjs +1 -1
- package/dist/src/App.vue.d.ts +3 -0
- package/dist/src/compare/CompareApp.vue.d.ts +3 -0
- package/dist/src/compare/useSynchronizedScroll.d.ts +7 -0
- package/dist/src/components/HelloWorld.vue.d.ts +3 -0
- package/dist/src/components/utils.d.ts +1 -1
- package/dist/src/package/common/type.d.ts +225 -0
- package/dist/src/package/components/FileViewer/FileViewer.vue.d.ts +15 -1
- package/dist/src/package/components/FileViewer/hooks/useViewerDocumentFeatures.d.ts +29 -0
- package/dist/src/package/components/FileViewer/{useViewerExport.d.ts → hooks/useViewerExport.d.ts} +1 -1
- package/dist/src/package/components/FileViewer/hooks/useViewerWatermark.d.ts +8 -0
- package/dist/src/package/components/FileViewer/util.d.ts +2 -2
- package/dist/src/package/index.d.ts +1 -1
- package/dist/src/package/use/documentLocation.d.ts +15 -0
- package/dist/src/package/use/documentSearch.d.ts +234 -0
- package/dist/src/package/use/index.d.ts +2 -0
- package/dist/src/package/vendors/archive/ArchiveViewer.vue.d.ts +1 -1
- package/dist/src/package/vendors/archive/index.d.ts +1 -1
- package/dist/src/package/vendors/cad/CadViewer.vue.d.ts +2 -0
- package/dist/src/package/vendors/cad/index.d.ts +4 -3
- package/dist/src/package/vendors/eda/index.d.ts +1 -1
- package/dist/src/package/vendors/email/EmailViewer.vue.d.ts +1 -1
- package/dist/src/package/vendors/email/index.d.ts +1 -1
- package/dist/src/package/vendors/model/index.d.ts +1 -1
- package/dist/src/package/vendors/nestedRender.d.ts +1 -1
- package/dist/src/package/vendors/pdf/PdfView.vue.d.ts +1 -1
- package/dist/src/package/vendors/pdf/index.d.ts +1 -1
- package/dist/src/package/vendors/renders.d.ts +1 -1
- package/dist/src/package/vendors/typst/TypstViewer.vue.d.ts +1 -1
- package/dist/src/package/vendors/typst/index.d.ts +1 -1
- package/dist/src/package/vendors/word/doc.d.ts +1 -1
- package/dist/src/package/vendors/word/docx.d.ts +1 -1
- package/dist/src/package/vendors/word/docx.worker.d.ts +1 -0
- package/dist/src/package/vendors/xlsx/index.d.ts +1 -1
- package/dist/src/package/vendors/xlsx/util.d.ts +0 -5
- package/dist/wasm/cad/DwgWorker-CuZJ5EUe.js +349 -0
- package/dist/wasm/cad/dwfv-render.wasm +0 -0
- package/dist/wasm/cad/dwg-worker.js +349 -0
- package/dist/wasm/cad/index-C365l3i9.js +4161 -0
- package/dist/wasm/cad/libredwg-web.js +15 -0
- package/dist/wasm/cad/libredwg-web.wasm +0 -0
- package/package.json +33 -27
package/README.en.md
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
# Flyfish Viewer
|
|
2
|
+
|
|
3
|
+
[Simplified Chinese](README.md) | [English](README.en.md)
|
|
4
|
+
|
|
5
|
+
Bring Word, Excel, PowerPoint, PDF, Typst, archives, email, audio, ebooks, drawings, CAD, 3D models, Markdown, images, and source code preview into the browser with a clean, deployable viewer.
|
|
6
|
+
|
|
7
|
+
`@flyfish-group/file-viewer3` is a pure frontend file preview component built with Vue 3, TypeScript, and Vite. Vue 2.7 projects should use the matching `@flyfish-group/file-viewer` package. The Vue 3 build is also the baseline runtime for the React, vanilla JavaScript, and iframe integration packages.
|
|
8
|
+
|
|
9
|
+
The viewer does not require a backend conversion service. It is designed for OA systems, knowledge bases, attachment centers, workflow platforms, customer support portals, document approval flows, intranet systems, and offline-capable deployments where file preview should feel like a maintained product module rather than a temporary feature.
|
|
10
|
+
|
|
11
|
+
- npm for Vue 3: [@flyfish-group/file-viewer3](https://www.npmjs.com/package/@flyfish-group/file-viewer3)
|
|
12
|
+
- npm for Vue 2.7: [@flyfish-group/file-viewer](https://www.npmjs.com/package/@flyfish-group/file-viewer)
|
|
13
|
+
- npm for React: [@flyfish-group/file-viewer-react](https://www.npmjs.com/package/@flyfish-group/file-viewer-react)
|
|
14
|
+
- npm for vanilla JavaScript: [@flyfish-group/file-viewer-web](https://www.npmjs.com/package/@flyfish-group/file-viewer-web)
|
|
15
|
+
- Official documentation: [doc.flyfish.dev](https://doc.flyfish.dev)
|
|
16
|
+
- Online demo: [viewer.flyfish.dev](https://viewer.flyfish.dev)
|
|
17
|
+
- Document comparison demo: [viewer.flyfish.dev/compare.html](https://viewer.flyfish.dev/compare.html)
|
|
18
|
+
- GitHub artifact repository: [github.com/flyfish-dev/file-viewer](https://github.com/flyfish-dev/file-viewer)
|
|
19
|
+
- Gitee artifact mirror: [gitee.com/flyfish-dev/file-viewer](https://gitee.com/flyfish-dev/file-viewer)
|
|
20
|
+
- Source access and commercial customization: [https://dev.flyfish.group/shop](https://dev.flyfish.group/shop)
|
|
21
|
+
|
|
22
|
+
## Current Packages
|
|
23
|
+
|
|
24
|
+
| Stack | Package | Version | Recommended branch | Notes |
|
|
25
|
+
| --- | --- | --- | --- | --- |
|
|
26
|
+
| Vue 3 | `@flyfish-group/file-viewer3` | `1.0.23` | `v3` | Recommended version and the runtime baseline for React / vanilla JS iframe integrations |
|
|
27
|
+
| Vue 2.7 | `@flyfish-group/file-viewer` | `1.0.23` | `main` | Vue 2 compatible package with the same format coverage and API semantics |
|
|
28
|
+
| React 17 / 18 / 19 | `@flyfish-group/file-viewer-react` | `1.0.23` | adapter package | iframe component that loads `/file-viewer/index.html` by default |
|
|
29
|
+
| Vanilla JavaScript | `@flyfish-group/file-viewer-web` | `1.0.23` | adapter package | iframe helpers and static viewer asset copier |
|
|
30
|
+
|
|
31
|
+
For intranet or offline environments, this artifact repository also ships npm tarballs under `artifacts/`:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install ./artifacts/flyfish-group-file-viewer3-1.0.23.tgz
|
|
35
|
+
npm install ./artifacts/flyfish-group-file-viewer-1.0.23.tgz
|
|
36
|
+
npm install ./artifacts/flyfish-group-file-viewer-web-1.0.23.tgz
|
|
37
|
+
npm install ./artifacts/flyfish-group-file-viewer-react-1.0.23.tgz
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
When installing the React tarball offline, install the same-version web tarball first because the React package depends on `@flyfish-group/file-viewer-web`.
|
|
41
|
+
|
|
42
|
+
If you use pnpm 10 and see `Ignored build scripts: @flyfish-group/file-viewer-web`, run:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pnpm approve-builds
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Then allow `@flyfish-group/file-viewer-web`, or manually copy the bundled viewer assets:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pnpm exec file-viewer-copy-assets ./public/file-viewer
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+

|
|
55
|
+
|
|
56
|
+
## Why Use It
|
|
57
|
+
|
|
58
|
+
- **Pure frontend and serverless.** File parsing and rendering happen in the browser. You do not need Office Server, a LibreOffice daemon, or a document conversion backend.
|
|
59
|
+
- **Broad format coverage.** The current release maps 149 extensions across 20 preview pipelines, including Office, PDF, OFD, Typst, archives, email, EDA files, CAD, 3D models, Excalidraw, draw.io, EPUB, UMD, Markdown, images, audio, video, and source code.
|
|
60
|
+
- **Lazy loaded renderers.** Heavy PDF, Office, OFD, Typst, archive, email, CAD, 3D, ebook, Markdown, and code highlighting dependencies are loaded only when the file type needs them.
|
|
61
|
+
- **Production-ready operations.** The viewer includes original file download, full rendered printing, rendered HTML export, watermark options, theme options, lifecycle hooks, iframe events, and before-operation guards for permission checks.
|
|
62
|
+
- **Better document reading.** Word and PDF keep a grey workspace, white paper surface, centered reading, width fitting, navigation, zoom, rotation, and complete print / HTML export paths.
|
|
63
|
+
- **Controlled theming.** `options.theme` supports `light`, `dark`, and `system`. Light business UIs can lock the viewer to `light` even when the operating system is in dark mode.
|
|
64
|
+
- **PDF toolbar ergonomics.** `toolbar.position` supports `auto`, `top`, and `bottom-right`. In `auto` mode, PDF uses a bottom-right floating operation bar to avoid duplicating the PDF navigation toolbar.
|
|
65
|
+
- **Demo and comparison views.** The repository includes the main demo and a standalone `/compare.html` page for side-by-side document comparison.
|
|
66
|
+
- **Component and standalone modes.** Use it as a Vue component, or deploy the static viewer and embed it through iframe in any system.
|
|
67
|
+
- **Artifact-first delivery.** This public repository contains minified build artifacts, static demos, documentation output, sample files, Docker deployment assets, and npm tarballs. It does not contain the private source tree.
|
|
68
|
+
|
|
69
|
+
## Supported Formats
|
|
70
|
+
|
|
71
|
+
The viewer is organized around preview pipelines rather than one-off file extensions.
|
|
72
|
+
|
|
73
|
+
| Category | Extensions | Rendering pipeline | Typical use |
|
|
74
|
+
| --- | --- | --- | --- |
|
|
75
|
+
| Word | `docx`, `docm`, `dotx`, `dotm` | `docx-preview`, read-only page preview, print and HTML export | Modern Word documents and templates |
|
|
76
|
+
| Legacy Word | `doc`, `dot` | `msdoc-viewer` with Word-like paper surface and CFB tolerance fixes | Old Word 97-2003 files |
|
|
77
|
+
| Excel | `xlsx`, `xltx` | `styled-exceljs` plus virtual table rendering, merged cells, styles, auto text color, workbook images | Business spreadsheets and templates |
|
|
78
|
+
| Excel-compatible | `xlsm`, `xlsb`, `xls`, `xlt`, `xltm`, `csv`, `ods`, `fods`, `numbers` | Progressive spreadsheet parsing and virtual rendering | Legacy spreadsheets and lightweight data preview |
|
|
79
|
+
| PowerPoint | `pptx`, `pptm`, `potx`, `potm`, `ppsx`, `ppsm` | Slide preview with images, shapes, theme backgrounds, clipping, and EMF fallback | Presentations, training decks, proposals |
|
|
80
|
+
| PDF | `pdf` | `pdfjs-dist`, streaming same-origin loading, Range support, zoom, rotation, page thumbnails, outline tree, width fitting, print, HTML export | Contracts, invoices, official layout documents |
|
|
81
|
+
| OFD | `ofd` | Browser-side OFD preview based on `DLTech21/ofd.js` source | Chinese e-invoices, government documents, archives |
|
|
82
|
+
| Typst | `typ`, `typst` | Direct Typst source rendering with browser WASM compiler and SVG pages | Technical reports, papers, engineering documents |
|
|
83
|
+
| Archives | `zip`, `zipx`, `7z`, `rar`, `tar`, `gz`, `tgz`, `bz2`, `xz`, `zst`, `cab`, `iso`, `jar`, `apk`, `cbz`, `cbr`, and more | `libarchive.js` Worker, directory listing, lazy extraction, IndexedDB cache | Attachment packages and internal document bundles |
|
|
84
|
+
| Email | `eml`, `msg` | `postal-mime` for EML, `@kenjiuno/msgreader` for MSG, headers, HTML/text body, attachment preview | Email archives and support tickets |
|
|
85
|
+
| EDA | `olb`, `dra` | CFB-based OrCAD / Allegro structure inspection, trees, symbols, footprints, padstack candidates, properties, strings, diagnostics | Component libraries and EDA attachments |
|
|
86
|
+
| CAD | `dwg`, `dxf`, `dwf`, `dwfx`, `xps` | `@flyfish-dev/cad-viewer` preview. DWG uses Worker + LibreDWG WASM, DXF uses a JS parser, and DWF/DWFx/XPS use the native `dwf-viewer` path for W2D/W3D/XPS graphics | Engineering drawings and AutoCAD archives |
|
|
87
|
+
| 3D models | `glb`, `gltf`, `obj`, `stl`, `ply`, `fbx`, `dae`, `3ds`, `3mf`, `amf`, `usd`, `usda`, `usdc`, `usdz`, `kmz`, `pcd`, `wrl`, `vrml`, `xyz`, `vtk`, `vtp`, `step`, `stp`, `iges`, `igs`, `ifc`, `3dm` | Three.js interactive preview, with conversion guidance for heavy CAD/BIM kernels | 3D assets, point clouds, design models |
|
|
88
|
+
| Excalidraw | `excalidraw` | Official `@excalidraw/excalidraw` restore and `exportToSvg` read-only rendering | Whiteboard sketches and product diagrams |
|
|
89
|
+
| draw.io | `drawio`, `dio` | Official diagrams.net `GraphViewer` | Flowcharts and architecture diagrams |
|
|
90
|
+
| EPUB | `epub` | `epubjs` table of contents and scrolling reader | Ebooks and long training materials |
|
|
91
|
+
| UMD ebook | `umd` | UMD metadata, chapters, offsets, zlib text blocks | Legacy mobile ebooks |
|
|
92
|
+
| Markdown | `md`, `markdown` | Markdown reading surface with theme-aware styles | README files and knowledge base articles |
|
|
93
|
+
| Images | `gif`, `jpg`, `jpeg`, `bmp`, `tiff`, `tif`, `png`, `svg`, `webp` | Native image preview | Image attachments and design assets |
|
|
94
|
+
| Source and text | `txt`, `json`, `js`, `mjs`, `cjs`, `css`, `java`, `py`, `html`, `htm`, `jsx`, `ts`, `tsx`, `xml`, `log`, `vue`, `yaml`, `yml`, `ini`, `sh`, `bash`, `sql`, `go`, `rs`, `php`, `c`, `cpp`, `cc`, `h`, `hpp`, `cs`, `diff` | Lightweight `highlight.js` language-specific highlighting, HTML shown as source | Logs, configs, code snippets, API responses |
|
|
95
|
+
| Audio | `mp3`, `mpeg`, `wav`, `ogg`, `oga`, `opus`, `m4a`, `aac`, `flac`, `weba` | Native browser audio player | Recordings and audio attachments |
|
|
96
|
+
| Video | `mp4` | Native browser video player | Screen recordings and demo videos |
|
|
97
|
+
|
|
98
|
+
## Vue 3 Integration
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm install @flyfish-group/file-viewer3
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { createApp } from 'vue'
|
|
106
|
+
import App from './App.vue'
|
|
107
|
+
import FileViewer from '@flyfish-group/file-viewer3'
|
|
108
|
+
|
|
109
|
+
createApp(App).use(FileViewer).mount('#app')
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```vue
|
|
113
|
+
<script setup lang="ts">
|
|
114
|
+
import { ref } from 'vue'
|
|
115
|
+
|
|
116
|
+
const url = ref('/files/demo.pdf')
|
|
117
|
+
|
|
118
|
+
const options = {
|
|
119
|
+
theme: 'light',
|
|
120
|
+
toolbar: { position: 'bottom-right', download: true, print: true, exportHtml: true },
|
|
121
|
+
watermark: { text: 'Internal Preview', opacity: 0.14 },
|
|
122
|
+
pdf: { streaming: 'same-origin', rangeChunkSize: 64 * 1024 }
|
|
123
|
+
}
|
|
124
|
+
</script>
|
|
125
|
+
|
|
126
|
+
<template>
|
|
127
|
+
<div style="height: 100vh">
|
|
128
|
+
<file-viewer :url="url" :options="options" />
|
|
129
|
+
</div>
|
|
130
|
+
</template>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
For local files or authenticated downloads, pass a `File` object:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
const response = await fetch('/api/files/contract', { credentials: 'include' })
|
|
137
|
+
const blob = await response.blob()
|
|
138
|
+
|
|
139
|
+
file.value = new File([blob], 'contract.pdf', { type: blob.type })
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
The filename matters. The viewer uses the extension to choose the correct rendering pipeline.
|
|
143
|
+
|
|
144
|
+
## Vue 2.7 Integration
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
npm install @flyfish-group/file-viewer
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
```ts
|
|
151
|
+
import Vue from 'vue'
|
|
152
|
+
import FileViewer from '@flyfish-group/file-viewer'
|
|
153
|
+
|
|
154
|
+
Vue.use(FileViewer)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
```vue
|
|
158
|
+
<template>
|
|
159
|
+
<div style="height: 100vh">
|
|
160
|
+
<file-viewer :url="url" :options="options" />
|
|
161
|
+
</div>
|
|
162
|
+
</template>
|
|
163
|
+
|
|
164
|
+
<script>
|
|
165
|
+
export default {
|
|
166
|
+
data() {
|
|
167
|
+
return {
|
|
168
|
+
url: '/files/demo.pdf',
|
|
169
|
+
options: {
|
|
170
|
+
theme: 'light',
|
|
171
|
+
toolbar: { position: 'bottom-right' }
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
</script>
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
The Vue 2 and Vue 3 package lines share the same user-facing capabilities and option semantics.
|
|
180
|
+
|
|
181
|
+
## React Integration
|
|
182
|
+
|
|
183
|
+
The React package is an iframe adapter. It reuses the Vue 3 baseline viewer that is bundled by `@flyfish-group/file-viewer-web`.
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
npm install @flyfish-group/file-viewer-react
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
```tsx
|
|
190
|
+
import FileViewer from '@flyfish-group/file-viewer-react'
|
|
191
|
+
|
|
192
|
+
export function Preview() {
|
|
193
|
+
return (
|
|
194
|
+
<div style={{ height: '100vh' }}>
|
|
195
|
+
<FileViewer
|
|
196
|
+
url="/files/demo.pdf"
|
|
197
|
+
options={{
|
|
198
|
+
theme: 'light',
|
|
199
|
+
toolbar: { position: 'bottom-right' },
|
|
200
|
+
watermark: { text: 'Internal Preview', opacity: 0.14 }
|
|
201
|
+
}}
|
|
202
|
+
onViewerEvent={(event) => {
|
|
203
|
+
console.log(event.type, event.event, event.payload)
|
|
204
|
+
}}
|
|
205
|
+
/>
|
|
206
|
+
</div>
|
|
207
|
+
)
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
By default, the iframe loads `/file-viewer/index.html`. If your static assets are deployed elsewhere, pass `viewerUrl`.
|
|
212
|
+
|
|
213
|
+
## Vanilla JavaScript Integration
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
npm install @flyfish-group/file-viewer-web
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
```html
|
|
220
|
+
<div id="viewer" style="height: 100vh"></div>
|
|
221
|
+
|
|
222
|
+
<script type="module">
|
|
223
|
+
import { mountViewerFrame } from '@flyfish-group/file-viewer-web'
|
|
224
|
+
|
|
225
|
+
mountViewerFrame(document.getElementById('viewer'), {
|
|
226
|
+
url: '/files/demo.pdf',
|
|
227
|
+
options: {
|
|
228
|
+
theme: 'light',
|
|
229
|
+
toolbar: { position: 'bottom-right' },
|
|
230
|
+
archive: { workerUrl: '/file-viewer/vendor/libarchive/worker-bundle.js', cache: true }
|
|
231
|
+
},
|
|
232
|
+
onEvent(event) {
|
|
233
|
+
console.log(event.type, event.event, event.payload)
|
|
234
|
+
}
|
|
235
|
+
})
|
|
236
|
+
</script>
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
The web package copies the static viewer into `public/file-viewer` during installation. If your package manager blocks install scripts, run:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
npx file-viewer-copy-assets ./public/file-viewer
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## iframe Protocol
|
|
246
|
+
|
|
247
|
+
If you cannot use npm helpers, deploy the static viewer and pass a file URL through query parameters:
|
|
248
|
+
|
|
249
|
+
```html
|
|
250
|
+
<iframe
|
|
251
|
+
src="/file-viewer/index.html?url=%2Ffiles%2Fdemo.pdf&options=%7B%22theme%22%3A%22light%22%2C%22toolbar%22%3A%7B%22position%22%3A%22bottom-right%22%7D%7D"
|
|
252
|
+
style="width: 100%; height: 100vh; border: 0"
|
|
253
|
+
></iframe>
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
For authenticated files, download the file in the host system and push a `Blob` to the iframe:
|
|
257
|
+
|
|
258
|
+
```ts
|
|
259
|
+
const viewerUrl = '/file-viewer/index.html'
|
|
260
|
+
const viewerOrigin = location.origin
|
|
261
|
+
const filename = 'contract.pdf'
|
|
262
|
+
const options = { theme: 'light', toolbar: { position: 'bottom-right' } }
|
|
263
|
+
const frame = document.getElementById('viewer') as HTMLIFrameElement
|
|
264
|
+
|
|
265
|
+
frame.src =
|
|
266
|
+
`${viewerUrl}?name=${encodeURIComponent(filename)}` +
|
|
267
|
+
`&from=${encodeURIComponent(location.origin)}` +
|
|
268
|
+
`&options=${encodeURIComponent(JSON.stringify(options))}`
|
|
269
|
+
|
|
270
|
+
frame.onload = async () => {
|
|
271
|
+
const response = await fetch('/api/files/contract', { credentials: 'include' })
|
|
272
|
+
const blob = await response.blob()
|
|
273
|
+
frame.contentWindow?.postMessage(blob, viewerOrigin)
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
The viewer validates `event.origin === from` and only accepts `Blob` messages from the declared origin.
|
|
278
|
+
|
|
279
|
+
## Core Options
|
|
280
|
+
|
|
281
|
+
| Option | Description |
|
|
282
|
+
| --- | --- |
|
|
283
|
+
| `theme` | `light`, `dark`, or `system`. Default is `system`. Use `light` when embedding in a fixed light UI. |
|
|
284
|
+
| `toolbar` | `true`, `false`, or an object that controls download, print, HTML export, and toolbar position. |
|
|
285
|
+
| `toolbar.position` | `auto`, `top`, or `bottom-right`. Default `auto` floats the operation bar at bottom right for PDF and keeps other formats at top. |
|
|
286
|
+
| `watermark` | Text or image watermark configuration. Watermark participates in preview, print, and exported HTML. |
|
|
287
|
+
| `archive.workerUrl` | Custom `libarchive.js` Worker URL for private deployment. |
|
|
288
|
+
| `archive.cache` | Enables IndexedDB cache for extracted archive entries. |
|
|
289
|
+
| `archive.maxArchiveSize` | Maximum archive size allowed for directory parsing. |
|
|
290
|
+
| `archive.maxEntryPreviewSize` | Maximum extracted entry size allowed for online preview. |
|
|
291
|
+
| `pdf.streaming` | PDF URL loading strategy. Same-origin streaming is enabled by default. |
|
|
292
|
+
| `pdf.rangeChunkSize` | PDF.js Range request chunk size. |
|
|
293
|
+
| `typst.compilerWasmUrl` | Custom Typst compiler WASM URL. |
|
|
294
|
+
| `hooks` | Vue component lifecycle hooks for load and unload events. |
|
|
295
|
+
| `beforeOperation` | Vue component guard before download, print, or HTML export. Return `false` to cancel. |
|
|
296
|
+
|
|
297
|
+
React, vanilla JavaScript, and iframe integrations cannot serialize function hooks into query parameters. Use `onViewerEvent` or `onEvent` to receive lifecycle and operation events from the iframe.
|
|
298
|
+
|
|
299
|
+
## Printing, Exporting, and Watermarks
|
|
300
|
+
|
|
301
|
+
- Download keeps the original file bytes. It does not write rendered output back into the source file.
|
|
302
|
+
- Print opens a print-only document containing the rendered body and watermark, without the demo shell or host UI.
|
|
303
|
+
- PDF print and HTML export use a dedicated adapter that renders complete pages rather than only the visible canvas.
|
|
304
|
+
- Word print and HTML export preserve the white paper surface and page sizing while removing preview-only layout wrappers.
|
|
305
|
+
- Spreadsheet, archive, email, EPUB, audio, video, and 3D pipelines hide unreliable print buttons when the full document cannot be printed consistently.
|
|
306
|
+
- HTML export clones the current rendered output and converts canvas content where possible.
|
|
307
|
+
|
|
308
|
+
## Document Comparison
|
|
309
|
+
|
|
310
|
+
The production demo includes a standalone comparison page:
|
|
311
|
+
|
|
312
|
+
[https://viewer.flyfish.dev/compare.html](https://viewer.flyfish.dev/compare.html)
|
|
313
|
+
|
|
314
|
+
It supports two-pane document preview, built-in samples, URL input, local upload, swapping panes, reset, and synchronized scrolling. The comparison page is intentionally separate from the main viewer entry so that the primary component API stays small and predictable.
|
|
315
|
+
|
|
316
|
+
## Private Deployment
|
|
317
|
+
|
|
318
|
+
For npm-based iframe integrations, make sure your final static output contains:
|
|
319
|
+
|
|
320
|
+
```txt
|
|
321
|
+
file-viewer/index.html
|
|
322
|
+
file-viewer/assets/*
|
|
323
|
+
file-viewer/vendor/libarchive/worker-bundle.js
|
|
324
|
+
file-viewer/vendor/libarchive/libarchive.wasm
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
The artifact repository also contains:
|
|
328
|
+
|
|
329
|
+
| Path | Purpose |
|
|
330
|
+
| --- | --- |
|
|
331
|
+
| `dist/` | Minified library build artifacts |
|
|
332
|
+
| `demo/` | Static production demo, including `index.html` and `compare.html` |
|
|
333
|
+
| `adapter-demo/` | React and vanilla JavaScript integration demo |
|
|
334
|
+
| `docs/` | Static documentation site output |
|
|
335
|
+
| `example/` | Sample files used by the demo |
|
|
336
|
+
| `artifacts/` | npm tarballs and packaged static build archives |
|
|
337
|
+
| `README.md` | Default Chinese documentation |
|
|
338
|
+
| `README.en.md` | English documentation |
|
|
339
|
+
| `LICENSE` | Apache-2.0 license |
|
|
340
|
+
|
|
341
|
+
## Docker
|
|
342
|
+
|
|
343
|
+
The project provides a static nginx runtime image and build scripts for `linux/amd64` and `linux/arm64`. A typical deployment can serve the demo and comparison page directly:
|
|
344
|
+
|
|
345
|
+
```bash
|
|
346
|
+
docker run --rm -p 8080:80 flyfishdev/file-viewer:1.0.23
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
Then open:
|
|
350
|
+
|
|
351
|
+
```txt
|
|
352
|
+
http://localhost:8080/
|
|
353
|
+
http://localhost:8080/compare.html
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
If you build the image yourself, use the provided `Dockerfile` and keep the static viewer assets, examples, and vendor WASM files together.
|
|
357
|
+
|
|
358
|
+
## Public Artifacts vs Source Code
|
|
359
|
+
|
|
360
|
+
This public repository is for artifact delivery. It contains minified build output, static demo sites, sample files, documentation output, and npm tarballs. It intentionally does not include the private source tree.
|
|
361
|
+
|
|
362
|
+
If you need source code access, second development resources, or commercial customization, use the self-service source access portal:
|
|
363
|
+
|
|
364
|
+
[https://dev.flyfish.group/shop](https://dev.flyfish.group/shop)
|
|
365
|
+
|
|
366
|
+
The self-service source access price is 4.99. It is designed to make legitimate second development and commercial evaluation straightforward without mixing source delivery into the public artifact repository.
|
|
367
|
+
|
|
368
|
+
## License and Attribution
|
|
369
|
+
|
|
370
|
+
Flyfish Viewer is distributed under the Apache-2.0 license. You may use the public artifacts according to that license.
|
|
371
|
+
|
|
372
|
+
For second development or commercial use, please keep clear attribution to Flyfish Viewer and contribute useful fixes or compatibility improvements back whenever possible. This keeps the preview ecosystem healthier for everyone using the component in real business systems.
|
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Flyfish Viewer
|
|
2
2
|
|
|
3
|
+
[简体中文](README.md) | [English](README.en.md)
|
|
4
|
+
|
|
3
5
|
把 Word、Excel、PPT、PDF、Typst、压缩包、邮件、音频和电子书稳稳带进浏览器里。
|
|
4
6
|
|
|
5
7
|
`@flyfish-group/file-viewer3` 是一款基于 Vue 3、TypeScript 和 Vite 构建的纯前端文件预览组件。Vue2.7 项目请使用同能力包 `@flyfish-group/file-viewer`。两条 npm 包线保持一致的格式覆盖、示例体验和 API 语义,Vue3 构建产物作为 React、纯 Web 和其他适配层的统一预览基线。
|
|
@@ -13,26 +15,27 @@
|
|
|
13
15
|
- 官方文档: [doc.flyfish.dev](https://doc.flyfish.dev)
|
|
14
16
|
- 在线 Demo: [viewer.flyfish.dev](https://viewer.flyfish.dev)
|
|
15
17
|
- 文档比对 Demo: [viewer.flyfish.dev/compare.html](https://viewer.flyfish.dev/compare.html)
|
|
16
|
-
- Docker 镜像发布目标: `flyfishdev/file-viewer:1.0.
|
|
17
|
-
-
|
|
18
|
+
- Docker 镜像发布目标: `flyfishdev/file-viewer:1.0.23`
|
|
19
|
+
- 公开成品仓库(GitHub): [github.com/flyfish-dev/file-viewer](https://github.com/flyfish-dev/file-viewer)
|
|
20
|
+
- 公开成品仓库(Gitee): [gitee.com/flyfish-dev/file-viewer](https://gitee.com/flyfish-dev/file-viewer)
|
|
18
21
|
- 源码自助开通: [https://dev.flyfish.group/shop](https://dev.flyfish.group/shop)
|
|
19
22
|
|
|
20
23
|
## 当前发布版本
|
|
21
24
|
|
|
22
25
|
| 技术栈 | npm 包 | 最新版本 | 推荐分支 | 说明 |
|
|
23
26
|
| --- | --- | --- | --- | --- |
|
|
24
|
-
| Vue3 | `@flyfish-group/file-viewer3` | `1.0.
|
|
25
|
-
| Vue2.7 | `@flyfish-group/file-viewer` | `1.0.
|
|
26
|
-
| React 17 / 18 / 19 | `@flyfish-group/file-viewer-react` | `1.0.
|
|
27
|
-
| 纯 JS | `@flyfish-group/file-viewer-web` | `1.0.
|
|
27
|
+
| Vue3 | `@flyfish-group/file-viewer3` | `1.0.23` | `v3` | 主推版本,也是 React / 纯 Web 私有化 iframe 适配层的构建基线 |
|
|
28
|
+
| Vue2.7 | `@flyfish-group/file-viewer` | `1.0.23` | `main` | 兼容 Vue2 项目,格式能力与 Vue3 保持一致 |
|
|
29
|
+
| React 17 / 18 / 19 | `@flyfish-group/file-viewer-react` | `1.0.23` | 当前仓库子工程 | iframe 组件,默认加载 `/file-viewer/index.html` |
|
|
30
|
+
| 纯 JS | `@flyfish-group/file-viewer-web` | `1.0.23` | 当前仓库子工程 | iframe helper 和 viewer 产物复制工具 |
|
|
28
31
|
|
|
29
32
|
如果你在内网、离线环境,或者 npm 发布权限还没有完成配置,也可以直接使用公开成品仓库 `artifacts/` 里的 tarball。离线安装 React 包时请先安装同版本 web 包:
|
|
30
33
|
|
|
31
34
|
```bash
|
|
32
|
-
npm install ./artifacts/flyfish-group-file-viewer3-1.0.
|
|
33
|
-
npm install ./artifacts/flyfish-group-file-viewer-1.0.
|
|
34
|
-
npm install ./artifacts/flyfish-group-file-viewer-web-1.0.
|
|
35
|
-
npm install ./artifacts/flyfish-group-file-viewer-react-1.0.
|
|
35
|
+
npm install ./artifacts/flyfish-group-file-viewer3-1.0.23.tgz
|
|
36
|
+
npm install ./artifacts/flyfish-group-file-viewer-1.0.23.tgz
|
|
37
|
+
npm install ./artifacts/flyfish-group-file-viewer-web-1.0.23.tgz
|
|
38
|
+
npm install ./artifacts/flyfish-group-file-viewer-react-1.0.23.tgz
|
|
36
39
|
```
|
|
37
40
|
|
|
38
41
|
Vue3、Vue2、React 和纯 JS tarball 都会随公开成品仓库一起生成。离线安装 React 包时请先安装同版本 web 包;React / 纯 JS 包推荐用 `npm install` 获得安装即复制的体验。pnpm 10 默认会拦截依赖包的 `postinstall`,如果看到 `Ignored build scripts: @flyfish-group/file-viewer-web`,请执行 `pnpm approve-builds` 允许该包,或安装后运行 `pnpm exec file-viewer-copy-assets ./public/file-viewer`。
|
|
@@ -44,12 +47,12 @@ Vue3、Vue2、React 和纯 JS tarball 都会随公开成品仓库一起生成。
|
|
|
44
47
|
- **纯前端 Serverless。** 文档解析和展示全部在浏览器内完成,部署简单,不依赖 Office 服务端、LibreOffice 守护进程或额外转码链路。
|
|
45
48
|
- **格式覆盖完整。** 当前内置 149 个扩展名映射,覆盖 Word、Excel、PowerPoint、PDF、OFD、Typst、压缩包、邮件、OLB/DRA、CAD、3D 模型、Excalidraw、draw.io、EPUB、UMD、Markdown、图片、音频、代码/文本和 MP4,能覆盖绝大多数业务附件场景。
|
|
46
49
|
- **按需异步加载。** PDF、OFD、Typst、压缩包、邮件、OLB/DRA、CAD、3D 模型、绘图、Office、EPUB、UMD、Markdown 和代码高亮渲染器都按需加载,重型解析依赖不会进入其他格式的首屏路径。
|
|
47
|
-
- **预览器操作完整。** 内置下载原文件、打印完整渲染结果、导出渲染后 HTML
|
|
50
|
+
- **预览器操作完整。** 内置下载原文件、打印完整渲染结果、导出渲染后 HTML、水印开关、水印 options、主题 options、搜索高亮、上一个 / 下一个命中、行级定位和 AI 友好文本切片;PDF 使用 PDF.js 原生搜索,Word / Markdown / 代码等文本类格式使用通用 DOM 搜索,避免污染 PDF 文本层、canvas、iframe 等特殊渲染结构;`theme` 支持 `light`、`dark`、`system`,默认跟随系统,浅色业务 UI 可显式锁定 `light`;打印按钮会按当前格式和渲染链路动态显隐,Word / PDF 使用专属完整页导出适配器,不依赖当前视口,适合合同、归档和审批类场景。
|
|
48
51
|
- **集成控制更完整。** 提供加载/卸载生命周期钩子、iframe 事件回传和按钮前置校验机制,下载、打印、导出前可以接入权限验证、审计确认或业务二次弹窗。
|
|
49
|
-
- **阅读体验更像产品。** `.doc`、`.docx`、PDF 都保留灰色工作台、白色纸张、居中阅读和自适应缩放;PDF 兼容旋转页和页面 / 目录导航,Excel 会尽量还原图片和自动文本色,避免“内容能打开但不好读”的落差。
|
|
52
|
+
- **阅读体验更像产品。** `.doc`、`.docx`、PDF 都保留灰色工作台、白色纸张、居中阅读和自适应缩放;DOCX 默认使用 Web Worker 承载 `docx-preview` 的解析和 HTML 构建,并把同一份 docx-preview HTML 按页面渐进挂载,主线程只负责挂载、缩放和打印适配;PDF 兼容旋转页和页面 / 目录导航,Excel 会尽量还原图片和自动文本色,避免“内容能打开但不好读”的落差。
|
|
50
53
|
- **明暗主题有边界。** Demo 外壳、Markdown 和代码预览会适配系统暗色模式;PDF、Word、Excel 等带原始版式的内容保持独立纸张或表格背景,避免全局主题污染文档。
|
|
51
54
|
- **Demo 更适合验收。** 示例文件按文档、表格、图纸、代码、图片等类型分组展示,点击样例即可打开并自动收起选择器。
|
|
52
|
-
- **独立文档比对入口。** 生产 Demo 额外提供 `/compare.html`,左右并排预览两份文档,支持示例、URL
|
|
55
|
+
- **独立文档比对入口。** 生产 Demo 额外提供 `/compare.html`,左右并排预览两份文档,支持示例、URL、本地上传、交换、重置、同步滚动、聚焦文档搜索、行级定位和 PDF 工具栏隐藏,不污染主预览入口。
|
|
53
56
|
- **Vue2 / Vue3 体验一致。** `main` 分支面向 Vue2.7,`v3` 分支面向 Vue3;两边共享完整格式覆盖、示例文件盒子、文档站和 iframe 集成体验。
|
|
54
57
|
- **组件和独立站两用。** 既支持在 Vue 项目里直接作为组件使用,也支持独立部署后通过 iframe 嵌入到任意系统,方便多业务线复用。
|
|
55
58
|
- **Docker 一键部署。** 提供 nginx 静态镜像、`Dockerfile` 和 buildx 发布脚本,发布镜像覆盖 `linux/amd64` 与 `linux/arm64`。
|
|
@@ -61,7 +64,7 @@ Vue3、Vue2、React 和纯 JS tarball 都会随公开成品仓库一起生成。
|
|
|
61
64
|
|
|
62
65
|
| 类别 | 扩展名 | 当前表现 | 适合场景 |
|
|
63
66
|
| --- | --- | --- | --- |
|
|
64
|
-
| Word | `docx`、`docm`、`dotx`、`dotm` | `docx-preview
|
|
67
|
+
| Word | `docx`、`docm`、`dotx`、`dotm` | `docx-preview` + Web Worker,保留文档结构和版式;模板/宏格式按只读预览处理 | 新生成的 Word 文档、正式文档、Word 模板 |
|
|
65
68
|
| Word | `doc`、`dot` | `msdoc-viewer` + Word 风格页面容器,增强 CFB 容错和表格布局 | 历史 `.doc` 老文档、Word 97-2003 模板 |
|
|
66
69
|
| Excel | `xlsx`、`xltx` | `styled-exceljs` + 虚拟滚动,支持尺寸、合并、常见样式、自动文本色和 workbook drawing 图片;打印按钮按能力隐藏,避免只打印当前视口 | 需要保留表格结构和样式的业务、Excel 模板 |
|
|
67
70
|
| Excel 兼容格式 | `xlsm`、`xlsb`、`xls`、`xlt`、`xltm`、`csv`、`ods`、`fods`、`numbers` | 统一解析,按格式可用信息渐进还原样式;同样遵循虚拟表格打印边界 | 老表格、轻量数据查看 |
|
|
@@ -72,8 +75,7 @@ Vue3、Vue2、React 和纯 JS tarball 都会随公开成品仓库一起生成。
|
|
|
72
75
|
| 压缩包 | `zip`、`zipx`、`7z`、`rar`、`tar`、`gz`、`gzip`、`tgz`、`bz2`、`bzip2`、`tbz`、`tbz2`、`xz`、`txz`、`lzma`、`zst`、`tzst`、`cab`、`ar`、`cpio`、`iso`、`xar`、`lha`、`lzh`、`jar`、`war`、`ear`、`apk`、`cbz`、`cbr` | 基于 `libarchive.js` 的 WASM Worker 读取目录,点击后按需解压内部文件并复用统一预览器,支持 IndexedDB 缓存和体积上限 | 归档附件、批量交付包、压缩包内文档快速查看 |
|
|
73
76
|
| 邮件 | `eml`、`msg` | EML 使用 `postal-mime`,MSG 使用 `@kenjiuno/msgreader`,支持头信息、HTML/文本正文、附件下载与附件预览 | 邮件归档、工单邮件、客户来信附件 |
|
|
74
77
|
| EDA | `olb`、`dra` | 使用 `cfb` 解析 OrCAD/Allegro 常见 CFB 容器,展示结构树、元件/封装/Padstack 候选、属性、诊断和可读字符串;退化时提供安全二进制索引 | 元件库、封装图纸、EDA 附件初筛 |
|
|
75
|
-
| CAD | `dxf` | 基于 `@
|
|
76
|
-
| CAD 兼容入口 | `dwg` | 优先识别误命名 DXF;真实 DWG 会尽量提取内嵌预览图,并说明未完整解析几何的原因 | 需要兼容上传入口的业务 |
|
|
78
|
+
| CAD | `dwg`、`dxf`、`dwf`、`dwfx`、`xps` | 基于 `@flyfish-dev/cad-viewer` 预览图纸;DWG 通过 Worker + LibreDWG WASM 解析,DXF 使用 JS parser,DWF/DWFx/XPS 使用 native `dwf-viewer` 渲染 W2D/W3D/XPS 图形 | 工程图纸、二维 CAD 附件、AutoCAD 归档文件 |
|
|
77
79
|
| 3D 模型 | `glb`、`gltf`、`obj`、`stl`、`ply`、`fbx`、`dae`、`3ds`、`3mf`、`amf`、`usd`、`usda`、`usdc`、`usdz`、`kmz`、`pcd`、`wrl`、`vrml`、`xyz`、`vtk`、`vtp`、`step`、`stp`、`iges`、`igs`、`ifc`、`3dm` | 基于 Three.js 交互预览;工程 CAD/BIM 格式会给出不内置几何内核的原因和转换建议 | 设计模型、点云、三维资产、工程模型 |
|
|
78
80
|
| Excalidraw | `excalidraw` | 基于官方 `@excalidraw/excalidraw` 的 `restore` + `exportToSvg` 输出只读预览 | 白板草图、流程草稿、产品沟通图 |
|
|
79
81
|
| draw.io | `drawio`、`dio` | 基于官方 diagrams.net `GraphViewer` 预览 mxGraphModel / mxfile | 流程图、架构图、业务泳道图 |
|
|
@@ -178,8 +180,8 @@ React 与纯 Web 适配层不再复制渲染器,只通过 iframe 加载 Vue3
|
|
|
178
180
|
官网 Demo 可用于快速验证预览效果,但 React / 纯 JS 组件不会把官网 Demo 地址作为内置 viewer 地址。
|
|
179
181
|
|
|
180
182
|
```bash
|
|
181
|
-
npm install @flyfish-group/file-viewer-react@1.0.
|
|
182
|
-
npm install @flyfish-group/file-viewer-web@1.0.
|
|
183
|
+
npm install @flyfish-group/file-viewer-react@1.0.23
|
|
184
|
+
npm install @flyfish-group/file-viewer-web@1.0.23
|
|
183
185
|
```
|
|
184
186
|
|
|
185
187
|
```tsx
|
|
@@ -222,7 +224,7 @@ docker run -d \
|
|
|
222
224
|
--name flyfish-viewer \
|
|
223
225
|
--restart unless-stopped \
|
|
224
226
|
-p 8080:80 \
|
|
225
|
-
flyfishdev/file-viewer:1.0.
|
|
227
|
+
flyfishdev/file-viewer:1.0.23
|
|
226
228
|
```
|
|
227
229
|
|
|
228
230
|
访问:
|
|
@@ -234,13 +236,13 @@ docker run -d \
|
|
|
234
236
|
|
|
235
237
|
```bash
|
|
236
238
|
pnpm docker:build
|
|
237
|
-
docker run --rm -p 8080:80 flyfishdev/file-viewer:1.0.
|
|
239
|
+
docker run --rm -p 8080:80 flyfishdev/file-viewer:1.0.23
|
|
238
240
|
```
|
|
239
241
|
|
|
240
242
|
## 使用说明
|
|
241
243
|
|
|
242
244
|
- 组件支持两条主要输入路径: `url?: string` 与 `file?: File`
|
|
243
|
-
- 独立文档比对页位于 `/compare.html`,可通过 `?left=/example/test.doc&right=/example/word.docx`
|
|
245
|
+
- 独立文档比对页位于 `/compare.html`,可通过 `?left=/example/test.doc&right=/example/word.docx` 预置左右文件;它支持同步滚动、当前聚焦文档的浮层搜索、高亮命中、上一个 / 下一个、行级定位和 PDF 工具栏隐藏,但只做视觉并排预览,不做语义 diff,完整说明见 [Demo 文档](docs/guide/demo.md#文档比对页)
|
|
244
246
|
- 当 `file` 和 `url` 同时存在时,会优先渲染 `file`
|
|
245
247
|
- 如果业务侧拿到的是 `Blob` 或 `ArrayBuffer`,推荐先包装成带扩展名的 `File`
|
|
246
248
|
- 预览器会填满父容器,请为父容器提供稳定高度
|
|
@@ -248,7 +250,7 @@ docker run --rm -p 8080:80 flyfishdev/file-viewer:1.0.20
|
|
|
248
250
|
- 如果下载地址本身没有明确扩展名,建议先在业务侧取回文件,再包装成 `File`
|
|
249
251
|
- PPTX 渲染器会尽量还原常见组合图形、旋转/翻转、主题背景、图片裁剪和 EMF 矢量图片;复杂 Office 特效仍建议用真实业务文件做回归
|
|
250
252
|
- OFD、Typst、压缩包、邮件、OLB/DRA、CAD、3D 模型、绘图、EPUB、UMD、PDF、Office、Markdown、音频和代码高亮渲染器都按需异步加载,只有命中格式时才拉取对应代码块;Typst compiler WASM 可通过 `options.typst.compilerWasmUrl` 指向自托管地址,默认仅在打开 `.typ` / `.typst` 时加载
|
|
251
|
-
- `options.watermark` 支持文字或图片水印;`options.toolbar`
|
|
253
|
+
- `options.theme` 支持 `light`、`dark`、`system`,默认继续跟随系统;`options.docx.worker` 默认开启,让 DOCX 在 Worker 内用 `docx-preview` 构建 HTML,`options.docx.progressive` 默认开启,把 docx-preview 页面按批次挂载以便先看到内容;CSP 或低版本浏览器不兼容时可设为 `worker: false` 回退原生主线程渲染;`options.watermark` 支持文字或图片水印;`options.toolbar` 可控制下载原文件、打印完整渲染结果、导出 HTML 和操作栏位置,`toolbar.position` 支持 `auto`、`top`、`bottom-right`,PDF 默认悬浮到右下角以避开自身导航栏;`options.pdf.toolbar` 可隐藏 PDF 自身页码缩放工具栏;`options.search` 可控制搜索高亮、整词/大小写和命中数量;`options.ai` 可开启文本切片结构,返回行号、页码、锚点和 label 等溯源字段,便于业务侧做向量化、召回、AI 摘要、高亮回填和来源定位;`options.hooks` 可接收加载/卸载生命周期;`options.beforeOperation` 可在下载、打印、导出前做权限校验;打印按钮会结合当前文件类型、渲染完成状态和导出适配器动态显隐,Word / PDF 会生成完整页面,Excel 等虚拟表格会隐藏打印按钮,避免只打印当前视口或第一页
|
|
252
254
|
|
|
253
255
|
```ts
|
|
254
256
|
const blob = await response.blob()
|
|
@@ -257,7 +259,7 @@ const file = new File([blob], 'contract.pdf', { type: blob.type })
|
|
|
257
259
|
|
|
258
260
|
## 本地开发
|
|
259
261
|
|
|
260
|
-
下面的命令适用于源码开通后的完整项目。公开 GitHub 成品仓库不包含源码目录,普通用户建议直接通过 npm、`dist/` 或 `artifacts/` 里的 tarball 使用。
|
|
262
|
+
下面的命令适用于源码开通后的完整项目。公开 GitHub / Gitee 成品仓库不包含源码目录,普通用户建议直接通过 npm、`dist/` 或 `artifacts/` 里的 tarball 使用。
|
|
261
263
|
|
|
262
264
|
```bash
|
|
263
265
|
pnpm install
|
|
@@ -330,7 +332,7 @@ npm publish --access public
|
|
|
330
332
|
|
|
331
333
|
如果 npm 账号启用了 MFA,请使用交互式终端完成浏览器确认后再等待发布结果。
|
|
332
334
|
|
|
333
|
-
公开 GitHub
|
|
335
|
+
公开 GitHub / Gitee 成品仓库只提交可直接使用的构建产物、示例、文档和 npm tarball,不提交当前源码目录。需要源码、二开包或商业自助开通的用户,可以前往 [https://dev.flyfish.group/shop](https://dev.flyfish.group/shop),付费 4.99 后自助开通。
|
|
334
336
|
|
|
335
337
|
## 文档导航
|
|
336
338
|
|