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 🙏

© 2024 – Pkg Stats / Ryan Hefner

fancy-editor

v0.14.30

Published

基于 `vue3` + `tiptap2` 封装的富文本编辑器,具有以下优势:

Downloads

140

Readme

fancy-editor

基于 vue3 + tiptap2 封装的富文本编辑器,具有以下优势:

  • 开箱即用
  • 现代化的界面(仿语雀)
  • 支持拖拽上传,并自动识别文件类型,chrome 91+ 支持粘贴文件上传
  • 支持图片尺寸调整
  • 代码块多语言支持

安装

yarn add fancy-editor

使用

库内包含两个命名导出的函数,分别是用于创建编辑的编辑器 createEditor 与用于展示的阅读器 createReader

createEditor

创建阅读器,支持如下参数

  • el: 编辑器要绑定到的 dom 元素
  • value: 编辑器初始内容
    • type**: **string
    • default**: **''
  • onlyFull: 是否仅全屏显示
    • type**: **boolean
    • default**: **false
  • to: 全屏显示时依附的容器
    • type**: **string | HTMLElement
    • default: 'body'
  • action: 文件上传地址
    • type**: **string
    • default**: **''
  • feeds: 提及人员列表,可被 @ 的人
    • type: string[]
    • default: ["Barney", "Lily", "Marshall", "Robin", "Ted"]
  • beforeUpload: 上传前的处理函数,可用于自定义请求方式
    • params:
      • file 待上传的文件
        • type: File
    • return: 包含请求配置的 AxiosRequestConfig 对象
      • Promise<AxiosRequestConfig>
  • afterUpload: 上传后的处理函数,用于自定义处理上传结果
    • params:
      • response 上传后返回的内容
        • type: AxiosPromise<any>
    • return: 上传的文件预览地址
      • Promise<string>
  • beforeDownload: 下载前的处理函数,用于自定义下载地址
    • params:
      • filename 文件名
        • type: string
      • fileUrl 文件预览地址
        • type: string
    • return: 文件下载地址
      • type: string
  • on: 事件处理对象
    • change: 内容更新时触发
      • event params:
        • content: 编辑器内容
    • focus: 聚焦事件
      • event params: 无
    • blur: 失焦事件
      • event params: 无
    • preserve: 保存事件,在编辑器中按下 Ctrl + S 时触发
      • event params:
        • content: 编辑器内容

createReader

创建一个阅读器,支持如下参数

  • el**: 阅读器要绑定到的 **dom 元素
  • content: 要查看的内容
    • type**: **string
    • default**: **''

Typescript 支持

包含 ts 类型声明,可给予开发者更好的编辑体验