refactoring
This commit is contained in:
@@ -135,16 +135,7 @@ class VueNodeView implements NodeView {
|
|||||||
const NodeViewWrapper = this.createNodeViewWrapper()
|
const NodeViewWrapper = this.createNodeViewWrapper()
|
||||||
const NodeViewContent = this.createNodeViewContent()
|
const NodeViewContent = this.createNodeViewContent()
|
||||||
|
|
||||||
const Component = Vue
|
const props = {
|
||||||
.extend(component)
|
|
||||||
.extend({
|
|
||||||
components: {
|
|
||||||
NodeViewWrapper,
|
|
||||||
NodeViewContent,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
const propsData = {
|
|
||||||
NodeViewWrapper,
|
NodeViewWrapper,
|
||||||
NodeViewContent,
|
NodeViewContent,
|
||||||
editor: this.editor,
|
editor: this.editor,
|
||||||
@@ -156,13 +147,23 @@ class VueNodeView implements NodeView {
|
|||||||
updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
|
updateAttributes: (attributes = {}) => this.updateAttributes(attributes),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const Component = Vue
|
||||||
|
.extend(component)
|
||||||
|
.extend({
|
||||||
|
props: Object.keys(props),
|
||||||
|
components: {
|
||||||
|
NodeViewWrapper,
|
||||||
|
NodeViewContent,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
const parent = this.editor.view.dom.parentElement
|
const parent = this.editor.view.dom.parentElement
|
||||||
? getComponentFromElement(this.editor.view.dom.parentElement)
|
? getComponentFromElement(this.editor.view.dom.parentElement)
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
this.renderer = new VueRenderer(Component, {
|
this.renderer = new VueRenderer(Component, {
|
||||||
parent,
|
parent,
|
||||||
propsData,
|
propsData: props,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user