@ohhwells/bridge 0.1.98 → 0.1.99
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 +22 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -17218,7 +17218,26 @@ function OhhwellsBridge() {
|
|
|
17218
17218
|
return;
|
|
17219
17219
|
}
|
|
17220
17220
|
const r2 = target.getBoundingClientRect();
|
|
17221
|
-
|
|
17221
|
+
let top = r2.top, left = r2.x - TEXT_HOVER_SIDE_PAD, bottom = r2.bottom, right = r2.x + r2.width + TEXT_HOVER_SIDE_PAD;
|
|
17222
|
+
let clipParent = target.parentElement;
|
|
17223
|
+
while (clipParent) {
|
|
17224
|
+
const style = getComputedStyle(clipParent);
|
|
17225
|
+
if (style.overflowY === "hidden" || style.overflowY === "clip" || style.overflowX === "hidden" || style.overflowX === "clip") {
|
|
17226
|
+
const pr = clipParent.getBoundingClientRect();
|
|
17227
|
+
top = Math.max(top, pr.top);
|
|
17228
|
+
bottom = Math.min(bottom, pr.bottom);
|
|
17229
|
+
left = Math.max(left, pr.left);
|
|
17230
|
+
right = Math.min(right, pr.right);
|
|
17231
|
+
}
|
|
17232
|
+
if (clipParent === document.documentElement) break;
|
|
17233
|
+
clipParent = clipParent.parentElement;
|
|
17234
|
+
}
|
|
17235
|
+
const width = right - left, height = bottom - top;
|
|
17236
|
+
if (width <= 0 || height <= 0) {
|
|
17237
|
+
setHoveredTextRect(null);
|
|
17238
|
+
return;
|
|
17239
|
+
}
|
|
17240
|
+
setHoveredTextRect(new DOMRect(left, top, width, height));
|
|
17222
17241
|
};
|
|
17223
17242
|
const observer = new MutationObserver(sync);
|
|
17224
17243
|
observer.observe(document.documentElement, {
|
|
@@ -20392,12 +20411,11 @@ function OhhwellsBridge() {
|
|
|
20392
20411
|
}
|
|
20393
20412
|
const { y } = toProbeCoords(clientX, clientY, fromParentViewport);
|
|
20394
20413
|
const sections = Array.from(document.querySelectorAll("[data-ohw-section]")).filter(
|
|
20395
|
-
(el) => !el.hasAttribute("data-ohw-ai-template-hidden") && !el.hasAttribute("data-ohw-ai-removed") && !el.hasAttribute("data-ohw-ai-replaced-by") && el.getBoundingClientRect().height > 0
|
|
20414
|
+
(el) => !el.hasAttribute("data-ohw-ai-template-hidden") && !el.hasAttribute("data-ohw-ai-removed") && !el.hasAttribute("data-ohw-ai-replaced-by") && !isPageFrameSection(el) && el.getBoundingClientRect().height > 0
|
|
20396
20415
|
).sort((a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top);
|
|
20397
20416
|
const ZONE = 20;
|
|
20398
20417
|
for (let i = 0; i < sections.length; i++) {
|
|
20399
20418
|
const a = sections[i];
|
|
20400
|
-
if (isPageFrameSection(a)) continue;
|
|
20401
20419
|
const b = sections[i + 1] ?? null;
|
|
20402
20420
|
const boundaryY = a.getBoundingClientRect().bottom;
|
|
20403
20421
|
if (Math.abs(y - boundaryY) <= ZONE) {
|
|
@@ -22044,7 +22062,7 @@ function OhhwellsBridge() {
|
|
|
22044
22062
|
postToParent2({
|
|
22045
22063
|
type: "ow:ready",
|
|
22046
22064
|
version: "1",
|
|
22047
|
-
bridgeVersion: "0.1.
|
|
22065
|
+
bridgeVersion: "0.1.98",
|
|
22048
22066
|
path: pathname,
|
|
22049
22067
|
nodes: collectEditableNodes(editContentRef.current),
|
|
22050
22068
|
sections
|