npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wanghe1995/docx-editor-ui

v1.2.8

Published

docx editor完整ui编辑器

Downloads

1,209

Readme

DocxEditor UI

功能完整的在线协作文档编辑器 UI 组件库

npm version license Vue Element Plus


📖 项目简介

DocxEditor UI 是一款基于 Vue 3 + Element Plus 构建的现代化文档编辑器 UI 组件库,提供类似 Microsoft Word 的完整编辑体验。它与 @wanghe1995/docx-editor-core 核心编辑器无缝集成,支持多人实时协作、AI 智能编辑、图表可视化等高级功能。

✨ 核心特性

  • 🎨 完整 UI 界面 - 提供工具栏、侧边栏、对话框、覆盖层等完整编辑器界面组件
  • 👥 实时协作 - 基于 Yjs CRDT + Hocuspocus 实现多人协同编辑
  • 🤖 AI 智能编辑 - 支持选中内容的智能修改、润色、翻译等功能
  • 📊 图表可视化 - 内置 ECharts 图表组件,支持多种图表类型插入与编辑
  • 🔒 文档保护 - 支持密码保护文档,防止未授权编辑
  • 📱 响应式设计 - 适配不同屏幕尺寸,支持移动端使用
  • 🌙 主题切换 - 支持亮色/暗色主题切换
  • 🛠️ 丰富组件 - 提供代码块、视频播放、二维码生成等多种实用组件

🏗️ 技术架构

核心技术栈

  • 框架: Vue 3.5.27 + TypeScript 4.9.5
  • UI 组件库: Element Plus 2.13.1
  • 图标: Element Plus Icons, Material Design Icons
  • 构建工具: Vite 5.4.10
  • 样式方案: vite-plugin-css-injected-by-js (CSS 内联注入)

依赖库

📦 安装

npm 安装

npm install @wanghe1995/docx-editor-ui element-plus @element-plus/icons-vue prismjs vue

yarn 安装

yarn add @wanghe1995/docx-editor-ui element-plus @element-plus/icons-vue prismjs vue

pnpm 安装

pnpm add @wanghe1995/docx-editor-ui element-plus @element-plus/icons-vue prismjs vue

🚀 快速开始(仅对象式接入)

import { WordEditor, type DocxEditorUiInitialDocument, type CollaborationOptions } from '@wanghe1995/docx-editor-ui'

const initialDocument: DocxEditorUiInitialDocument = {
  meta: {
    id: 'doc-123',
    path: '/demo/doc-123.docx',
    status: 'edit',
    name: '示例文档.docx'
  },
  format: 'canvas',
  content: { main: [] }
}

const collaboration: CollaborationOptions = {
  serverUrl: 'ws://127.0.0.1:1234',
  docId: 'doc-123',
  user: { userId: 'user-001', userName: '张三', color: '#4CAF50' }
}

const editor = new WordEditor({
  container: '#app',
  initialDocument,
  collaboration,
  onReady: () => console.log('ready'),
  onChange: (payload) => console.log('change', payload),
  onMetaChange: (payload) => console.log('meta', payload),
  onStatusChange: (payload) => console.log('status', payload)
})

⚙️ 对外 API(仅对象式)

Options

interface Options {
  container: string | HTMLElement
  initialDocument?: DocxEditorUiInitialDocument
  collaboration?: CollaborationOptions
  onReady?: (payload: any) => void
  onChange?: (payload: { content: any; meta: any; raw: any }) => void
  onMetaChange?: (payload: any) => void
  onStatusChange?: (payload: any) => void
}

WordEditor

class WordEditor {
  constructor(options: Options)
  setInitialDocument(initialDocument?: DocxEditorUiInitialDocument): void
  setCollaboration(collaboration?: CollaborationOptions): void
  executeCommand(command: string, ...args: any[]): any
  getApi(): any
  destroy(): void
}

🔧 开发命令

npm run dev
npm run lib
npm run build:ui
npm run lint

📌 说明

  • 文档内容请求与保存由宿主项目负责。
  • 编辑器实例只负责渲染、命令执行与事件回传。
  • 本包不再提供组件式公开接入说明,统一采用对象式接入。

由于作者业余搞开源,遇到问题或者有想要的功能需求,欢迎提 issue 或 PR。

当前版本属于免费可用版本,没有任何使用限制,但不排除有一些BUG(没有进行完整测试),有问题及时反馈,作者看到后会第一时间回复。