sceyt-chat-react-uikit 1.8.6-beta.5 → 1.8.6-beta.6

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/index.js CHANGED
@@ -47519,12 +47519,16 @@ function setFloatingElemPosition(targetRect, floatingElem, anchorElem, verticalG
47519
47519
  }
47520
47520
  var floatingElemRect = floatingElem.getBoundingClientRect();
47521
47521
  var anchorElementRect = anchorElem.getBoundingClientRect();
47522
- var top = floatingElemRect.height - targetRect.height + verticalGap;
47523
47522
  var menuWidthHalf = floatingElemRect.width / 2;
47524
47523
  var selectionWidthHalf = targetRect.width / 2;
47525
47524
  var left = targetRect.left - anchorElementRect.left + horizontalOffset - menuWidthHalf + selectionWidthHalf;
47525
+ var effectiveTop = Math.max(targetRect.top, anchorElementRect.top);
47526
+ var top = effectiveTop - anchorElementRect.top - floatingElemRect.height - verticalGap;
47527
+ if (effectiveTop - floatingElemRect.height - verticalGap < 0) {
47528
+ top = Math.min(targetRect.bottom, anchorElementRect.bottom) - anchorElementRect.top + verticalGap;
47529
+ }
47526
47530
  floatingElem.style.opacity = '1';
47527
- floatingElem.style.transform = "translate(" + left + "px, " + -top + "px)";
47531
+ floatingElem.style.transform = "translate(" + left + "px, " + top + "px)";
47528
47532
  }
47529
47533
  function getSelectedNode(selection) {
47530
47534
  var anchor = selection.anchor;
package/index.modern.js CHANGED
@@ -47518,12 +47518,16 @@ function setFloatingElemPosition(targetRect, floatingElem, anchorElem, verticalG
47518
47518
  }
47519
47519
  var floatingElemRect = floatingElem.getBoundingClientRect();
47520
47520
  var anchorElementRect = anchorElem.getBoundingClientRect();
47521
- var top = floatingElemRect.height - targetRect.height + verticalGap;
47522
47521
  var menuWidthHalf = floatingElemRect.width / 2;
47523
47522
  var selectionWidthHalf = targetRect.width / 2;
47524
47523
  var left = targetRect.left - anchorElementRect.left + horizontalOffset - menuWidthHalf + selectionWidthHalf;
47524
+ var effectiveTop = Math.max(targetRect.top, anchorElementRect.top);
47525
+ var top = effectiveTop - anchorElementRect.top - floatingElemRect.height - verticalGap;
47526
+ if (effectiveTop - floatingElemRect.height - verticalGap < 0) {
47527
+ top = Math.min(targetRect.bottom, anchorElementRect.bottom) - anchorElementRect.top + verticalGap;
47528
+ }
47525
47529
  floatingElem.style.opacity = '1';
47526
- floatingElem.style.transform = "translate(" + left + "px, " + -top + "px)";
47530
+ floatingElem.style.transform = "translate(" + left + "px, " + top + "px)";
47527
47531
  }
47528
47532
  function getSelectedNode(selection) {
47529
47533
  var anchor = selection.anchor;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sceyt-chat-react-uikit",
3
- "version": "1.8.6-beta.5",
3
+ "version": "1.8.6-beta.6",
4
4
  "description": "Interactive React UI Components for Sceyt Chat.",
5
5
  "author": "Sceyt",
6
6
  "license": "MIT",