引入v-md-editor组件,做为md编辑器

This commit is contained in:
huangge1199 2024-08-27 08:53:50 +08:00
parent 673fa9990b
commit a523fe4db5
2 changed files with 62 additions and 5 deletions

View File

@ -30,20 +30,18 @@
"admin-template", "admin-template",
"management-system" "management-system"
], ],
"repository": {
"type": "git",
"url": "https://gitee.com/dataprince/flex-elementplus-ui.git"
},
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "2.1.0", "@element-plus/icons-vue": "2.1.0",
"@kangc/v-md-editor": "next",
"@vueuse/core": "9.5.0", "@vueuse/core": "9.5.0",
"animate.css": "4.1.1",
"@zeronejs/utils": "^1.4.0", "@zeronejs/utils": "^1.4.0",
"animate.css": "4.1.1",
"axios": "^1.6.2", "axios": "^1.6.2",
"echarts": "5.4.0", "echarts": "5.4.0",
"element-plus": "2.2.27", "element-plus": "2.2.27",
"file-saver": "2.0.5", "file-saver": "2.0.5",
"fuse.js": "6.6.2", "fuse.js": "6.6.2",
"highlight.js": "^11.10.0",
"js-cookie": "3.0.1", "js-cookie": "3.0.1",
"jsencrypt": "3.3.1", "jsencrypt": "3.3.1",
"nprogress": "0.2.0", "nprogress": "0.2.0",

View File

@ -48,6 +48,63 @@ import TreeSelect from '@/components/TreeSelect'
// 字典标签组件 // 字典标签组件
import DictTag from '@/components/DictTag' import DictTag from '@/components/DictTag'
// v-md-editor 引入
import VMdEditor from '@kangc/v-md-editor';
import VMdPreview from '@kangc/v-md-editor/lib/preview';
import '@kangc/v-md-editor/lib/style/base-editor.css';
import githubTheme from '@kangc/v-md-editor/lib/theme/github.js';
import '@kangc/v-md-editor/lib/theme/style/github.css';
// highlightjs
import hljs from 'highlight.js';
VMdEditor.use(githubTheme, {
Hljs: hljs
});
VMdPreview.use(githubTheme, {
Hljs: hljs
});
// 提示插件
import createTipPlugin from '@kangc/v-md-editor/lib/plugins/tip/index';
import '@kangc/v-md-editor/lib/plugins/tip/tip.css';
VMdEditor.use(createTipPlugin());
VMdPreview.use(createTipPlugin());
// Emoji 表情插件
import createEmojiPlugin from '@kangc/v-md-editor/lib/plugins/emoji/index';
import '@kangc/v-md-editor/lib/plugins/emoji/emoji.css';
VMdEditor.use(createEmojiPlugin());
VMdPreview.use(createEmojiPlugin());
// Katex 插件
import createKatexPlugin from '@kangc/v-md-editor/lib/plugins/katex/cdn';
VMdEditor.use(createKatexPlugin());
VMdPreview.use(createKatexPlugin());
// Mermaid 插件
import createMermaidPlugin from '@kangc/v-md-editor/lib/plugins/mermaid/cdn';
import '@kangc/v-md-editor/lib/plugins/mermaid/mermaid.css';
VMdEditor.use(createMermaidPlugin());
VMdPreview.use(createMermaidPlugin());
// TodoList 任务列表
import createTodoListPlugin from '@kangc/v-md-editor/lib/plugins/todo-list/index';
import '@kangc/v-md-editor/lib/plugins/todo-list/todo-list.css';
VMdEditor.use(createTodoListPlugin());
VMdPreview.use(createTodoListPlugin());
// LineNumber 代码行号
import createLineNumbertPlugin from '@kangc/v-md-editor/lib/plugins/line-number/index';
VMdEditor.use(createLineNumbertPlugin());
VMdPreview.use(createLineNumbertPlugin());
// Highlight Lines 高亮代码行
import createHighlightLinesPlugin from '@kangc/v-md-editor/lib/plugins/highlight-lines/index';
import '@kangc/v-md-editor/lib/plugins/highlight-lines/highlight-lines.css';
VMdEditor.use(createHighlightLinesPlugin());
VMdPreview.use(createHighlightLinesPlugin());
// Copy Code 快捷复制代码
import createCopyCodePlugin from '@kangc/v-md-editor/lib/plugins/copy-code/index';
import '@kangc/v-md-editor/lib/plugins/copy-code/copy-code.css';
VMdEditor.use(createCopyCodePlugin());
VMdPreview.use(createCopyCodePlugin());
// Align 内容定位
import createAlignPlugin from '@kangc/v-md-editor/lib/plugins/align';
VMdEditor.use(createAlignPlugin());
VMdPreview.use(createAlignPlugin());
const app = createApp(App) const app = createApp(App)
// 全局方法挂载 // 全局方法挂载
@ -74,6 +131,8 @@ app.use(store)
app.use(plugins) app.use(plugins)
app.use(elementIcons) app.use(elementIcons)
app.component('svg-icon', SvgIcon) app.component('svg-icon', SvgIcon)
app.use(VMdEditor);
app.use(VMdPreview);
directive(app) directive(app)