feat: Enhance drag interception with dynamic URL pattern matching configuration injection
This commit is contained in:
parent
f385ee6410
commit
0eba82b8af
2 changed files with 62 additions and 9 deletions
|
|
@ -88,7 +88,7 @@
|
|||
for (var i = 0; i < angularDragHandlers.length; i++) {
|
||||
var h = angularDragHandlers[i];
|
||||
if (h.target === document || h.target === e.target ||
|
||||
(h.target.contains && h.target.contains(e.target))) {https://devagravitystg.file.core.windows.net/devagravitysync/anPGZszKzgKaSz1SIx2HFgduy/weiss_ORIGINAL.jpg
|
||||
(h.target.contains && h.target.contains(e.target))) {
|
||||
try {
|
||||
h.listener.call(e.target, e);
|
||||
handled++;
|
||||
|
|
@ -102,10 +102,27 @@
|
|||
|
||||
// NOW check if we should intercept
|
||||
if (e.altKey && currentDragUrl) {
|
||||
var isAzure = /^https?:\/\/.+\.file\.core\.windows\.net\//i.test(currentDragUrl);
|
||||
var isZDrive = /^z:/i.test(currentDragUrl);
|
||||
var shouldIntercept = false;
|
||||
|
||||
if (isAzure || isZDrive) {
|
||||
// Check against configured URL mappings
|
||||
if (window.webdropConfig && window.webdropConfig.urlMappings) {
|
||||
for (var j = 0; j < window.webdropConfig.urlMappings.length; j++) {
|
||||
var mapping = window.webdropConfig.urlMappings[j];
|
||||
if (currentDragUrl.toLowerCase().startsWith(mapping.url_prefix.toLowerCase())) {
|
||||
shouldIntercept = true;
|
||||
console.log('[Intercept] URL matches mapping for:', mapping.local_path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Fallback: Check for legacy Z: drive pattern if no config available
|
||||
shouldIntercept = /^z:/i.test(currentDragUrl);
|
||||
if (shouldIntercept) {
|
||||
console.warn('[Intercept] Using fallback Z: drive pattern (no URL mappings configured)');
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldIntercept) {
|
||||
console.log('%c[Intercept] PREVENTING browser drag, using Qt',
|
||||
'background: #F44336; color: white; font-weight: bold; padding: 4px 8px;');
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue