Skip to content

Commit

Permalink
Fix : React DND broken when used within a NodeViewWrapper (#5023)
Browse files Browse the repository at this point in the history
* Fix : React DND broken when used within a NodeViewWrapper

* added changeset

---------

Co-authored-by: Tejendra Singh <[email protected]>
Co-authored-by: Dominik Biedebach <[email protected]>
  • Loading branch information
3 people authored Dec 2, 2024
1 parent 722ec00 commit b7ef150
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-shrimps-speak.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tiptap/core": patch
---

Fixed an issue with nodeviews preventing any drag events in child nodes of the nodeview wrapper element
4 changes: 2 additions & 2 deletions packages/core/src/NodeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ export class NodeView<
// ProseMirror tries to drag selectable nodes
// even if `draggable` is set to `false`
// this fix prevents that
if (!isDraggable && isSelectable && isDragEvent) {
if (!isDraggable && isSelectable && isDragEvent && event.target === this.dom) {
event.preventDefault()
}

if (isDraggable && isDragEvent && !isDragging) {
if (isDraggable && isDragEvent && !isDragging && event.target === this.dom) {
event.preventDefault()
return false
}
Expand Down

0 comments on commit b7ef150

Please sign in to comment.