fix: fix lowlight decorations for vue 3

This commit is contained in:
Philipp Kühn
2021-04-12 16:20:49 +02:00
parent 00ac898242
commit daa5dc0fb1
4 changed files with 36 additions and 20 deletions

View File

@@ -16,10 +16,10 @@ import Text from '@tiptap/extension-text'
import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'
import CodeBlockComponent from './CodeBlockComponent'
// install all highlight.js languages
import 'lowlight'
// load all highlight.js languages
import lowlight from 'lowlight'
// or install specific languages only
// load specific languages only
// import lowlight from 'lowlight/lib/core'
// import javascript from 'highlight.js/lib/languages/javascript'
// lowlight.registerLanguage('javascript', javascript)
@@ -41,11 +41,13 @@ export default {
Document,
Paragraph,
Text,
CodeBlockLowlight.extend({
addNodeView() {
return VueNodeViewRenderer(CodeBlockComponent)
},
}),
CodeBlockLowlight
.extend({
addNodeView() {
return VueNodeViewRenderer(CodeBlockComponent)
},
})
.configure({ lowlight }),
],
content: `
<p>

View File

@@ -15,10 +15,10 @@ import Paragraph from '@tiptap/extension-paragraph'
import Text from '@tiptap/extension-text'
import CodeBlockLowlight from '@tiptap/extension-code-block-lowlight'
// install all highlight.js languages
import 'lowlight'
// load all highlight.js languages
import lowlight from 'lowlight'
// or install specific languages only
// load specific languages only
// import lowlight from 'lowlight/lib/core'
// import javascript from 'highlight.js/lib/languages/javascript'
// lowlight.registerLanguage('javascript', javascript)
@@ -40,7 +40,9 @@ export default {
Document,
Paragraph,
Text,
CodeBlockLowlight,
CodeBlockLowlight.configure({
lowlight,
}),
],
content: `
<p>