Fix : React DND broken when used within a NodeViewWrapper (#5023)

* Fix : React DND broken when used within a NodeViewWrapper

* added changeset

---------

Co-authored-by: Tejendra Singh <tejendrasingh@Tejendras-MacBook-Pro.local>
Co-authored-by: Dominik Biedebach <dominik.biedebach@tiptap.dev>
This commit is contained in:
Tejendra Singh 2024-12-02 15:09:05 +05:30 committed by GitHub
parent 722ec00fb2
commit b7ef150d33
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"@tiptap/core": patch
---
Fixed an issue with nodeviews preventing any drag events in child nodes of the nodeview wrapper element

View File

@ -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
}