@casualoffice/docs

中文文档
1.4.2发布于 2026/07/11MITTypeScriptESM + CJS近 30 天下载 1.4万

A browser-based DOCX template editor with variable insertion support

原始使用文档
文档目录5 节
  1. Casual Editor — editor package
  2. Packages
  3. Useful commands
  4. Architecture cheat sheet
  5. License

Casual Editor

Casual Editor — editor package

Built on eigenpal/docx-editor (MIT).

This directory holds the browser editor codebase for Casual Editor. Everything project-wide (architecture, deployment, backend plan) lives in the outer README — start there.

This README is just a quick map of what's inside docx-editor/ so folks browsing the package itself don't have to grep around.

Packages

PathWhat it is
packages/core/DOCX parser + serializer, layout engine, ProseMirror schema
packages/react/The <DocxEditor> React component (used by the demo)
packages/vue/Vue wrapper (private, community-maintained, not published)

Useful commands

Run from inside docx-editor/. Bun ≥ 1.3.14 required.

bun install
bun run dev           # vite demo at http://localhost:5173
bun run typecheck     # type-check every package
bun test              # unit tests
bun run test:e2e      # Playwright e2e (chromium)
bun run build         # build core + react packages
bun run build:demo    # build the Vite demo bundle

Round-trip audit (lists every OOXML tag we silently drop on save):

bun run scripts/roundtrip-audit.mjs
# writes roundtrip-audit-report.md

Architecture cheat sheet

The editor has two rendering pipelines that must stay in sync:

┌──────────────────────────────────────────────────────────────┐
│ HIDDEN ProseMirror (off-screen)                              │
│   real editing state, selection, undo/redo, commands         │
│   src/paged-editor/HiddenProseMirror.tsx                     │
└──────────────────────────────────────────────────────────────┘
                state changes ↓ trigger re-render
┌──────────────────────────────────────────────────────────────┐
│ VISIBLE pages (layout-painter)                               │
│   what the user actually sees, has its own render logic      │
│   src/layout-painter/renderPage.ts                           │
└──────────────────────────────────────────────────────────────┘

When fixing a visual bug, edit layout-painter/. When fixing an editing-behavior bug, edit prosemirror/extensions/. For both, you usually need to touch both pipelines.

See CLAUDE.md in this directory for the full "Key File Map" used by day-to-day work.

License

MIT (docx-editor/LICENSE). Derived from eigenpal/docx-editor under the same MIT license; their copyright notice is retained.

版本与发布记录

@casualoffice/docs 共发布 4 个版本,首次发布于 2026/07/08;过去 12 个月发布了 4 个版本。

版本发布日期距今
1.4.2latest2026/07/113 个月前
1.4.12026/07/104 个月前
1.3.02026/07/094 个月前
1.2.02026/07/084 个月前

关于 @casualoffice/docs 的常见问题

@casualoffice/docs 是什么?

A browser-based DOCX template editor with variable insertion support

如何安装 @casualoffice/docs?

在项目目录运行 npm install @casualoffice/docs,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:prosemirror-commands(^1.5.2)、prosemirror-dropcursor(^1.8.2)、prosemirror-history(^1.4.0)、prosemirror-keymap(^1.2.2)、prosemirror-model(^1.19.4)、prosemirror-state(^1.4.3)、prosemirror-tables(^1.8.5)、prosemirror-transform(^1.10.2)、prosemirror-view(^1.41.6)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@casualoffice/docs 支持 TypeScript 吗?

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

@casualoffice/docs 支持 ESM 还是 CommonJS?

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

@casualoffice/docs 可以商用吗?

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

@casualoffice/docs 的下载量有多少?

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

@casualoffice/docs 还在维护吗?

最新版本 1.4.2 发布于 2026/07/11(3 个月前);至今共发布 4 个版本,其中过去 12 个月发布了 4 个;首次发布于 2026/07/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。