@ohhwells/bridge 0.1.168 → 0.1.169
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 +11 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17490,7 +17490,7 @@ function apiBase() {
|
|
|
17490
17490
|
function bridgeVersion() {
|
|
17491
17491
|
try {
|
|
17492
17492
|
if (true) {
|
|
17493
|
-
return "0.1.
|
|
17493
|
+
return "0.1.169";
|
|
17494
17494
|
}
|
|
17495
17495
|
} catch {
|
|
17496
17496
|
}
|
|
@@ -17504,7 +17504,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17504
17504
|
return;
|
|
17505
17505
|
}
|
|
17506
17506
|
try {
|
|
17507
|
-
const v = true ? "0.1.
|
|
17507
|
+
const v = true ? "0.1.169" : "";
|
|
17508
17508
|
if (v) {
|
|
17509
17509
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17510
17510
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -18486,6 +18486,12 @@ function highlightChangedElements(keys, item, sectionId) {
|
|
|
18486
18486
|
clearTimer = setTimeout(clearChangeHighlight, HIGHLIGHT_MS);
|
|
18487
18487
|
return targets.length;
|
|
18488
18488
|
}
|
|
18489
|
+
function highlightedRect() {
|
|
18490
|
+
const first = document.querySelector(`[${MARK_ATTR}]`);
|
|
18491
|
+
if (!first) return null;
|
|
18492
|
+
const rect = first.getBoundingClientRect();
|
|
18493
|
+
return { top: rect.top + window.scrollY, bottom: rect.bottom + window.scrollY };
|
|
18494
|
+
}
|
|
18489
18495
|
function installAiChangeHighlight() {
|
|
18490
18496
|
const onMessage = (e) => {
|
|
18491
18497
|
const data = e.data;
|
|
@@ -18495,7 +18501,8 @@ function installAiChangeHighlight() {
|
|
|
18495
18501
|
const item = raw && typeof raw.sectionId === "string" && typeof raw.group === "string" && typeof raw.index === "number" ? { sectionId: raw.sectionId, group: raw.group, index: raw.index } : void 0;
|
|
18496
18502
|
const sectionId = typeof data.sectionId === "string" ? data.sectionId : void 0;
|
|
18497
18503
|
const found = highlightChangedElements(keys, item, sectionId);
|
|
18498
|
-
|
|
18504
|
+
const rect = data.reveal === true && found > 0 ? highlightedRect() : null;
|
|
18505
|
+
window.parent?.postMessage({ type: "ow:ai-highlight-done", found, ...rect ? { rect } : {} }, "*");
|
|
18499
18506
|
};
|
|
18500
18507
|
window.addEventListener("message", onMessage);
|
|
18501
18508
|
return () => window.removeEventListener("message", onMessage);
|
|
@@ -32693,7 +32700,7 @@ function OhhwellsBridge() {
|
|
|
32693
32700
|
postToParent2({
|
|
32694
32701
|
type: "ow:ready",
|
|
32695
32702
|
version: "1",
|
|
32696
|
-
bridgeVersion: "0.1.
|
|
32703
|
+
bridgeVersion: "0.1.169",
|
|
32697
32704
|
path: pathname,
|
|
32698
32705
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32699
32706
|
sections
|