@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.js CHANGED
@@ -7035,7 +7035,14 @@ function findClosestButtonLike(target) {
7035
7035
  function findButtonAtPoint(x, y, media) {
7036
7036
  const hits = Array.from(
7037
7037
  document.querySelectorAll(BUTTON_LIKE_SELECTOR)
7038
- ).filter((el) => containsPoint(el, x, y) && !(media && el.contains(media)));
7038
+ ).filter(
7039
+ (el) => containsPoint(el, x, y) && !(media && el.contains(media)) && // Bridge-injected chrome (e.g. MediaOverlay's own "Replace image" button) is never a
7040
+ // site button. Without this, once the media overlay renders its button lands right
7041
+ // under the cursor, gets detected as "a button on the media", and dismisses the very
7042
+ // overlay it belongs to — which removes the button, so the next hit-test finds nothing
7043
+ // and the overlay reappears. Flip-flops every tick: the "Replace image" button flashes.
7044
+ !el.closest("[data-ohw-bridge]")
7045
+ );
7039
7046
  if (hits.length === 0) return null;
7040
7047
  return hits.reduce((best, el) => best.contains(el) ? el : best);
7041
7048
  }
@@ -13556,6 +13563,8 @@ function OhhwellsBridge() {
13556
13563
  const [isFooterFrameSelection, setIsFooterFrameSelection] = useState11(false);
13557
13564
  isFooterFrameSelectionRef.current = isFooterFrameSelection;
13558
13565
  const [floatingPanel, setFloatingPanel] = useState11(null);
13566
+ const floatingPanelOpenRef = useRef9(false);
13567
+ floatingPanelOpenRef.current = floatingPanel !== null;
13559
13568
  const [floatingPanelPos, setFloatingPanelPos] = useState11(null);
13560
13569
  const [parentScrollSnap, setParentScrollSnap] = useState11(null);
13561
13570
  const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = useState11(null);
@@ -14581,6 +14590,8 @@ function OhhwellsBridge() {
14581
14590
  const closeFloatingPanelOnly = useCallback7(() => {
14582
14591
  setFloatingPanel(null);
14583
14592
  }, []);
14593
+ const closeFloatingPanelOnlyRef = useRef9(closeFloatingPanelOnly);
14594
+ closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
14584
14595
  const closeFloatingPanelAndDeselect = useCallback7(() => {
14585
14596
  setFloatingPanel(null);
14586
14597
  deselectRef.current();
@@ -16332,6 +16343,10 @@ function OhhwellsBridge() {
16332
16343
  closeLinkPopoverRef.current();
16333
16344
  return;
16334
16345
  }
16346
+ if (floatingPanelOpenRef.current) {
16347
+ closeFloatingPanelOnlyRef.current();
16348
+ return;
16349
+ }
16335
16350
  if (activeElRef.current) {
16336
16351
  const hrefCtx = getHrefKeyFromElement(activeElRef.current);
16337
16352
  const navAnchor = hrefCtx ? getNavigationItemAnchor(hrefCtx.anchor) : null;
@@ -16395,6 +16410,11 @@ function OhhwellsBridge() {
16395
16410
  closeLinkPopoverRef.current();
16396
16411
  return;
16397
16412
  }
16413
+ if (e.key === "Escape" && floatingPanelOpenRef.current) {
16414
+ e.preventDefault();
16415
+ closeFloatingPanelOnlyRef.current();
16416
+ return;
16417
+ }
16398
16418
  if (e.key === "Escape" && selectedElRef.current && !activeElRef.current) {
16399
16419
  if (toolbarVariantRef.current === "select-frame") {
16400
16420
  const parent2 = getNavigationSelectionParent(selectedElRef.current);
@@ -17095,7 +17115,7 @@ function OhhwellsBridge() {
17095
17115
  postToParent2({
17096
17116
  type: "ow:ready",
17097
17117
  version: "1",
17098
- bridgeVersion: "0.1.56",
17118
+ bridgeVersion: "0.1.58",
17099
17119
  path: pathname,
17100
17120
  nodes: collectEditableNodes(editContentRef.current),
17101
17121
  sections