mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-04 19:59:02 +08:00
add parent to nodeviews
This commit is contained in:
parent
21ed0761e7
commit
77e30cad4a
@ -219,6 +219,7 @@ export default {
|
||||
state: this.state,
|
||||
dispatchTransaction: this.dispatchTransaction,
|
||||
nodeViews: initNodeViews({
|
||||
parent: this,
|
||||
nodes: this.views,
|
||||
editable: this.editable,
|
||||
}),
|
||||
|
@ -2,12 +2,14 @@ import Vue from 'vue'
|
||||
|
||||
export default class ComponentView {
|
||||
constructor(component, {
|
||||
parent,
|
||||
node,
|
||||
view,
|
||||
getPos,
|
||||
decorations,
|
||||
editable,
|
||||
}) {
|
||||
this.parent = parent
|
||||
this.component = component
|
||||
this.node = node
|
||||
this.view = view
|
||||
@ -22,6 +24,7 @@ export default class ComponentView {
|
||||
createDOM() {
|
||||
const Component = Vue.extend(this.component)
|
||||
this.vm = new Component({
|
||||
parent: this.parent,
|
||||
propsData: {
|
||||
node: this.node,
|
||||
view: this.view,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import ComponentView from './ComponentView'
|
||||
|
||||
export default function initNodeViews({ nodes, editable }) {
|
||||
export default function initNodeViews({ parent, nodes, editable }) {
|
||||
const nodeViews = {}
|
||||
|
||||
Object.keys(nodes).forEach(nodeName => {
|
||||
@ -8,6 +8,7 @@ export default function initNodeViews({ nodes, editable }) {
|
||||
const component = nodes[nodeName]
|
||||
|
||||
return new ComponentView(component, {
|
||||
parent,
|
||||
node,
|
||||
view,
|
||||
getPos,
|
||||
|
Loading…
Reference in New Issue
Block a user