Skip to content

Commit

Permalink
feat: add markdown language
Browse files Browse the repository at this point in the history
  • Loading branch information
wangdan-fit2cloud committed Jan 22, 2025
1 parent 34b626d commit d2ab551
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
5 changes: 3 additions & 2 deletions ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"@ctrl/tinycolor": "^4.1.0",
"@logicflow/core": "^1.2.27",
"@logicflow/extension": "^1.2.27",
"@vavt/cm-extension": "^1.6.0",
"@vueuse/core": "^10.9.0",
"@wecom/jssdk": "^2.1.0",
"axios": "^0.28.0",
Expand Down Expand Up @@ -46,10 +47,10 @@
"vue": "^3.3.4",
"vue-clipboard3": "^2.0.0",
"vue-codemirror": "^6.1.1",
"vue-demi": "latest",
"vue-i18n": "^9.13.1",
"vue-router": "^4.2.4",
"vue3-menus": "^1.1.2",
"vue-demi": "latest"
"vue3-menus": "^1.1.2"
},
"devDependencies": {
"@rushstack/eslint-patch": "^1.3.2",
Expand Down
16 changes: 14 additions & 2 deletions ui/src/components/markdown/MdEditor.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,26 @@
<template>
<MdEditor noIconfont noPrettier v-bind="$attrs">
<MdEditor :language="language" noIconfont noPrettier v-bind="$attrs">
<template #defFooters>
<slot name="defFooters"> </slot>
</template>
</MdEditor>
</template>

<script setup lang="ts">
import { MdEditor } from 'md-editor-v3'
import { computed } from 'vue'
import { MdEditor, config } from 'md-editor-v3'
import './assets/markdown-iconfont.js'
// 引入公共库中的语言配置
import ZH_TW from '@vavt/cm-extension/dist/locale/zh-TW'
defineOptions({ name: 'MdEditor' })
const language = computed(() => localStorage.getItem('MaxKB-locale') || '')
config({
editorConfig: {
languageUserDefined: {
'zh-Hant': ZH_TW
}
}
})
</script>

0 comments on commit d2ab551

Please sign in to comment.