当前位置:首页 > 每日看点

语雀什么时候开源@语雀?

卡卷网1年前 (2025-04-19)每日看点287

Yuque Rich Text(语雀富文本编辑器)

由于本人觉得语雀编辑器非常好用,很符合我的使用习惯,然后发现语雀的Chrome浏览器插件实现了编辑器的功能,所以将其富文本的功能拆分位一个单独的Vue3组件。

安装

npm i yuque-rich-text

截图

语雀什么时候开源@语雀?  第1张

Props

export interface EditorProps { value: string; // 传递给组件的内容 children?: any; isview?: boolean; // 预览模式,用于在客户端页面展示结果。 uploadImage?: (params: { data: string | File }) => Promise<{ url: string; size: number; filename: string; }>; uploadVideo?: (params: { data: string | File }) => Promise<{ url: string; size: number; filename: string; }>; }

Emit

export interface EditorEmits{ onChange?: (value: string) => void; onLoad?: () => void; onSave?: () => void; }

Expose

export interface IEditorRef { /** * 追加html到文档 * @param html html内容 * @param breakLine 是否前置一个换行符 */ appendContent: (html: string, breakLine?: boolean) => void; /** * 设置文档内容,将清空旧的内容 * @param html html内容 */ setContent: (content: string, type?: "text/lake" | "text/html") => void; /** * 获取文档内容 * @param type 内容的格式 * @return 文档内容 */ getContent: (type: "lake" | "text/html") => Promise<string>; /** * 判断当前文档是否是空文档 * @return true表示当前是空文档 */ isEmpty: () => boolean; /** * 获取额外信息 * @return */ getSummaryContent: () => string; /** * 统计字数 * @return */ wordCount: () => number; /** * 聚焦到文档开头 * @param {number} offset 偏移多少个段落,可以将选区落到开头的第offset个段落上, 默认是0 * @return */ focusToStart: (offset?: number) => void; /** * 插入换行符 * @return */ insertBreakLine: () => void; }

使用编辑器

使用非常简单,只需import组件即可

注意不可在onChange事件中修改value的值,否则会进入无限递归。

<template> <YuqueRichText ref="editRef" :value="modelValue"/> </template> <script setup lang="ts"> import { ref, watch, PropType } from "vue"; import { YuqueRichText } from "yuque-rich-text"; const editRef = ref<InstanceType<typeof YuqueRichText>>(); const modelValue = ref("hello yuque richtext"); </script>

⚠️ Disclaimer

This is an unofficial third-party extension for [www.yuque.com]. It is not affiliated with, maintained by, or endorsed by [www.yuque.com].

  • Use at your own risk. The developers are not responsible for any violations of [www.yuque.com]'s terms or damages caused by this project.
  • Do not use if [www.yuque.com] prohibits third-party modifications.
  • This project does not redistribute any copyrighted materials from [www.yuque.com].

ef="zhihu.com/question/5721">Read [yuque.com]'s Terms of Service before installation.

扫描二维码推送至手机访问。

版权声明:本文由卡卷网发布,如需转载请注明出处。

本文链接:https://www.kajuan.net/ttnews/2025/04/12707.html

分享给朋友:

相关文章

学了两个月网络安全,一直未入门怎么办,知乎大佬们给些建议吧?

学了两个月网络安全,一直未入门怎么办,知乎大佬们给些建议吧?

你才学两个月,就想入门,笑不活了,我学了8年了,还被人说是个菜鸟。 我学了这么多的渗透,依然挖不到自己的漏洞。 ailx10:学习CSRF漏洞 ailx10:学习PHP XXE漏洞 ailx10:学习CORS漏洞 ailx10:学习Cl…

有没有推荐什么手游搬砖,或者是用手机就能做的工作能日入100左右就好了?

有没有推荐什么手游搬砖,或者是用手机就能做的工作能日入100左右就好了?

大家好,我是思聪。思聪游戏搬砖社每天分享真实靠谱的游戏赚钱的方法。 整个游戏的攻略用一句话概括就是:打元宝兑换平台物品,xx元宝兑换一个分红物品。你把你打游戏得来的元宝去兑换平台的分红物品,就能每天领取xx元的分红。(具体看是哪个分红物品,…

网页上的视频怎么下载呀?

网页上的视频怎么下载呀?

1、贝贝BiliBili - B站视频下载 https://xbeibeix.com/api/bilibili/ 贝贝BiliBili 是个 免费、免登录的bilibili视频下载工具,没有任何套路。把视频链接粘贴进去 → 输入验证码 →…

Layui 不更新了么?

Layui 不更新了么?

layui2.8已经于今天正式发布了,新增优化了大量特性,这里按照layui更新日志的模块结构,详细为你一一介绍。 基础风格调整 新版调整主色调为 #16baaa,在原有的墨绿基础上赋予了清新。 更简单的构建构建代码更简单,除字体外…

数字人民币为什么又不火了?

我完全不懂行。 我一开始以为,数字人民币,是对我银行里的每一分钱,都赋予一个独一无二的数字编码。 我要用一块钱买矿泉水,它就从我的存款中随机选取一百个一分钱,组合成一块钱,支付给商家。 我花一百块钱吃饭,它就随机选取一万个一分钱,组合成一百…

闲鱼上为什么会有人问都不问直接下单?

我去年卖一个荣耀90,挂的2200,最终成交2137.5元。 对方是一个高高壮壮的西北口音,要求的自取。 大概我吃过午饭,约了旁边的商场,那里有荣耀售后。 见了面,先看了手机,试了好一会儿,各种测试,没问题。 然后去了商场二楼的荣耀售后,让…

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。