@eigenpal/docx-editor-vue

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

Vue 3 DOCX editor adapter for @eigenpal/docx-editor-core.

此软件包已被标记为弃用

deprecated

原始使用文档
文档目录8 节
  1. Quick Start
  2. Start with a blank document
  3. Packages
  4. Imperative mounting
  5. Subpaths
  6. Component API
  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-vue

Vue 3 adapter for the docx-editor. WYSIWYG .docx editing with canonical OOXML, tracked changes, comments, and an AI agent bridge.

Quick Start

npm install @eigenpal/docx-editor-vue
<script setup lang="ts">
import { ref } from 'vue';
import { DocxEditor } from '@eigenpal/docx-editor-vue';
import '@eigenpal/docx-editor-vue/styles.css';

const buffer = ref<ArrayBuffer | null>(null);

async function loadFile(e: Event) {
  const file = (e.target as HTMLInputElement).files?.[0];
  buffer.value = file ? await file.arrayBuffer() : null;
}
</script>

<template>
  <input type="file" accept=".docx" @change="loadFile" />
  <DocxEditor v-if="buffer" :document-buffer="buffer" mode="editing" />
</template>

Import the stylesheet once at your app entry. Vite's library mode doesn't auto-inject CSS imports, so the toolbar will render unstyled without it.

Using Nuxt? @eigenpal/nuxt-docx-editor wraps this adapter as a Nuxt 3 & 4 module — SSR-safe component registration and the stylesheet are wired automatically.

Start with a blank document

Skip the file picker for new documents. createEmptyDocument returns a fresh Document model you can pass straight to the editor:

<script setup lang="ts">
import { ref } from 'vue';
import { DocxEditor, createEmptyDocument } from '@eigenpal/docx-editor-vue';
import '@eigenpal/docx-editor-vue/styles.css';

const doc = ref(createEmptyDocument());
// Or with options:
// createEmptyDocument({ initialText: 'Untitled', pageWidth: 12240 })
</script>

<template>
  <DocxEditor :document="doc" mode="editing" />
</template>

createDocumentWithText(text, options?) is the same idea with a starting paragraph already typed. Both helpers are re-exported from @eigenpal/docx-editor-core so you don't need a separate dependency.

Packages

PackageDescription
@eigenpal/docx-editor-react   React adapter. Toolbar, paged editor, plugins.
@eigenpal/docx-editor-vue   Vue 3 adapter. Toolbar, paged editor, plugins.
@eigenpal/nuxt-docx-editor   Nuxt 3 & 4 module wrapping this adapter.
@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.

Imperative mounting

import { renderAsync } from '@eigenpal/docx-editor-vue';

const editor = await renderAsync(file, document.getElementById('editor')!, { mode: 'editing' });
await editor.save();
editor.destroy();

Subpaths

  • @eigenpal/docx-editor-vue — DocxEditor, renderAsync, public types
  • @eigenpal/docx-editor-vue/ui — toolbar primitives, pickers, sidebars, dialogs
  • @eigenpal/docx-editor-vue/composables — useDocxEditor, useZoom, useTableSelection, ...
  • @eigenpal/docx-editor-vue/dialogs — dialog SFCs barrel
  • @eigenpal/docx-editor-vue/plugin-api — plugin host and plugin-facing types
  • @eigenpal/docx-editor-vue/styles — style constants (EDITOR_CSS_PATH, z-index)

Component API

DocxEditor and DocxEditorRef mirror the React adapter — the same props, emits, and ref methods, with the import path swapped. Full reference: docx-editor.dev/docs/props.

For lower-level mounting on your own DOM, use the useDocxEditor composable.

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-vue 共发布 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-vue 的常见问题

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

Vue 3 DOCX editor adapter for @eigenpal/docx-editor-core.注意:该包已被作者标记为弃用——deprecated

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

在项目目录运行 npm install @eigenpal/docx-editor-vue,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vue(^3.3.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.12.0)、prosemirror-dropcursor(^1.8.2)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

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

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

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

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

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

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

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

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

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

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