# @eigenpal/docx-js-editor 中文文档

规范地址：https://npmcn.com/package/%40eigenpal/docx-js-editor/

版本：0\.5\.3
npm 元数据更新时间：2026-06-29T21:04:02.093Z
中文译文更新时间：2026-11-13T09:38:37.602Z
软件包许可：MIT

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40eigenpal/docx-js-editor
原文对照：https://npmcn.com/package/%40eigenpal/docx-js-editor/?lang=original
项目主页：https://docx-editor.dev/
源码仓库：https://github.com/eigenpal/docx-editor

弃用说明：deprecated

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：4.2 MB，140 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- 运行依赖：3 个
- peer 依赖：react ^18\.0\.0 \|\| ^19\.0\.0，react-dom ^18\.0\.0 \|\| ^19\.0\.0，prosemirror-view ^1\.41\.6，prosemirror-model ^1\.19\.4，prosemirror-state ^1\.4\.3，prosemirror-keymap ^1\.2\.2，prosemirror-tables ^1\.8\.5，prosemirror-history ^1\.4\.0，prosemirror-commands ^1\.5\.2，prosemirror-transform ^1\.10\.2，prosemirror-dropcursor ^1\.8\.2
- 首次发布：2026-02-04T23:44:32.722Z
- 最新版本发布：2026-05-31T17:16:57.308Z
- 近 30 天下载量：84583（2026-10-13 至 2026-11-11，npm 官方下载统计）
- 已发布版本数：48（近 12 个月 48 个）

## 中文简介

(原始内容存档于2017-09-22). Deprecated: renamed to @eigenpal/docx-editor-resact. 一个基于浏览器的DOCX编辑器. 移徙指南: [https://www.docx-editor.dev/docs/latest/移民](https://www.docx-editor.dev/docs/latest/migration)

## 安装

```sh
npm install @eigenpal/docx-js-editor
```

也可以使用：`pnpm add @eigenpal/docx-js-editor`、`yarn add @eigenpal/docx-js-editor`、`bun add @eigenpal/docx-js-editor`

## README

> ⚠️ **`@eigenpal/docx-js-editor` 已贬值.** 现已更名为 [`@eigenpal/docx-editor-react`](https://www.npmjs.com/package/@eigenpal/docx-editor-react),随着中断的 API 更改(组件重命名,去除的道具,新的 i18n 导入),所以它不是一个滴入的查找/替换. 这个 `0.x` 线条只接收关键修正.
> 
> 安装新软件包 : `npm install @eigenpal/docx-editor-react`,然后跟随 [移徙指南](https://www.docx-editor.dev/docs/latest/migration) 升级前.

[![DOCX Editor — .docx in, .docx out. Open source, agent ready, client-side.](https://raw.githubusercontent.com/eigenpal/docx-editor/main/assets/header.png)](https://www.docx-editor.dev/)

[![npm version](https://img.shields.io/npm/v/@eigenpal/docx-js-editor.svg?style=flat-square&color=3B5BDB)](https://www.npmjs.com/package/@eigenpal/docx-js-editor) [![npm downloads](https://img.shields.io/npm/dm/@eigenpal/docx-js-editor.svg?style=flat-square&color=3B5BDB)](https://www.npmjs.com/package/@eigenpal/docx-js-editor) [![license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square&color=3B5BDB)](https://github.com/eigenpal/docx-js-editor/blob/main/LICENSE) [![Demo](https://img.shields.io/badge/Live_Demo-3B5BDB?style=flat-square&logo=vercel&logoColor=white)](https://docx-editor.dev/editor) [![Documentation](https://img.shields.io/badge/Docs-3B5BDB?style=flat-square&logo=readthedocs&logoColor=white)](https://www.docx-editor.dev/docs)

开源WYSIWYG `.docx` 由Canonical OOXML为React编辑,跟踪变化,以及实时协作. 特工准备好了. **[现场演示](https://docx-editor.dev/editor)** | **[文档](https://www.docx-editor.dev/docs)**

## 快速启动

```bash
npm install @eigenpal/docx-js-editor
```

```tsx
import { useRef } from 'react';
import { DocxEditor, type DocxEditorRef } from '@eigenpal/docx-js-editor';
import '@eigenpal/docx-js-editor/styles.css';

function Editor({ file }: { file: ArrayBuffer }) {
  const editorRef = useRef<DocxEditorRef>(null);
  return <DocxEditor ref={editorRef} documentBuffer={file} mode="editing" onChange={() => {}} />;
}
```

> **下一个.js/安保部门改革:** 使用动态导入——编辑器需要DOM.

[![DOCX JS Editor screenshot](https://raw.githubusercontent.com/eigenpal/docx-editor/main/assets/editor.png)](https://docx-editor.dev/editor)

## 软件包

| 软件包 | 说明 |
| --- | --- |
| [`@eigenpal/docx-js-editor`](https://github.com/eigenpal/docx-editor/tree/main/packages/react) | 反应UI——工具栏,被页编辑器,插件. **安装这个.** |
| [`@eigenpal/docx-editor-vue`](https://github.com/eigenpal/docx-editor/tree/main/packages/vue) | Vue.js脚手架——欢迎发言 |

## 插件

```tsx
import { DocxEditor, PluginHost, templatePlugin } from '@eigenpal/docx-js-editor';

<PluginHost plugins={[templatePlugin]}>
  <DocxEditor documentBuffer={file} />
</PluginHost>;
```

见 [插件文档](https://www.docx-editor.dev/docs/plugins) 用于完整的插件 API.

## 发展

```bash
bun install
bun run dev        # localhost:5173
bun run build
bun run typecheck
```

现场预览 `main` 自动部署在 **[最新. docx-editor.dev](https://latest.docx-editor.dev/)** ——在将更改运入npm之前,用于尝试修改.

实例: [维特](https://github.com/eigenpal/docx-editor/tree/main/examples/vite) | [下一个.js](https://github.com/eigenpal/docx-editor/tree/main/examples/nextjs) | [重混合](https://github.com/eigenpal/docx-editor/tree/main/examples/remix) | [天体](https://github.com/eigenpal/docx-editor/tree/main/examples/astro) | [阴道](https://github.com/eigenpal/docx-editor/tree/main/examples/vue)

**[文档](https://www.docx-editor.dev/docs)** | **[道具和参考方法](https://www.docx-editor.dev/docs/props)** | **[插件](https://www.docx-editor.dev/docs/plugins)** | **[建筑](https://www.docx-editor.dev/docs/architecture)**

## 捐款

欢迎捐款。 见 [捐款额](https://npmcn.com/package/%40eigenpal/docx-js-editor/CONTRIBUTING.md) 用于设置,测试,以及一次性CLA签名.

## 翻译

| 语言 | 语言 | 覆盖范围 |
| --- | --- | --- |
| `en` | 联合国 | 100% |
| `de` | 德语 | 100% |
| `pl` | 波兰语Name | 100% |
| `pt-BR` | 葡萄牙语( 巴西) | 100% |

帮助翻译编辑到您的语言! 见全 **[i18n 捐款指南](https://github.com/eigenpal/docx-editor/blob/main/docs/i18n.md)**。 。 。 .

```bash
bun run i18n:new de      # scaffold German locale
bun run i18n:status      # check translation coverage
```

## 商业支助

> \[TIP\] 问题还是习惯特征? 电子邮件 **[docx-编辑器@eigenpal.com](mailto:docx-editor@eigenpal.com)**。 。 。 .

## 常见问题

### @eigenpal/docx-js-editor 是什么？

\(原始内容存档于2017-09-22\)\. Deprecated: renamed to @eigenpal/docx-editor-resact\. 一个基于浏览器的DOCX编辑器\. 移徙指南: https://www\.docx-editor\.dev/docs/latest/移民注意：该包已被作者标记为弃用——deprecated

### 如何安装 @eigenpal/docx-js-editor？

在项目目录运行 npm install @eigenpal/docx-js-editor，或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖：prosemirror-view（^1\.41\.6）、prosemirror-model（^1\.19\.4）、prosemirror-state（^1\.4\.3）、prosemirror-keymap（^1\.2\.2）、prosemirror-tables（^1\.8\.5）、prosemirror-history（^1\.4\.0）、prosemirror-commands（^1\.5\.2）、prosemirror-transform（^1\.10\.2）、prosemirror-dropcursor（^1\.8\.2）。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖，Yarn 需要手动安装。

### @eigenpal/docx-js-editor 支持 TypeScript 吗？

支持。包内自带 TypeScript 类型声明（package\.json 声明了 types 入口），安装后即可获得类型提示，无需再安装 @types 包。

### @eigenpal/docx-js-editor 支持 ESM 还是 CommonJS？

同时提供 ES Module 与 CommonJS 入口，import 和 require\(\) 都可以使用，打包工具会自动选择合适的版本。

### @eigenpal/docx-js-editor 可以商用吗？

@eigenpal/docx-js-editor 使用 MIT 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。以上为概括，不构成法律意见，请以许可原文为准。

### @eigenpal/docx-js-editor 的下载量有多少？

根据 npm 官方下载统计，@eigenpal/docx-js-editor 在 2026/10/13 – 2026/11/11 这 30 天内被下载 84,583 次，日均约 2,819 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @eigenpal/docx-js-editor 还在维护吗？

最新版本 0\.5\.3 发布于 2026/06/01（5 个月前）；至今共发布 48 个版本，其中过去 12 个月发布了 48 个；首次发布于 2026/02/05。作者已将其标记为弃用，新项目建议寻找替代方案。

