Skip to content

Commit

Permalink
fix(react): reorder handleSelectionUpdate callback (#5982)
Browse files Browse the repository at this point in the history
  • Loading branch information
rushillshah authored Jan 3, 2025
1 parent 5370cbe commit dac7fd2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/early-parrots-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tiptap/react": patch
---

Resolves #5870 by re-ordering executation of selectionUpdate handler
2 changes: 1 addition & 1 deletion packages/react/src/ReactNodeViewRenderer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ export class ReactNodeView<
const { className = '' } = this.options

this.handleSelectionUpdate = this.handleSelectionUpdate.bind(this)
this.editor.on('selectionUpdate', this.handleSelectionUpdate)

this.renderer = new ReactRenderer(ReactNodeViewProvider, {
editor: this.editor,
Expand All @@ -150,6 +149,7 @@ export class ReactNodeView<
className: `node-${this.node.type.name} ${className}`.trim(),
})

this.editor.on('selectionUpdate', this.handleSelectionUpdate)
this.updateElementAttributes()
}

Expand Down

0 comments on commit dac7fd2

Please sign in to comment.