当前位置:首页 > 每日看点 > 正文内容

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

卡卷网11个月前 (04-19)每日看点247

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

分享给朋友:

相关文章

荣耀magic 7 首发的应该都收到货了,感觉怎么样?

8号入手magic7,跟mate40pro比。优点:1、电池真耐用,充电块,华为电池也是新换的但是明显荣耀耐用;2、系统明显快多了,mate40pro下半年开始卡的不行,实在受不了了。3、声音、震动效果提升明显,指纹反应灵敏很多。 缺点:1...

为什么雷军身上没有酒色财气?

武大建校130周年时,雷军向母校个人捐款13亿。在2023年8月14日晚上七点,雷总在国家会议中心举行的进行第四次年度演讲「成长」:全篇都在谈成长、梦想,这么多年了,始终做到了知行合一,我相信酒色财气可能真不是他所追求的,一直追求的就像他演...

什么样的网站能快速捕获你的心?

什么样的网站能快速捕获你的心?

大家好,我是程序员鱼皮。大家如果平时使用网站或产品时出现了问题,一般都会去寻找 “联系客服” 的位置,从而获得人工的帮助。我们团队的面试刷题产品 - 面试鸭最近就遇到了这样一个难题:明明我们网站右下角就有联系客服按钮、而且我们每道面试题目下...

你见过哪些有趣的偏微分方程组?

你见过哪些有趣的偏微分方程组?

说说我一直在做的一个偏微分方程系统吧,该模型为生物领域的趋化性(chemotaxis)模型,也叫Keller-Segel模型,由该二人于1971年左右提出,用于刻画细胞或者细菌的趋化机制。解释一下趋化性(chemotaxis):趋化性是指单...

客观的讲,华为是不是真的遥遥领先?

客观的讲,华为是不是真的遥遥领先?

最近,华为上市了最新款的三折叠屏手机,于是很多大V们把这款手机吹上了天,吹成是技术上遥遥领先于全世界。谁要是敢质疑华而不实,就会被人扣上一顶汉奸卖国贼美狗的帽子。把一个商品捧成了宗教和菩萨,你只能说好,不能说不好。其实这个世界上,只要是人和...

有哪些好玩到爆的小网站?推荐?

有哪些好玩到爆的小网站?推荐?

1、Poki 免费在线游戏https://poki.com/zh免费在线小游戏网站。上千款在线游戏,完全免费,无需登录,打开就能玩。2、http://YORG.iohttps://yorg.io超耐玩的塔防游戏。搭建自己的防御基地、开采资源...

发表评论

访客

看不清,换一张

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