Files
ebiz-ai-knowledge-manage/src/components/MavonEditor/index.vue
2025-04-08 10:31:05 +08:00

80 lines
2.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<template>
<div class="mavonEditor-index-container">
<!-- 可视化富文本编辑器 书写代码-->
<mavonEditor :defaultOpen="defaultOpen" ref="mavonEditor" :toolbarsFla="false" v-model="content" :toolbars="toolbars" :ishljs="true"></mavonEditor>
</div>
</template>
<script>
import { mavonEditor } from 'mavon-editor'
import 'mavon-editor/dist/css/index.css'
export default {
name: 'mavonEditor-index',
components: { mavonEditor },
props: {
value: {
type: String
},
defaultOpen: {
type: String,
default: 'edit'
}
},
model: {
prop: 'value',
event: 'event1'
},
watch: {
value(o) {
this.content = o
},
content(o) {
this.$emit('event1', o)
}
},
data() {
return {
content: '',
toolbars: {
bold: true, // 粗体
italic: true, // 斜体
header: true, // 标题
underline: true, // 下划线
strikethrough: true, // 中划线
mark: true, // 标记
superscript: true, // 上角标
subscript: true, // 下角标
quote: true, // 引用
ol: true, // 有序列表
ul: true, // 无序列表
link: true, // 链接
imagelink: true, // 图片链接
code: true, // code
table: true, // 表格
fullscreen: true, // 全屏编辑
readmodel: true, // 沉浸式阅读
htmlcode: true, // 展示html源码
help: true, // 帮助
/* 1.3.5 */
undo: true, // 上一步
redo: true, // 下一步
trash: true, // 清空
save: true, // 保存触发events中的save事件
/* 1.4.2 */
navigation: true, // 导航目录
/* 2.1.8 */
alignleft: true, // 左对齐
aligncenter: true, // 居中
alignright: true, // 右对齐
/* 2.2.1 */
subfield: true, // 单双栏模式
preview: true // 预览
}
}
},
methods: {}
}
</script>
<style scoped></style>