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

vue-ex-editor

v1.1.3

Published

专业的 Vue 3 富文本编辑器,基于 ProseMirror,支持 Markdown、协作编辑、插件扩展

Downloads

35

Readme

vue-ex-editor

专业的 Vue 3 富文本编辑器,基于 ProseMirror,支持 Markdown、协作编辑、插件扩展。

✨ 特性

  • 🎨 开箱即用 - 完整的工具栏和格式化功能
  • 📝 Markdown 支持 - 粘贴和输入自动转换
  • 🔌 插件系统 - 灵活的插件扩展机制
  • 👥 协作编辑 - 基于 Yjs 的实时协作(可选)
  • 📱 响应式 - 适配桌面和移动端
  • 🎯 TypeScript - 完整的类型支持
  • 🌙 主题切换 - 支持亮色/暗色主题
  • 🖥️ 全屏模式 - 浏览器原生全屏 API
  • 🔒 样式隔离 - 自动添加命名空间前缀,避免样式冲突

📦 安装

npm install vue-ex-editor
# 或
yarn add vue-ex-editor
# 或
pnpm add vue-ex-editor

🚀 快速开始

<script setup lang="ts">
import { ref } from 'vue'
import { ExEditor } from 'vue-ex-editor'
import 'vue-ex-editor/style.css'

const content = ref(null)

const handleReady = (editor) => {
  console.log('编辑器已就绪', editor)
}
</script>

<template>
  <ExEditor
    v-model:content="content"
    placeholder="开始编写内容..."
    @ready="handleReady"
  />
</template>

⚙️ Props

| 属性 | 类型 | 默认值 | 说明 | |------|------|--------|------| | content | Object | undefined | 编辑器初始内容(ProseMirror JSON) | | readonly | boolean | false | 是否只读模式 | | showToolbar | boolean | true | 是否显示工具栏 | | showStatusbar | boolean | true | 是否显示状态栏 | | placeholder | string | '开始编写内容...' | 占位符文本 | | theme | 'light' \| 'dark' | 'light' | 主题模式 | | apiConfig | EditorAPIConfig | undefined | API 配置(上传、协作等) |

📤 Events

| 事件 | 参数 | 说明 | |------|------|------| | update:content | content: ProseMirrorNode | 内容更新时触发 | | ready | editor: Editor | 编辑器初始化完成时触发 | | fullscreen-change | isFullscreen: boolean | 全屏状态变化时触发 |

🎨 主题切换

<script setup>
import { ref } from 'vue'
import { ExEditor } from 'vue-ex-editor'

const theme = ref<'light' | 'dark'>('light')

const toggleTheme = () => {
  theme.value = theme.value === 'light' ? 'dark' : 'light'
}
</script>

<template>
  <button @click="toggleTheme">切换主题</button>
  <ExEditor :theme="theme" />
</template>

🖥️ 全屏模式

编辑器内置全屏按钮,也可以通过方法控制:

const editorRef = ref()

// 进入全屏
editorRef.value.enterFullscreen()

// 退出全屏(按 Escape 键也可退出)
editorRef.value.exitFullscreen()

// 切换全屏
editorRef.value.toggleFullscreen()

监听全屏变化事件:

<ExEditor @fullscreen-change="onFullscreenChange" />

🎨 导出格式

// 获取编辑器实例
const editorRef = ref()

// 导出为不同格式
const json = editorRef.value.exportContent('json')
const html = editorRef.value.exportContent('html')
const markdown = editorRef.value.exportContent('markdown')
const text = editorRef.value.exportContent('text')

🔧 高级用法

使用核心 Editor 类

import { Editor } from 'vue-ex-editor'

const editor = new Editor({
  container: document.getElementById('editor'),
  content: '<p>Hello World</p>',
  placeholder: '输入内容...',
})

// 执行命令
editor.executeCommand('bold')
editor.executeCommand('heading', { level: 1 })

// 获取内容
const content = editor.exportContent('markdown')

API 配置

const apiConfig = {
  upload: {
    enabled: true,
    endpoint: '/api/upload',
    maxFileSize: 10 * 1024 * 1024,
    allowedTypes: ['image', 'video', 'attachment'],
  },
  collaboration: {
    enabled: true,
    websocketUrl: 'wss://collab.example.com',
    reconnectAttempts: 5,
    reconnectDelay: 3000,
  },
}

🔒 样式隔离

编辑器使用 .vex-editor 命名空间和 CSS 变量前缀 --editor-,避免与宿主项目样式冲突。

如需自定义样式,可覆盖 CSS 变量:

.vex-editor {
  --editor-primary: #your-color;
  --editor-bg: #your-bg;
}

📝 License

MIT