fix(#4757): defer window-drop cleanup a tick so target ondrop runs first (gate finding)

Codex re-gate: the capture-phase window 'drop' listener fired BEFORE the target
el.ondrop, clearing _wsActiveDragPath before _isWorkspaceTreeMoveDrag/_wsDragSrcPath
ran — re-breaking the macOS stripped-MIME move it set out to fix. setTimeout(_clearWsDragData,0)
lets the real drop handler complete, then clears the lingering flag.

Co-authored-by: Rod Boev <rod.boev@gmail.com>
This commit is contained in:
nesquena-hermesandRod Boev committed 2026-06-24 19:13:59 +00:00
1 parent 63e3f91654
commit c21d30e02b
1 file changed
+6 -1
+6 -1
View File
@@ -14783,7 +14783,12 @@ function _clearWsDragData(){
if(typeof window!=='undefined'&&!window._wsDragCleanupBound){
window._wsDragCleanupBound=true;
window.addEventListener('dragend',_clearWsDragData,true);
window.addEventListener('drop',_clearWsDragData,true);
// Defer the drop cleanup a tick: this capture-phase window listener fires
// BEFORE the target element's ondrop, so clearing synchronously here would
// wipe _wsActiveDragPath before _isWorkspaceTreeMoveDrag()/_wsDragSrcPath()
// run in the target handler — re-breaking the macOS stripped-MIME move. The
// setTimeout lets the real drop handler complete, then clears the lingering flag.
window.addEventListener('drop',()=>setTimeout(_clearWsDragData,0),true);
window.addEventListener('pagehide',_clearWsDragData);
window.addEventListener('blur',_clearWsDragData);
}