fix: Incorrect reuse of NodeViews with drag and drop (#11208)

closes #11199
This commit is contained in:
Tom Moor authored and GitHub committed 2026-01-17 16:31:36 -05:00
1 parent 8b18d5e93f
commit cc14f18fd2
1 file changed
+14 -1
+14 -1
View File
@@ -84,6 +84,15 @@ export default class ComponentView {
return false;
}
// Ensure we don't reuse NodeViews for different nodes that have a distinct identity
// This prevents attribute swapping during drag operations.
if (
this.node.attrs.id !== undefined &&
node.attrs.id !== this.node.attrs.id
) {
return false;
}
this.node = node;
this.decorations = decorations;
this.applyDecorationClasses();
@@ -137,7 +146,11 @@ export default class ComponentView {
}
stopEvent(event: Event) {
return event.type !== "mousedown" && !event.type.startsWith("drag");
return (
event.type !== "mousedown" &&
!event.type.startsWith("drag") &&
!event.type.startsWith("drop")
);
}
destroy() {