@eigenpal/docx-editor-core

中文文档
1.9.0发布于 2026/06/21Apache-2.0TypeScriptESM + CJS构建来源已验证近 30 天下载 21.3万

Framework-agnostic core for DOCX parsing, editing, and rendering

此软件包已被标记为弃用

deprecated

原始使用文档
文档目录8 节
  1. Quick Start
  2. Packages
  3. Subpath map
  4. Stability
  5. Peer dependencies
  6. Architecture
  7. Contributing
  8. Commercial Support

DOCX Editor — .docx in, .docx out. Open source, agent ready, client-side.

npm version npm downloads license Demo Documentation

@eigenpal/docx-editor-core

Framework-agnostic core for the docx-editor. Parses DOCX, builds the document model, runs ProseMirror, and renders Word-fidelity pages. Powers the React and Vue adapters and anything else you build on top.

Quick Start

Most users want the React or Vue adapter. Reach for core directly when building a custom adapter, running headless on the server, or driving DOCX parsing/serialization without a UI.

npm install @eigenpal/docx-editor-core
import { readFile } from 'node:fs/promises';
import { parseDocx } from '@eigenpal/docx-editor-core/docx';

const buffer = await readFile('contract.docx');
const document = await parseDocx(buffer);
console.log(document.paragraphs.length);

Each subpath tree-shakes independently. Pick the smallest entry point that gives you what you need.

Packages

PackageDescription
@eigenpal/docx-editor-react   React adapter. Toolbar, paged editor, plugins.
@eigenpal/docx-editor-vue   Vue 3 adapter. Toolbar, paged editor, plugins.
@eigenpal/docx-editor-coreFramework-agnostic core: OOXML parser, serializer, layout engine, ProseMirror schema. Depend on this if you fork the React or Vue adapter.
@eigenpal/docx-editor-i18nShared locale strings and types consumed by both adapters.
@eigenpal/docx-editor-agentsAgent SDK and chat UI: framework-agnostic bridge, MCP server, AI SDK adapters, plus React UI.

Forking the adapter? Keep your fork thin. Depend on @eigenpal/docx-editor-core directly so parser, serializer, and rendering fixes land in your build automatically, without backporting each upstream change by hand.

Subpath map

Building...Import fromWhat you get
A new framework adapter./docx, ./prosemirror/conversion, ./prosemirror/extensionsparseDocx, toProseDoc / fromProseDoc, createStarterKit, ExtensionManager
Custom layout / rendering./layout-engine, ./layout-bridge, ./layout-painterlayoutDocument, mouseToPosition, renderPage, LayoutPainter
Editor commands and plugins./prosemirror/commands, ./prosemirror/pluginsFormatting, tables, suggestion mode, selection tracker
Saving back to .docx./docxrepackDocx, attemptSelectiveSave
Headless agents (no UI)./agentDocumentAgent, executeCommand, AgentCommand types
An MCP server./mcpModel Context Protocol server scaffolding
Just unit/color/clipboard helpers./utilstwipsToPixels, resolveColor, font loading, clipboard, selection helpers
Just a type./types/document, ./types/content, ./types/agentApiDocument, Paragraph, Comment, AgentCommand, ...
Default editor stylesheet./prosemirror/editor.cssImport once at the top of your app

Stability

./layout-engine, ./layout-painter, ./layout-bridge, and ./plugin-api are @experimental — used by the first-party adapters but the API may change in minor releases until a third-party adapter validates it. Pin a version range. Everything else follows SemVer.

Peer dependencies

ProseMirror packages are declared as peerDependencies so consumer bundles don't ship duplicates:

npm i prosemirror-commands prosemirror-dropcursor prosemirror-history \
      prosemirror-keymap prosemirror-model prosemirror-state \
      prosemirror-tables prosemirror-transform prosemirror-view

Architecture

Dual-rendering: a hidden ProseMirror instance owns editing state (selection, undo/redo, commands) while layout-painter produces the visible pages. Full breakdown: docx-editor.dev/docs/architecture.

Contributing

Contributions welcome. See CONTRIBUTING.md for setup, tests, and the one-time CLA signature.

Commercial Support

[!TIP] Questions or custom features? Email [email protected].

版本与发布记录

@eigenpal/docx-editor-core 共发布 23 个版本,首次发布于 2026/05/19;过去 12 个月发布了 23 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.9.0latest2026/06/214 个月前
1.8.32026/06/204 个月前
1.8.22026/06/194 个月前
1.8.12026/06/194 个月前
1.8.02026/06/194 个月前
1.7.02026/06/184 个月前

关于 @eigenpal/docx-editor-core 的常见问题

@eigenpal/docx-editor-core 是什么?

Framework-agnostic core for DOCX parsing, editing, and rendering注意:该包已被作者标记为弃用——deprecated

如何安装 @eigenpal/docx-editor-core?

在项目目录运行 npm install @eigenpal/docx-editor-core,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:prosemirror-view(^1.32.7)、prosemirror-model(^1.19.4)、prosemirror-state(^1.4.3)、prosemirror-keymap(^1.2.2)、prosemirror-tables(^1.8.5)、prosemirror-history(^1.5.0)、prosemirror-commands(^1.5.2)、prosemirror-transform(^1.12.0)、prosemirror-dropcursor(^1.8.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 docx-editor-mcp,可以用 npx docx-editor-mcp 直接运行。

@eigenpal/docx-editor-core 支持 TypeScript 吗?

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

@eigenpal/docx-editor-core 支持 ESM 还是 CommonJS?

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

@eigenpal/docx-editor-core 可以商用吗?

@eigenpal/docx-editor-core 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@eigenpal/docx-editor-core 的下载量有多少?

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

@eigenpal/docx-editor-core 还在维护吗?

最新版本 1.9.0 发布于 2026/06/21(4 个月前);至今共发布 23 个版本,其中过去 12 个月发布了 23 个;首次发布于 2026/05/19。作者已将其标记为弃用,新项目建议寻找替代方案。