@ohhwells/bridge 0.1.57 → 0.1.59

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
@@ -7108,7 +7108,14 @@ function findClosestButtonLike(target) {
7108
7108
  function findButtonAtPoint(x, y, media) {
7109
7109
  const hits = Array.from(
7110
7110
  document.querySelectorAll(BUTTON_LIKE_SELECTOR)
7111
- ).filter((el) => containsPoint(el, x, y) && !(media && el.contains(media)));
7111
+ ).filter(
7112
+ (el) => containsPoint(el, x, y) && !(media && el.contains(media)) && // Bridge-injected chrome (e.g. MediaOverlay's own "Replace image" button) is never a
7113
+ // site button. Without this, once the media overlay renders its button lands right
7114
+ // under the cursor, gets detected as "a button on the media", and dismisses the very
7115
+ // overlay it belongs to — which removes the button, so the next hit-test finds nothing
7116
+ // and the overlay reappears. Flip-flops every tick: the "Replace image" button flashes.
7117
+ !el.closest("[data-ohw-bridge]")
7118
+ );
7112
7119
  if (hits.length === 0) return null;
7113
7120
  return hits.reduce((best, el) => best.contains(el) ? el : best);
7114
7121
  }
@@ -13623,6 +13630,8 @@ function OhhwellsBridge() {
13623
13630
  const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react16.useState)(false);
13624
13631
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
13625
13632
  const [floatingPanel, setFloatingPanel] = (0, import_react16.useState)(null);
13633
+ const floatingPanelOpenRef = (0, import_react16.useRef)(false);
13634
+ floatingPanelOpenRef.current = floatingPanel !== null;
13626
13635
  const [floatingPanelPos, setFloatingPanelPos] = (0, import_react16.useState)(null);
13627
13636
  const [parentScrollSnap, setParentScrollSnap] = (0, import_react16.useState)(null);
13628
13637
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react16.useState)(null);
@@ -14648,6 +14657,8 @@ function OhhwellsBridge() {
14648
14657
  const closeFloatingPanelOnly = (0, import_react16.useCallback)(() => {
14649
14658
  setFloatingPanel(null);
14650
14659
  }, []);
14660
+ const closeFloatingPanelOnlyRef = (0, import_react16.useRef)(closeFloatingPanelOnly);
14661
+ closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
14651
14662
  const closeFloatingPanelAndDeselect = (0, import_react16.useCallback)(() => {
14652
14663
  setFloatingPanel(null);
14653
14664
  deselectRef.current();
@@ -16399,6 +16410,10 @@ function OhhwellsBridge() {
16399
16410
  closeLinkPopoverRef.current();
16400
16411
  return;
16401
16412
  }
16413
+ if (floatingPanelOpenRef.current) {
16414
+ closeFloatingPanelOnlyRef.current();
16415
+ return;
16416
+ }
16402
16417
  if (activeElRef.current) {
16403
16418
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
16404
16419
  const navAnchor = hrefCtx ? getNavigationItemAnchor(hrefCtx.anchor) : null;
@@ -16462,6 +16477,11 @@ function OhhwellsBridge() {
16462
16477
  closeLinkPopoverRef.current();
16463
16478
  return;
16464
16479
  }
16480
+ if (e.key === "Escape" && floatingPanelOpenRef.current) {
16481
+ e.preventDefault();
16482
+ closeFloatingPanelOnlyRef.current();
16483
+ return;
16484
+ }
16465
16485
  if (e.key === "Escape" && selectedElRef.current && !activeElRef.current) {
16466
16486
  if (toolbarVariantRef.current === "select-frame") {
16467
16487
  const parent2 = getNavigationSelectionParent(selectedElRef.current);
@@ -17162,7 +17182,7 @@ function OhhwellsBridge() {
17162
17182
  postToParent2({
17163
17183
  type: "ow:ready",
17164
17184
  version: "1",
17165
- bridgeVersion: "0.1.56",
17185
+ bridgeVersion: "0.1.58",
17166
17186
  path: pathname,
17167
17187
  nodes: collectEditableNodes(editContentRef.current),
17168
17188
  sections