@langeditor/plugin-docx 1.0.0
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/LICENSE +21 -0
- package/PRD.md +20 -0
- package/README.md +57 -0
- package/dist/chunks/dist-CCgJdXY1.js +14477 -0
- package/dist/chunks/docx-CTc58_gh.js +3480 -0
- package/dist/chunks/docx-LNMvqtvT.js +1591 -0
- package/dist/chunks/rolldown-runtime-DldpqzEl.js +16 -0
- package/dist/extensions/ExportWord/ExportWord.d.ts +19 -0
- package/dist/extensions/ExportWord/docx.d.ts +6 -0
- package/dist/extensions/ExportWord/fallback.d.ts +24 -0
- package/dist/extensions/ExportWord/index.d.ts +2 -0
- package/dist/extensions/ImportWord/ImportWord.d.ts +20 -0
- package/dist/extensions/ImportWord/docx.d.ts +13 -0
- package/dist/extensions/ImportWord/index.d.ts +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.es.js +226 -0
- package/dist/manifest.d.ts +10 -0
- package/dist/plugin.d.ts +9 -0
- package/package.json +56 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024-present TyCoding and LangEditor contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/PRD.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# DOCX Plugin PRD
|
|
2
|
+
|
|
3
|
+
## Boundary
|
|
4
|
+
|
|
5
|
+
`@langeditor/plugin-docx` owns DOCX import, DOCX export, Word image handling,
|
|
6
|
+
and DOCX fallback registration. Core owns the editor, Word page layout, and
|
|
7
|
+
comment model but does not load DOCX runtimes.
|
|
8
|
+
|
|
9
|
+
## Runtime behavior
|
|
10
|
+
|
|
11
|
+
- Package import registers per-editor `ImportWord` and `ExportWord` extensions.
|
|
12
|
+
- DOCX parsing and serialization use dynamic imports from the command handlers.
|
|
13
|
+
- The package is usable through Vue, Web Components, and the React adapter because
|
|
14
|
+
the extensions are ordinary Tiptap extensions.
|
|
15
|
+
- Import failures, file-size failures, and unsupported structures remain
|
|
16
|
+
localized through the core locale and diagnostics APIs.
|
|
17
|
+
|
|
18
|
+
## License
|
|
19
|
+
|
|
20
|
+
MIT. No commercial license feature is required.
|
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @langeditor/plugin-docx
|
|
2
|
+
|
|
3
|
+
DOCX import and export for LangEditor. The plugin keeps `docx`,
|
|
4
|
+
`prosemirror-docx`, and the DOCX parser out of the core editor bundle. Importing
|
|
5
|
+
the package registers the extensions with the editor plugin runtime; the parser
|
|
6
|
+
and serializer are still loaded only when the corresponding command is used.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
pnpm add @langeditor/core @langeditor/plugin-docx
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import '@langeditor/plugin-docx'
|
|
16
|
+
import { BaseKit, LangEditor } from '@langeditor/core'
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
With the side-effect registration enabled, `LangEditor` adds the Word actions
|
|
20
|
+
automatically. To configure image uploads or export image resolution, pass
|
|
21
|
+
plugin options through `pluginOptions`:
|
|
22
|
+
|
|
23
|
+
```vue
|
|
24
|
+
<LangEditor
|
|
25
|
+
v-model="content"
|
|
26
|
+
:plugin-options="{
|
|
27
|
+
docx: {
|
|
28
|
+
importWord: { upload: uploadImages },
|
|
29
|
+
exportWord: { resolveImage: resolveImage },
|
|
30
|
+
},
|
|
31
|
+
}"
|
|
32
|
+
/>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
The extensions and serializers are also available for explicit composition:
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import {
|
|
39
|
+
ExportWord,
|
|
40
|
+
ImportWord,
|
|
41
|
+
createDocxDocument,
|
|
42
|
+
parseDocx,
|
|
43
|
+
} from '@langeditor/plugin-docx'
|
|
44
|
+
|
|
45
|
+
const extensions = [
|
|
46
|
+
ImportWord.configure({ spacer: true }),
|
|
47
|
+
ExportWord,
|
|
48
|
+
]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
`ImportWord` preserves supported text, headings, lists, tables, links, images,
|
|
52
|
+
and Word comments. Unsupported structures produce diagnostics instead of being
|
|
53
|
+
silently dropped. `ExportWord` serializes ordinary editor content and Word page
|
|
54
|
+
documents, including comments and registered fallback representations.
|
|
55
|
+
|
|
56
|
+
The plugin is MIT licensed. It requires `@langeditor/core >=1.1.0 <2.0.0` and
|
|
57
|
+
does not add any commercial capability or license requirement.
|