@ohhwells/bridge 0.1.105 → 0.1.106

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
@@ -19434,10 +19434,21 @@ function OhhwellsBridge() {
19434
19434
  gap: 6px;
19435
19435
  }
19436
19436
  /* Not the form: it is a layout container (flex/grid with gaps), and forcing block
19437
- crushed its fields together (OHH-490). */
19438
- [data-ohw-editable]:not([data-ohw-editable="form"]) {
19437
+ crushed its fields together (OHH-490). Not media (image/bg-image/video/icon/map)
19438
+ either: those can be their own flex containers centering fallback content (a
19439
+ placeholder label, a mascot emoji) \u2014 forcing block broke that centering while the
19440
+ image was unset (OHH-758-ish). */
19441
+ [data-ohw-editable]:not([data-ohw-editable="form"]):not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"]):not([data-ohw-editable="icon"]):not([data-ohw-editable="map"]) {
19439
19442
  display: block;
19440
19443
  }
19444
+ /* The block-force above is an author rule, so it beats the browser's own
19445
+ details-not-open child-display-none UA rule \u2014 origin always wins over specificity.
19446
+ Left alone, a closed FAQ's answer became a real, hoverable box that overflowed past
19447
+ the collapsed <details> into the gap before the next item. Restore the native
19448
+ collapse for editable content once it isn't the summary. */
19449
+ details:not([open]) > [data-ohw-editable]:not(summary) {
19450
+ display: none !important;
19451
+ }
19441
19452
  /* Body text (no item-action toolbar) \u2014 first click enters text edit \u2192 I-beam.
19442
19453
  Exclude select-first nav/footer labels so grab/default on [data-ohw-href-key] can win. */
19443
19454
  [data-ohw-editable]:not([contenteditable]):not([data-ohw-editable="image"]):not([data-ohw-editable="bg-image"]):not([data-ohw-editable="video"]):not([data-ohw-editable="link"]):not(:is([data-ohw-href-key] *)) {
@@ -19461,6 +19472,14 @@ function OhhwellsBridge() {
19461
19472
  [data-ohw-editable="video"], [data-ohw-editable="video"] *,
19462
19473
  [data-ohw-editable="bg-image"], [data-ohw-editable="bg-image"] * { cursor: pointer !important; }
19463
19474
  [data-ohw-editable="link"], [data-ohw-editable="link"] * { cursor: pointer !important; }
19475
+ /* A text/plain editable nested inside a media editable (e.g. a placeholder's fallback
19476
+ label inside its bg-image box) is its own click target, not the media picker \u2014 the
19477
+ blanket media cursor rule above would otherwise show pointer where a click actually
19478
+ opens text edit. */
19479
+ [data-ohw-editable="bg-image"] [data-ohw-editable="text"],
19480
+ [data-ohw-editable="bg-image"] [data-ohw-editable="text"] *,
19481
+ [data-ohw-editable="image"] [data-ohw-editable="text"],
19482
+ [data-ohw-editable="image"] [data-ohw-editable="text"] * { cursor: text !important; }
19464
19483
  /* A form field is a design surface in the editor: its input takes the pointer so the
19465
19484
  field can be picked and hovered from anywhere inside it (OHH-642). */
19466
19485
  [data-ohw-editable="form"] [data-ohw-form-field] input,
@@ -20047,6 +20066,8 @@ function OhhwellsBridge() {
20047
20066
  setFormHoverRect(null);
20048
20067
  }
20049
20068
  if (!editable) return;
20069
+ const editableRect = editable.getBoundingClientRect();
20070
+ if (editableRect.width <= 0 || editableRect.height <= 0) return;
20050
20071
  const selected = selectedElRef.current;
20051
20072
  if (selected && (selected === editable || selected.contains(editable))) return;
20052
20073
  if (!isMediaEditable(editable) && !editable.hasAttribute("contenteditable")) {
@@ -22150,6 +22171,18 @@ function OhhwellsBridge() {
22150
22171
  hoveredNavContainerRef.current = null;
22151
22172
  setHoveredNavContainerRect(null);
22152
22173
  };
22174
+ const handleDetailsToggle = (e) => {
22175
+ if (e.target?.tagName !== "DETAILS") return;
22176
+ document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
22177
+ hovered.removeAttribute("data-ohw-hovered");
22178
+ });
22179
+ setHoveredTextRect(null);
22180
+ hoveredItemElRef.current = null;
22181
+ setHoveredItemRect(null);
22182
+ hoveredNavContainerRef.current = null;
22183
+ setHoveredNavContainerRect(null);
22184
+ };
22185
+ document.addEventListener("toggle", handleDetailsToggle, true);
22153
22186
  window.addEventListener("resize", handleViewportResize, { passive: true });
22154
22187
  document.addEventListener("click", handleClick, true);
22155
22188
  document.addEventListener("dblclick", handleDblClick, true);
@@ -22167,6 +22200,7 @@ function OhhwellsBridge() {
22167
22200
  document.addEventListener("selectionchange", handleSelectionChange);
22168
22201
  window.addEventListener("scroll", handleScroll, true);
22169
22202
  return () => {
22203
+ document.removeEventListener("toggle", handleDetailsToggle, true);
22170
22204
  document.removeEventListener("click", handleClick, true);
22171
22205
  document.removeEventListener("dblclick", handleDblClick, true);
22172
22206
  document.removeEventListener("paste", handlePaste, true);
@@ -22420,7 +22454,7 @@ function OhhwellsBridge() {
22420
22454
  postToParent2({
22421
22455
  type: "ow:ready",
22422
22456
  version: "1",
22423
- bridgeVersion: "0.1.104",
22457
+ bridgeVersion: "0.1.105",
22424
22458
  path: pathname,
22425
22459
  nodes: collectEditableNodes(editContentRef.current),
22426
22460
  sections