@file-viewer/react 3.2.2 → 3.3.1

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # @file-viewer/react
2
2
 
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
+
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
+
3
7
  <!-- FILE_VIEWER_PACKAGE_HEADER -->
4
8
  <p>
5
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>
@@ -9,7 +13,7 @@
9
13
  </p>
10
14
 
11
15
  <p>
12
- <a href="https://github.com/flyfish-dev/file-viewer">GitHub</a> · <a href="https://doc.file-viewer.app/">Docs</a> · <a href="https://demo.file-viewer.app/">Live demo</a> · <a href="https://doc.file-viewer.app/guide/formats">Format matrix</a> · <a href="https://github.com/flyfish-dev/file-viewer/issues">Issues</a> · <a href="https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/react/README.md">简体中文</a>
16
+ <a href="https://github.com/flyfish-dev/file-viewer">GitHub</a> · <a href="https://doc.file-viewer.app/">Docs</a> · <a href="https://demo.file-viewer.app/">Live demo</a> · <a href="https://doc.file-viewer.app/guide/formats">Format matrix</a> · <a href="https://github.com/flyfish-dev/file-viewer/issues">Issues</a> · <a href="https://github.com/flyfish-dev/file-viewer/blob/main/packages/components/react/README.zh-CN.md">简体中文</a>
13
17
  </p>
14
18
 
15
19
  <p>
@@ -18,14 +22,28 @@
18
22
 
19
23
  > ⭐ If File Viewer helps you, please [star the repo on GitHub](https://github.com/flyfish-dev/file-viewer).
20
24
 
21
- The standard React native component package for Flyfish File Viewer. The component renders a React container and mounts the complete viewer through this package's local controller on top of `@file-viewer/core` and the core browser engine. It keeps ref APIs, controlled props, lifecycle events, and the full options surface.
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.
22
38
 
23
39
  ```bash
24
- 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
25
42
  ```
26
43
 
27
44
  ```tsx
28
45
  import FileViewer from '@file-viewer/react'
46
+ import standardRenderers from '@file-viewer/preset-standard'
29
47
 
30
48
  export function Preview() {
31
49
  return (
@@ -33,6 +51,7 @@ export function Preview() {
33
51
  <FileViewer
34
52
  url="/example/demo.docx"
35
53
  options={{
54
+ preset: standardRenderers,
36
55
  theme: 'light',
37
56
  toolbar: { position: 'bottom-right' }
38
57
  }}