MCPcopy Create free account
hub / github.com/PaulleDemon/PyUIBuilder / handleDropEvent

Function handleDropEvent

src/components/draggable/droppable.js:80–106  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

78 }
79
80 const handleDropEvent = (e) => {
81
82 setShowDroppable({
83 allow: false,
84 show: false
85 })
86
87 if (!draggedElement || !draggedElement.getAttribute("data-drag-start-within")){
88 // if the drag is starting from outside (eg: file drop) or if drag doesn't exist
89 return
90 }
91
92 e.stopPropagation()
93
94
95 const dragElementType = draggedElement.getAttribute("data-draggable-type")
96
97
98 const allowDrop = (droppableTags && droppableTags !== null && (Object.keys(droppableTags).length === 0 ||
99 (droppableTags.include?.length > 0 && droppableTags.include?.includes(dragElementType)) ||
100 (droppableTags.exclude?.length > 0 && !droppableTags.exclude?.includes(dragElementType))
101 ))
102
103 if(onDrop && allowDrop){
104 onDrop(e, draggedElement, widgetClass, posMetaData)
105 }
106 }
107
108
109 const handleDragLeave = (e) => {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected