feat: Improve dragstart handler installation with retry logic for Angular handlers

This commit is contained in:
claudi 2026-02-18 08:06:11 +01:00
parent e91a2445f3
commit c32453018b

View file

@ -65,9 +65,15 @@
// PART 3: Install OUR dragstart handler in capture phase
// ============================================================================
setTimeout(function() {
function installDragHandler() {
console.log('[Intercept] Installing dragstart handler, have', angularDragHandlers.length, 'Angular handlers');
if (angularDragHandlers.length === 0) {
console.warn('[Intercept] No Angular handlers found yet, will retry in 1s...');
setTimeout(installDragHandler, 1000);
return;
}
// Stop intercepting addEventListener
listenerPatchActive = false;
@ -124,7 +130,11 @@
}, true); // Capture phase
console.log('[Intercept] dragstart handler installed ✓');
}, 1500); // Wait for Angular to register its listeners
}
// Wait for Angular to register its listeners, then install our handler
// Start checking after 2 seconds (give Angular time to load on first page load)
setTimeout(installDragHandler, 2000);
// ============================================================================
// PART 3: QWebChannel connection