Merge branch 'main' of github.com:ueberdosis/tiptap-next into main

This commit is contained in:
Hans Pagel
2020-12-14 14:41:28 +01:00
9 changed files with 148 additions and 34 deletions

View File

@@ -31,6 +31,8 @@ import * as d3 from 'd3'
import simplify from 'simplify-js'
export default {
name: 'Paper',
props: {
updateAttributes: {
type: Function,

View File

@@ -6,6 +6,26 @@
TODO
```js
import { Node } from '@tiptap/core'
import { VueRenderer } from '@tiptap/vue'
import Component from './Component.vue'
export default Node.create({
addNodeView() {
return ({ editor, node, getPos, HTMLAttributes, decorations, extension }) => {
const dom = document.createElement('div')
dom.innerHTML = 'Im a node view'
return {
dom,
}
})
},
})
```
## Different types of node views
### Simple
@@ -53,3 +73,60 @@ TODO
## Render Vue components
### Node
```js
import { Node } from '@tiptap/core'
import { VueRenderer } from '@tiptap/vue'
import Component from './Component.vue'
export default Node.create({
addNodeView() {
return VueRenderer(Component)
},
})
```
### Component
```html
<template>
<node-view-wrapper>
<node-view-content />
</node-view-wrapper>
</template>
<script>
export default {
props: {
editor: {
type: Object,
},
node: {
type: Object,
},
decorations: {
type: Array,
},
selected: {
type: Boolean,
},
extension: {
type: Object,
},
getPos: {
type: Function,
},
updateAttributes: {
type: Function,
},
},
}
</script>
```