From f7111896b50e05fe6b56167085c1e5b87afb2a30 Mon Sep 17 00:00:00 2001 From: claudi Date: Wed, 25 Feb 2026 15:45:26 +0100 Subject: [PATCH] feat: enhance dragstart interception with native DnD disable check via URL param --- src/webdrop_bridge/ui/bridge_script_intercept.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/webdrop_bridge/ui/bridge_script_intercept.js b/src/webdrop_bridge/ui/bridge_script_intercept.js index b3c2f52..e600d0d 100644 --- a/src/webdrop_bridge/ui/bridge_script_intercept.js +++ b/src/webdrop_bridge/ui/bridge_script_intercept.js @@ -82,7 +82,9 @@ originalAddEventListener.call(document, 'dragstart', function(e) { currentDragUrl = null; // Reset - console.log('%c[Intercept] dragstart', 'background: #FF9800; color: white; padding: 2px 6px;', 'ALT:', e.altKey); + // 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 var handled = 0; @@ -102,7 +104,8 @@ console.log('[Intercept] Called', handled, 'Angular handlers, URL:', currentDragUrl ? currentDragUrl.substring(0, 60) : 'none'); // NOW check if we should intercept - if (e.altKey && currentDragUrl) { + // Intercept when: Alt key held (normal mode) OR native DnD disabled via URL param + if ((e.altKey || disabledNativeDnD) && currentDragUrl) { var shouldIntercept = false; // Check against configured URL mappings @@ -188,7 +191,7 @@ }); } - console.log('%c[WebDrop Intercept] Ready! ALT-drag will use Qt file drag.', + console.log('%c[WebDrop Intercept] Ready! ALT-drag or ?disablednd=true will use Qt file drag.', 'background: #4CAF50; color: white; font-weight: bold; padding: 4px 8px;'); } catch(e) { console.error('[WebDrop Intercept] FATAL ERROR in bridge script:', e);