@parhelia/core 0.1.12285 → 0.1.12287

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3251,10 +3251,19 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
3251
3251
  }
3252
3252
  return null;
3253
3253
  };
3254
+ let modifierWasPressedOnMouseDown = false;
3255
+ const handleMouseDown = (event) => {
3256
+ modifierWasPressedOnMouseDown = event.ctrlKey || event.metaKey;
3257
+ };
3254
3258
  const handleCtrlClick = async (event) => {
3255
- // Only proceed if Ctrl (or Cmd on Mac) is pressed
3259
+ // Only proceed if Ctrl/Cmd was already pressed when the mouse interaction started.
3260
+ // This avoids accidental navigation when users press Ctrl after selecting text to copy.
3261
+ if (!modifierWasPressedOnMouseDown)
3262
+ return;
3263
+ // Also require the modifier to still be held for the final click event.
3256
3264
  if (!event.ctrlKey && !event.metaKey)
3257
3265
  return;
3266
+ modifierWasPressedOnMouseDown = false;
3258
3267
  const target = event.target;
3259
3268
  const text = getTextFromElement(target);
3260
3269
  if (text && isGuid(text)) {
@@ -3296,8 +3305,10 @@ export function EditorShell({ configuration, className, item: loadItemDescriptor
3296
3305
  }
3297
3306
  };
3298
3307
  if (typeof document !== "undefined") {
3308
+ document.addEventListener("mousedown", handleMouseDown, true);
3299
3309
  document.addEventListener("click", handleCtrlClick, true);
3300
3310
  return () => {
3311
+ document.removeEventListener("mousedown", handleMouseDown, true);
3301
3312
  document.removeEventListener("click", handleCtrlClick, true);
3302
3313
  };
3303
3314
  }