add toc demo

This commit is contained in:
Philipp Kühn
2020-11-30 22:53:31 +01:00
parent 85a983cd11
commit b7ae78a95f
4 changed files with 183 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
import { Node, mergeAttributes } from '@tiptap/core'
import { VueRenderer } from '@tiptap/vue'
import Component from './Component.vue'
export default Node.create({
name: 'tableOfContents',
group: 'block',
atom: true,
parseHTML() {
return [
{
tag: 'toc',
},
]
},
renderHTML({ HTMLAttributes }) {
return ['toc', mergeAttributes(HTMLAttributes)]
},
addNodeView() {
return VueRenderer(Component)
},
})