@ohhwells/bridge 0.1.106 → 0.1.107

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
@@ -520,6 +520,19 @@ function alignSubjectOf(el) {
520
520
  while (subject.parentElement && !subject.parentElement.hasAttribute("data-ohw-section") && /^inline/.test(getComputedStyle(subject).display)) {
521
521
  subject = subject.parentElement;
522
522
  }
523
+ const TEXT_ROW = /^(P|LI|H[1-6]|BLOCKQUOTE|FIGCAPTION|DT|DD)$/;
524
+ const parent = subject.parentElement;
525
+ if (parent && TEXT_ROW.test(parent.tagName) && /^(inline-)?flex$/.test(getComputedStyle(parent).display)) {
526
+ return parent;
527
+ }
528
+ if (parent && !parent.hasAttribute("data-ohw-section")) {
529
+ const pcs = getComputedStyle(parent);
530
+ const children = Array.from(parent.children);
531
+ const textRowChild = (c) => c.hasAttribute("data-ohw-editable") || (c.textContent ?? "").trim().length === 0 || c.getAttribute("aria-hidden") === "true";
532
+ if (/^(inline-)?flex$/.test(pcs.display) && pcs.flexDirection.startsWith("row") && children.length > 0 && children.some((c) => c.hasAttribute("data-ohw-editable")) && children.every(textRowChild)) {
533
+ return parent;
534
+ }
535
+ }
523
536
  const row = subject.closest("li");
524
537
  if (row && row !== subject && /^(inline-)?flex$/.test(getComputedStyle(row).display)) {
525
538
  return row;
@@ -22454,7 +22467,7 @@ function OhhwellsBridge() {
22454
22467
  postToParent2({
22455
22468
  type: "ow:ready",
22456
22469
  version: "1",
22457
- bridgeVersion: "0.1.105",
22470
+ bridgeVersion: "0.1.106",
22458
22471
  path: pathname,
22459
22472
  nodes: collectEditableNodes(editContentRef.current),
22460
22473
  sections