From 6bafc182156f52f6463cdce29b218f53df507297 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Mon, 1 Mar 2021 08:44:01 +0100 Subject: [PATCH] refactoring --- packages/vue-2/src/VueNodeViewRenderer.ts | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/packages/vue-2/src/VueNodeViewRenderer.ts b/packages/vue-2/src/VueNodeViewRenderer.ts index 386cf814..1311a474 100644 --- a/packages/vue-2/src/VueNodeViewRenderer.ts +++ b/packages/vue-2/src/VueNodeViewRenderer.ts @@ -135,16 +135,7 @@ class VueNodeView implements NodeView { const NodeViewWrapper = this.createNodeViewWrapper() const NodeViewContent = this.createNodeViewContent() - const Component = Vue - .extend(component) - .extend({ - components: { - NodeViewWrapper, - NodeViewContent, - }, - }) - - const propsData = { + const props = { NodeViewWrapper, NodeViewContent, editor: this.editor, @@ -156,13 +147,23 @@ class VueNodeView implements NodeView { 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 ? getComponentFromElement(this.editor.view.dom.parentElement) : undefined this.renderer = new VueRenderer(Component, { parent, - propsData, + propsData: props, }) }