diff --git a/docs/src/demos/Guide/NodeViews/TableOfContents/Component.vue b/docs/src/demos/Guide/NodeViews/TableOfContents/Component.vue new file mode 100644 index 00000000..85a9933f --- /dev/null +++ b/docs/src/demos/Guide/NodeViews/TableOfContents/Component.vue @@ -0,0 +1,106 @@ + + + + + + + diff --git a/docs/src/demos/Guide/NodeViews/TableOfContents/TableOfContents.js b/docs/src/demos/Guide/NodeViews/TableOfContents/TableOfContents.js new file mode 100644 index 00000000..a52a6571 --- /dev/null +++ b/docs/src/demos/Guide/NodeViews/TableOfContents/TableOfContents.js @@ -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) + }, +}) diff --git a/docs/src/demos/Guide/NodeViews/TableOfContents/index.vue b/docs/src/demos/Guide/NodeViews/TableOfContents/index.vue new file mode 100644 index 00000000..68012810 --- /dev/null +++ b/docs/src/demos/Guide/NodeViews/TableOfContents/index.vue @@ -0,0 +1,48 @@ + + + diff --git a/docs/src/docPages/guide/node-views.md b/docs/src/docPages/guide/node-views.md index 486b5d43..ee539221 100644 --- a/docs/src/docPages/guide/node-views.md +++ b/docs/src/docPages/guide/node-views.md @@ -28,6 +28,8 @@ TODO ``` + + ### Advanced node views with content ```html