@file-viewer/react 3.3.0 → 3.3.3
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 +21 -4
- package/README.md +21 -4
- package/README.zh-CN.md +2 -2
- package/package.json +4 -4
package/README.en.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[English](https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/react/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/react/README.zh-CN.md)
|
|
4
4
|
|
|
5
|
+
Browser-side file preview for React 18/19. Use one component API for loading, search, zoom, page navigation, print and export where supported by the selected format. This is the lightweight package: add renderer presets for PDF, Office and other document formats.
|
|
6
|
+
|
|
5
7
|
<!-- FILE_VIEWER_PACKAGE_HEADER -->
|
|
6
8
|
<p>
|
|
7
9
|
<a href="https://www.npmjs.com/package/@file-viewer/react"><img src="https://img.shields.io/npm/v/@file-viewer%2Freact?logo=npm" alt="npm version"></a>
|
|
@@ -20,14 +22,28 @@
|
|
|
20
22
|
|
|
21
23
|
> ⭐ If File Viewer helps you, please [star the repo on GitHub](https://github.com/flyfish-dev/file-viewer).
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
Create an application with renderers and local assets configured:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx file-viewer-cli@latest create my-viewer --framework react --profile standard
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For an existing project, use `npx file-viewer-cli@latest add .`, or follow the [manual integration guide](https://doc.file-viewer.app/guide/on-demand-renderers). The component alone does not install document engines or deploy their Worker/WASM files.
|
|
34
|
+
|
|
35
|
+
## Manual integration
|
|
36
|
+
|
|
37
|
+
The examples below require the matching renderer preset and self-hosted assets. The CLI configures these for you; a bare component install is not a PDF or Office viewer.
|
|
24
38
|
|
|
25
39
|
```bash
|
|
26
|
-
npm install @file-viewer/react
|
|
40
|
+
npm install @file-viewer/react @file-viewer/preset-standard file-viewer-copy-assets
|
|
41
|
+
npx --no-install file-viewer-copy-assets ./public/file-viewer
|
|
27
42
|
```
|
|
28
43
|
|
|
29
44
|
```tsx
|
|
30
45
|
import FileViewer from '@file-viewer/react'
|
|
46
|
+
import standardRenderers from '@file-viewer/preset-standard'
|
|
31
47
|
|
|
32
48
|
export function Preview() {
|
|
33
49
|
return (
|
|
@@ -35,6 +51,7 @@ export function Preview() {
|
|
|
35
51
|
<FileViewer
|
|
36
52
|
url="/example/demo.docx"
|
|
37
53
|
options={{
|
|
54
|
+
preset: standardRenderers,
|
|
38
55
|
theme: 'light',
|
|
39
56
|
toolbar: { position: 'bottom-right' }
|
|
40
57
|
}}
|
|
@@ -277,7 +294,7 @@ The table below lists the real props, event channel, and customization entry for
|
|
|
277
294
|
| `iwork` | After explicitly installing the iWork capability, configure its Pages / Numbers / Keynote module Worker, timeout, ZIP/Snappy/IWA safety limits, and Quick Look fallback policy. It is not in the standard/full default closure. |
|
|
278
295
|
| `hangul` | After explicitly installing the Hangul capability, configure its HWP/HWPX module Worker, timeout, ZIP limits, and HWP record limits. It is not in the standard/full default closure. |
|
|
279
296
|
| `wordPerfect` | After explicitly installing the WordPerfect capability, configure its Worker, libwpd/librevenge WASM URL, and timeout. It is not in the standard/full default closure. |
|
|
280
|
-
| `presentation` |
|
|
297
|
+
| `presentation` | Standard includes PPTX/OpenXML; Office/All presets and Full packages also support binary `.ppt` / `.pot`. PPT uses an Apache-2.0 TypeScript engine and parsing Worker, without WASM or embedded fonts. Minimal installs can use `file-viewer add ppt --write`; custom routes can override `pptModuleUrl` / `pptWorkerUrl`. |
|
|
281
298
|
| `typst` / `data` / `cad` | After explicitly installing the matching capability, configure Typst, SQLite, or CAD/DWG/DXF/DWF WASM, worker, encoding, and rendering options. These capabilities are not in the standard/full default closure. |
|
|
282
299
|
| `hooks` / `beforeOperation` | Shared lifecycle hooks and operation preflight checks for audit, permission, telemetry, and safety controls. |
|
|
283
300
|
|
|
@@ -403,7 +420,7 @@ View-state sync is designed for projection systems, remote-control displays, sid
|
|
|
403
420
|
|
|
404
421
|
See the official documentation for options, lifecycle hooks, beforeOperation, theme, watermark, search, zoom, print, and export APIs: https://doc.file-viewer.app/
|
|
405
422
|
|
|
406
|
-
Online demo: https://demo.file-viewer.app/. File Viewer-authored source
|
|
423
|
+
Online demo: https://demo.file-viewer.app/. File Viewer-authored source, component packages and the new compiled TypeScript PPT runtime use Apache-2.0. The PPT engine source remains private; retain its LICENSE and NOTICE.md. Previous native PPT license and watermark requirements are unchanged, and other third-party runtimes retain their original licenses. Keep Flyfish Viewer attribution in derivative and commercial use.
|
|
407
424
|
<!-- FILE_VIEWER_GENERATED:END -->
|
|
408
425
|
|
|
409
426
|
## Formats and related packages
|
package/README.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[English](https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/react/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/react/README.zh-CN.md)
|
|
4
4
|
|
|
5
|
+
Browser-side file preview for React 18/19. Use one component API for loading, search, zoom, page navigation, print and export where supported by the selected format. This is the lightweight package: add renderer presets for PDF, Office and other document formats.
|
|
6
|
+
|
|
5
7
|
<!-- FILE_VIEWER_PACKAGE_HEADER -->
|
|
6
8
|
<p>
|
|
7
9
|
<a href="https://www.npmjs.com/package/@file-viewer/react"><img src="https://img.shields.io/npm/v/@file-viewer%2Freact?logo=npm" alt="npm version"></a>
|
|
@@ -20,14 +22,28 @@
|
|
|
20
22
|
|
|
21
23
|
> ⭐ If File Viewer helps you, please [star the repo on GitHub](https://github.com/flyfish-dev/file-viewer).
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
Create an application with renderers and local assets configured:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx file-viewer-cli@latest create my-viewer --framework react --profile standard
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For an existing project, use `npx file-viewer-cli@latest add .`, or follow the [manual integration guide](https://doc.file-viewer.app/guide/on-demand-renderers). The component alone does not install document engines or deploy their Worker/WASM files.
|
|
34
|
+
|
|
35
|
+
## Manual integration
|
|
36
|
+
|
|
37
|
+
The examples below require the matching renderer preset and self-hosted assets. The CLI configures these for you; a bare component install is not a PDF or Office viewer.
|
|
24
38
|
|
|
25
39
|
```bash
|
|
26
|
-
npm install @file-viewer/react
|
|
40
|
+
npm install @file-viewer/react @file-viewer/preset-standard file-viewer-copy-assets
|
|
41
|
+
npx --no-install file-viewer-copy-assets ./public/file-viewer
|
|
27
42
|
```
|
|
28
43
|
|
|
29
44
|
```tsx
|
|
30
45
|
import FileViewer from '@file-viewer/react'
|
|
46
|
+
import standardRenderers from '@file-viewer/preset-standard'
|
|
31
47
|
|
|
32
48
|
export function Preview() {
|
|
33
49
|
return (
|
|
@@ -35,6 +51,7 @@ export function Preview() {
|
|
|
35
51
|
<FileViewer
|
|
36
52
|
url="/example/demo.docx"
|
|
37
53
|
options={{
|
|
54
|
+
preset: standardRenderers,
|
|
38
55
|
theme: 'light',
|
|
39
56
|
toolbar: { position: 'bottom-right' }
|
|
40
57
|
}}
|
|
@@ -277,7 +294,7 @@ The table below lists the real props, event channel, and customization entry for
|
|
|
277
294
|
| `iwork` | After explicitly installing the iWork capability, configure its Pages / Numbers / Keynote module Worker, timeout, ZIP/Snappy/IWA safety limits, and Quick Look fallback policy. It is not in the standard/full default closure. |
|
|
278
295
|
| `hangul` | After explicitly installing the Hangul capability, configure its HWP/HWPX module Worker, timeout, ZIP limits, and HWP record limits. It is not in the standard/full default closure. |
|
|
279
296
|
| `wordPerfect` | After explicitly installing the WordPerfect capability, configure its Worker, libwpd/librevenge WASM URL, and timeout. It is not in the standard/full default closure. |
|
|
280
|
-
| `presentation` |
|
|
297
|
+
| `presentation` | Standard includes PPTX/OpenXML; Office/All presets and Full packages also support binary `.ppt` / `.pot`. PPT uses an Apache-2.0 TypeScript engine and parsing Worker, without WASM or embedded fonts. Minimal installs can use `file-viewer add ppt --write`; custom routes can override `pptModuleUrl` / `pptWorkerUrl`. |
|
|
281
298
|
| `typst` / `data` / `cad` | After explicitly installing the matching capability, configure Typst, SQLite, or CAD/DWG/DXF/DWF WASM, worker, encoding, and rendering options. These capabilities are not in the standard/full default closure. |
|
|
282
299
|
| `hooks` / `beforeOperation` | Shared lifecycle hooks and operation preflight checks for audit, permission, telemetry, and safety controls. |
|
|
283
300
|
|
|
@@ -403,7 +420,7 @@ View-state sync is designed for projection systems, remote-control displays, sid
|
|
|
403
420
|
|
|
404
421
|
See the official documentation for options, lifecycle hooks, beforeOperation, theme, watermark, search, zoom, print, and export APIs: https://doc.file-viewer.app/
|
|
405
422
|
|
|
406
|
-
Online demo: https://demo.file-viewer.app/. File Viewer-authored source
|
|
423
|
+
Online demo: https://demo.file-viewer.app/. File Viewer-authored source, component packages and the new compiled TypeScript PPT runtime use Apache-2.0. The PPT engine source remains private; retain its LICENSE and NOTICE.md. Previous native PPT license and watermark requirements are unchanged, and other third-party runtimes retain their original licenses. Keep Flyfish Viewer attribution in derivative and commercial use.
|
|
407
424
|
<!-- FILE_VIEWER_GENERATED:END -->
|
|
408
425
|
|
|
409
426
|
## Formats and related packages
|
package/README.zh-CN.md
CHANGED
|
@@ -277,7 +277,7 @@ const options = {
|
|
|
277
277
|
| `iwork` | 显式安装 iWork capability 后,配置 Pages / Numbers / Keynote 的模块 Worker、超时、ZIP/Snappy/IWA 安全上限与 Quick Look 降级策略;它不属于 standard/full 默认闭包。 |
|
|
278
278
|
| `hangul` | 显式安装 Hangul capability 后,配置 HWP/HWPX 模块 Worker、超时、ZIP 解压/压缩率/条目数与 HWP 记录数安全上限;它不属于 standard/full 默认闭包。 |
|
|
279
279
|
| `wordPerfect` | 显式安装 WordPerfect capability 后,配置 Worker、libwpd/librevenge WASM 地址与超时;它不属于 standard/full 默认闭包。 |
|
|
280
|
-
| `presentation` | standard
|
|
280
|
+
| `presentation` | standard 默认包含 PPTX/OpenXML;Office/All preset 和 Full 包同时支持二进制 `.ppt` / `.pot`。PPT 使用 Apache-2.0 的 TypeScript 引擎与解析 Worker,无需 WASM 或内置字体。精简安装可用 `file-viewer add ppt --write`;自定义路径可覆盖 `pptModuleUrl` / `pptWorkerUrl`。 |
|
|
281
281
|
| `typst` / `data` / `cad` | 显式安装相应 capability 后,配置 Typst、SQLite、CAD/DWG/DXF/DWF 等 WASM、Worker、编码和渲染策略;这些能力不属于 standard/full 默认闭包。 |
|
|
282
282
|
| `hooks` / `beforeOperation` | 统一生命周期 hooks 和操作前置校验,可用于审计、权限、埋点和安全控制。 |
|
|
283
283
|
|
|
@@ -403,7 +403,7 @@ const options = {
|
|
|
403
403
|
|
|
404
404
|
完整参数、生命周期 hooks、beforeOperation、主题、水印、搜索、缩放、打印和导出说明见官方文档: https://doc.file-viewer.app/
|
|
405
405
|
|
|
406
|
-
在线 Demo: https://demo.file-viewer.app/ 。File Viewer
|
|
406
|
+
在线 Demo: https://demo.file-viewer.app/ 。File Viewer 自身源码、组件包和新 TypeScript PPT 公共编译包使用 Apache-2.0;PPT 引擎源码保持私有,发行时保留其 LICENSE 与 NOTICE.md。旧 native PPT 的许可和水印要求不变,其余第三方运行时保留原许可证。二开或商用请保留 Flyfish Viewer 来源说明。
|
|
407
407
|
<!-- FILE_VIEWER_GENERATED:END -->
|
|
408
408
|
|
|
409
409
|
## 格式与相关包
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/react",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "
|
|
6
|
+
"description": "Lightweight React 18/19 file viewer. Add PDF, Office and other browser-side previews with renderer presets.",
|
|
7
7
|
"keywords": [
|
|
8
8
|
"file-viewer",
|
|
9
9
|
"document-preview",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"type": "git",
|
|
27
27
|
"url": "git+https://github.com/flyfish-dev/file-viewer.git"
|
|
28
28
|
},
|
|
29
|
-
"homepage": "https://
|
|
29
|
+
"homepage": "https://github.com/flyfish-dev/file-viewer#readme",
|
|
30
30
|
"bugs": {
|
|
31
31
|
"url": "https://github.com/flyfish-dev/file-viewer/issues"
|
|
32
32
|
},
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"react": ">=17 <20"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@file-viewer/core": "3.3.
|
|
62
|
+
"@file-viewer/core": "3.3.3"
|
|
63
63
|
},
|
|
64
64
|
"license": "Apache-2.0",
|
|
65
65
|
"fileViewer": {
|