@ohhwells/bridge 0.1.67-next.195 → 0.1.67-next.196
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 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -18735,7 +18735,9 @@ function OhhwellsBridge() {
|
|
|
18735
18735
|
return;
|
|
18736
18736
|
}
|
|
18737
18737
|
const { y } = toProbeCoords(clientX, clientY, fromParentViewport);
|
|
18738
|
-
const sections = Array.from(document.querySelectorAll("[data-ohw-section]")).
|
|
18738
|
+
const sections = Array.from(document.querySelectorAll("[data-ohw-section]")).filter(
|
|
18739
|
+
(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
|
|
18740
|
+
).sort((a, b) => a.getBoundingClientRect().top - b.getBoundingClientRect().top);
|
|
18739
18741
|
const ZONE = 20;
|
|
18740
18742
|
for (let i = 0; i < sections.length; i++) {
|
|
18741
18743
|
const a = sections[i];
|
|
@@ -19159,10 +19161,16 @@ function OhhwellsBridge() {
|
|
|
19159
19161
|
nodes: collectEditableNodes(editContentRef.current)
|
|
19160
19162
|
});
|
|
19161
19163
|
};
|
|
19164
|
+
const clearInteractionChrome = () => {
|
|
19165
|
+
deactivateRef.current();
|
|
19166
|
+
deselectRef.current();
|
|
19167
|
+
clearMediaSelectionRef.current();
|
|
19168
|
+
};
|
|
19162
19169
|
const handleAiApplyTree = (e) => {
|
|
19163
19170
|
if (e.data?.type !== "ow:ai-apply-tree") return;
|
|
19164
19171
|
const payload = e.data.payload;
|
|
19165
19172
|
if (!payload || typeof payload.id !== "string" || !isRenderableTree(payload.tree)) return;
|
|
19173
|
+
clearInteractionChrome();
|
|
19166
19174
|
const previous = aiSectionsRef.current;
|
|
19167
19175
|
const nextState = applyTreeToState(parseAiSectionsState(previous), {
|
|
19168
19176
|
...payload,
|
|
@@ -19187,6 +19195,7 @@ function OhhwellsBridge() {
|
|
|
19187
19195
|
if (!sectionId || sectionId === "navbar" || sectionId === "footer") return;
|
|
19188
19196
|
const exists = document.querySelector(`[data-ohw-section="${CSS.escape(sectionId)}"]`);
|
|
19189
19197
|
if (!exists) return;
|
|
19198
|
+
clearInteractionChrome();
|
|
19190
19199
|
const previous = aiSectionsRef.current;
|
|
19191
19200
|
const nextState = deleteSectionFromState(parseAiSectionsState(previous), sectionId);
|
|
19192
19201
|
const nextValue = serializeAiSectionsState(nextState);
|
|
@@ -19202,6 +19211,7 @@ function OhhwellsBridge() {
|
|
|
19202
19211
|
const handleAiSetSections = (e) => {
|
|
19203
19212
|
if (e.data?.type !== "ow:ai-set-sections") return;
|
|
19204
19213
|
const value = typeof e.data.value === "string" ? e.data.value : "";
|
|
19214
|
+
clearInteractionChrome();
|
|
19205
19215
|
aiSectionsRef.current = value;
|
|
19206
19216
|
applyAiSectionsToDom(parseAiSectionsState(value));
|
|
19207
19217
|
applyStylesToDom(parseStyleStore(stylesRef.current));
|