#I3BMNS 代码块高亮,增加判空和状态判断
This commit is contained in:
26
zyplayer-doc-ui/wiki-ui/package-lock.json
generated
26
zyplayer-doc-ui/wiki-ui/package-lock.json
generated
@@ -2898,6 +2898,12 @@
|
||||
"integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
|
||||
"dev": true
|
||||
},
|
||||
"highlight.js": {
|
||||
"version": "9.18.5",
|
||||
"resolved": "https://registry.npmmirror.com/highlight.js/download/highlight.js-9.18.5.tgz",
|
||||
"integrity": "sha1-0Yo1mGfzeME41oGe38KorNXymCU=",
|
||||
"dev": true
|
||||
},
|
||||
"supports-color": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npm.taobao.org/supports-color/download/supports-color-7.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.1.0.tgz",
|
||||
@@ -5720,9 +5726,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"highlight.js": {
|
||||
"version": "9.16.2",
|
||||
"resolved": "https://registry.npm.taobao.org/highlight.js/download/highlight.js-9.16.2.tgz",
|
||||
"integrity": "sha1-aDaNA5/+HGIRvMB+SD2vld4+QD4="
|
||||
"version": "11.3.1",
|
||||
"resolved": "https://registry.npmmirror.com/highlight.js/download/highlight.js-11.3.1.tgz",
|
||||
"integrity": "sha1-gTB47zqlGcYXAPhP6QRyMcXcMpE="
|
||||
},
|
||||
"highlight.js-async-webpack": {
|
||||
"version": "1.0.4",
|
||||
@@ -7009,6 +7015,13 @@
|
||||
"highlight.js": "^9.11.0",
|
||||
"highlight.js-async-webpack": "^1.0.4",
|
||||
"xss": "^1.0.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"highlight.js": {
|
||||
"version": "9.18.5",
|
||||
"resolved": "https://registry.npmmirror.com/highlight.js/download/highlight.js-9.18.5.tgz",
|
||||
"integrity": "sha1-0Yo1mGfzeME41oGe38KorNXymCU="
|
||||
}
|
||||
}
|
||||
},
|
||||
"md5.js": {
|
||||
@@ -10800,6 +10813,13 @@
|
||||
"integrity": "sha1-1mOeMJZNGsyzFvM7TjJm7cHmAS0=",
|
||||
"requires": {
|
||||
"highlight.js": "^9.13.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"highlight.js": {
|
||||
"version": "9.18.5",
|
||||
"resolved": "https://registry.npmmirror.com/highlight.js/download/highlight.js-9.18.5.tgz",
|
||||
"integrity": "sha1-0Yo1mGfzeME41oGe38KorNXymCU="
|
||||
}
|
||||
}
|
||||
},
|
||||
"vue-hot-reload-api": {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
"jquery": "^3.5.1",
|
||||
"js-cookie": "^2.2.1",
|
||||
"mavon-editor": "^2.9.0",
|
||||
"highlight.js": "^11.3.1",
|
||||
"pouchdb": "^7.1.1",
|
||||
"qrcodejs2": "0.0.2",
|
||||
"sql-formatter": "^2.3.3",
|
||||
|
||||
@@ -32,6 +32,18 @@ let vue = new Vue({
|
||||
return h(App);
|
||||
}
|
||||
});
|
||||
|
||||
// 注册一个全局自定义指令
|
||||
import hljs from 'highlight.js'
|
||||
import 'highlight.js/styles/googlecode.css'
|
||||
|
||||
Vue.directive('highlight', function (el) {
|
||||
let blocks = el.querySelectorAll('pre code');
|
||||
blocks.forEach((block) => {
|
||||
hljs.highlightBlock(block);
|
||||
})
|
||||
});
|
||||
|
||||
export default vue;
|
||||
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@
|
||||
</el-table>
|
||||
</div>
|
||||
<div ref="pageContent" class="wiki-page-content">
|
||||
<div v-html="pageShowDetail" class="markdown-body" v-if="wikiPage.editorType == 2"></div>
|
||||
<div v-html="pageShowDetail" class="markdown-body" v-if="wikiPage.editorType == 2" v-highlight></div>
|
||||
<div v-html="pageShowDetail" class="wang-editor-body" v-else></div>
|
||||
</div>
|
||||
<div style="margin-top: 40px; font-size: 14px;">
|
||||
|
||||
Reference in New Issue
Block a user