@ohhwells/bridge 0.1.164 → 0.1.165
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 +455 -307
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -1
- package/dist/index.d.ts +60 -1
- package/dist/index.js +210 -64
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -86,6 +86,7 @@ __export(index_exports, {
|
|
|
86
86
|
hasMountedContentNodes: () => hasMountedContentNodes,
|
|
87
87
|
indexCollectionItems: () => indexCollectionItems,
|
|
88
88
|
insertFooterHours: () => insertFooterHours,
|
|
89
|
+
isDeadPageHref: () => isDeadPageHref,
|
|
89
90
|
isEditSessionActive: () => isEditSessionActive,
|
|
90
91
|
isPlainLeftClick: () => isPlainLeftClick,
|
|
91
92
|
isRenderableFooterTree: () => isRenderableFooterTree,
|
|
@@ -97,6 +98,7 @@ __export(index_exports, {
|
|
|
97
98
|
parseAiFooterState: () => parseAiFooterState,
|
|
98
99
|
parseAiSectionsState: () => parseAiSectionsState,
|
|
99
100
|
parseTarget: () => parseTarget,
|
|
101
|
+
planBuildPageSync: () => planBuildPageSync,
|
|
100
102
|
recordOverriddenPaths: () => recordOverriddenPaths,
|
|
101
103
|
releaseTemplateLogoIfReplaced: () => releaseTemplateLogoIfReplaced,
|
|
102
104
|
removeFooterBlock: () => removeFooterBlock,
|
|
@@ -115,7 +117,7 @@ __export(index_exports, {
|
|
|
115
117
|
module.exports = __toCommonJS(index_exports);
|
|
116
118
|
|
|
117
119
|
// src/OhhwellsBridge.tsx
|
|
118
|
-
var
|
|
120
|
+
var import_react24 = __toESM(require("react"), 1);
|
|
119
121
|
var import_client3 = require("react-dom/client");
|
|
120
122
|
var import_react_dom5 = require("react-dom");
|
|
121
123
|
|
|
@@ -954,6 +956,10 @@ function useOhwCarousel(key, initial) {
|
|
|
954
956
|
if (Array.isArray(detail?.images)) setImages(detail.images);
|
|
955
957
|
};
|
|
956
958
|
el.addEventListener(CAROUSEL_EVENT, onChange);
|
|
959
|
+
const pending = parseSlides(el.getAttribute(CAROUSEL_VALUE_ATTR));
|
|
960
|
+
if (pending.length > 0) {
|
|
961
|
+
setImages((prev) => JSON.stringify(prev) === JSON.stringify(pending) ? prev : pending);
|
|
962
|
+
}
|
|
957
963
|
return () => el.removeEventListener(CAROUSEL_EVENT, onChange);
|
|
958
964
|
}, [key]);
|
|
959
965
|
const bind = {
|
|
@@ -2638,6 +2644,14 @@ function socialHrefKey(item) {
|
|
|
2638
2644
|
function socialIconKey(item) {
|
|
2639
2645
|
return item.querySelector(ICON_SELECTOR)?.dataset.ohwKey ?? null;
|
|
2640
2646
|
}
|
|
2647
|
+
function pendingIconKey(item) {
|
|
2648
|
+
const existing = socialIconKey(item);
|
|
2649
|
+
if (existing) return existing;
|
|
2650
|
+
const base = socialHrefKey(item)?.replace(/-href$/, "");
|
|
2651
|
+
if (!base) return null;
|
|
2652
|
+
const taken = item.ownerDocument.querySelector(`[data-ohw-key="${base}"]`);
|
|
2653
|
+
return taken && taken !== item ? `${base}-icon` : base;
|
|
2654
|
+
}
|
|
2641
2655
|
var SOCIAL_PLATFORM_LABELS = {
|
|
2642
2656
|
instagram: "Instagram",
|
|
2643
2657
|
facebook: "Facebook",
|
|
@@ -2835,9 +2849,9 @@ function reconcileSocialsFromContent(content, root = document) {
|
|
|
2835
2849
|
listSocialsRows(root).forEach((row) => {
|
|
2836
2850
|
const rowDisplay = socialsDisplayFor(row, content);
|
|
2837
2851
|
listSocialItems(row).forEach((item) => {
|
|
2838
|
-
const key =
|
|
2852
|
+
const key = pendingIconKey(item);
|
|
2839
2853
|
const stored2 = key ? content[key] : void 0;
|
|
2840
|
-
if (!stored2?.trim()) return;
|
|
2854
|
+
if (!stored2?.trim().startsWith("<")) return;
|
|
2841
2855
|
const existing = item.querySelector(ICON_SELECTOR);
|
|
2842
2856
|
if (existing && existing.innerHTML.trim() && !existing.hasAttribute(SOCIALS_ICON_PLACEHOLDER_ATTR)) return;
|
|
2843
2857
|
ensureIconSlot(item);
|
|
@@ -3097,8 +3111,7 @@ function ensureIconSlot(item) {
|
|
|
3097
3111
|
const adopted = adoptAsIconSlot(drawn, base);
|
|
3098
3112
|
if (adopted) return adopted;
|
|
3099
3113
|
}
|
|
3100
|
-
const
|
|
3101
|
-
const iconKey = taken && taken !== item ? `${base}-icon` : base;
|
|
3114
|
+
const iconKey = pendingIconKey(item) ?? base;
|
|
3102
3115
|
const slot = document.createElement("span");
|
|
3103
3116
|
slot.setAttribute("data-ohw-key", iconKey);
|
|
3104
3117
|
slot.setAttribute("data-ohw-editable", "icon");
|
|
@@ -3610,11 +3623,11 @@ function insertFooterColumnDom(colIndex, heading, items) {
|
|
|
3610
3623
|
container.appendChild(column);
|
|
3611
3624
|
return { column, firstLink };
|
|
3612
3625
|
}
|
|
3613
|
-
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL,
|
|
3626
|
+
function insertFooterColumn(heading = DEFAULT_FOOTER_COLUMN_HEADING, linkLabel = DEFAULT_FOOTER_COLUMN_LINK_LABEL, linkHref2 = DEFAULT_FOOTER_COLUMN_LINK_HREF) {
|
|
3614
3627
|
if (!canAddFooterColumn()) {
|
|
3615
3628
|
throw new Error(`Footer column limit reached (${MAX_FOOTER_COLUMNS})`);
|
|
3616
3629
|
}
|
|
3617
|
-
const resolvedHref =
|
|
3630
|
+
const resolvedHref = linkHref2 || (document.querySelector("[data-ai-footer], [data-ohw-ai-footer]") ? "/" : DEFAULT_FOOTER_COLUMN_LINK_HREF);
|
|
3618
3631
|
const colIndex = getNextFooterColumnIndex();
|
|
3619
3632
|
const inserted = insertFooterColumnDom(colIndex, heading, [{ href: resolvedHref, label: linkLabel }]);
|
|
3620
3633
|
if (!inserted?.firstLink) throw new Error("Failed to insert footer column");
|
|
@@ -3993,8 +4006,8 @@ function duplicateFooterItem(sourceAnchor) {
|
|
|
3993
4006
|
const column = findFooterColumnForLink(sourceAnchor);
|
|
3994
4007
|
if (!column) return null;
|
|
3995
4008
|
const href = getLinkHref(sourceAnchor);
|
|
3996
|
-
const
|
|
3997
|
-
const label = (
|
|
4009
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
4010
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
3998
4011
|
return insertFooterItem(column, href || "/", label, sourceAnchor);
|
|
3999
4012
|
}
|
|
4000
4013
|
function footerLabelKeyFromHrefKey(hrefKey) {
|
|
@@ -4004,8 +4017,8 @@ function deleteFooterItem(sourceAnchor) {
|
|
|
4004
4017
|
if (!isFooterLinkAnchor(sourceAnchor)) return null;
|
|
4005
4018
|
const hrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
4006
4019
|
if (!hrefKey || !isFooterHrefKey(hrefKey)) return null;
|
|
4007
|
-
const
|
|
4008
|
-
const label = (
|
|
4020
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
4021
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
4009
4022
|
const labelKey = footerLabelKeyFromHrefKey(hrefKey);
|
|
4010
4023
|
const previousOrder = getFooterOrderFromDom();
|
|
4011
4024
|
const previousOrderJson = JSON.stringify(previousOrder);
|
|
@@ -4973,8 +4986,8 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4973
4986
|
const mapped = keyMap.get(oldHrefKey);
|
|
4974
4987
|
if (!mapped) return;
|
|
4975
4988
|
el.setAttribute("data-ohw-href-key", mapped.hrefKey);
|
|
4976
|
-
const
|
|
4977
|
-
if (
|
|
4989
|
+
const labelEl2 = el.querySelector(':scope > [data-ohw-editable="text"][data-ohw-key]') ?? el.querySelector('[data-ohw-editable="text"][data-ohw-key]');
|
|
4990
|
+
if (labelEl2) labelEl2.setAttribute("data-ohw-key", mapped.labelKey);
|
|
4978
4991
|
};
|
|
4979
4992
|
if (root.matches("[data-ohw-href-key]")) remapAnchor(root);
|
|
4980
4993
|
root.querySelectorAll("[data-ohw-href-key]").forEach(remapAnchor);
|
|
@@ -4982,10 +4995,10 @@ function remapNavKeysInSubtree(root, keyMap) {
|
|
|
4982
4995
|
function readNavLinkSnapshot(hrefKey) {
|
|
4983
4996
|
const el = findCounterpartByHrefKey(hrefKey, document) ?? document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
4984
4997
|
if (!el) return { href: "/", label: "Untitled" };
|
|
4985
|
-
const
|
|
4998
|
+
const labelEl2 = el.querySelector('[data-ohw-editable="text"]');
|
|
4986
4999
|
return {
|
|
4987
5000
|
href: getLinkHref2(el),
|
|
4988
|
-
label: (
|
|
5001
|
+
label: (labelEl2?.textContent ?? "").trim() || "Untitled"
|
|
4989
5002
|
};
|
|
4990
5003
|
}
|
|
4991
5004
|
function findClonedNavAnchor(unit, hrefKey) {
|
|
@@ -5159,8 +5172,8 @@ function deleteNavbarItem(sourceAnchor) {
|
|
|
5159
5172
|
if (!isNavbarLinkItem(sourceAnchor)) return null;
|
|
5160
5173
|
const sourceHrefKey = sourceAnchor.getAttribute("data-ohw-href-key");
|
|
5161
5174
|
if (!sourceHrefKey || !isNavbarHrefKey(sourceHrefKey)) return null;
|
|
5162
|
-
const
|
|
5163
|
-
const label = (
|
|
5175
|
+
const labelEl2 = sourceAnchor.querySelector('[data-ohw-editable="text"]');
|
|
5176
|
+
const label = (labelEl2?.textContent ?? "").trim() || "Untitled";
|
|
5164
5177
|
const previousForest = getNavForestFromDom();
|
|
5165
5178
|
const previousOrderJson = serializeNavOrder(previousForest);
|
|
5166
5179
|
const parentHrefKey = previousForest.find((n) => n.children.some((c) => c.id === sourceHrefKey))?.id ?? null;
|
|
@@ -11767,8 +11780,8 @@ function syncFooterTreeLinksFromDom(tree) {
|
|
|
11767
11780
|
const heading = getFooterColumnHeadingEl(col);
|
|
11768
11781
|
const title = heading ? textOf2(heading) : void 0;
|
|
11769
11782
|
const items = listFooterLinksInColumn(col).map((anchor) => {
|
|
11770
|
-
const
|
|
11771
|
-
const label = textOf2(
|
|
11783
|
+
const labelEl2 = anchor.querySelector('[data-ohw-editable="text"]');
|
|
11784
|
+
const label = textOf2(labelEl2) || textOf2(anchor);
|
|
11772
11785
|
const href = hrefToFooterTreeRef(anchor.getAttribute("href"));
|
|
11773
11786
|
return label ? { label, href: href || "home" } : null;
|
|
11774
11787
|
}).filter((x) => Boolean(x));
|
|
@@ -17467,7 +17480,7 @@ function apiBase() {
|
|
|
17467
17480
|
function bridgeVersion() {
|
|
17468
17481
|
try {
|
|
17469
17482
|
if (true) {
|
|
17470
|
-
return "0.1.
|
|
17483
|
+
return "0.1.165";
|
|
17471
17484
|
}
|
|
17472
17485
|
} catch {
|
|
17473
17486
|
}
|
|
@@ -17481,7 +17494,7 @@ function stampBridgeVersionOnDocument() {
|
|
|
17481
17494
|
return;
|
|
17482
17495
|
}
|
|
17483
17496
|
try {
|
|
17484
|
-
const v = true ? "0.1.
|
|
17497
|
+
const v = true ? "0.1.165" : "";
|
|
17485
17498
|
if (v) {
|
|
17486
17499
|
document.documentElement.setAttribute("data-ohw-bridge-version", v);
|
|
17487
17500
|
window.__OHW_BRIDGE_VERSION__ = v;
|
|
@@ -24201,6 +24214,138 @@ function deleteSelectedNavFooterItem(deps) {
|
|
|
24201
24214
|
return false;
|
|
24202
24215
|
}
|
|
24203
24216
|
|
|
24217
|
+
// src/lib/build-page-sync.ts
|
|
24218
|
+
var import_react23 = require("react");
|
|
24219
|
+
var CHROME_KEY_RE = /^(nav|footer|header|navbar)[-_]/u;
|
|
24220
|
+
function normalisePath(path) {
|
|
24221
|
+
const trimmed = path.trim().replace(/[?#].*$/u, "");
|
|
24222
|
+
if (!trimmed || trimmed === "/") return "/";
|
|
24223
|
+
return `/${trimmed.replace(/^\/+|\/+$/gu, "")}`;
|
|
24224
|
+
}
|
|
24225
|
+
function isDeadPageHref(href, livePaths) {
|
|
24226
|
+
const value = href.trim();
|
|
24227
|
+
if (!value.startsWith("/") || value.startsWith("//")) return false;
|
|
24228
|
+
const path = normalisePath(value);
|
|
24229
|
+
if (path === "/") return false;
|
|
24230
|
+
return !livePaths.some((live) => {
|
|
24231
|
+
const p = normalisePath(live);
|
|
24232
|
+
return p === path || p !== "/" && path.startsWith(`${p}/`);
|
|
24233
|
+
});
|
|
24234
|
+
}
|
|
24235
|
+
var sameWords = (a, b) => a.trim().toLowerCase() === b.trim().toLowerCase();
|
|
24236
|
+
function planBuildPageSync(links, msg) {
|
|
24237
|
+
const live = Array.isArray(msg.livePaths) ? msg.livePaths : [];
|
|
24238
|
+
const removed = new Set((msg.removed ?? []).map(normalisePath));
|
|
24239
|
+
const remove = [];
|
|
24240
|
+
const relabel = [];
|
|
24241
|
+
const retarget = [];
|
|
24242
|
+
const fallback = live.some((p) => normalisePath(p) === "/contact") ? "/contact" : "/";
|
|
24243
|
+
for (const link of links) {
|
|
24244
|
+
const href = link.href.trim();
|
|
24245
|
+
const isPage = href.startsWith("/") && !href.startsWith("//");
|
|
24246
|
+
if (isPage && (removed.has(normalisePath(href)) || live.length > 0 && isDeadPageHref(href, live))) {
|
|
24247
|
+
if (link.area === "chrome") retarget.push({ hrefKey: link.hrefKey, href: fallback });
|
|
24248
|
+
else remove.push(link.hrefKey);
|
|
24249
|
+
continue;
|
|
24250
|
+
}
|
|
24251
|
+
if (isPage) {
|
|
24252
|
+
const path = normalisePath(href);
|
|
24253
|
+
const rename = (msg.relabel ?? []).find((r2) => normalisePath(r2.path) === path);
|
|
24254
|
+
if (rename && sameWords(link.label, rename.oldTitle) && !sameWords(link.label, rename.label)) {
|
|
24255
|
+
relabel.push({ hrefKey: link.hrefKey, label: rename.label });
|
|
24256
|
+
}
|
|
24257
|
+
continue;
|
|
24258
|
+
}
|
|
24259
|
+
if (href.startsWith("#") || href.startsWith("/#")) {
|
|
24260
|
+
const anchor = href.replace(/^\/?#/u, "").toLowerCase();
|
|
24261
|
+
const target = (msg.anchorLabels ?? []).find((a) => a.anchors.some((id) => id.toLowerCase() === anchor));
|
|
24262
|
+
if (target && sameWords(link.label.replace(/\s+/gu, "-"), anchor) && !sameWords(link.label, target.label)) {
|
|
24263
|
+
relabel.push({ hrefKey: link.hrefKey, label: target.label });
|
|
24264
|
+
}
|
|
24265
|
+
}
|
|
24266
|
+
}
|
|
24267
|
+
return { remove, relabel, retarget };
|
|
24268
|
+
}
|
|
24269
|
+
function linkHref(el) {
|
|
24270
|
+
const key = el.getAttribute("data-ohw-href-key");
|
|
24271
|
+
const stored = key ? getStoredLinkHref(key) : void 0;
|
|
24272
|
+
return stored ?? el.getAttribute("href") ?? "";
|
|
24273
|
+
}
|
|
24274
|
+
function labelEl(anchor) {
|
|
24275
|
+
return anchor.querySelector('[data-ohw-editable="text"]');
|
|
24276
|
+
}
|
|
24277
|
+
function collectLinks() {
|
|
24278
|
+
const seen = /* @__PURE__ */ new Set();
|
|
24279
|
+
const links = [];
|
|
24280
|
+
document.querySelectorAll("[data-ohw-href-key]").forEach((el) => {
|
|
24281
|
+
const hrefKey = el.getAttribute("data-ohw-href-key") ?? "";
|
|
24282
|
+
if (seen.has(hrefKey)) return;
|
|
24283
|
+
const area = isNavbarHrefKey(hrefKey) ? "nav" : isFooterHrefKey(hrefKey) ? "footer" : CHROME_KEY_RE.test(hrefKey) ? "chrome" : null;
|
|
24284
|
+
if (!area) return;
|
|
24285
|
+
const label = labelEl(el);
|
|
24286
|
+
if (!label && area !== "chrome") return;
|
|
24287
|
+
seen.add(hrefKey);
|
|
24288
|
+
links.push({ hrefKey, href: linkHref(el), label: label?.textContent ?? el.textContent ?? "", area });
|
|
24289
|
+
});
|
|
24290
|
+
return links;
|
|
24291
|
+
}
|
|
24292
|
+
function applyBuildPageSync(msg, deps) {
|
|
24293
|
+
const plan = planBuildPageSync(collectLinks(), msg);
|
|
24294
|
+
const nodes = /* @__PURE__ */ new Map();
|
|
24295
|
+
for (const hrefKey of plan.remove) {
|
|
24296
|
+
const anchor = document.querySelector(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`);
|
|
24297
|
+
if (!anchor) continue;
|
|
24298
|
+
const nav = isNavbarHrefKey(hrefKey);
|
|
24299
|
+
const result = nav ? deleteNavbarItem(anchor) : deleteFooterItem(anchor);
|
|
24300
|
+
if (!result) continue;
|
|
24301
|
+
for (const key of result.removedKeys) {
|
|
24302
|
+
nodes.set(key, "");
|
|
24303
|
+
clearStoredLinkHref(key);
|
|
24304
|
+
}
|
|
24305
|
+
nodes.set(nav ? NAV_ORDER_KEY : FOOTER_ORDER_KEY, result.orderJson);
|
|
24306
|
+
}
|
|
24307
|
+
for (const { hrefKey, label } of plan.relabel) {
|
|
24308
|
+
const labelKey = hrefKey.replace(/-href$/u, "-label");
|
|
24309
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24310
|
+
const el = labelEl(anchor);
|
|
24311
|
+
if (el) el.textContent = label;
|
|
24312
|
+
});
|
|
24313
|
+
nodes.set(labelKey, label);
|
|
24314
|
+
}
|
|
24315
|
+
for (const { hrefKey, href } of plan.retarget) {
|
|
24316
|
+
setStoredLinkHref(hrefKey, href);
|
|
24317
|
+
document.querySelectorAll(`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`).forEach((anchor) => {
|
|
24318
|
+
if (anchor instanceof HTMLAnchorElement) anchor.setAttribute("href", href);
|
|
24319
|
+
});
|
|
24320
|
+
nodes.set(hrefKey, href);
|
|
24321
|
+
}
|
|
24322
|
+
if (nodes.size === 0) return 0;
|
|
24323
|
+
deps.setEditContent({ ...deps.getEditContent(), ...Object.fromEntries(nodes) });
|
|
24324
|
+
deps.postToParent({
|
|
24325
|
+
type: "ow:change",
|
|
24326
|
+
nodes: [...nodes].map(([key, text]) => ({ key, text }))
|
|
24327
|
+
});
|
|
24328
|
+
return plan.remove.length + plan.relabel.length + plan.retarget.length;
|
|
24329
|
+
}
|
|
24330
|
+
function useBuildPageSync(isEditMode, editContentRef, postToParent2) {
|
|
24331
|
+
(0, import_react23.useEffect)(() => {
|
|
24332
|
+
if (!isEditMode) return;
|
|
24333
|
+
const onMessage = (e) => {
|
|
24334
|
+
if (e.source !== window.parent || e.data?.type !== "ow:pages-sync") return;
|
|
24335
|
+
const changed = applyBuildPageSync(e.data, {
|
|
24336
|
+
getEditContent: () => editContentRef.current,
|
|
24337
|
+
setEditContent: (next) => {
|
|
24338
|
+
editContentRef.current = next;
|
|
24339
|
+
},
|
|
24340
|
+
postToParent: postToParent2
|
|
24341
|
+
});
|
|
24342
|
+
postToParent2({ type: "ow:pages-synced", changed });
|
|
24343
|
+
};
|
|
24344
|
+
window.addEventListener("message", onMessage);
|
|
24345
|
+
return () => window.removeEventListener("message", onMessage);
|
|
24346
|
+
}, [isEditMode, editContentRef, postToParent2]);
|
|
24347
|
+
}
|
|
24348
|
+
|
|
24204
24349
|
// src/lib/nav-page-sync.ts
|
|
24205
24350
|
function labelKeyFor(hrefKey) {
|
|
24206
24351
|
return hrefKey.replace(/-href$/, "-label");
|
|
@@ -25656,9 +25801,9 @@ function FloatingToolbar({
|
|
|
25656
25801
|
showEditLink,
|
|
25657
25802
|
onEditLink
|
|
25658
25803
|
}) {
|
|
25659
|
-
const localRef =
|
|
25660
|
-
const [measuredW, setMeasuredW] =
|
|
25661
|
-
const setRefs =
|
|
25804
|
+
const localRef = import_react24.default.useRef(null);
|
|
25805
|
+
const [measuredW, setMeasuredW] = import_react24.default.useState(330);
|
|
25806
|
+
const setRefs = import_react24.default.useCallback(
|
|
25662
25807
|
(node) => {
|
|
25663
25808
|
localRef.current = node;
|
|
25664
25809
|
if (typeof elRef === "function") elRef(node);
|
|
@@ -25670,7 +25815,7 @@ function FloatingToolbar({
|
|
|
25670
25815
|
},
|
|
25671
25816
|
[elRef]
|
|
25672
25817
|
);
|
|
25673
|
-
|
|
25818
|
+
import_react24.default.useLayoutEffect(() => {
|
|
25674
25819
|
const node = localRef.current;
|
|
25675
25820
|
if (!node) return;
|
|
25676
25821
|
const update = () => {
|
|
@@ -25696,7 +25841,7 @@ function FloatingToolbar({
|
|
|
25696
25841
|
pointerEvents: "auto"
|
|
25697
25842
|
},
|
|
25698
25843
|
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(CustomToolbar, { children: [
|
|
25699
|
-
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
25844
|
+
TOOLBAR_GROUPS.map((btns, gi) => /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_react24.default.Fragment, { children: [
|
|
25700
25845
|
gi > 0 && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(CustomToolbarDivider, {}),
|
|
25701
25846
|
btns.map((btn) => {
|
|
25702
25847
|
const isActive = activeCommands.has(btn.cmd);
|
|
@@ -25905,8 +26050,8 @@ function OhhwellsBridge() {
|
|
|
25905
26050
|
const router = (0, import_navigation4.useRouter)();
|
|
25906
26051
|
const searchParams = (0, import_navigation4.useSearchParams)();
|
|
25907
26052
|
const isEditMode = isEditSessionActive();
|
|
25908
|
-
const [bridgeRoot, setBridgeRoot] = (0,
|
|
25909
|
-
(0,
|
|
26053
|
+
const [bridgeRoot, setBridgeRoot] = (0, import_react24.useState)(null);
|
|
26054
|
+
(0, import_react24.useEffect)(() => {
|
|
25910
26055
|
const figtreeFontId = "ohw-figtree-font";
|
|
25911
26056
|
if (!document.getElementById(figtreeFontId)) {
|
|
25912
26057
|
const preconnect1 = Object.assign(document.createElement("link"), { rel: "preconnect", href: "https://fonts.googleapis.com" });
|
|
@@ -25932,8 +26077,8 @@ function OhhwellsBridge() {
|
|
|
25932
26077
|
};
|
|
25933
26078
|
}, []);
|
|
25934
26079
|
const subdomainFromQuery = searchParams.get("subdomain");
|
|
25935
|
-
const [subdomain, setSubdomain] = (0,
|
|
25936
|
-
(0,
|
|
26080
|
+
const [subdomain, setSubdomain] = (0, import_react24.useState)(() => resolveSubdomain(subdomainFromQuery));
|
|
26081
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
25937
26082
|
const next = resolveSubdomain(subdomainFromQuery);
|
|
25938
26083
|
if (next !== subdomain) setSubdomain(next);
|
|
25939
26084
|
if (next) return;
|
|
@@ -25945,7 +26090,7 @@ function OhhwellsBridge() {
|
|
|
25945
26090
|
}, 0);
|
|
25946
26091
|
return () => window.clearTimeout(t);
|
|
25947
26092
|
}, [subdomainFromQuery, subdomain]);
|
|
25948
|
-
(0,
|
|
26093
|
+
(0, import_react24.useEffect)(() => {
|
|
25949
26094
|
if (!subdomainFromQuery || typeof window === "undefined") return;
|
|
25950
26095
|
const url = new URL(window.location.href);
|
|
25951
26096
|
if (!url.searchParams.has("subdomain")) return;
|
|
@@ -25957,22 +26102,22 @@ function OhhwellsBridge() {
|
|
|
25957
26102
|
useSavedLinkNavigation(isEditMode);
|
|
25958
26103
|
useNavDropdownToggle(isEditMode);
|
|
25959
26104
|
useHashLinkScroll(isEditMode);
|
|
25960
|
-
const postToParent2 = (0,
|
|
26105
|
+
const postToParent2 = (0, import_react24.useCallback)((data) => {
|
|
25961
26106
|
if (typeof window !== "undefined" && window.parent !== window) {
|
|
25962
26107
|
window.parent.postMessage(data, "*");
|
|
25963
26108
|
}
|
|
25964
26109
|
}, []);
|
|
25965
|
-
const [fetchState, setFetchState] = (0,
|
|
25966
|
-
const [showBranding, setShowBranding] = (0,
|
|
25967
|
-
const autoSaveTimers = (0,
|
|
25968
|
-
(0,
|
|
26110
|
+
const [fetchState, setFetchState] = (0, import_react24.useState)("idle");
|
|
26111
|
+
const [showBranding, setShowBranding] = (0, import_react24.useState)(false);
|
|
26112
|
+
const autoSaveTimers = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
|
|
26113
|
+
(0, import_react24.useEffect)(() => {
|
|
25969
26114
|
stampBridgeVersionOnDocument();
|
|
25970
26115
|
}, []);
|
|
25971
|
-
(0,
|
|
26116
|
+
(0, import_react24.useEffect)(() => {
|
|
25972
26117
|
if (isEditMode) return;
|
|
25973
26118
|
return armLoaderHangBeacon(subdomain, fetchState);
|
|
25974
26119
|
}, [isEditMode, subdomain, fetchState]);
|
|
25975
|
-
(0,
|
|
26120
|
+
(0, import_react24.useEffect)(() => {
|
|
25976
26121
|
if (isEditMode || !subdomain) return;
|
|
25977
26122
|
const onError = (event) => {
|
|
25978
26123
|
reportOutageBeacon({
|
|
@@ -25993,40 +26138,40 @@ function OhhwellsBridge() {
|
|
|
25993
26138
|
window.removeEventListener("unhandledrejection", onRejection);
|
|
25994
26139
|
};
|
|
25995
26140
|
}, [isEditMode, subdomain]);
|
|
25996
|
-
const activeElRef = (0,
|
|
25997
|
-
const pointerHeldRef = (0,
|
|
25998
|
-
const selectedElRef = (0,
|
|
25999
|
-
const selectedHrefKeyRef = (0,
|
|
26000
|
-
const selectedFooterColAttrRef = (0,
|
|
26001
|
-
const footerHeadingTitleCacheRef = (0,
|
|
26002
|
-
const originalContentRef = (0,
|
|
26003
|
-
const activeStateElRef = (0,
|
|
26004
|
-
const parentScrollRef = (0,
|
|
26005
|
-
const visibleViewportRef = (0,
|
|
26006
|
-
const [dialogPortalContainer, setDialogPortalContainer] = (0,
|
|
26007
|
-
const attachVisibleViewport = (0,
|
|
26141
|
+
const activeElRef = (0, import_react24.useRef)(null);
|
|
26142
|
+
const pointerHeldRef = (0, import_react24.useRef)(false);
|
|
26143
|
+
const selectedElRef = (0, import_react24.useRef)(null);
|
|
26144
|
+
const selectedHrefKeyRef = (0, import_react24.useRef)(null);
|
|
26145
|
+
const selectedFooterColAttrRef = (0, import_react24.useRef)(null);
|
|
26146
|
+
const footerHeadingTitleCacheRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
|
|
26147
|
+
const originalContentRef = (0, import_react24.useRef)(null);
|
|
26148
|
+
const activeStateElRef = (0, import_react24.useRef)(null);
|
|
26149
|
+
const parentScrollRef = (0, import_react24.useRef)(null);
|
|
26150
|
+
const visibleViewportRef = (0, import_react24.useRef)(null);
|
|
26151
|
+
const [dialogPortalContainer, setDialogPortalContainer] = (0, import_react24.useState)(null);
|
|
26152
|
+
const attachVisibleViewport = (0, import_react24.useCallback)((node) => {
|
|
26008
26153
|
visibleViewportRef.current = node;
|
|
26009
26154
|
setDialogPortalContainer(node);
|
|
26010
26155
|
if (node) applyVisibleViewport(node, parentScrollRef.current);
|
|
26011
26156
|
}, []);
|
|
26012
|
-
const toolbarElRef = (0,
|
|
26013
|
-
const glowElRef = (0,
|
|
26014
|
-
const hoveredImageRef = (0,
|
|
26015
|
-
const hoveredImageHasTextOverlapRef = (0,
|
|
26016
|
-
const dragOverElRef = (0,
|
|
26017
|
-
const [mediaHover, setMediaHover] = (0,
|
|
26018
|
-
const [selectedAiSectionId, setSelectedAiSectionId] = (0,
|
|
26019
|
-
const selectedAiSectionIdRef = (0,
|
|
26020
|
-
const handleAiSectionSelectionChange = (0,
|
|
26157
|
+
const toolbarElRef = (0, import_react24.useRef)(null);
|
|
26158
|
+
const glowElRef = (0, import_react24.useRef)(null);
|
|
26159
|
+
const hoveredImageRef = (0, import_react24.useRef)(null);
|
|
26160
|
+
const hoveredImageHasTextOverlapRef = (0, import_react24.useRef)(false);
|
|
26161
|
+
const dragOverElRef = (0, import_react24.useRef)(null);
|
|
26162
|
+
const [mediaHover, setMediaHover] = (0, import_react24.useState)(null);
|
|
26163
|
+
const [selectedAiSectionId, setSelectedAiSectionId] = (0, import_react24.useState)(null);
|
|
26164
|
+
const selectedAiSectionIdRef = (0, import_react24.useRef)(null);
|
|
26165
|
+
const handleAiSectionSelectionChange = (0, import_react24.useCallback)((id) => {
|
|
26021
26166
|
selectedAiSectionIdRef.current = id;
|
|
26022
26167
|
setSelectedAiSectionId(id);
|
|
26023
26168
|
}, []);
|
|
26024
|
-
const [selectedMedia, setSelectedMedia] = (0,
|
|
26025
|
-
const selectedMediaElRef = (0,
|
|
26026
|
-
const mediaKeyDropTokenRef = (0,
|
|
26027
|
-
const selectedIconElRef = (0,
|
|
26028
|
-
const selectedSocialElRef = (0,
|
|
26029
|
-
const queueSectionKeyDrop = (0,
|
|
26169
|
+
const [selectedMedia, setSelectedMedia] = (0, import_react24.useState)(null);
|
|
26170
|
+
const selectedMediaElRef = (0, import_react24.useRef)(null);
|
|
26171
|
+
const mediaKeyDropTokenRef = (0, import_react24.useRef)(0);
|
|
26172
|
+
const selectedIconElRef = (0, import_react24.useRef)(null);
|
|
26173
|
+
const selectedSocialElRef = (0, import_react24.useRef)(null);
|
|
26174
|
+
const queueSectionKeyDrop = (0, import_react24.useCallback)((prev) => {
|
|
26030
26175
|
const sectionEl = prev?.closest("[data-ohw-section]") ?? null;
|
|
26031
26176
|
if (!sectionEl) return;
|
|
26032
26177
|
const sectionInstanceId = instanceIdOf(movableUnit(sectionEl)) || null;
|
|
@@ -26047,31 +26192,31 @@ function OhhwellsBridge() {
|
|
|
26047
26192
|
window.addEventListener("message", onQueueDrained);
|
|
26048
26193
|
window.postMessage({ type: "ow:media-key-drop", token }, "*");
|
|
26049
26194
|
}, []);
|
|
26050
|
-
const clearMediaSelection = (0,
|
|
26195
|
+
const clearMediaSelection = (0, import_react24.useCallback)(() => {
|
|
26051
26196
|
const prev = selectedMediaElRef.current;
|
|
26052
26197
|
selectedMediaElRef.current = null;
|
|
26053
26198
|
setSelectedMedia(null);
|
|
26054
26199
|
queueSectionKeyDrop(prev);
|
|
26055
26200
|
}, [queueSectionKeyDrop]);
|
|
26056
|
-
const clearMediaSelectionRef = (0,
|
|
26201
|
+
const clearMediaSelectionRef = (0, import_react24.useRef)(clearMediaSelection);
|
|
26057
26202
|
clearMediaSelectionRef.current = clearMediaSelection;
|
|
26058
|
-
const clearIconSelection = (0,
|
|
26203
|
+
const clearIconSelection = (0, import_react24.useCallback)(() => {
|
|
26059
26204
|
const prev = selectedIconElRef.current;
|
|
26060
26205
|
if (!prev) return;
|
|
26061
26206
|
selectedIconElRef.current = null;
|
|
26062
26207
|
queueSectionKeyDrop(prev);
|
|
26063
26208
|
}, [queueSectionKeyDrop]);
|
|
26064
|
-
const clearIconSelectionRef = (0,
|
|
26209
|
+
const clearIconSelectionRef = (0, import_react24.useRef)(clearIconSelection);
|
|
26065
26210
|
clearIconSelectionRef.current = clearIconSelection;
|
|
26066
|
-
const clearSocialSelection = (0,
|
|
26211
|
+
const clearSocialSelection = (0, import_react24.useCallback)(() => {
|
|
26067
26212
|
const prev = selectedSocialElRef.current;
|
|
26068
26213
|
if (!prev) return;
|
|
26069
26214
|
selectedSocialElRef.current = null;
|
|
26070
26215
|
queueSectionKeyDrop(prev);
|
|
26071
26216
|
}, [queueSectionKeyDrop]);
|
|
26072
|
-
const clearSocialSelectionRef = (0,
|
|
26217
|
+
const clearSocialSelectionRef = (0, import_react24.useRef)(clearSocialSelection);
|
|
26073
26218
|
clearSocialSelectionRef.current = clearSocialSelection;
|
|
26074
|
-
const selectIconElement = (0,
|
|
26219
|
+
const selectIconElement = (0, import_react24.useCallback)((el) => {
|
|
26075
26220
|
if (selectedMediaElRef.current) clearMediaSelectionRef.current();
|
|
26076
26221
|
selectedIconElRef.current = el;
|
|
26077
26222
|
const sectionEl = el.closest("[data-ohw-section]");
|
|
@@ -26084,9 +26229,9 @@ function OhhwellsBridge() {
|
|
|
26084
26229
|
keyLabel: "Icon"
|
|
26085
26230
|
});
|
|
26086
26231
|
}, []);
|
|
26087
|
-
const selectIconElementRef = (0,
|
|
26232
|
+
const selectIconElementRef = (0, import_react24.useRef)(selectIconElement);
|
|
26088
26233
|
selectIconElementRef.current = selectIconElement;
|
|
26089
|
-
const selectMediaElement = (0,
|
|
26234
|
+
const selectMediaElement = (0, import_react24.useCallback)((el) => {
|
|
26090
26235
|
const r2 = el.getBoundingClientRect();
|
|
26091
26236
|
const video = el.dataset.ohwEditable === "video" ? el.querySelector("video") : null;
|
|
26092
26237
|
selectedIconElRef.current = null;
|
|
@@ -26111,9 +26256,9 @@ function OhhwellsBridge() {
|
|
|
26111
26256
|
keyLabel: el.dataset.ohwEditable === "video" ? "Video" : el.dataset.ohwEditable === "bg-image" ? "Background" : "Image"
|
|
26112
26257
|
});
|
|
26113
26258
|
}, []);
|
|
26114
|
-
const selectMediaElementRef = (0,
|
|
26259
|
+
const selectMediaElementRef = (0, import_react24.useRef)(selectMediaElement);
|
|
26115
26260
|
selectMediaElementRef.current = selectMediaElement;
|
|
26116
|
-
(0,
|
|
26261
|
+
(0, import_react24.useEffect)(() => {
|
|
26117
26262
|
if (!selectedMedia) return;
|
|
26118
26263
|
const update = () => {
|
|
26119
26264
|
const el = selectedMediaElRef.current;
|
|
@@ -26133,54 +26278,54 @@ function OhhwellsBridge() {
|
|
|
26133
26278
|
window.removeEventListener("resize", update);
|
|
26134
26279
|
};
|
|
26135
26280
|
}, [selectedMedia !== null]);
|
|
26136
|
-
const [carouselHover, setCarouselHover] = (0,
|
|
26137
|
-
const [uploadingRects, setUploadingRects] = (0,
|
|
26138
|
-
const hoveredGapRef = (0,
|
|
26139
|
-
const imageUnhoverTimerRef = (0,
|
|
26140
|
-
const imageShowTimerRef = (0,
|
|
26141
|
-
const editStylesRef = (0,
|
|
26142
|
-
const activateRef = (0,
|
|
26281
|
+
const [carouselHover, setCarouselHover] = (0, import_react24.useState)(null);
|
|
26282
|
+
const [uploadingRects, setUploadingRects] = (0, import_react24.useState)({});
|
|
26283
|
+
const hoveredGapRef = (0, import_react24.useRef)(null);
|
|
26284
|
+
const imageUnhoverTimerRef = (0, import_react24.useRef)(null);
|
|
26285
|
+
const imageShowTimerRef = (0, import_react24.useRef)(null);
|
|
26286
|
+
const editStylesRef = (0, import_react24.useRef)(null);
|
|
26287
|
+
const activateRef = (0, import_react24.useRef)(() => {
|
|
26143
26288
|
});
|
|
26144
|
-
const deactivateRef = (0,
|
|
26289
|
+
const deactivateRef = (0, import_react24.useRef)(() => {
|
|
26145
26290
|
});
|
|
26146
|
-
const selectRef = (0,
|
|
26291
|
+
const selectRef = (0, import_react24.useRef)(() => {
|
|
26147
26292
|
});
|
|
26148
|
-
const selectFrameRef = (0,
|
|
26293
|
+
const selectFrameRef = (0, import_react24.useRef)(() => {
|
|
26149
26294
|
});
|
|
26150
|
-
const selectLogoRef = (0,
|
|
26295
|
+
const selectLogoRef = (0, import_react24.useRef)(() => {
|
|
26151
26296
|
});
|
|
26152
|
-
const openLogoSizePanelRef = (0,
|
|
26297
|
+
const openLogoSizePanelRef = (0, import_react24.useRef)(() => {
|
|
26153
26298
|
});
|
|
26154
|
-
const deselectRef = (0,
|
|
26299
|
+
const deselectRef = (0, import_react24.useRef)(() => {
|
|
26155
26300
|
});
|
|
26156
|
-
const closeFloatingPanelOnlyRef = (0,
|
|
26301
|
+
const closeFloatingPanelOnlyRef = (0, import_react24.useRef)(() => {
|
|
26157
26302
|
});
|
|
26158
|
-
const reselectNavigationItemRef = (0,
|
|
26303
|
+
const reselectNavigationItemRef = (0, import_react24.useRef)(() => {
|
|
26159
26304
|
});
|
|
26160
|
-
const commitNavigationTextEditRef = (0,
|
|
26305
|
+
const commitNavigationTextEditRef = (0, import_react24.useRef)(() => {
|
|
26161
26306
|
});
|
|
26162
|
-
const handleDeleteSelectedRef = (0,
|
|
26163
|
-
const runPendingDeleteUndoRef = (0,
|
|
26164
|
-
const isFooterFrameSelectionRef = (0,
|
|
26165
|
-
const refreshActiveCommandsRef = (0,
|
|
26307
|
+
const handleDeleteSelectedRef = (0, import_react24.useRef)(() => false);
|
|
26308
|
+
const runPendingDeleteUndoRef = (0, import_react24.useRef)(() => false);
|
|
26309
|
+
const isFooterFrameSelectionRef = (0, import_react24.useRef)(false);
|
|
26310
|
+
const refreshActiveCommandsRef = (0, import_react24.useRef)(() => {
|
|
26166
26311
|
});
|
|
26167
|
-
const postToParentRef = (0,
|
|
26312
|
+
const postToParentRef = (0, import_react24.useRef)(postToParent2);
|
|
26168
26313
|
postToParentRef.current = postToParent2;
|
|
26169
|
-
const aiSectionApiRef = (0,
|
|
26170
|
-
const sectionsLoadedRef = (0,
|
|
26171
|
-
const pendingScheduleConfigRequests = (0,
|
|
26172
|
-
const [toolbarRect, setToolbarRect] = (0,
|
|
26173
|
-
const [formPickRect, setFormPickRect] = (0,
|
|
26174
|
-
const formPickElRef = (0,
|
|
26175
|
-
const [formViewState, setFormViewStateUi] = (0,
|
|
26176
|
-
const [formPickCount, setFormPickCount] = (0,
|
|
26177
|
-
const [formHoverRect, setFormHoverRect] = (0,
|
|
26178
|
-
const formHoverElRef = (0,
|
|
26179
|
-
const [fieldPickRect, setFieldPickRect] = (0,
|
|
26180
|
-
const fieldPickElRef = (0,
|
|
26181
|
-
const [fieldPickState, setFieldPickState] = (0,
|
|
26182
|
-
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0,
|
|
26183
|
-
const clearFormPick = (0,
|
|
26314
|
+
const aiSectionApiRef = (0, import_react24.useRef)(null);
|
|
26315
|
+
const sectionsLoadedRef = (0, import_react24.useRef)(false);
|
|
26316
|
+
const pendingScheduleConfigRequests = (0, import_react24.useRef)([]);
|
|
26317
|
+
const [toolbarRect, setToolbarRect] = (0, import_react24.useState)(null);
|
|
26318
|
+
const [formPickRect, setFormPickRect] = (0, import_react24.useState)(null);
|
|
26319
|
+
const formPickElRef = (0, import_react24.useRef)(null);
|
|
26320
|
+
const [formViewState, setFormViewStateUi] = (0, import_react24.useState)("default");
|
|
26321
|
+
const [formPickCount, setFormPickCount] = (0, import_react24.useState)(null);
|
|
26322
|
+
const [formHoverRect, setFormHoverRect] = (0, import_react24.useState)(null);
|
|
26323
|
+
const formHoverElRef = (0, import_react24.useRef)(null);
|
|
26324
|
+
const [fieldPickRect, setFieldPickRect] = (0, import_react24.useState)(null);
|
|
26325
|
+
const fieldPickElRef = (0, import_react24.useRef)(null);
|
|
26326
|
+
const [fieldPickState, setFieldPickState] = (0, import_react24.useState)(null);
|
|
26327
|
+
const [fieldTypePickerOpen, setFieldTypePickerOpen] = (0, import_react24.useState)(false);
|
|
26328
|
+
const clearFormPick = (0, import_react24.useCallback)(() => {
|
|
26184
26329
|
const form = formPickElRef.current;
|
|
26185
26330
|
const editing = fieldPickElRef.current;
|
|
26186
26331
|
if (commitPlaceholderEdit(editing) && editing) {
|
|
@@ -26200,7 +26345,7 @@ function OhhwellsBridge() {
|
|
|
26200
26345
|
formPickElRef.current = null;
|
|
26201
26346
|
setFormPickRect(null);
|
|
26202
26347
|
}, []);
|
|
26203
|
-
const clearFieldPick = (0,
|
|
26348
|
+
const clearFieldPick = (0, import_react24.useCallback)(() => {
|
|
26204
26349
|
const wrapper = fieldPickElRef.current;
|
|
26205
26350
|
if (commitPlaceholderEdit(wrapper) && wrapper) {
|
|
26206
26351
|
const form = wrapper.closest('[data-ohw-editable="form"]');
|
|
@@ -26210,9 +26355,9 @@ function OhhwellsBridge() {
|
|
|
26210
26355
|
setFieldPickRect(null);
|
|
26211
26356
|
setFieldPickState(null);
|
|
26212
26357
|
}, []);
|
|
26213
|
-
const persistFieldsRef = (0,
|
|
26358
|
+
const persistFieldsRef = (0, import_react24.useRef)(() => {
|
|
26214
26359
|
});
|
|
26215
|
-
const persistFields = (0,
|
|
26360
|
+
const persistFields = (0, import_react24.useCallback)(
|
|
26216
26361
|
(form) => {
|
|
26217
26362
|
const key = formKeyOf(form);
|
|
26218
26363
|
if (!key) return;
|
|
@@ -26223,7 +26368,7 @@ function OhhwellsBridge() {
|
|
|
26223
26368
|
[]
|
|
26224
26369
|
);
|
|
26225
26370
|
persistFieldsRef.current = persistFields;
|
|
26226
|
-
const selectField = (0,
|
|
26371
|
+
const selectField = (0, import_react24.useCallback)((wrapper) => {
|
|
26227
26372
|
if (fieldPickElRef.current && fieldPickElRef.current !== wrapper) {
|
|
26228
26373
|
commitPlaceholderEdit(fieldPickElRef.current);
|
|
26229
26374
|
}
|
|
@@ -26236,7 +26381,7 @@ function OhhwellsBridge() {
|
|
|
26236
26381
|
setFieldPickState({ type: fieldTypeOf(wrapper), required: isFieldRequired(wrapper) });
|
|
26237
26382
|
setFieldTypePickerOpen(false);
|
|
26238
26383
|
}, []);
|
|
26239
|
-
const withSelectedField = (0,
|
|
26384
|
+
const withSelectedField = (0, import_react24.useCallback)(
|
|
26240
26385
|
(run) => {
|
|
26241
26386
|
const wrapper = fieldPickElRef.current;
|
|
26242
26387
|
const form = formPickElRef.current;
|
|
@@ -26249,28 +26394,28 @@ function OhhwellsBridge() {
|
|
|
26249
26394
|
},
|
|
26250
26395
|
[persistFields]
|
|
26251
26396
|
);
|
|
26252
|
-
const handleFieldTypeChange = (0,
|
|
26397
|
+
const handleFieldTypeChange = (0, import_react24.useCallback)(
|
|
26253
26398
|
(type) => withSelectedField((_form, wrapper) => {
|
|
26254
26399
|
applyFieldType(wrapper, type);
|
|
26255
26400
|
selectField(wrapper);
|
|
26256
26401
|
}),
|
|
26257
26402
|
[selectField, withSelectedField]
|
|
26258
26403
|
);
|
|
26259
|
-
const handleFieldRequiredToggle = (0,
|
|
26404
|
+
const handleFieldRequiredToggle = (0, import_react24.useCallback)(
|
|
26260
26405
|
() => withSelectedField((_form, wrapper) => {
|
|
26261
26406
|
setFieldRequired(wrapper, !isFieldRequired(wrapper));
|
|
26262
26407
|
selectField(wrapper);
|
|
26263
26408
|
}),
|
|
26264
26409
|
[selectField, withSelectedField]
|
|
26265
26410
|
);
|
|
26266
|
-
const handleFieldDuplicate = (0,
|
|
26411
|
+
const handleFieldDuplicate = (0, import_react24.useCallback)(
|
|
26267
26412
|
() => withSelectedField((form, wrapper) => {
|
|
26268
26413
|
const copy = duplicateField(form, wrapper);
|
|
26269
26414
|
selectField(copy);
|
|
26270
26415
|
}),
|
|
26271
26416
|
[selectField, withSelectedField]
|
|
26272
26417
|
);
|
|
26273
|
-
const handleFieldDelete = (0,
|
|
26418
|
+
const handleFieldDelete = (0, import_react24.useCallback)(
|
|
26274
26419
|
() => withSelectedField((_form, wrapper) => {
|
|
26275
26420
|
removeField(wrapper);
|
|
26276
26421
|
clearFieldPick();
|
|
@@ -26278,7 +26423,7 @@ function OhhwellsBridge() {
|
|
|
26278
26423
|
}),
|
|
26279
26424
|
[clearFieldPick, withSelectedField]
|
|
26280
26425
|
);
|
|
26281
|
-
const handleAddField = (0,
|
|
26426
|
+
const handleAddField = (0, import_react24.useCallback)(
|
|
26282
26427
|
(type) => {
|
|
26283
26428
|
const form = formPickElRef.current;
|
|
26284
26429
|
if (!form) return;
|
|
@@ -26294,8 +26439,8 @@ function OhhwellsBridge() {
|
|
|
26294
26439
|
},
|
|
26295
26440
|
[persistFields, selectField]
|
|
26296
26441
|
);
|
|
26297
|
-
const fieldDragRef = (0,
|
|
26298
|
-
const buildFieldDropSlots = (0,
|
|
26442
|
+
const fieldDragRef = (0, import_react24.useRef)(null);
|
|
26443
|
+
const buildFieldDropSlots = (0, import_react24.useCallback)((form, draggedKey) => {
|
|
26299
26444
|
const others = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== draggedKey);
|
|
26300
26445
|
const slots = others.map((el) => {
|
|
26301
26446
|
const rect = el.getBoundingClientRect();
|
|
@@ -26308,7 +26453,7 @@ function OhhwellsBridge() {
|
|
|
26308
26453
|
}
|
|
26309
26454
|
return slots;
|
|
26310
26455
|
}, []);
|
|
26311
|
-
const handleFieldDragStart = (0,
|
|
26456
|
+
const handleFieldDragStart = (0, import_react24.useCallback)(() => {
|
|
26312
26457
|
const wrapper = fieldPickElRef.current;
|
|
26313
26458
|
const form = formPickElRef.current;
|
|
26314
26459
|
if (!wrapper || !form) return;
|
|
@@ -26317,18 +26462,18 @@ function OhhwellsBridge() {
|
|
|
26317
26462
|
setFieldDragging(true);
|
|
26318
26463
|
setFieldDropSlots(buildFieldDropSlots(form, key));
|
|
26319
26464
|
}, [buildFieldDropSlots]);
|
|
26320
|
-
const handleFieldDragEnd = (0,
|
|
26465
|
+
const handleFieldDragEnd = (0, import_react24.useCallback)(() => {
|
|
26321
26466
|
fieldDragRef.current = null;
|
|
26322
26467
|
setFieldDropIndex(null);
|
|
26323
26468
|
setFieldDropSlots([]);
|
|
26324
26469
|
setFieldDragging(false);
|
|
26325
26470
|
}, []);
|
|
26326
|
-
const [fieldDropIndex, setFieldDropIndex] = (0,
|
|
26327
|
-
const [fieldDropSlots, setFieldDropSlots] = (0,
|
|
26328
|
-
const [fieldDragging, setFieldDragging] = (0,
|
|
26329
|
-
const clearFormPickRef = (0,
|
|
26471
|
+
const [fieldDropIndex, setFieldDropIndex] = (0, import_react24.useState)(null);
|
|
26472
|
+
const [fieldDropSlots, setFieldDropSlots] = (0, import_react24.useState)([]);
|
|
26473
|
+
const [fieldDragging, setFieldDragging] = (0, import_react24.useState)(false);
|
|
26474
|
+
const clearFormPickRef = (0, import_react24.useRef)(clearFormPick);
|
|
26330
26475
|
clearFormPickRef.current = clearFormPick;
|
|
26331
|
-
(0,
|
|
26476
|
+
(0, import_react24.useEffect)(() => {
|
|
26332
26477
|
const el = fieldPickElRef.current;
|
|
26333
26478
|
if (!el || fieldPickRect === null) return;
|
|
26334
26479
|
const observer = new ResizeObserver(() => {
|
|
@@ -26337,7 +26482,7 @@ function OhhwellsBridge() {
|
|
|
26337
26482
|
observer.observe(el);
|
|
26338
26483
|
return () => observer.disconnect();
|
|
26339
26484
|
}, [fieldPickRect !== null, fieldPickState]);
|
|
26340
|
-
(0,
|
|
26485
|
+
(0, import_react24.useEffect)(() => {
|
|
26341
26486
|
const el = formPickElRef.current;
|
|
26342
26487
|
if (!el || formPickRect === null) return;
|
|
26343
26488
|
const observer = new ResizeObserver(() => {
|
|
@@ -26346,25 +26491,25 @@ function OhhwellsBridge() {
|
|
|
26346
26491
|
observer.observe(el);
|
|
26347
26492
|
return () => observer.disconnect();
|
|
26348
26493
|
}, [formPickRect !== null, formViewState]);
|
|
26349
|
-
const [toolbarVariant, setToolbarVariant] = (0,
|
|
26350
|
-
const toolbarVariantRef = (0,
|
|
26494
|
+
const [toolbarVariant, setToolbarVariant] = (0, import_react24.useState)("none");
|
|
26495
|
+
const toolbarVariantRef = (0, import_react24.useRef)("none");
|
|
26351
26496
|
toolbarVariantRef.current = toolbarVariant;
|
|
26352
|
-
const [selectedIsCta, setSelectedIsCta] = (0,
|
|
26353
|
-
const [selectedIsSocial, setSelectedIsSocial] = (0,
|
|
26354
|
-
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0,
|
|
26355
|
-
const [reorderHrefKey, setReorderHrefKey] = (0,
|
|
26356
|
-
const [reorderDragDisabled, setReorderDragDisabled] = (0,
|
|
26357
|
-
const [toggleState, setToggleState] = (0,
|
|
26358
|
-
const [maxBadge, setMaxBadge] = (0,
|
|
26359
|
-
const [activeCommands, setActiveCommands] = (0,
|
|
26360
|
-
const [sectionGap, setSectionGap] = (0,
|
|
26361
|
-
const [toolbarShowEditLink, setToolbarShowEditLink] = (0,
|
|
26362
|
-
const hoveredNavContainerRef = (0,
|
|
26363
|
-
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0,
|
|
26364
|
-
const hoveredItemElRef = (0,
|
|
26365
|
-
const [hoveredItemRect, setHoveredItemRect] = (0,
|
|
26366
|
-
const [hoveredTextRect, setHoveredTextRect] = (0,
|
|
26367
|
-
(0,
|
|
26497
|
+
const [selectedIsCta, setSelectedIsCta] = (0, import_react24.useState)(false);
|
|
26498
|
+
const [selectedIsSocial, setSelectedIsSocial] = (0, import_react24.useState)(false);
|
|
26499
|
+
const [selectedIsSocialsRow, setSelectedIsSocialsRow] = (0, import_react24.useState)(false);
|
|
26500
|
+
const [reorderHrefKey, setReorderHrefKey] = (0, import_react24.useState)(null);
|
|
26501
|
+
const [reorderDragDisabled, setReorderDragDisabled] = (0, import_react24.useState)(false);
|
|
26502
|
+
const [toggleState, setToggleState] = (0, import_react24.useState)(null);
|
|
26503
|
+
const [maxBadge, setMaxBadge] = (0, import_react24.useState)(null);
|
|
26504
|
+
const [activeCommands, setActiveCommands] = (0, import_react24.useState)(/* @__PURE__ */ new Set());
|
|
26505
|
+
const [sectionGap, setSectionGap] = (0, import_react24.useState)(null);
|
|
26506
|
+
const [toolbarShowEditLink, setToolbarShowEditLink] = (0, import_react24.useState)(false);
|
|
26507
|
+
const hoveredNavContainerRef = (0, import_react24.useRef)(null);
|
|
26508
|
+
const [hoveredNavContainerRect, setHoveredNavContainerRect] = (0, import_react24.useState)(null);
|
|
26509
|
+
const hoveredItemElRef = (0, import_react24.useRef)(null);
|
|
26510
|
+
const [hoveredItemRect, setHoveredItemRect] = (0, import_react24.useState)(null);
|
|
26511
|
+
const [hoveredTextRect, setHoveredTextRect] = (0, import_react24.useState)(null);
|
|
26512
|
+
(0, import_react24.useEffect)(() => {
|
|
26368
26513
|
const sync = () => {
|
|
26369
26514
|
const el = document.querySelector(
|
|
26370
26515
|
'[data-ohw-hovered]:not([contenteditable]):not([data-ohw-href-key]):not([data-ohw-editable="form"] *)'
|
|
@@ -26408,63 +26553,64 @@ function OhhwellsBridge() {
|
|
|
26408
26553
|
});
|
|
26409
26554
|
return () => observer.disconnect();
|
|
26410
26555
|
}, []);
|
|
26411
|
-
const siblingHintElRef = (0,
|
|
26412
|
-
const [siblingHintRect, setSiblingHintRect] = (0,
|
|
26413
|
-
const [siblingHintRects, setSiblingHintRects] = (0,
|
|
26414
|
-
const [isItemDragging, setIsItemDragging] = (0,
|
|
26415
|
-
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0,
|
|
26556
|
+
const siblingHintElRef = (0, import_react24.useRef)(null);
|
|
26557
|
+
const [siblingHintRect, setSiblingHintRect] = (0, import_react24.useState)(null);
|
|
26558
|
+
const [siblingHintRects, setSiblingHintRects] = (0, import_react24.useState)([]);
|
|
26559
|
+
const [isItemDragging, setIsItemDragging] = (0, import_react24.useState)(false);
|
|
26560
|
+
const [isFooterFrameSelection, setIsFooterFrameSelection] = (0, import_react24.useState)(false);
|
|
26416
26561
|
isFooterFrameSelectionRef.current = isFooterFrameSelection;
|
|
26417
|
-
const [floatingPanel, setFloatingPanel] = (0,
|
|
26418
|
-
const floatingPanelOpenRef = (0,
|
|
26562
|
+
const [floatingPanel, setFloatingPanel] = (0, import_react24.useState)(null);
|
|
26563
|
+
const floatingPanelOpenRef = (0, import_react24.useRef)(false);
|
|
26419
26564
|
floatingPanelOpenRef.current = floatingPanel !== null;
|
|
26420
|
-
const floatingPanelRef = (0,
|
|
26565
|
+
const floatingPanelRef = (0, import_react24.useRef)(null);
|
|
26421
26566
|
floatingPanelRef.current = floatingPanel;
|
|
26422
|
-
const [floatingPanelPos, setFloatingPanelPos] = (0,
|
|
26423
|
-
const buttonCollectionDragRef = (0,
|
|
26424
|
-
const buttonDropInsertIndexRef = (0,
|
|
26425
|
-
const [buttonDropSlots, setButtonDropSlots] = (0,
|
|
26426
|
-
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0,
|
|
26427
|
-
const buttonPointerDragRef = (0,
|
|
26428
|
-
const [buttonStyleTick, setButtonStyleTick] = (0,
|
|
26429
|
-
const [logoSizeDraft, setLogoSizeDraft] = (0,
|
|
26430
|
-
const [editorViewport, setEditorViewport] = (0,
|
|
26431
|
-
const [parentScrollSnap, setParentScrollSnap] = (0,
|
|
26432
|
-
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0,
|
|
26433
|
-
const [footerHeadingVisible, setFooterHeadingVisible] = (0,
|
|
26434
|
-
const footerDragRef = (0,
|
|
26435
|
-
const [footerDropSlots, setFooterDropSlots] = (0,
|
|
26436
|
-
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0,
|
|
26437
|
-
const [draggedItemRect, setDraggedItemRect] = (0,
|
|
26438
|
-
const footerPointerDragRef = (0,
|
|
26439
|
-
const suppressNextClickRef = (0,
|
|
26440
|
-
const suppressClickUntilRef = (0,
|
|
26441
|
-
const [linkPopover, setLinkPopover] = (0,
|
|
26442
|
-
const linkPopoverSessionRef = (0,
|
|
26443
|
-
const addNavAfterAnchorRef = (0,
|
|
26444
|
-
const editContentRef = (0,
|
|
26445
|
-
|
|
26446
|
-
const
|
|
26447
|
-
const
|
|
26567
|
+
const [floatingPanelPos, setFloatingPanelPos] = (0, import_react24.useState)(null);
|
|
26568
|
+
const buttonCollectionDragRef = (0, import_react24.useRef)(null);
|
|
26569
|
+
const buttonDropInsertIndexRef = (0, import_react24.useRef)(null);
|
|
26570
|
+
const [buttonDropSlots, setButtonDropSlots] = (0, import_react24.useState)([]);
|
|
26571
|
+
const [activeButtonDropIndex, setActiveButtonDropIndex] = (0, import_react24.useState)(null);
|
|
26572
|
+
const buttonPointerDragRef = (0, import_react24.useRef)(null);
|
|
26573
|
+
const [buttonStyleTick, setButtonStyleTick] = (0, import_react24.useState)(0);
|
|
26574
|
+
const [logoSizeDraft, setLogoSizeDraft] = (0, import_react24.useState)(null);
|
|
26575
|
+
const [editorViewport, setEditorViewport] = (0, import_react24.useState)("desktop");
|
|
26576
|
+
const [parentScrollSnap, setParentScrollSnap] = (0, import_react24.useState)(null);
|
|
26577
|
+
const [navDropdownPreviewOpen, setNavDropdownPreviewOpen] = (0, import_react24.useState)(null);
|
|
26578
|
+
const [footerHeadingVisible, setFooterHeadingVisible] = (0, import_react24.useState)(null);
|
|
26579
|
+
const footerDragRef = (0, import_react24.useRef)(null);
|
|
26580
|
+
const [footerDropSlots, setFooterDropSlots] = (0, import_react24.useState)([]);
|
|
26581
|
+
const [activeFooterDropIndex, setActiveFooterDropIndex] = (0, import_react24.useState)(null);
|
|
26582
|
+
const [draggedItemRect, setDraggedItemRect] = (0, import_react24.useState)(null);
|
|
26583
|
+
const footerPointerDragRef = (0, import_react24.useRef)(null);
|
|
26584
|
+
const suppressNextClickRef = (0, import_react24.useRef)(false);
|
|
26585
|
+
const suppressClickUntilRef = (0, import_react24.useRef)(0);
|
|
26586
|
+
const [linkPopover, setLinkPopover] = (0, import_react24.useState)(null);
|
|
26587
|
+
const linkPopoverSessionRef = (0, import_react24.useRef)(null);
|
|
26588
|
+
const addNavAfterAnchorRef = (0, import_react24.useRef)(null);
|
|
26589
|
+
const editContentRef = (0, import_react24.useRef)({});
|
|
26590
|
+
useBuildPageSync(isEditMode, editContentRef, postToParent2);
|
|
26591
|
+
const aiSectionsRef = (0, import_react24.useRef)("");
|
|
26592
|
+
const aiFooterRef = (0, import_react24.useRef)("");
|
|
26593
|
+
const applyTreeLocalRef = (0, import_react24.useRef)(
|
|
26448
26594
|
null
|
|
26449
26595
|
);
|
|
26450
|
-
const applyFooterTreeLocalRef = (0,
|
|
26451
|
-
const clearInteractionChromeRef = (0,
|
|
26596
|
+
const applyFooterTreeLocalRef = (0, import_react24.useRef)(null);
|
|
26597
|
+
const clearInteractionChromeRef = (0, import_react24.useRef)(() => {
|
|
26452
26598
|
});
|
|
26453
|
-
const brandKitRef = (0,
|
|
26454
|
-
const stylesRef = (0,
|
|
26455
|
-
const appliedDrawerRef = (0,
|
|
26456
|
-
const pendingDeleteUndoRef = (0,
|
|
26457
|
-
const [sitePages, setSitePages] = (0,
|
|
26458
|
-
const collectionItemsRef = (0,
|
|
26459
|
-
const [sectionsByPath, setSectionsByPath] = (0,
|
|
26460
|
-
const sectionsPrefetchGenRef = (0,
|
|
26461
|
-
const setLinkPopoverRef = (0,
|
|
26462
|
-
const linkPopoverPanelRef = (0,
|
|
26463
|
-
const linkPopoverOpenRef = (0,
|
|
26464
|
-
const linkPopoverGraceUntilRef = (0,
|
|
26599
|
+
const brandKitRef = (0, import_react24.useRef)("");
|
|
26600
|
+
const stylesRef = (0, import_react24.useRef)("");
|
|
26601
|
+
const appliedDrawerRef = (0, import_react24.useRef)(null);
|
|
26602
|
+
const pendingDeleteUndoRef = (0, import_react24.useRef)(null);
|
|
26603
|
+
const [sitePages, setSitePages] = (0, import_react24.useState)([]);
|
|
26604
|
+
const collectionItemsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Map());
|
|
26605
|
+
const [sectionsByPath, setSectionsByPath] = (0, import_react24.useState)({});
|
|
26606
|
+
const sectionsPrefetchGenRef = (0, import_react24.useRef)(0);
|
|
26607
|
+
const setLinkPopoverRef = (0, import_react24.useRef)(setLinkPopover);
|
|
26608
|
+
const linkPopoverPanelRef = (0, import_react24.useRef)(null);
|
|
26609
|
+
const linkPopoverOpenRef = (0, import_react24.useRef)(false);
|
|
26610
|
+
const linkPopoverGraceUntilRef = (0, import_react24.useRef)(0);
|
|
26465
26611
|
setLinkPopoverRef.current = setLinkPopover;
|
|
26466
26612
|
linkPopoverSessionRef.current = linkPopover;
|
|
26467
|
-
(0,
|
|
26613
|
+
(0, import_react24.useEffect)(() => {
|
|
26468
26614
|
setSectionOrderPersistHandler((entries) => {
|
|
26469
26615
|
const currentPath = window.location.pathname;
|
|
26470
26616
|
const merged = mergePageSectionOrder(editContentRef.current[SECTION_ORDER_KEY], currentPath, entries);
|
|
@@ -26474,7 +26620,7 @@ function OhhwellsBridge() {
|
|
|
26474
26620
|
});
|
|
26475
26621
|
return () => setSectionOrderPersistHandler(null);
|
|
26476
26622
|
}, []);
|
|
26477
|
-
(0,
|
|
26623
|
+
(0, import_react24.useEffect)(() => {
|
|
26478
26624
|
setAiFooterMountOptions({
|
|
26479
26625
|
resolvePageHref: (pageOrAnchorId) => {
|
|
26480
26626
|
const [pageId, anchor] = pageOrAnchorId.split("#");
|
|
@@ -26537,7 +26683,7 @@ function OhhwellsBridge() {
|
|
|
26537
26683
|
const bumpLinkPopoverGrace = () => {
|
|
26538
26684
|
linkPopoverGraceUntilRef.current = Date.now() + 350;
|
|
26539
26685
|
};
|
|
26540
|
-
const runSectionsPrefetch = (0,
|
|
26686
|
+
const runSectionsPrefetch = (0, import_react24.useCallback)((pages) => {
|
|
26541
26687
|
if (!isEditMode || shouldUseDevFixtures() || pages.length === 0) return;
|
|
26542
26688
|
const gen = ++sectionsPrefetchGenRef.current;
|
|
26543
26689
|
const paths = pages.map((p) => p.path);
|
|
@@ -26556,9 +26702,9 @@ function OhhwellsBridge() {
|
|
|
26556
26702
|
);
|
|
26557
26703
|
});
|
|
26558
26704
|
}, [isEditMode, pathname]);
|
|
26559
|
-
const runSectionsPrefetchRef = (0,
|
|
26705
|
+
const runSectionsPrefetchRef = (0, import_react24.useRef)(runSectionsPrefetch);
|
|
26560
26706
|
runSectionsPrefetchRef.current = runSectionsPrefetch;
|
|
26561
|
-
(0,
|
|
26707
|
+
(0, import_react24.useEffect)(() => {
|
|
26562
26708
|
if (!linkPopover) {
|
|
26563
26709
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26564
26710
|
return;
|
|
@@ -26586,7 +26732,7 @@ function OhhwellsBridge() {
|
|
|
26586
26732
|
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
26587
26733
|
};
|
|
26588
26734
|
}, [linkPopover, postToParent2]);
|
|
26589
|
-
(0,
|
|
26735
|
+
(0, import_react24.useEffect)(() => {
|
|
26590
26736
|
if (!isEditMode) return;
|
|
26591
26737
|
const useFixtures = shouldUseDevFixtures();
|
|
26592
26738
|
if (useFixtures) {
|
|
@@ -26612,7 +26758,7 @@ function OhhwellsBridge() {
|
|
|
26612
26758
|
if (!useFixtures) postToParent2({ type: "ow:request-site-pages" });
|
|
26613
26759
|
return () => window.removeEventListener("message", onSitePages);
|
|
26614
26760
|
}, [isEditMode, postToParent2]);
|
|
26615
|
-
(0,
|
|
26761
|
+
(0, import_react24.useEffect)(() => {
|
|
26616
26762
|
if (!isEditMode) return;
|
|
26617
26763
|
const deps = {
|
|
26618
26764
|
getEditContent: () => editContentRef.current,
|
|
@@ -26649,14 +26795,14 @@ function OhhwellsBridge() {
|
|
|
26649
26795
|
window.addEventListener("message", onPageMessage);
|
|
26650
26796
|
return () => window.removeEventListener("message", onPageMessage);
|
|
26651
26797
|
}, [isEditMode, postToParent2]);
|
|
26652
|
-
(0,
|
|
26798
|
+
(0, import_react24.useEffect)(() => {
|
|
26653
26799
|
if (!isEditMode || shouldUseDevFixtures()) return;
|
|
26654
26800
|
void loadAllSectionsManifest().then((manifest) => {
|
|
26655
26801
|
if (Object.keys(manifest).length === 0) return;
|
|
26656
26802
|
setSectionsByPath((prev) => ({ ...manifest, ...prev }));
|
|
26657
26803
|
});
|
|
26658
26804
|
}, [isEditMode]);
|
|
26659
|
-
(0,
|
|
26805
|
+
(0, import_react24.useEffect)(() => {
|
|
26660
26806
|
const update = () => {
|
|
26661
26807
|
const el = activeElRef.current ?? selectedElRef.current;
|
|
26662
26808
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
@@ -26680,10 +26826,10 @@ function OhhwellsBridge() {
|
|
|
26680
26826
|
vvp.removeEventListener("resize", update);
|
|
26681
26827
|
};
|
|
26682
26828
|
}, []);
|
|
26683
|
-
const refreshStateRules = (0,
|
|
26829
|
+
const refreshStateRules = (0, import_react24.useCallback)(() => {
|
|
26684
26830
|
editStylesRef.current?.forceHover && (editStylesRef.current.forceHover.textContent = collectStateRules());
|
|
26685
26831
|
}, []);
|
|
26686
|
-
const processConfigRequest = (0,
|
|
26832
|
+
const processConfigRequest = (0, import_react24.useCallback)((insertAfterVal) => {
|
|
26687
26833
|
const tracker = getSectionsTracker();
|
|
26688
26834
|
let entries = [];
|
|
26689
26835
|
try {
|
|
@@ -26706,7 +26852,7 @@ function OhhwellsBridge() {
|
|
|
26706
26852
|
}
|
|
26707
26853
|
window.postMessage({ type: "ow:schedule-config", insertAfter: insertAfterVal, scheduleId: null }, "*");
|
|
26708
26854
|
}, [isEditMode]);
|
|
26709
|
-
const deactivate = (0,
|
|
26855
|
+
const deactivate = (0, import_react24.useCallback)(() => {
|
|
26710
26856
|
const el = activeElRef.current;
|
|
26711
26857
|
if (!el) return;
|
|
26712
26858
|
const isFormBlock = el.dataset.ohwEditable === "form";
|
|
@@ -26772,12 +26918,12 @@ function OhhwellsBridge() {
|
|
|
26772
26918
|
setToolbarShowEditLink(false);
|
|
26773
26919
|
postToParent2({ type: "ow:exit-edit" });
|
|
26774
26920
|
}, [postToParent2]);
|
|
26775
|
-
const clearSelectedAttr = (0,
|
|
26921
|
+
const clearSelectedAttr = (0, import_react24.useCallback)(() => {
|
|
26776
26922
|
document.querySelectorAll("[data-ohw-selected]").forEach((el) => {
|
|
26777
26923
|
el.removeAttribute("data-ohw-selected");
|
|
26778
26924
|
});
|
|
26779
26925
|
}, []);
|
|
26780
|
-
const deselect = (0,
|
|
26926
|
+
const deselect = (0, import_react24.useCallback)(() => {
|
|
26781
26927
|
const nestedGroup = selectedElRef.current?.closest("[data-ohw-nav-children]") != null ? selectedElRef.current.closest("[data-ohw-nav-group]") : null;
|
|
26782
26928
|
clearSelectedAttr();
|
|
26783
26929
|
selectedElRef.current = null;
|
|
@@ -26813,20 +26959,20 @@ function OhhwellsBridge() {
|
|
|
26813
26959
|
setToolbarVariant("none");
|
|
26814
26960
|
}
|
|
26815
26961
|
}, [clearSelectedAttr]);
|
|
26816
|
-
const markSelected = (0,
|
|
26962
|
+
const markSelected = (0, import_react24.useCallback)((el) => {
|
|
26817
26963
|
clearSelectedAttr();
|
|
26818
26964
|
el.removeAttribute("data-ohw-hovered");
|
|
26819
26965
|
el.setAttribute("data-ohw-selected", "");
|
|
26820
26966
|
}, [clearSelectedAttr]);
|
|
26821
|
-
const isSelectedForHover = (0,
|
|
26967
|
+
const isSelectedForHover = (0, import_react24.useCallback)((el) => {
|
|
26822
26968
|
if (!el) return false;
|
|
26823
26969
|
return [selectedElRef.current, activeElRef.current].some(
|
|
26824
26970
|
(busy) => busy && (el === busy || busy.contains(el) || el.contains(busy))
|
|
26825
26971
|
);
|
|
26826
26972
|
}, []);
|
|
26827
|
-
const isSelectedForHoverRef = (0,
|
|
26973
|
+
const isSelectedForHoverRef = (0, import_react24.useRef)(isSelectedForHover);
|
|
26828
26974
|
isSelectedForHoverRef.current = isSelectedForHover;
|
|
26829
|
-
const resolveHrefKeyElement = (0,
|
|
26975
|
+
const resolveHrefKeyElement = (0, import_react24.useCallback)((hrefKey) => {
|
|
26830
26976
|
if (isFooterHrefKey(hrefKey)) {
|
|
26831
26977
|
return document.querySelector(
|
|
26832
26978
|
`footer [data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
@@ -26841,7 +26987,7 @@ function OhhwellsBridge() {
|
|
|
26841
26987
|
`[data-ohw-href-key="${CSS.escape(hrefKey)}"]`
|
|
26842
26988
|
);
|
|
26843
26989
|
}, []);
|
|
26844
|
-
const resyncSelectedNavigationItem = (0,
|
|
26990
|
+
const resyncSelectedNavigationItem = (0, import_react24.useCallback)(() => {
|
|
26845
26991
|
const hrefKey = selectedHrefKeyRef.current;
|
|
26846
26992
|
if (hrefKey) {
|
|
26847
26993
|
const link = resolveHrefKeyElement(hrefKey);
|
|
@@ -26879,7 +27025,7 @@ function OhhwellsBridge() {
|
|
|
26879
27025
|
);
|
|
26880
27026
|
}
|
|
26881
27027
|
}, [resolveHrefKeyElement]);
|
|
26882
|
-
const reselectNavigationItem = (0,
|
|
27028
|
+
const reselectNavigationItem = (0, import_react24.useCallback)((navAnchor) => {
|
|
26883
27029
|
selectedElRef.current = navAnchor;
|
|
26884
27030
|
selectedHrefKeyRef.current = navAnchor.getAttribute("data-ohw-href-key");
|
|
26885
27031
|
selectedFooterColAttrRef.current = null;
|
|
@@ -26910,7 +27056,7 @@ function OhhwellsBridge() {
|
|
|
26910
27056
|
setToolbarShowEditLink(false);
|
|
26911
27057
|
setActiveCommands(/* @__PURE__ */ new Set());
|
|
26912
27058
|
}, [markSelected]);
|
|
26913
|
-
const commitNavigationTextEdit = (0,
|
|
27059
|
+
const commitNavigationTextEdit = (0, import_react24.useCallback)((navAnchor) => {
|
|
26914
27060
|
const el = activeElRef.current;
|
|
26915
27061
|
if (!el) return;
|
|
26916
27062
|
const key = el.dataset.ohwKey;
|
|
@@ -26943,7 +27089,7 @@ function OhhwellsBridge() {
|
|
|
26943
27089
|
postToParent2({ type: "ow:exit-edit" });
|
|
26944
27090
|
reselectNavigationItem(navAnchor);
|
|
26945
27091
|
}, [postToParent2, reselectNavigationItem]);
|
|
26946
|
-
const handleAddTopLevelNavItem = (0,
|
|
27092
|
+
const handleAddTopLevelNavItem = (0, import_react24.useCallback)(() => {
|
|
26947
27093
|
const items = listNavbarRootItems();
|
|
26948
27094
|
addNavAfterAnchorRef.current = items[items.length - 1] ?? null;
|
|
26949
27095
|
deselectRef.current();
|
|
@@ -26955,7 +27101,7 @@ function OhhwellsBridge() {
|
|
|
26955
27101
|
intent: "add-nav"
|
|
26956
27102
|
});
|
|
26957
27103
|
}, []);
|
|
26958
|
-
const maybeWarnNavLinkDropdownConflict = (0,
|
|
27104
|
+
const maybeWarnNavLinkDropdownConflict = (0, import_react24.useCallback)(
|
|
26959
27105
|
(anchor) => {
|
|
26960
27106
|
if (!isNavbarHrefKey(anchor.getAttribute("data-ohw-href-key"))) return;
|
|
26961
27107
|
if (!navDropdownsOpenOnClick()) return;
|
|
@@ -26968,7 +27114,7 @@ function OhhwellsBridge() {
|
|
|
26968
27114
|
},
|
|
26969
27115
|
[postToParent2]
|
|
26970
27116
|
);
|
|
26971
|
-
const handleNavDropdownOpenChange = (0,
|
|
27117
|
+
const handleNavDropdownOpenChange = (0, import_react24.useCallback)((open) => {
|
|
26972
27118
|
const selected = selectedElRef.current;
|
|
26973
27119
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
26974
27120
|
if (isNestedNavChild(selected)) return;
|
|
@@ -26984,7 +27130,7 @@ function OhhwellsBridge() {
|
|
|
26984
27130
|
}
|
|
26985
27131
|
});
|
|
26986
27132
|
}, []);
|
|
26987
|
-
const handleFooterHeadingVisibleChange = (0,
|
|
27133
|
+
const handleFooterHeadingVisibleChange = (0, import_react24.useCallback)(
|
|
26988
27134
|
(visible) => {
|
|
26989
27135
|
const selected = selectedElRef.current;
|
|
26990
27136
|
if (!selected || !isFooterFrameSelectionRef.current) return;
|
|
@@ -27037,7 +27183,7 @@ function OhhwellsBridge() {
|
|
|
27037
27183
|
},
|
|
27038
27184
|
[postToParent2]
|
|
27039
27185
|
);
|
|
27040
|
-
const enterEditOnNewItem = (0,
|
|
27186
|
+
const enterEditOnNewItem = (0, import_react24.useCallback)((anchor) => {
|
|
27041
27187
|
const label = anchor.querySelector('[data-ohw-editable="text"]');
|
|
27042
27188
|
if (!label) {
|
|
27043
27189
|
selectRef.current(anchor);
|
|
@@ -27046,8 +27192,8 @@ function OhhwellsBridge() {
|
|
|
27046
27192
|
setNavGroupForceOpen(anchor, true);
|
|
27047
27193
|
activateRef.current(label);
|
|
27048
27194
|
}, []);
|
|
27049
|
-
const pendingSocialAddRef = (0,
|
|
27050
|
-
const handleAddChildItem = (0,
|
|
27195
|
+
const pendingSocialAddRef = (0, import_react24.useRef)(null);
|
|
27196
|
+
const handleAddChildItem = (0, import_react24.useCallback)(() => {
|
|
27051
27197
|
const selected = selectedElRef.current;
|
|
27052
27198
|
if (!selected) return;
|
|
27053
27199
|
const socialsRow = isSocialsRow(selected) ? selected : findSocialsRow(selected);
|
|
@@ -27174,7 +27320,7 @@ function OhhwellsBridge() {
|
|
|
27174
27320
|
});
|
|
27175
27321
|
});
|
|
27176
27322
|
}, [enterEditOnNewItem, isFooterFrameSelection, maybeWarnNavLinkDropdownConflict, postToParent2]);
|
|
27177
|
-
const handleAddFooterColumn = (0,
|
|
27323
|
+
const handleAddFooterColumn = (0, import_react24.useCallback)(() => {
|
|
27178
27324
|
if (document.querySelector("[data-ai-footer]")) {
|
|
27179
27325
|
const state = parseAiFooterState(aiFooterRef.current);
|
|
27180
27326
|
if (!state?.tree) return;
|
|
@@ -27230,7 +27376,7 @@ function OhhwellsBridge() {
|
|
|
27230
27376
|
selectRef.current(result.firstLink);
|
|
27231
27377
|
});
|
|
27232
27378
|
}, [postToParent2]);
|
|
27233
|
-
const clearFooterDragVisuals = (0,
|
|
27379
|
+
const clearFooterDragVisuals = (0, import_react24.useCallback)(() => {
|
|
27234
27380
|
footerDragRef.current = null;
|
|
27235
27381
|
setSiblingHintRects([]);
|
|
27236
27382
|
setFooterDropSlots([]);
|
|
@@ -27239,7 +27385,7 @@ function OhhwellsBridge() {
|
|
|
27239
27385
|
setIsItemDragging(false);
|
|
27240
27386
|
unlockFooterDragInteraction();
|
|
27241
27387
|
}, []);
|
|
27242
|
-
const refreshFooterDragVisuals = (0,
|
|
27388
|
+
const refreshFooterDragVisuals = (0, import_react24.useCallback)((session, activeSlot, clientX, clientY) => {
|
|
27243
27389
|
const dragged = session.draggedEl;
|
|
27244
27390
|
setDraggedItemRect(dragged.getBoundingClientRect());
|
|
27245
27391
|
if (typeof clientX === "number" && typeof clientY === "number") {
|
|
@@ -27271,13 +27417,13 @@ function OhhwellsBridge() {
|
|
|
27271
27417
|
const activeIdx = activeSlot ? slots.findIndex((s) => s.insertIndex === activeSlot.insertIndex) : -1;
|
|
27272
27418
|
setActiveFooterDropIndex(activeIdx >= 0 ? activeIdx : null);
|
|
27273
27419
|
}, []);
|
|
27274
|
-
const refreshFooterDragVisualsRef = (0,
|
|
27420
|
+
const refreshFooterDragVisualsRef = (0, import_react24.useRef)(refreshFooterDragVisuals);
|
|
27275
27421
|
refreshFooterDragVisualsRef.current = refreshFooterDragVisuals;
|
|
27276
|
-
const commitFooterDragRef = (0,
|
|
27422
|
+
const commitFooterDragRef = (0, import_react24.useRef)(() => {
|
|
27277
27423
|
});
|
|
27278
|
-
const beginFooterDragRef = (0,
|
|
27424
|
+
const beginFooterDragRef = (0, import_react24.useRef)(() => {
|
|
27279
27425
|
});
|
|
27280
|
-
const beginFooterDrag = (0,
|
|
27426
|
+
const beginFooterDrag = (0, import_react24.useCallback)(
|
|
27281
27427
|
(session) => {
|
|
27282
27428
|
const rect = session.draggedEl.getBoundingClientRect();
|
|
27283
27429
|
session.lastClientX = session.lastClientX || rect.left + rect.width / 2;
|
|
@@ -27297,7 +27443,7 @@ function OhhwellsBridge() {
|
|
|
27297
27443
|
[refreshFooterDragVisuals]
|
|
27298
27444
|
);
|
|
27299
27445
|
beginFooterDragRef.current = beginFooterDrag;
|
|
27300
|
-
const commitFooterDrag = (0,
|
|
27446
|
+
const commitFooterDrag = (0, import_react24.useCallback)(
|
|
27301
27447
|
(clientX, clientY) => {
|
|
27302
27448
|
const session = footerDragRef.current;
|
|
27303
27449
|
if (!session) {
|
|
@@ -27469,7 +27615,7 @@ function OhhwellsBridge() {
|
|
|
27469
27615
|
[clearFooterDragVisuals, resolveHrefKeyElement, resyncSelectedNavigationItem]
|
|
27470
27616
|
);
|
|
27471
27617
|
commitFooterDragRef.current = commitFooterDrag;
|
|
27472
|
-
const startFooterLinkDrag = (0,
|
|
27618
|
+
const startFooterLinkDrag = (0, import_react24.useCallback)(
|
|
27473
27619
|
(anchor, clientX, clientY, wasSelected) => {
|
|
27474
27620
|
const hrefKey = anchor.getAttribute("data-ohw-href-key");
|
|
27475
27621
|
if (!hrefKey) return false;
|
|
@@ -27505,7 +27651,7 @@ function OhhwellsBridge() {
|
|
|
27505
27651
|
},
|
|
27506
27652
|
[beginFooterDrag]
|
|
27507
27653
|
);
|
|
27508
|
-
const startFooterColumnDrag = (0,
|
|
27654
|
+
const startFooterColumnDrag = (0, import_react24.useCallback)(
|
|
27509
27655
|
(columnEl, clientX, clientY, wasSelected) => {
|
|
27510
27656
|
const columns = listFooterColumns(columnEl);
|
|
27511
27657
|
const idx = columns.indexOf(columnEl);
|
|
@@ -27525,7 +27671,7 @@ function OhhwellsBridge() {
|
|
|
27525
27671
|
},
|
|
27526
27672
|
[beginFooterDrag]
|
|
27527
27673
|
);
|
|
27528
|
-
const persistButtonCollectionDrag = (0,
|
|
27674
|
+
const persistButtonCollectionDrag = (0, import_react24.useCallback)(
|
|
27529
27675
|
(button, clientX) => {
|
|
27530
27676
|
const insertIndex = buttonDropInsertIndexRef.current;
|
|
27531
27677
|
if (insertIndex != null) insertButtonAtCollectionIndex(button, insertIndex);
|
|
@@ -27549,7 +27695,7 @@ function OhhwellsBridge() {
|
|
|
27549
27695
|
},
|
|
27550
27696
|
[postToParent2]
|
|
27551
27697
|
);
|
|
27552
|
-
const refreshButtonDragVisuals = (0,
|
|
27698
|
+
const refreshButtonDragVisuals = (0, import_react24.useCallback)((button, clientX, clientY) => {
|
|
27553
27699
|
const collection = buttonCollectionOf(button);
|
|
27554
27700
|
if (!collection) {
|
|
27555
27701
|
setButtonDropSlots([]);
|
|
@@ -27566,7 +27712,7 @@ function OhhwellsBridge() {
|
|
|
27566
27712
|
setDraggedItemRect(button.getBoundingClientRect());
|
|
27567
27713
|
if (selectedElRef.current === button) setToolbarRect(button.getBoundingClientRect());
|
|
27568
27714
|
}, []);
|
|
27569
|
-
const handleItemDragStart = (0,
|
|
27715
|
+
const handleItemDragStart = (0, import_react24.useCallback)(
|
|
27570
27716
|
(e) => {
|
|
27571
27717
|
const selected = selectedElRef.current;
|
|
27572
27718
|
if (!selected) {
|
|
@@ -27597,7 +27743,7 @@ function OhhwellsBridge() {
|
|
|
27597
27743
|
},
|
|
27598
27744
|
[startFooterColumnDrag, startFooterLinkDrag, startNavLinkDrag, refreshButtonDragVisuals]
|
|
27599
27745
|
);
|
|
27600
|
-
const handleItemDragEnd = (0,
|
|
27746
|
+
const handleItemDragEnd = (0, import_react24.useCallback)(
|
|
27601
27747
|
(e) => {
|
|
27602
27748
|
const collectionButton = buttonCollectionDragRef.current;
|
|
27603
27749
|
if (collectionButton) {
|
|
@@ -27628,7 +27774,7 @@ function OhhwellsBridge() {
|
|
|
27628
27774
|
},
|
|
27629
27775
|
[commitFooterDrag, commitNavDrag, navDragRef, persistButtonCollectionDrag]
|
|
27630
27776
|
);
|
|
27631
|
-
const handleItemChromePointerDown = (0,
|
|
27777
|
+
const handleItemChromePointerDown = (0, import_react24.useCallback)((e) => {
|
|
27632
27778
|
if (e.button !== 0) return;
|
|
27633
27779
|
const selected = selectedElRef.current;
|
|
27634
27780
|
if (!selected) return;
|
|
@@ -27669,7 +27815,7 @@ function OhhwellsBridge() {
|
|
|
27669
27815
|
}
|
|
27670
27816
|
if (armNavPressFromChrome(selected, e.clientX, e.clientY, e.pointerId)) return;
|
|
27671
27817
|
}, [armNavPressFromChrome]);
|
|
27672
|
-
const handleItemChromeClick = (0,
|
|
27818
|
+
const handleItemChromeClick = (0, import_react24.useCallback)((clientX, clientY) => {
|
|
27673
27819
|
if (suppressNextClickRef.current || Date.now() < suppressClickUntilRef.current) {
|
|
27674
27820
|
suppressNextClickRef.current = false;
|
|
27675
27821
|
return;
|
|
@@ -27682,7 +27828,7 @@ function OhhwellsBridge() {
|
|
|
27682
27828
|
}, []);
|
|
27683
27829
|
reselectNavigationItemRef.current = reselectNavigationItem;
|
|
27684
27830
|
commitNavigationTextEditRef.current = commitNavigationTextEdit;
|
|
27685
|
-
const select = (0,
|
|
27831
|
+
const select = (0, import_react24.useCallback)((anchor) => {
|
|
27686
27832
|
if (!isNavigationItem2(anchor)) return;
|
|
27687
27833
|
if (activeElRef.current) deactivate();
|
|
27688
27834
|
clearSocialSelectionRef.current();
|
|
@@ -27759,7 +27905,7 @@ function OhhwellsBridge() {
|
|
|
27759
27905
|
setLogoSizeDraft(null);
|
|
27760
27906
|
}
|
|
27761
27907
|
}, [deactivate, markSelected]);
|
|
27762
|
-
const selectFrame = (0,
|
|
27908
|
+
const selectFrame = (0, import_react24.useCallback)((el) => {
|
|
27763
27909
|
if (!isNavigationContainer(el)) return;
|
|
27764
27910
|
if (activeElRef.current) deactivate();
|
|
27765
27911
|
aiSectionApiRef.current?.selectFromElement(el);
|
|
@@ -27800,7 +27946,7 @@ function OhhwellsBridge() {
|
|
|
27800
27946
|
setFloatingPanelPos(null);
|
|
27801
27947
|
setLogoSizeDraft(null);
|
|
27802
27948
|
}, [deactivate, markSelected, postToParent2]);
|
|
27803
|
-
const selectLogo = (0,
|
|
27949
|
+
const selectLogo = (0, import_react24.useCallback)(
|
|
27804
27950
|
(logoEl) => {
|
|
27805
27951
|
if (activeElRef.current) deactivate();
|
|
27806
27952
|
selectedElRef.current = logoEl;
|
|
@@ -27829,7 +27975,7 @@ function OhhwellsBridge() {
|
|
|
27829
27975
|
},
|
|
27830
27976
|
[deactivate, markSelected]
|
|
27831
27977
|
);
|
|
27832
|
-
const openLogoSizePanel = (0,
|
|
27978
|
+
const openLogoSizePanel = (0, import_react24.useCallback)((logoEl) => {
|
|
27833
27979
|
const placement = getLogoPlacement(logoEl);
|
|
27834
27980
|
const draft = readLogoSizeState(editContentRef.current, placement);
|
|
27835
27981
|
setLogoSizeDraft(draft);
|
|
@@ -27842,7 +27988,7 @@ function OhhwellsBridge() {
|
|
|
27842
27988
|
placement
|
|
27843
27989
|
});
|
|
27844
27990
|
}, []);
|
|
27845
|
-
const openSocialsDisplayPanel = (0,
|
|
27991
|
+
const openSocialsDisplayPanel = (0, import_react24.useCallback)((row) => {
|
|
27846
27992
|
setFloatingPanelPos(null);
|
|
27847
27993
|
setParentScrollSnap(parentScrollRef.current);
|
|
27848
27994
|
setFloatingPanel({
|
|
@@ -27853,7 +27999,7 @@ function OhhwellsBridge() {
|
|
|
27853
27999
|
row
|
|
27854
28000
|
});
|
|
27855
28001
|
}, []);
|
|
27856
|
-
const rememberButtonTokens = (0,
|
|
28002
|
+
const rememberButtonTokens = (0, import_react24.useCallback)(
|
|
27857
28003
|
(content, tokens, nodes) => {
|
|
27858
28004
|
if (nodes.length === 0) return content;
|
|
27859
28005
|
const next = { ...content };
|
|
@@ -27864,7 +28010,7 @@ function OhhwellsBridge() {
|
|
|
27864
28010
|
},
|
|
27865
28011
|
[postToParent2]
|
|
27866
28012
|
);
|
|
27867
|
-
const tokensForButton = (0,
|
|
28013
|
+
const tokensForButton = (0, import_react24.useCallback)(
|
|
27868
28014
|
(el, persistFallback = false) => {
|
|
27869
28015
|
const stored = readStoredStyleTokens(editContentRef.current);
|
|
27870
28016
|
if (stored) return stored;
|
|
@@ -27879,7 +28025,7 @@ function OhhwellsBridge() {
|
|
|
27879
28025
|
},
|
|
27880
28026
|
[rememberButtonTokens]
|
|
27881
28027
|
);
|
|
27882
|
-
const openButtonStylePanel = (0,
|
|
28028
|
+
const openButtonStylePanel = (0, import_react24.useCallback)(
|
|
27883
28029
|
(anchor) => {
|
|
27884
28030
|
const id = buttonId(anchor);
|
|
27885
28031
|
if (!id) return;
|
|
@@ -27897,7 +28043,7 @@ function OhhwellsBridge() {
|
|
|
27897
28043
|
},
|
|
27898
28044
|
[tokensForButton]
|
|
27899
28045
|
);
|
|
27900
|
-
const applySelectedButtonStyle = (0,
|
|
28046
|
+
const applySelectedButtonStyle = (0, import_react24.useCallback)(
|
|
27901
28047
|
(patch) => {
|
|
27902
28048
|
const panel = floatingPanelRef.current;
|
|
27903
28049
|
const id = panel?.kind === "button-style" ? panel.buttonId : null;
|
|
@@ -27915,7 +28061,7 @@ function OhhwellsBridge() {
|
|
|
27915
28061
|
},
|
|
27916
28062
|
[postToParent2]
|
|
27917
28063
|
);
|
|
27918
|
-
(0,
|
|
28064
|
+
(0, import_react24.useEffect)(() => {
|
|
27919
28065
|
const onDragOver = (e) => {
|
|
27920
28066
|
const dragged = buttonCollectionDragRef.current;
|
|
27921
28067
|
if (!dragged) return;
|
|
@@ -27934,11 +28080,11 @@ function OhhwellsBridge() {
|
|
|
27934
28080
|
document.removeEventListener("drop", onDrop);
|
|
27935
28081
|
};
|
|
27936
28082
|
}, [refreshButtonDragVisuals]);
|
|
27937
|
-
const isEditModeRef = (0,
|
|
27938
|
-
const requestMissingSocialIconsRef = (0,
|
|
28083
|
+
const isEditModeRef = (0, import_react24.useRef)(false);
|
|
28084
|
+
const requestMissingSocialIconsRef = (0, import_react24.useRef)(() => {
|
|
27939
28085
|
});
|
|
27940
|
-
const askedSocialIconsRef = (0,
|
|
27941
|
-
const requestMissingSocialIcons = (0,
|
|
28086
|
+
const askedSocialIconsRef = (0, import_react24.useRef)(/* @__PURE__ */ new Set());
|
|
28087
|
+
const requestMissingSocialIcons = (0, import_react24.useCallback)(() => {
|
|
27942
28088
|
const items = Array.from(document.querySelectorAll(`[${SOCIALS_ROW_ATTR}]`)).filter((row) => socialsDisplayFor(row, editContentRef.current).icon).flatMap((row) => {
|
|
27943
28089
|
const missing = socialsMissingIcons(row);
|
|
27944
28090
|
listSocialItems(row).forEach((item) => ensureIconSlot(item));
|
|
@@ -27950,7 +28096,7 @@ function OhhwellsBridge() {
|
|
|
27950
28096
|
}, []);
|
|
27951
28097
|
requestMissingSocialIconsRef.current = requestMissingSocialIcons;
|
|
27952
28098
|
isEditModeRef.current = isEditMode;
|
|
27953
|
-
const changeSocialsDisplay = (0,
|
|
28099
|
+
const changeSocialsDisplay = (0, import_react24.useCallback)(
|
|
27954
28100
|
(row, next) => {
|
|
27955
28101
|
if (next.icon) {
|
|
27956
28102
|
const missing = socialsMissingIcons(row);
|
|
@@ -27974,19 +28120,19 @@ function OhhwellsBridge() {
|
|
|
27974
28120
|
},
|
|
27975
28121
|
[]
|
|
27976
28122
|
);
|
|
27977
|
-
const closeFloatingPanelOnly = (0,
|
|
28123
|
+
const closeFloatingPanelOnly = (0, import_react24.useCallback)(() => {
|
|
27978
28124
|
setFloatingPanel(null);
|
|
27979
28125
|
setFloatingPanelPos(null);
|
|
27980
28126
|
setLogoSizeDraft(null);
|
|
27981
28127
|
}, []);
|
|
27982
28128
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
27983
|
-
const closeFloatingPanelAndDeselect = (0,
|
|
28129
|
+
const closeFloatingPanelAndDeselect = (0, import_react24.useCallback)(() => {
|
|
27984
28130
|
setFloatingPanel(null);
|
|
27985
28131
|
setFloatingPanelPos(null);
|
|
27986
28132
|
setLogoSizeDraft(null);
|
|
27987
28133
|
deselectRef.current();
|
|
27988
28134
|
}, []);
|
|
27989
|
-
(0,
|
|
28135
|
+
(0, import_react24.useEffect)(() => {
|
|
27990
28136
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
27991
28137
|
if (!session || !logoSizeDraft) {
|
|
27992
28138
|
postToParentRef.current({ type: "ow:logo-size-panel", open: false });
|
|
@@ -28005,7 +28151,7 @@ function OhhwellsBridge() {
|
|
|
28005
28151
|
max: LOGO_SIZE_MAX
|
|
28006
28152
|
});
|
|
28007
28153
|
}, [floatingPanel, logoSizeDraft, editorViewport]);
|
|
28008
|
-
const persistLogoSizeDraft = (0,
|
|
28154
|
+
const persistLogoSizeDraft = (0, import_react24.useCallback)(
|
|
28009
28155
|
(placement, draft) => {
|
|
28010
28156
|
const desktopKey = LOGO_SIZE_DESKTOP_KEYS[placement];
|
|
28011
28157
|
const mobileKey = LOGO_SIZE_MOBILE_KEYS[placement];
|
|
@@ -28045,7 +28191,7 @@ function OhhwellsBridge() {
|
|
|
28045
28191
|
},
|
|
28046
28192
|
[postToParent2]
|
|
28047
28193
|
);
|
|
28048
|
-
const activate = (0,
|
|
28194
|
+
const activate = (0, import_react24.useCallback)((el, options) => {
|
|
28049
28195
|
if (activeElRef.current === el) return;
|
|
28050
28196
|
document.querySelectorAll("[data-ohw-hovered]").forEach((hovered) => {
|
|
28051
28197
|
hovered.removeAttribute("data-ohw-hovered");
|
|
@@ -28143,8 +28289,8 @@ function OhhwellsBridge() {
|
|
|
28143
28289
|
openLogoSizePanelRef.current = openLogoSizePanel;
|
|
28144
28290
|
deselectRef.current = deselect;
|
|
28145
28291
|
closeFloatingPanelOnlyRef.current = closeFloatingPanelOnly;
|
|
28146
|
-
const lastSiteWideScopeRef = (0,
|
|
28147
|
-
(0,
|
|
28292
|
+
const lastSiteWideScopeRef = (0, import_react24.useRef)(null);
|
|
28293
|
+
(0, import_react24.useEffect)(() => {
|
|
28148
28294
|
if (!isEditMode) {
|
|
28149
28295
|
if (lastSiteWideScopeRef.current !== false) {
|
|
28150
28296
|
lastSiteWideScopeRef.current = false;
|
|
@@ -28170,7 +28316,7 @@ function OhhwellsBridge() {
|
|
|
28170
28316
|
isFooterFrameSelection,
|
|
28171
28317
|
postToParent2
|
|
28172
28318
|
]);
|
|
28173
|
-
(0,
|
|
28319
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
28174
28320
|
if (!subdomain || isEditMode) {
|
|
28175
28321
|
setFetchState("done");
|
|
28176
28322
|
return;
|
|
@@ -28321,7 +28467,7 @@ function OhhwellsBridge() {
|
|
|
28321
28467
|
cancelled = true;
|
|
28322
28468
|
};
|
|
28323
28469
|
}, [subdomain, isEditMode]);
|
|
28324
|
-
(0,
|
|
28470
|
+
(0, import_react24.useEffect)(() => {
|
|
28325
28471
|
if (!isEditMode) return;
|
|
28326
28472
|
const resolveIndex = (form, clientY) => {
|
|
28327
28473
|
const wrappers = listFieldWrappers(form).filter((el) => fieldKeyOf(el) !== fieldDragRef.current?.key);
|
|
@@ -28362,7 +28508,7 @@ function OhhwellsBridge() {
|
|
|
28362
28508
|
window.removeEventListener("drop", onDrop, true);
|
|
28363
28509
|
};
|
|
28364
28510
|
}, [buildFieldDropSlots, isEditMode, persistFields, selectField]);
|
|
28365
|
-
(0,
|
|
28511
|
+
(0, import_react24.useEffect)(() => {
|
|
28366
28512
|
if (!isEditMode) return;
|
|
28367
28513
|
const mark = () => document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28368
28514
|
markFormFields(form);
|
|
@@ -28374,7 +28520,7 @@ function OhhwellsBridge() {
|
|
|
28374
28520
|
});
|
|
28375
28521
|
return () => observer.disconnect();
|
|
28376
28522
|
}, [isEditMode, fetchState, pathname]);
|
|
28377
|
-
(0,
|
|
28523
|
+
(0, import_react24.useEffect)(() => {
|
|
28378
28524
|
if (!isEditMode) return;
|
|
28379
28525
|
let saveTimer = null;
|
|
28380
28526
|
const onInput = (e) => {
|
|
@@ -28396,14 +28542,14 @@ function OhhwellsBridge() {
|
|
|
28396
28542
|
document.addEventListener("input", onInput, true);
|
|
28397
28543
|
return () => document.removeEventListener("input", onInput, true);
|
|
28398
28544
|
}, [isEditMode, persistFields]);
|
|
28399
|
-
(0,
|
|
28545
|
+
(0, import_react24.useEffect)(() => {
|
|
28400
28546
|
if (isEditMode || fetchState !== "done") return;
|
|
28401
28547
|
const content = contentCache.get(subdomain) ?? {};
|
|
28402
28548
|
document.querySelectorAll('[data-ohw-editable="form"]').forEach((form) => {
|
|
28403
28549
|
reconcileFieldsFromContent(form, content);
|
|
28404
28550
|
});
|
|
28405
28551
|
}, [isEditMode, fetchState, subdomain]);
|
|
28406
|
-
(0,
|
|
28552
|
+
(0, import_react24.useEffect)(() => {
|
|
28407
28553
|
if (!isEditMode) return;
|
|
28408
28554
|
const swallow = (e) => {
|
|
28409
28555
|
const target = e.target;
|
|
@@ -28412,14 +28558,14 @@ function OhhwellsBridge() {
|
|
|
28412
28558
|
document.addEventListener("submit", swallow, true);
|
|
28413
28559
|
return () => document.removeEventListener("submit", swallow, true);
|
|
28414
28560
|
}, [isEditMode]);
|
|
28415
|
-
(0,
|
|
28561
|
+
(0, import_react24.useEffect)(() => {
|
|
28416
28562
|
if (isEditMode || fetchState !== "done") return;
|
|
28417
28563
|
console.log("env", process.env.NEXT_PUBLIC_FLOWOPS_API_URL);
|
|
28418
28564
|
const apiUrl = process.env.NEXT_PUBLIC_FLOWOPS_API_URL ?? "https://flowops-backend-staging-2yfdh7pwpq-as.a.run.app";
|
|
28419
28565
|
console.log({ apiUrl, subdomain });
|
|
28420
28566
|
bindPublishedForms(apiUrl, subdomain, contentCache.get(subdomain) ?? {});
|
|
28421
28567
|
}, [isEditMode, fetchState, subdomain]);
|
|
28422
|
-
(0,
|
|
28568
|
+
(0, import_react24.useEffect)(() => {
|
|
28423
28569
|
if (!subdomain || isEditMode) return;
|
|
28424
28570
|
let debounceTimer = null;
|
|
28425
28571
|
let observer = null;
|
|
@@ -28536,16 +28682,16 @@ function OhhwellsBridge() {
|
|
|
28536
28682
|
if (debounceTimer) clearTimeout(debounceTimer);
|
|
28537
28683
|
};
|
|
28538
28684
|
}, [subdomain, isEditMode, pathname]);
|
|
28539
|
-
(0,
|
|
28685
|
+
(0, import_react24.useLayoutEffect)(() => {
|
|
28540
28686
|
const el = document.getElementById("ohw-loader");
|
|
28541
28687
|
if (!el) return;
|
|
28542
28688
|
const visible = Boolean(subdomain) && fetchState !== "done";
|
|
28543
28689
|
el.style.display = visible ? "flex" : "none";
|
|
28544
28690
|
}, [subdomain, fetchState]);
|
|
28545
|
-
(0,
|
|
28691
|
+
(0, import_react24.useEffect)(() => {
|
|
28546
28692
|
postToParent2({ type: "ow:navigation", path: pathname });
|
|
28547
28693
|
}, [pathname, postToParent2]);
|
|
28548
|
-
(0,
|
|
28694
|
+
(0, import_react24.useEffect)(() => {
|
|
28549
28695
|
if (!subdomain || isEditMode) return;
|
|
28550
28696
|
const content = contentCache.get(subdomain);
|
|
28551
28697
|
if (!content) return;
|
|
@@ -28563,7 +28709,7 @@ function OhhwellsBridge() {
|
|
|
28563
28709
|
}
|
|
28564
28710
|
applyAiFooterFromContent(content);
|
|
28565
28711
|
}, [pathname, subdomain, isEditMode]);
|
|
28566
|
-
(0,
|
|
28712
|
+
(0, import_react24.useEffect)(() => {
|
|
28567
28713
|
if (!isEditMode) return;
|
|
28568
28714
|
if (linkPopoverSessionRef.current?.intent === "add-nav") return;
|
|
28569
28715
|
if (document.querySelector("[data-ohw-section-picker]")) return;
|
|
@@ -28571,12 +28717,12 @@ function OhhwellsBridge() {
|
|
|
28571
28717
|
deselectRef.current();
|
|
28572
28718
|
deactivateRef.current();
|
|
28573
28719
|
}, [pathname, isEditMode]);
|
|
28574
|
-
(0,
|
|
28720
|
+
(0, import_react24.useEffect)(() => {
|
|
28575
28721
|
if (!isEditMode) return;
|
|
28576
28722
|
initSectionInstancesFromContent(editContentRef.current, pathname);
|
|
28577
28723
|
initItemInstancesFromContent(editContentRef.current);
|
|
28578
28724
|
}, [pathname, isEditMode]);
|
|
28579
|
-
(0,
|
|
28725
|
+
(0, import_react24.useEffect)(() => {
|
|
28580
28726
|
if (!isEditMode) return;
|
|
28581
28727
|
const observer = new MutationObserver(() => {
|
|
28582
28728
|
const drawer = document.querySelector("[data-ohw-nav-drawer]");
|
|
@@ -28587,7 +28733,7 @@ function OhhwellsBridge() {
|
|
|
28587
28733
|
observer.observe(document.body, { childList: true, subtree: true });
|
|
28588
28734
|
return () => observer.disconnect();
|
|
28589
28735
|
}, [isEditMode, pathname]);
|
|
28590
|
-
(0,
|
|
28736
|
+
(0, import_react24.useEffect)(() => {
|
|
28591
28737
|
const contentForNav = () => {
|
|
28592
28738
|
if (isEditMode) return editContentRef.current;
|
|
28593
28739
|
if (!subdomain) return {};
|
|
@@ -28660,7 +28806,7 @@ function OhhwellsBridge() {
|
|
|
28660
28806
|
observer?.disconnect();
|
|
28661
28807
|
};
|
|
28662
28808
|
}, [isEditMode, pathname, subdomain, fetchState, resyncSelectedNavigationItem]);
|
|
28663
|
-
(0,
|
|
28809
|
+
(0, import_react24.useEffect)(() => {
|
|
28664
28810
|
if (!isEditMode) return;
|
|
28665
28811
|
let applying = false;
|
|
28666
28812
|
let rafId = null;
|
|
@@ -28698,7 +28844,7 @@ function OhhwellsBridge() {
|
|
|
28698
28844
|
observer.disconnect();
|
|
28699
28845
|
};
|
|
28700
28846
|
}, [isEditMode, pathname]);
|
|
28701
|
-
(0,
|
|
28847
|
+
(0, import_react24.useEffect)(() => {
|
|
28702
28848
|
if (!isEditMode) return;
|
|
28703
28849
|
let lastPosted = 0;
|
|
28704
28850
|
const measure = () => {
|
|
@@ -28742,7 +28888,7 @@ function OhhwellsBridge() {
|
|
|
28742
28888
|
window.removeEventListener("resize", handleResize);
|
|
28743
28889
|
};
|
|
28744
28890
|
}, [pathname, isEditMode, postToParent2]);
|
|
28745
|
-
(0,
|
|
28891
|
+
(0, import_react24.useEffect)(() => {
|
|
28746
28892
|
if (isEditMode) return;
|
|
28747
28893
|
const handleClick = (e) => {
|
|
28748
28894
|
if (!isPlainLeftClick(e)) return;
|
|
@@ -28756,7 +28902,7 @@ function OhhwellsBridge() {
|
|
|
28756
28902
|
document.addEventListener("click", handleClick, true);
|
|
28757
28903
|
return () => document.removeEventListener("click", handleClick, true);
|
|
28758
28904
|
}, [isEditMode, router, pathname]);
|
|
28759
|
-
(0,
|
|
28905
|
+
(0, import_react24.useEffect)(() => {
|
|
28760
28906
|
if (!isEditMode) {
|
|
28761
28907
|
editStylesRef.current?.base.remove();
|
|
28762
28908
|
editStylesRef.current?.forceHover.remove();
|
|
@@ -32211,7 +32357,7 @@ function OhhwellsBridge() {
|
|
|
32211
32357
|
if (imageShowTimerRef.current) clearTimeout(imageShowTimerRef.current);
|
|
32212
32358
|
};
|
|
32213
32359
|
}, [isEditMode, refreshStateRules]);
|
|
32214
|
-
(0,
|
|
32360
|
+
(0, import_react24.useEffect)(() => {
|
|
32215
32361
|
if (!isEditMode) return;
|
|
32216
32362
|
const THRESHOLD = 10;
|
|
32217
32363
|
const resolveWasSelected = (el) => {
|
|
@@ -32367,7 +32513,7 @@ function OhhwellsBridge() {
|
|
|
32367
32513
|
unlockFooterDragInteraction();
|
|
32368
32514
|
};
|
|
32369
32515
|
}, [isEditMode]);
|
|
32370
|
-
(0,
|
|
32516
|
+
(0, import_react24.useEffect)(() => {
|
|
32371
32517
|
if (!isEditMode) return;
|
|
32372
32518
|
const THRESHOLD = 10;
|
|
32373
32519
|
const onPointerDown = (e) => {
|
|
@@ -32458,7 +32604,7 @@ function OhhwellsBridge() {
|
|
|
32458
32604
|
document.removeEventListener("selectstart", blockSelectStart, true);
|
|
32459
32605
|
};
|
|
32460
32606
|
}, [isEditMode, persistButtonCollectionDrag, refreshButtonDragVisuals]);
|
|
32461
|
-
(0,
|
|
32607
|
+
(0, import_react24.useEffect)(() => {
|
|
32462
32608
|
const handler = (e) => {
|
|
32463
32609
|
if (e.data?.type !== "ow:request-schedule-config") return;
|
|
32464
32610
|
const insertAfterVal = e.data.insertAfter;
|
|
@@ -32474,7 +32620,7 @@ function OhhwellsBridge() {
|
|
|
32474
32620
|
window.addEventListener("message", handler);
|
|
32475
32621
|
return () => window.removeEventListener("message", handler);
|
|
32476
32622
|
}, [processConfigRequest]);
|
|
32477
|
-
(0,
|
|
32623
|
+
(0, import_react24.useEffect)(() => {
|
|
32478
32624
|
if (!isEditMode) return;
|
|
32479
32625
|
document.querySelectorAll("[data-ohw-active-state]").forEach((el) => {
|
|
32480
32626
|
el.removeAttribute("data-ohw-active-state");
|
|
@@ -32498,7 +32644,7 @@ function OhhwellsBridge() {
|
|
|
32498
32644
|
postToParent2({
|
|
32499
32645
|
type: "ow:ready",
|
|
32500
32646
|
version: "1",
|
|
32501
|
-
bridgeVersion: "0.1.
|
|
32647
|
+
bridgeVersion: "0.1.165",
|
|
32502
32648
|
path: pathname,
|
|
32503
32649
|
nodes: collectEditableNodes(editContentRef.current),
|
|
32504
32650
|
sections
|
|
@@ -32510,13 +32656,13 @@ function OhhwellsBridge() {
|
|
|
32510
32656
|
clearTimeout(timer);
|
|
32511
32657
|
};
|
|
32512
32658
|
}, [pathname, isEditMode, refreshStateRules, postToParent2]);
|
|
32513
|
-
(0,
|
|
32659
|
+
(0, import_react24.useEffect)(() => {
|
|
32514
32660
|
scrollToHashSectionWhenReady();
|
|
32515
32661
|
const onHashChange = () => scrollToHashSectionWhenReady();
|
|
32516
32662
|
window.addEventListener("hashchange", onHashChange);
|
|
32517
32663
|
return () => window.removeEventListener("hashchange", onHashChange);
|
|
32518
32664
|
}, [pathname]);
|
|
32519
|
-
const handleCommand = (0,
|
|
32665
|
+
const handleCommand = (0, import_react24.useCallback)((cmd) => {
|
|
32520
32666
|
const el = activeElRef.current;
|
|
32521
32667
|
const selBefore = window.getSelection();
|
|
32522
32668
|
let savedOffsets = null;
|
|
@@ -32552,7 +32698,7 @@ function OhhwellsBridge() {
|
|
|
32552
32698
|
if (el) setToolbarRect(getEditMeasureEl(el).getBoundingClientRect());
|
|
32553
32699
|
refreshActiveCommandsRef.current();
|
|
32554
32700
|
}, []);
|
|
32555
|
-
(0,
|
|
32701
|
+
(0, import_react24.useEffect)(() => {
|
|
32556
32702
|
const session = floatingPanel && floatingPanel.kind === "logo-size" ? floatingPanel : null;
|
|
32557
32703
|
if (!session || !logoSizeDraft) return;
|
|
32558
32704
|
const onPanelAction = (e) => {
|
|
@@ -32590,7 +32736,7 @@ function OhhwellsBridge() {
|
|
|
32590
32736
|
window.addEventListener("message", onPanelAction);
|
|
32591
32737
|
return () => window.removeEventListener("message", onPanelAction);
|
|
32592
32738
|
}, [floatingPanel, logoSizeDraft, editorViewport, persistLogoSizeDraft, closeFloatingPanelAndDeselect]);
|
|
32593
|
-
const handleStateChange = (0,
|
|
32739
|
+
const handleStateChange = (0, import_react24.useCallback)((state) => {
|
|
32594
32740
|
if (!activeStateElRef.current) return;
|
|
32595
32741
|
const el = activeStateElRef.current;
|
|
32596
32742
|
if (state === "Default") {
|
|
@@ -32603,7 +32749,7 @@ function OhhwellsBridge() {
|
|
|
32603
32749
|
}
|
|
32604
32750
|
setToggleState((prev) => prev ? { ...prev, activeState: state } : null);
|
|
32605
32751
|
}, [deactivate]);
|
|
32606
|
-
const reselectAfterLinkPopover = (0,
|
|
32752
|
+
const reselectAfterLinkPopover = (0, import_react24.useCallback)(
|
|
32607
32753
|
(hrefKey) => {
|
|
32608
32754
|
requestAnimationFrame(() => {
|
|
32609
32755
|
const el = resolveHrefKeyElement(hrefKey);
|
|
@@ -32612,7 +32758,7 @@ function OhhwellsBridge() {
|
|
|
32612
32758
|
},
|
|
32613
32759
|
[resolveHrefKeyElement]
|
|
32614
32760
|
);
|
|
32615
|
-
const closeLinkPopover = (0,
|
|
32761
|
+
const closeLinkPopover = (0, import_react24.useCallback)(() => {
|
|
32616
32762
|
const session = linkPopoverSessionRef.current;
|
|
32617
32763
|
addNavAfterAnchorRef.current = null;
|
|
32618
32764
|
setLinkPopover(null);
|
|
@@ -32620,9 +32766,9 @@ function OhhwellsBridge() {
|
|
|
32620
32766
|
reselectAfterLinkPopover(session.key);
|
|
32621
32767
|
}
|
|
32622
32768
|
}, [reselectAfterLinkPopover]);
|
|
32623
|
-
const closeLinkPopoverRef = (0,
|
|
32769
|
+
const closeLinkPopoverRef = (0, import_react24.useRef)(closeLinkPopover);
|
|
32624
32770
|
closeLinkPopoverRef.current = closeLinkPopover;
|
|
32625
|
-
const openLinkPopoverForActive = (0,
|
|
32771
|
+
const openLinkPopoverForActive = (0, import_react24.useCallback)(() => {
|
|
32626
32772
|
const hrefCtx = getHrefKeyFromElement(activeElRef.current);
|
|
32627
32773
|
if (!hrefCtx) return;
|
|
32628
32774
|
bumpLinkPopoverGrace();
|
|
@@ -32633,7 +32779,7 @@ function OhhwellsBridge() {
|
|
|
32633
32779
|
});
|
|
32634
32780
|
deactivate();
|
|
32635
32781
|
}, [deactivate]);
|
|
32636
|
-
const openLinkPopoverForSelected = (0,
|
|
32782
|
+
const openLinkPopoverForSelected = (0, import_react24.useCallback)(() => {
|
|
32637
32783
|
const anchor = selectedElRef.current;
|
|
32638
32784
|
if (!anchor) return;
|
|
32639
32785
|
const key = anchor.getAttribute("data-ohw-href-key");
|
|
@@ -32650,7 +32796,7 @@ function OhhwellsBridge() {
|
|
|
32650
32796
|
});
|
|
32651
32797
|
deselect();
|
|
32652
32798
|
}, [deselect]);
|
|
32653
|
-
const handleSelectParent = (0,
|
|
32799
|
+
const handleSelectParent = (0, import_react24.useCallback)(() => {
|
|
32654
32800
|
const selected = selectedElRef.current;
|
|
32655
32801
|
if (!selected) return;
|
|
32656
32802
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -32677,7 +32823,7 @@ function OhhwellsBridge() {
|
|
|
32677
32823
|
}
|
|
32678
32824
|
deselectRef.current();
|
|
32679
32825
|
}, []);
|
|
32680
|
-
const handleDuplicateSelected = (0,
|
|
32826
|
+
const handleDuplicateSelected = (0, import_react24.useCallback)(() => {
|
|
32681
32827
|
const selected = selectedElRef.current;
|
|
32682
32828
|
if (!selected || !isNavigationItem2(selected)) return;
|
|
32683
32829
|
if (isCtaButton(selected)) {
|
|
@@ -32846,7 +32992,7 @@ function OhhwellsBridge() {
|
|
|
32846
32992
|
});
|
|
32847
32993
|
}
|
|
32848
32994
|
}, [postToParent2, tokensForButton]);
|
|
32849
|
-
const runPendingDeleteUndo = (0,
|
|
32995
|
+
const runPendingDeleteUndo = (0, import_react24.useCallback)(() => {
|
|
32850
32996
|
const pending = pendingDeleteUndoRef.current;
|
|
32851
32997
|
if (!pending) return false;
|
|
32852
32998
|
pendingDeleteUndoRef.current = null;
|
|
@@ -32854,7 +33000,7 @@ function OhhwellsBridge() {
|
|
|
32854
33000
|
enforceLinkHrefs();
|
|
32855
33001
|
return true;
|
|
32856
33002
|
}, []);
|
|
32857
|
-
const handleDeleteSelected = (0,
|
|
33003
|
+
const handleDeleteSelected = (0, import_react24.useCallback)(() => {
|
|
32858
33004
|
const selected = selectedElRef.current;
|
|
32859
33005
|
if (!selected) return false;
|
|
32860
33006
|
if (isCtaButton(selected)) {
|
|
@@ -32916,7 +33062,7 @@ function OhhwellsBridge() {
|
|
|
32916
33062
|
}, [postToParent2]);
|
|
32917
33063
|
handleDeleteSelectedRef.current = handleDeleteSelected;
|
|
32918
33064
|
runPendingDeleteUndoRef.current = runPendingDeleteUndo;
|
|
32919
|
-
const handleLinkPopoverSubmit = (0,
|
|
33065
|
+
const handleLinkPopoverSubmit = (0, import_react24.useCallback)(
|
|
32920
33066
|
(target) => {
|
|
32921
33067
|
const session = linkPopoverSessionRef.current;
|
|
32922
33068
|
if (!session) return;
|
|
@@ -32982,14 +33128,14 @@ function OhhwellsBridge() {
|
|
|
32982
33128
|
const showEditLink = toolbarShowEditLink;
|
|
32983
33129
|
const currentSections = sectionsByPath[pathname] ?? [];
|
|
32984
33130
|
linkPopoverOpenRef.current = linkPopover !== null;
|
|
32985
|
-
const handleMediaSelect = (0,
|
|
33131
|
+
const handleMediaSelect = (0, import_react24.useCallback)((key) => {
|
|
32986
33132
|
const el = hoveredImageRef.current?.dataset.ohwKey === key ? hoveredImageRef.current : Array.from(document.querySelectorAll(MEDIA_SELECTOR)).find(
|
|
32987
33133
|
(m) => (m.dataset.ohwKey ?? "") === key
|
|
32988
33134
|
) ?? null;
|
|
32989
33135
|
if (!el) return;
|
|
32990
33136
|
selectMediaElementRef.current(el);
|
|
32991
33137
|
}, []);
|
|
32992
|
-
const handleMediaReplace = (0,
|
|
33138
|
+
const handleMediaReplace = (0, import_react24.useCallback)(
|
|
32993
33139
|
(key) => {
|
|
32994
33140
|
postToParent2({
|
|
32995
33141
|
type: "ow:image-pick",
|
|
@@ -32999,13 +33145,13 @@ function OhhwellsBridge() {
|
|
|
32999
33145
|
},
|
|
33000
33146
|
[postToParent2, mediaHover?.elementType, selectedMedia?.elementType]
|
|
33001
33147
|
);
|
|
33002
|
-
const handleEditCarousel = (0,
|
|
33148
|
+
const handleEditCarousel = (0, import_react24.useCallback)(
|
|
33003
33149
|
(key) => {
|
|
33004
33150
|
postToParent2({ type: "ow:carousel-open", key, images: readCarouselValue(key) });
|
|
33005
33151
|
},
|
|
33006
33152
|
[postToParent2]
|
|
33007
33153
|
);
|
|
33008
|
-
const handleMediaFadeOutComplete = (0,
|
|
33154
|
+
const handleMediaFadeOutComplete = (0, import_react24.useCallback)((key) => {
|
|
33009
33155
|
setUploadingRects((prev) => {
|
|
33010
33156
|
if (!(key in prev)) return prev;
|
|
33011
33157
|
const next = { ...prev };
|
|
@@ -33013,7 +33159,7 @@ function OhhwellsBridge() {
|
|
|
33013
33159
|
return next;
|
|
33014
33160
|
});
|
|
33015
33161
|
}, []);
|
|
33016
|
-
const handleVideoSettingsChange = (0,
|
|
33162
|
+
const handleVideoSettingsChange = (0, import_react24.useCallback)(
|
|
33017
33163
|
(key, settings) => {
|
|
33018
33164
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
33019
33165
|
const video = getVideoEl2(el);
|
|
@@ -33727,6 +33873,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
33727
33873
|
hasMountedContentNodes,
|
|
33728
33874
|
indexCollectionItems,
|
|
33729
33875
|
insertFooterHours,
|
|
33876
|
+
isDeadPageHref,
|
|
33730
33877
|
isEditSessionActive,
|
|
33731
33878
|
isPlainLeftClick,
|
|
33732
33879
|
isRenderableFooterTree,
|
|
@@ -33738,6 +33885,7 @@ function EmptySection({ title, homeHref = "/", eyebrowKey, titleKey, subtitleKey
|
|
|
33738
33885
|
parseAiFooterState,
|
|
33739
33886
|
parseAiSectionsState,
|
|
33740
33887
|
parseTarget,
|
|
33888
|
+
planBuildPageSync,
|
|
33741
33889
|
recordOverriddenPaths,
|
|
33742
33890
|
releaseTemplateLogoIfReplaced,
|
|
33743
33891
|
removeFooterBlock,
|