@innovastudio/contentbuilder 1.5.117 → 1.5.118

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.5.117",
4
+ "version": "1.5.118",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "types": "index.d.ts",
@@ -45527,14 +45527,24 @@ class DragDropImageUploader {
45527
45527
  this.isAttached = false;
45528
45528
  }
45529
45529
  _getImageUnderCursor(e) {
45530
+ const x = e.clientX;
45531
+ const y = e.clientY;
45530
45532
  const doc = this.element.ownerDocument || document;
45531
- const range = doc.caretRangeFromPoint ? doc.caretRangeFromPoint(e.clientX, e.clientY) : doc.caretPositionFromPoint(e.clientX, e.clientY);
45532
- if (!range) return null;
45533
- const node = range.startContainer.nodeType === 1 ? range.startContainer : range.startContainer.parentElement;
45534
45533
  if (this.element.getAttribute('id') === 'divImageResizer') {
45535
45534
  return this.builder.activeImage;
45536
45535
  }
45537
- return node.tagName === 'IMG' ? node : node.querySelector && node.querySelector('img');
45536
+
45537
+ // Use elementFromPoint for reliability across browsers
45538
+ const elementAtPoint = doc.elementFromPoint(x, y);
45539
+ if (!elementAtPoint) return null;
45540
+
45541
+ // If the element itself is an image, return it
45542
+ if (elementAtPoint.tagName === 'IMG') {
45543
+ return elementAtPoint;
45544
+ }
45545
+
45546
+ // Otherwise, check if it contains an image (e.g., inside a div, anchor, etc.)
45547
+ return elementAtPoint.querySelector && elementAtPoint.querySelector('img');
45538
45548
  }
45539
45549
  async _onDrop(e) {
45540
45550
  e.preventDefault();