@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.cjs +14 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -593,6 +593,19 @@ function alignSubjectOf(el) {
|
|
|
593
593
|
while (subject.parentElement && !subject.parentElement.hasAttribute("data-ohw-section") && /^inline/.test(getComputedStyle(subject).display)) {
|
|
594
594
|
subject = subject.parentElement;
|
|
595
595
|
}
|
|
596
|
+
const TEXT_ROW = /^(P|LI|H[1-6]|BLOCKQUOTE|FIGCAPTION|DT|DD)$/;
|
|
597
|
+
const parent = subject.parentElement;
|
|
598
|
+
if (parent && TEXT_ROW.test(parent.tagName) && /^(inline-)?flex$/.test(getComputedStyle(parent).display)) {
|
|
599
|
+
return parent;
|
|
600
|
+
}
|
|
601
|
+
if (parent && !parent.hasAttribute("data-ohw-section")) {
|
|
602
|
+
const pcs = getComputedStyle(parent);
|
|
603
|
+
const children = Array.from(parent.children);
|
|
604
|
+
const textRowChild = (c) => c.hasAttribute("data-ohw-editable") || (c.textContent ?? "").trim().length === 0 || c.getAttribute("aria-hidden") === "true";
|
|
605
|
+
if (/^(inline-)?flex$/.test(pcs.display) && pcs.flexDirection.startsWith("row") && children.length > 0 && children.some((c) => c.hasAttribute("data-ohw-editable")) && children.every(textRowChild)) {
|
|
606
|
+
return parent;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
596
609
|
const row = subject.closest("li");
|
|
597
610
|
if (row && row !== subject && /^(inline-)?flex$/.test(getComputedStyle(row).display)) {
|
|
598
611
|
return row;
|
|
@@ -22521,7 +22534,7 @@ function OhhwellsBridge() {
|
|
|
22521
22534
|
postToParent2({
|
|
22522
22535
|
type: "ow:ready",
|
|
22523
22536
|
version: "1",
|
|
22524
|
-
bridgeVersion: "0.1.
|
|
22537
|
+
bridgeVersion: "0.1.106",
|
|
22525
22538
|
path: pathname,
|
|
22526
22539
|
nodes: collectEditableNodes(editContentRef.current),
|
|
22527
22540
|
sections
|