(e)
| 116 | } |
| 117 | |
| 118 | const handleDropEvent = (e) => { |
| 119 | e.preventDefault() |
| 120 | e.stopPropagation() |
| 121 | console.log("Dropped: ", draggedElement, props.children) |
| 122 | |
| 123 | setShowDroppable({ |
| 124 | allow: false, |
| 125 | show: false |
| 126 | }) |
| 127 | |
| 128 | if (onDrop) { |
| 129 | onDrop(e, draggedElement) |
| 130 | } |
| 131 | |
| 132 | // if (draggedElement === widgetRef.current){ |
| 133 | // // prevent drop on itself, since the widget is invisible when dragging, if dropped on itself, it may consume itself |
| 134 | // return |
| 135 | // } |
| 136 | |
| 137 | let currentElement = e.currentTarget |
| 138 | while (currentElement) { |
| 139 | if (currentElement === draggedElement) { |
| 140 | console.log("Dropped into a descendant element, ignoring drop") |
| 141 | return // Exit early to prevent the drop |
| 142 | } |
| 143 | currentElement = currentElement.parentElement // Traverse up to check ancestors |
| 144 | } |
| 145 | |
| 146 | } |
| 147 | |
| 148 | |
| 149 | const handleDragLeave = (e) => { |
nothing calls this directly
no outgoing calls
no test coverage detected