some more tests
This commit is contained in:
@@ -4,10 +4,21 @@
|
||||
<button @click="editor.chain().focus().insertText('hey').run()">
|
||||
button
|
||||
</button>
|
||||
<component :is="inner" />
|
||||
<div>
|
||||
attrs {{ node.attrs }}
|
||||
</div>
|
||||
<inner />
|
||||
</div> -->
|
||||
<inner as="p" class="hey" foo="bar" />
|
||||
<!-- <inner /> -->
|
||||
<div style="white-space: normal;">
|
||||
<button @click="toggleChecked">
|
||||
toggle checked
|
||||
</button>
|
||||
hey {{ node.attrs.checked }}
|
||||
<inner />
|
||||
</div>
|
||||
|
||||
<!-- <inner as="p" :class="random" foo="bar" /> -->
|
||||
<!-- <component :is="inner" as="p" /> -->
|
||||
</template>
|
||||
|
||||
@@ -19,19 +30,44 @@ export default {
|
||||
required: true,
|
||||
},
|
||||
|
||||
node: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
|
||||
inner: {
|
||||
type: [Object, Function],
|
||||
required: true,
|
||||
},
|
||||
|
||||
updateAttrs: {
|
||||
type: Function,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
|
||||
data() {
|
||||
return {
|
||||
foo: 'foo',
|
||||
random: 'foo',
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
toggleChecked() {
|
||||
this.editor.commands.focus()
|
||||
this.updateAttrs({
|
||||
checked: !this.node.attrs.checked,
|
||||
})
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
// console.log(this.node)
|
||||
|
||||
console.log('mounted')
|
||||
// setInterval(() => {
|
||||
// this.random = `foo${Math.random()}`
|
||||
// }, 1000)
|
||||
// console.log(this)
|
||||
},
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Node } from '@tiptap/core'
|
||||
import { Node, mergeAttributes } from '@tiptap/core'
|
||||
import { VueRenderer } from '@tiptap/vue'
|
||||
import Component from './Component.vue'
|
||||
|
||||
@@ -13,6 +13,16 @@ export default Node.create({
|
||||
|
||||
selectable: false,
|
||||
|
||||
// atom: true,
|
||||
|
||||
addAttributes() {
|
||||
return {
|
||||
checked: {
|
||||
default: false,
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
parseHTML() {
|
||||
return [
|
||||
{
|
||||
@@ -21,8 +31,8 @@ export default Node.create({
|
||||
]
|
||||
},
|
||||
|
||||
renderHTML() {
|
||||
return ['div', { 'data-type': 'test' }, 0]
|
||||
renderHTML({ HTMLAttributes }) {
|
||||
return ['div', mergeAttributes(HTMLAttributes, { 'data-type': 'test' }), 0]
|
||||
},
|
||||
|
||||
addNodeView() {
|
||||
|
||||
Reference in New Issue
Block a user