From d49af82a851b6e1e454b4d221be69d8c733f2346 Mon Sep 17 00:00:00 2001 From: Hans Pagel Date: Mon, 8 Mar 2021 18:33:50 +0100 Subject: [PATCH] docs: update content --- .../NodeViews/VueComponent/Component.vue | 61 +++++++++++++++++++ .../Guide/NodeViews/VueComponent/index.js | 27 ++++++++ .../Guide/NodeViews/VueComponent/index.vue | 52 ++++++++++++++++ docs/src/docPages/guide/node-views.md | 28 ++++++--- 4 files changed, 160 insertions(+), 8 deletions(-) create mode 100644 docs/src/demos/Guide/NodeViews/VueComponent/Component.vue create mode 100644 docs/src/demos/Guide/NodeViews/VueComponent/index.js create mode 100644 docs/src/demos/Guide/NodeViews/VueComponent/index.vue diff --git a/docs/src/demos/Guide/NodeViews/VueComponent/Component.vue b/docs/src/demos/Guide/NodeViews/VueComponent/Component.vue new file mode 100644 index 00000000..d956dc04 --- /dev/null +++ b/docs/src/demos/Guide/NodeViews/VueComponent/Component.vue @@ -0,0 +1,61 @@ + + + + + diff --git a/docs/src/demos/Guide/NodeViews/VueComponent/index.js b/docs/src/demos/Guide/NodeViews/VueComponent/index.js new file mode 100644 index 00000000..4e32f2bd --- /dev/null +++ b/docs/src/demos/Guide/NodeViews/VueComponent/index.js @@ -0,0 +1,27 @@ +import { Node, mergeAttributes } from '@tiptap/core' +import { VueNodeViewRenderer } from '@tiptap/vue-2' +import Component from './Component.vue' + +export default Node.create({ + name: 'vueComponent', + + group: 'block', + + atom: true, + + parseHTML() { + return [ + { + tag: 'vue-component', + }, + ] + }, + + renderHTML({ HTMLAttributes }) { + return ['vue-component', mergeAttributes(HTMLAttributes)] + }, + + addNodeView() { + return VueNodeViewRenderer(Component) + }, +}) diff --git a/docs/src/demos/Guide/NodeViews/VueComponent/index.vue b/docs/src/demos/Guide/NodeViews/VueComponent/index.vue new file mode 100644 index 00000000..7b7e67c5 --- /dev/null +++ b/docs/src/demos/Guide/NodeViews/VueComponent/index.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/docs/src/docPages/guide/node-views.md b/docs/src/docPages/guide/node-views.md index 076bce4e..fcf1a36c 100644 --- a/docs/src/docPages/guide/node-views.md +++ b/docs/src/docPages/guide/node-views.md @@ -3,7 +3,8 @@ ## toc ## Introduction -Node views are the best thing since sliced bread, at least if you’re a fan of customization (and bread). Node views enable you to add literally anything to a node. If you can write it in JavaScript, you can use it in your editor. +Node views are the best thing since sliced bread, at least if you’re a fan of customization (and bread). With node views you can add interactive nodes to your editor content. That can literally be everything. If you can write it in JavaScript, you can use it in your editor. + - + -#### Example: Drag handles - + -## Render Vue components +## Node views with Vue.js +TODO -### Node +### Render a Vue component + + +### Access node attributes + + +### Update attributes + + + + ## Reference