Fix highlight.js in editor
This commit is contained in:
parent
5e82e75e1b
commit
f2c29d42dd
1 changed files with 1 additions and 1 deletions
|
@ -58,6 +58,7 @@ import VueEasymde from 'vue-easymde'
|
||||||
import EasyMDE from 'easymde'
|
import EasyMDE from 'easymde'
|
||||||
import marked from 'marked'
|
import marked from 'marked'
|
||||||
import DOMPurify from 'dompurify'
|
import DOMPurify from 'dompurify'
|
||||||
|
import hljs from 'highlight.js'
|
||||||
|
|
||||||
import AttachmentModel from '../../models/attachment'
|
import AttachmentModel from '../../models/attachment'
|
||||||
import AttachmentService from '../../services/attachment'
|
import AttachmentService from '../../services/attachment'
|
||||||
|
@ -370,7 +371,6 @@ export default {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
highlight: function (code, language) {
|
highlight: function (code, language) {
|
||||||
const hljs = require('highlight.js')
|
|
||||||
const validLanguage = hljs.getLanguage(language) ? language : 'plaintext'
|
const validLanguage = hljs.getLanguage(language) ? language : 'plaintext'
|
||||||
return hljs.highlight(code, {language: validLanguage}).value
|
return hljs.highlight(code, {language: validLanguage}).value
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue