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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@wetspace/rich-text-editor

v0.0.2

Published

::: tip 基本介绍

Readme

WetRichEditor 富文本编辑器

::: tip 基本介绍

本组件是对Quill的二次封装,Quill官方文档

组件引入:import { WetProCard } from '@wetspace/pro-components'

:::

基本使用

一般来说,使用该富文本编辑器

  1. 写入值
  2. 使用实例方法getContents,获取默认的JSON对象字符串( Delta 格式),存入数据库(该值是必要存入数据库的,用于初始化编辑内容所需)
  3. 按需获取内容的html字符串,使用实例方法getContents(true)

初始化编辑器值

设置initialValue属性即可,接受一个JSON对象字符串(Delta 格式),格式如下

"{\"ops\":[{\"insert\":\"测试文本\"},{\"attributes\":{\"header\":1},\"insert\":\"\\n\"},{\"insert\":\"\\n一、代码示例\"},{\"attributes\":{\"header\":2},\"insert\":\"\\n\"},{\"insert\":\"\\n<template>\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"    <WetRichEditor ref=\\\"richText\\\"></WetRichEditor>\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"    <ElDivider></ElDivider>\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"    <ElButton @click=\\\"getValue\\\">获取值</ElButton>\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"</template>\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"<script setup lang=\\\"ts\\\">\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"import { WetRichEditor } from '../../index'\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"import type { WetRichEditorInstance } from '../../index'\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"import { ElDivider,ElButton } from 'element-plus'\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"import { shallowRef } from 'vue'\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\\n\"},{\"insert\":\"const richText = shallowRef<WetRichEditorInstance>()\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"const getValue = ()=>{\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"   const res =  richText.value?.getContents()\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"   console.log(JSON.stringify(res),'值')\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"}\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"</script>\"},{\"attributes\":{\"code-block\":\"javascript\"},\"insert\":\"\\n\"},{\"insert\":\"\\n\"},{\"insert\":{\"image\":\"data:image/png;base64,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ZvMYYqkc5JbADNAKdcRCzH/eBk1jBPoMpYnBsJCABAP3HMfd4r/xktnQpbRPhAgHQSGUTlB6qTS1mcHT2Zz37Ys9SRo/eZx1bi6P/4LxscYHn93HaQuh7mo2Qvj5C8/XNs92/s52rYy5GkbVwBE+mjPTLusSKnNXvFo2jaEhtlOS0ux/uCt1cS+63ofVxwSEQvoNqjEvwH0dd/VwKxVN4Km2mjICz1q7VKfCEpIo3qH8jwWMZG0lYkpIUdnti6eqkgUgjQWBPEQgW0WYbcTJcjyWW/DmmZt/c0+8kwxYEWAgEiW30W9TvnuDYVavX86ak67E+lTZZM5bGgsAMEIgS+xkDa6VFSyVVPEdFHq3nQQNWqh5dr7Q5g+8kUxQEWAiQiV0jODqGIMGpVzBXcGAI3tC/e+jRp7l0eRZS0lgQ2CME2MTeELwK5sB7VvL1GJZitc/z7qOZWU33CH8ZqiAwCALJxN7o39r4k1Ovx7iTYEV4cTuX9oLAVBHoReyWeM65HovjWctnFm8sLQQBQaCOQBZi18RzDA5HgtP0b/e3uEYRX/RoWaiCQDoCWYm9Ec9512PPo2f5jqdPWZ4UBKaPQHZi18TzQ3TvBIAPERjZIZvT/ywyQ0GgHwKDEbulf/uux1iZUvpNVZ4WBOaDwODErunf6L2G12Oof4sePZ81JjPdAQL/A3N0KMiGpoKEAAAAAElFTkSuQmCC\"}},{\"insert\":\"\\n\\n这就是基本情况了\\n\"},{\"attributes\":{\"color\":\"#3c3c43\"},\"insert\":\"本组件是对\"},{\"attributes\":{\"color\":\"var(--vp-c-tip-1)\",\"background\":\"var(--vp-custom-block-tip-code-bg)\",\"code\":true},\"insert\":\"Quill\"},{\"attributes\":{\"color\":\"#3c3c43\"},\"insert\":\"的二次封装,\"},{\"attributes\":{\"link\":\"https://quilljs.com/docs/quickstart\",\"color\":\"var(--vp-c-tip-1)\",\"underline\":true},\"insert\":\"Quill官方文档\"},{\"insert\":\"\\n\"},{\"attributes\":{\"color\":\"#3c3c43\",\"bold\":true},\"insert\":\"组件引入:\"},{\"attributes\":{\"code\":true},\"insert\":\"import { WetProCard } from '@wetspace/pro-components'\"},{\"insert\":\"\\n\\n\"}]}"

获取值

本组件获取值使用的是实例上的getContents方法,方法接受一个boolean值,默认为fasle,获取的是ops,JSON对象字符串(Delta 格式),类似下面这样,设置为true,获取的则是编辑器内的html字符串

帮组页面

属性

|属性| 描述| 类型| 默许值| |---|-----|-----|-------| |initialValue|初始化值(Delta 格式) |string|-| |imageHttpRequest|图片上传函数,返回一个Promise<string>,字符串是图片上传后生产的url地址|(options:UploadRequestOptions) => Promise<string>|-| |showToolsbar|显示工具栏|Boolean|true| |readOnly|只读模式|Boolean|false|

类型参考

import type { UploadRequestOptions } from 'element-plus'
export type WetRichTextProvide = {
    quill:ShallowRef<Quill>,
    httpRequest:ComputedRef<(options:UploadRequestOptions)=>Promise<string>>
}