fix: simplify drag interception logic by removing native DnD check and updating console messages
This commit is contained in:
parent
705969cdba
commit
ced50dd1f6
1 changed files with 3 additions and 7 deletions
|
|
@ -82,10 +82,6 @@
|
||||||
originalAddEventListener.call(document, 'dragstart', function(e) {
|
originalAddEventListener.call(document, 'dragstart', function(e) {
|
||||||
currentDragUrl = null; // Reset
|
currentDragUrl = null; // Reset
|
||||||
|
|
||||||
// Check once per drag if native DnD is disabled via URL param (e.g. ?disablednd=true)
|
|
||||||
var disabledNativeDnD = /[?&]disablednd=true/i.test(window.location.search);
|
|
||||||
console.log('%c[Intercept] dragstart', 'background: #FF9800; color: white; padding: 2px 6px;', 'ALT:', e.altKey, '| disablednd:', disabledNativeDnD);
|
|
||||||
|
|
||||||
// Call Angular's handlers first to let them set the data
|
// Call Angular's handlers first to let them set the data
|
||||||
var handled = 0;
|
var handled = 0;
|
||||||
for (var i = 0; i < angularDragHandlers.length; i++) {
|
for (var i = 0; i < angularDragHandlers.length; i++) {
|
||||||
|
|
@ -104,8 +100,8 @@
|
||||||
console.log('[Intercept] Called', handled, 'Angular handlers, URL:', currentDragUrl ? currentDragUrl.substring(0, 60) : 'none');
|
console.log('[Intercept] Called', handled, 'Angular handlers, URL:', currentDragUrl ? currentDragUrl.substring(0, 60) : 'none');
|
||||||
|
|
||||||
// NOW check if we should intercept
|
// NOW check if we should intercept
|
||||||
// Intercept when: Alt key held (normal mode) OR native DnD disabled via URL param
|
// Intercept any drag with a URL that matches our configured mappings
|
||||||
if ((e.altKey || disabledNativeDnD) && currentDragUrl) {
|
if (currentDragUrl) {
|
||||||
var shouldIntercept = false;
|
var shouldIntercept = false;
|
||||||
|
|
||||||
// Check against configured URL mappings
|
// Check against configured URL mappings
|
||||||
|
|
@ -191,7 +187,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('%c[WebDrop Intercept] Ready! ALT-drag or ?disablednd=true will use Qt file drag.',
|
console.log('%c[WebDrop Intercept] Ready! URL-mapped drags will use Qt file drag.',
|
||||||
'background: #4CAF50; color: white; font-weight: bold; padding: 4px 8px;');
|
'background: #4CAF50; color: white; font-weight: bold; padding: 4px 8px;');
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error('[WebDrop Intercept] FATAL ERROR in bridge script:', e);
|
console.error('[WebDrop Intercept] FATAL ERROR in bridge script:', e);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue