![Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility](https://cdn.sanity.io/images/cgdhsj6q/production/97774ea8c88cc8f4bed2766c31994ebc38116948-1664x1366.png?w=400&fit=max&auto=format)
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
milkdown-vue
Advanced tools
基于milkdown的封装,整合了所有常用插件的Vue3
组件 。
yarn add milkdown-vue
<editor v-model="doc" ref="editorRef" :config="config" :uploader="uploader" @save="save" />
1、 v-model
: markdown
内容
2、 config
: 组件配置相关
属性 | 类型 | 默认值 | 说明 |
---|---|---|---|
readonly | Boolean | false | 是否为只读 |
menu | Boolean | false | 是否展示菜单 |
theme | String | auto | 主题样式auto、dark, light |
3、uploader
: 图片上传自定义方法,接收原始图片文件,许返回包含图片地址的对象数组。
[{
"url": "图片地址",
"name": "名称"
}]
save
: 使用保存快捷键Mod+s
时,接收value
值的回调
参考preset-gfm插件的快捷键。
这里新增加了Mod+/
快捷键,可在不同的窗口编辑模式中切换
vue setup
示例// 组件引入
import Editor from 'milkdown-vue'
import { ref } from 'vue'
const editorRef = ref(null)
const config = ref({
// 是否为只读模式
readonly: false,
// 是否展示菜单
menu: true,
// 主题样式auto、dark, light
theme: 'auto'
})
const doc = ref('')
const save = v => {
// markdown 内容字符串
console.log(v)
}
// 自定义上传
const uploader = (images) => {
// 图片原始文件数组对象
console.log(images)
// 返回上传后的地址和名称
return [{
url: "https://cyyjs.top/_nuxt/img/qrcode.5c9aef0.jpg",
name: "head"
}]
}
// 获取html内容
const getHtml = () => {
console.log(editorRef.value.getHtml())
}
// 获取目录结构
const getOutline = () => {
console.log(editorRef.value.getOutline())
}
// 设置markdown 内容
const setValue = (v) => {
editorRef.value.setValue(v)
}
FAQs
milkdown vue 封装
We found that milkdown-vue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.