@ohhwells/bridge 0.1.109 → 0.1.110

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/dist/index.js CHANGED
@@ -16853,6 +16853,10 @@ function getIframeVisibleClip(parentScroll) {
16853
16853
  );
16854
16854
  return { top: clipTop, bottom: Math.max(clipTop, clipBottom) };
16855
16855
  }
16856
+ function isRectOutsideClip(rect, clip) {
16857
+ if (!clip) return false;
16858
+ return rect.bottom < clip.top || rect.top > clip.bottom;
16859
+ }
16856
16860
  function applyVisibleViewport(el, parentScroll) {
16857
16861
  const clip = getIframeVisibleClip(parentScroll);
16858
16862
  const top = clip?.top ?? 0;
@@ -22201,14 +22205,20 @@ function OhhwellsBridge() {
22201
22205
  };
22202
22206
  const applyToolbarPos = (rect) => {
22203
22207
  const ps = parentScrollRef.current;
22208
+ const hidden = isRectOutsideClip(rect, getIframeVisibleClip(ps));
22204
22209
  const measuredW = toolbarElRef.current?.offsetWidth || 330;
22205
22210
  if (toolbarElRef.current) {
22206
- const { top, left, transform } = calcToolbarPos(rect, ps, measuredW);
22207
- toolbarElRef.current.style.top = `${top}px`;
22208
- toolbarElRef.current.style.left = `${left}px`;
22209
- toolbarElRef.current.style.transform = transform;
22211
+ toolbarElRef.current.style.display = hidden ? "none" : "";
22212
+ if (!hidden) {
22213
+ const { top, left, transform } = calcToolbarPos(rect, ps, measuredW);
22214
+ toolbarElRef.current.style.top = `${top}px`;
22215
+ toolbarElRef.current.style.left = `${left}px`;
22216
+ toolbarElRef.current.style.transform = transform;
22217
+ }
22210
22218
  }
22211
22219
  if (glowElRef.current) {
22220
+ glowElRef.current.style.display = hidden ? "none" : "";
22221
+ if (hidden) return;
22212
22222
  const GAP = SELECTION_CHROME_GAP2;
22213
22223
  glowElRef.current.style.top = `${rect.top - GAP}px`;
22214
22224
  glowElRef.current.style.left = `${rect.left - GAP}px`;
@@ -22650,7 +22660,7 @@ function OhhwellsBridge() {
22650
22660
  postToParent2({
22651
22661
  type: "ow:ready",
22652
22662
  version: "1",
22653
- bridgeVersion: "0.1.108",
22663
+ bridgeVersion: "0.1.109",
22654
22664
  path: pathname,
22655
22665
  nodes: collectEditableNodes(editContentRef.current),
22656
22666
  sections
@@ -23438,7 +23448,7 @@ function OhhwellsBridge() {
23438
23448
  ) : void 0
23439
23449
  }
23440
23450
  ),
23441
- toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ jsxs20(Fragment8, { children: [
23451
+ toolbarRect && toolbarVariant === "rich-text" && !linkPopover && !isRectOutsideClip(toolbarRect, getIframeVisibleClip(parentScrollRef.current)) && /* @__PURE__ */ jsxs20(Fragment8, { children: [
23442
23452
  /* @__PURE__ */ jsx33(
23443
23453
  EditGlowChrome,
23444
23454
  {