@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.cjs CHANGED
@@ -16920,6 +16920,10 @@ function getIframeVisibleClip(parentScroll) {
16920
16920
  );
16921
16921
  return { top: clipTop, bottom: Math.max(clipTop, clipBottom) };
16922
16922
  }
16923
+ function isRectOutsideClip(rect, clip) {
16924
+ if (!clip) return false;
16925
+ return rect.bottom < clip.top || rect.top > clip.bottom;
16926
+ }
16923
16927
  function applyVisibleViewport(el, parentScroll) {
16924
16928
  const clip = getIframeVisibleClip(parentScroll);
16925
16929
  const top = clip?.top ?? 0;
@@ -22268,14 +22272,20 @@ function OhhwellsBridge() {
22268
22272
  };
22269
22273
  const applyToolbarPos = (rect) => {
22270
22274
  const ps = parentScrollRef.current;
22275
+ const hidden = isRectOutsideClip(rect, getIframeVisibleClip(ps));
22271
22276
  const measuredW = toolbarElRef.current?.offsetWidth || 330;
22272
22277
  if (toolbarElRef.current) {
22273
- const { top, left, transform } = calcToolbarPos(rect, ps, measuredW);
22274
- toolbarElRef.current.style.top = `${top}px`;
22275
- toolbarElRef.current.style.left = `${left}px`;
22276
- toolbarElRef.current.style.transform = transform;
22278
+ toolbarElRef.current.style.display = hidden ? "none" : "";
22279
+ if (!hidden) {
22280
+ const { top, left, transform } = calcToolbarPos(rect, ps, measuredW);
22281
+ toolbarElRef.current.style.top = `${top}px`;
22282
+ toolbarElRef.current.style.left = `${left}px`;
22283
+ toolbarElRef.current.style.transform = transform;
22284
+ }
22277
22285
  }
22278
22286
  if (glowElRef.current) {
22287
+ glowElRef.current.style.display = hidden ? "none" : "";
22288
+ if (hidden) return;
22279
22289
  const GAP = SELECTION_CHROME_GAP2;
22280
22290
  glowElRef.current.style.top = `${rect.top - GAP}px`;
22281
22291
  glowElRef.current.style.left = `${rect.left - GAP}px`;
@@ -22717,7 +22727,7 @@ function OhhwellsBridge() {
22717
22727
  postToParent2({
22718
22728
  type: "ow:ready",
22719
22729
  version: "1",
22720
- bridgeVersion: "0.1.108",
22730
+ bridgeVersion: "0.1.109",
22721
22731
  path: pathname,
22722
22732
  nodes: collectEditableNodes(editContentRef.current),
22723
22733
  sections
@@ -23505,7 +23515,7 @@ function OhhwellsBridge() {
23505
23515
  ) : void 0
23506
23516
  }
23507
23517
  ),
23508
- toolbarRect && toolbarVariant === "rich-text" && !linkPopover && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
23518
+ toolbarRect && toolbarVariant === "rich-text" && !linkPopover && !isRectOutsideClip(toolbarRect, getIframeVisibleClip(parentScrollRef.current)) && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [
23509
23519
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
23510
23520
  EditGlowChrome,
23511
23521
  {