From f7890c0b42318482501d4e1b1975cfac40dfb063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Mon, 14 Jun 2021 15:35:43 +0200 Subject: [PATCH] refactoring --- packages/core/src/NodeView.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/core/src/NodeView.ts b/packages/core/src/NodeView.ts index 079c777e..b681faf3 100644 --- a/packages/core/src/NodeView.ts +++ b/packages/core/src/NodeView.ts @@ -224,14 +224,16 @@ export class NodeView impleme } updateAttributes(attributes: {}) { - const { state } = this.editor.view - const pos = this.getPos() - const transaction = state.tr.setNodeMarkup(pos, undefined, { - ...this.node.attrs, - ...attributes, - }) + this.editor.commands.command(({ tr }) => { + const pos = this.getPos() - this.editor.view.dispatch(transaction) + tr.setNodeMarkup(pos, undefined, { + ...this.node.attrs, + ...attributes, + }) + + return true + }) } deleteNode(): void {