vue3-tiptap-katex
Version:
tiptap editor using mathlive package to render katex in vue 3
29 lines (22 loc) • 587 B
JavaScript
import { Node } from '@tiptap/core'
import { VueNodeViewRenderer } from '@tiptap/vue-3'
import TiptapInteractiveReading from './TiptapInteractiveReading.vue'
export default Node.create({
name: 'TiptapInteractiveReading',
group: 'block',
content: 'block+',
parseHTML() {
return [
{
tag: 'div',
getAttrs: (element) => element.getAttribute('class') === 'reading-duplicate'
}
]
},
renderHTML() {
return ['div', { class: 'reading-duplicate' }, 0]
},
addNodeView() {
return VueNodeViewRenderer(TiptapInteractiveReading)
}
})