File tree Expand file tree Collapse file tree 3 files changed +21
-7
lines changed
Expand file tree Collapse file tree 3 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 4545 "nprogress" : " ^0.2.0" ,
4646 "pinia" : " ^3.0.1" ,
4747 "recorder-core" : " ^1.3.25011100" ,
48+ "sanitize-html" : " ^2.17.0" ,
4849 "screenfull" : " ^6.0.2" ,
4950 "sortablejs" : " ^1.15.6" ,
5051 "svg2pdf.js" : " ^2.5.0" ,
Original file line number Diff line number Diff line change 11<template >
2- <MdEditor :language =" language" noIconfont noPrettier v-bind =" $attrs" >
2+ <MdEditor :language =" language" noIconfont noPrettier v-bind =" $attrs" :sanitize = " sanitize " >
33 <template #defFooters >
44 <slot name =" defFooters" > </slot >
55 </template >
@@ -13,14 +13,17 @@ import { getBrowserLang } from '@/locales/index'
1313import ' ./assets/markdown-iconfont.js'
1414// 引入公共库中的语言配置
1515import ZH_TW from ' @vavt/cm-extension/dist/locale/zh-TW'
16-
16+ import sanitizeHtml from ' sanitize-html '
1717defineOptions ({ name: ' MdEditor' })
1818const language = computed (() => localStorage .getItem (' MaxKB-locale' ) || getBrowserLang () || ' ' )
1919config ({
2020 editorConfig: {
2121 languageUserDefined: {
22- ' zh-Hant' : ZH_TW
23- }
24- }
22+ ' zh-Hant' : ZH_TW ,
23+ },
24+ },
2525})
26+ const sanitize = (html : any ) => {
27+ return sanitizeHtml (html )
28+ }
2629 </script >
Original file line number Diff line number Diff line change 11<template >
2- <MdPreview :language =" language" noIconfont noPrettier :codeFoldable =" false" v-bind =" $attrs" />
2+ <MdPreview
3+ :language =" language"
4+ noIconfont
5+ noPrettier
6+ :sanitize =" sanitize"
7+ :codeFoldable =" false"
8+ v-bind =" $attrs"
9+ />
310</template >
411
512<script setup lang="ts">
@@ -9,7 +16,7 @@ import { getBrowserLang } from '@/locales/index'
916import useStore from ' @/stores'
1017// 引入公共库中的语言配置
1118import ZH_TW from ' @vavt/cm-extension/dist/locale/zh-TW'
12-
19+ import sanitizeHtml from ' sanitize-html '
1320defineOptions ({ name: ' MdPreview' })
1421
1522const emit = defineEmits ([' clickPreview' ])
@@ -23,6 +30,9 @@ config({
2330 },
2431 },
2532})
33+ const sanitize = (html : any ) => {
34+ return sanitizeHtml (html )
35+ }
2636 </script >
2737
2838<style lang="scss" scoped>
You can’t perform that action at this time.
0 commit comments