Skip to content

Commit e23882d

Browse files
JinForYodabdbch
andcommittedMar 30, 2025·
fix: clone node before dragging for better dispaly (#6174)
* fix: clone node before dragging for better dispaly * Create shiny-days-rhyme.md --------- Co-authored-by: bdbch <6538827+bdbch@users.noreply.github.com>

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed
 

‎.changeset/shiny-days-rhyme.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@tiptap/core": patch
3+
---
4+
5+
Clone dragged node before dragging to get correct drag preview image

‎packages/core/src/NodeView.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ export class NodeView<
9898
y = handleBox.y - domBox.y + offsetY
9999
}
100100

101-
event.dataTransfer?.setDragImage(this.dom, x, y)
101+
const clonedNode = this.dom.cloneNode(true) as HTMLElement
102+
103+
event.dataTransfer?.setDragImage(clonedNode, x, y)
102104

103105
const pos = this.getPos()
104106

0 commit comments

Comments
 (0)
Please sign in to comment.