@embedpdf-editor/chapter-snippet 0.3.4 → 0.3.5
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.md +17 -1
- package/dist/embedpdf-chapter.js +65295 -47014
- package/dist/embedpdf-chapter.js.map +1 -1
- package/package.json +11 -10
package/README.md
CHANGED
|
@@ -14,7 +14,7 @@ pnpm add @embedpdf-editor/chapter-snippet
|
|
|
14
14
|
|
|
15
15
|
## Vite
|
|
16
16
|
|
|
17
|
-
`chapterSnippetViteResolve()` 用于 Vue2/snippet 场景:
|
|
17
|
+
`chapterSnippetViteResolve()` 用于 Vite + Vue2/snippet 场景:
|
|
18
18
|
|
|
19
19
|
```ts
|
|
20
20
|
// vite.config.ts
|
|
@@ -33,6 +33,22 @@ export default defineConfig({
|
|
|
33
33
|
| `server.headers` | 开发环境添加 COOP/COEP,满足 worker/wasm 常见要求 |
|
|
34
34
|
| `optimizeDeps.exclude` | 避免 Vite 二次预构建 snippet 和 PDFium 引擎 |
|
|
35
35
|
|
|
36
|
+
## Vue CLI / Webpack
|
|
37
|
+
|
|
38
|
+
**无需修改 `vue.config.js`。** 安装后直接:
|
|
39
|
+
|
|
40
|
+
```js
|
|
41
|
+
import ChapterEmbedPDF from '@embedpdf-editor/chapter-snippet';
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
发包构建会对 `dist/embedpdf-chapter.js` 做语法降级(去掉 `??` 等 ES2020 语法),Webpack / Vue CLI 默认可 parse。默认 `wasmUrl` 指向 jsDelivr 上的 `pdfium.wasm`,无需复制到 `public/`。
|
|
45
|
+
|
|
46
|
+
离线或内网部署时,可传 `wasmUrl: '/pdfium.wasm'`(自行把 `node_modules/@embedpdf-editor/chapter-snippet/dist/pdfium.wasm` 放到静态目录)。
|
|
47
|
+
|
|
48
|
+
`@embedpdf-editor/chapter-snippet/webpack` 为**可选**辅助(仅 monorepo Vue 2.6 解析、或自定义 devServer COOP/COEP),普通用户不必使用。
|
|
49
|
+
|
|
50
|
+
完整示例见 `examples/chapter-viewer-demo-vue2`。
|
|
51
|
+
|
|
36
52
|
## 快速开始
|
|
37
53
|
|
|
38
54
|
不需要把 `pdfium.wasm` 手动放到宿主项目的 `public/`。默认会从 `@embedpdf-editor/chapter-snippet/dist/pdfium.wasm` 加载。只有当你要走 CDN 或自定义静态域名时,才需要传 `wasmUrl`。
|