Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkuehn committed Jun 14, 2021
1 parent fbc8fff commit f7890c0
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions packages/core/src/NodeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,16 @@ export class NodeView<Component, Editor extends CoreEditor = CoreEditor> 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()

tr.setNodeMarkup(pos, undefined, {
...this.node.attrs,
...attributes,
})

this.editor.view.dispatch(transaction)
return true
})
}

deleteNode(): void {
Expand Down

0 comments on commit f7890c0

Please sign in to comment.