feat: enhance dragstart interception with native DnD disable check via URL param
This commit is contained in:
parent
4b252da572
commit
f7111896b5
1 changed files with 6 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue