@ohhwells/bridge 0.1.42-next.86 → 0.1.42-next.88
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 +78 -142
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +78 -142
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6617,17 +6617,20 @@ function navOrderKeysEqual(a, b) {
|
|
|
6617
6617
|
}
|
|
6618
6618
|
return true;
|
|
6619
6619
|
}
|
|
6620
|
-
function
|
|
6620
|
+
function getNavbarLinkKeysInContainer(container) {
|
|
6621
6621
|
return Array.from(container.querySelectorAll("[data-ohw-href-key]")).filter(isNavbarLinkItem).map((el) => el.getAttribute("data-ohw-href-key")).filter((key) => Boolean(key));
|
|
6622
6622
|
}
|
|
6623
6623
|
function applyNavOrderToContainer(container, order) {
|
|
6624
6624
|
const desired = order.filter((key, i) => order.indexOf(key) === i);
|
|
6625
|
-
const current =
|
|
6625
|
+
const current = getNavbarLinkKeysInContainer(container);
|
|
6626
6626
|
const extras = current.filter((key) => !desired.includes(key));
|
|
6627
6627
|
const expected = [...desired.filter((key) => current.includes(key)), ...extras];
|
|
6628
|
+
const orderedEls = [];
|
|
6628
6629
|
if (navOrderKeysEqual(current, expected)) return;
|
|
6630
|
+
if (current.length === expected.length && current.every((key, i) => key === expected[i])) {
|
|
6631
|
+
return;
|
|
6632
|
+
}
|
|
6629
6633
|
const seen = /* @__PURE__ */ new Set();
|
|
6630
|
-
const orderedEls = [];
|
|
6631
6634
|
for (const hrefKey of desired) {
|
|
6632
6635
|
if (seen.has(hrefKey)) continue;
|
|
6633
6636
|
seen.add(hrefKey);
|
|
@@ -8033,7 +8036,13 @@ function collectEditableNodes(extraContent) {
|
|
|
8033
8036
|
nodes.push({ key: `${key}${VIDEO_AUTOPLAY_SUFFIX}`, type: "video-setting", text: String(video.autoplay) });
|
|
8034
8037
|
nodes.push({ key: `${key}${VIDEO_MUTED_SUFFIX}`, type: "video-setting", text: String(video.muted) });
|
|
8035
8038
|
});
|
|
8036
|
-
|
|
8039
|
+
const seen = /* @__PURE__ */ new Set();
|
|
8040
|
+
return nodes.filter((node) => {
|
|
8041
|
+
if (!node.key) return true;
|
|
8042
|
+
if (seen.has(node.key)) return false;
|
|
8043
|
+
seen.add(node.key);
|
|
8044
|
+
return true;
|
|
8045
|
+
});
|
|
8037
8046
|
}
|
|
8038
8047
|
function isMediaEditable(el) {
|
|
8039
8048
|
const t = el.dataset.ohwEditable;
|
|
@@ -8165,7 +8174,7 @@ function countFooterNavItems(el) {
|
|
|
8165
8174
|
return Array.from(el.querySelectorAll("[data-ohw-href-key]")).filter(isNavigationItem).length;
|
|
8166
8175
|
}
|
|
8167
8176
|
function findFooterItemGroup(item) {
|
|
8168
|
-
const explicit = item.closest("[data-ohw-footer-
|
|
8177
|
+
const explicit = item.closest("[data-ohw-footer-column]");
|
|
8169
8178
|
if (explicit) return explicit;
|
|
8170
8179
|
const footer = item.closest("footer");
|
|
8171
8180
|
if (!footer) return null;
|
|
@@ -8182,14 +8191,17 @@ function isNavigationRoot(el) {
|
|
|
8182
8191
|
function isInferredFooterGroup(el) {
|
|
8183
8192
|
const footer = el.closest("footer");
|
|
8184
8193
|
if (!footer || el === footer) return false;
|
|
8185
|
-
if (el.hasAttribute("data-ohw-footer-
|
|
8194
|
+
if (el.hasAttribute("data-ohw-footer-column")) return true;
|
|
8186
8195
|
return countFooterNavItems(el) >= 2;
|
|
8187
8196
|
}
|
|
8188
8197
|
function isNavigationContainer(el) {
|
|
8189
|
-
return el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-col") || isNavigationRoot(el) || isInferredFooterGroup(el);
|
|
8198
|
+
return el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-col") || el.hasAttribute("data-ohw-footer-column") || isNavigationRoot(el) || isInferredFooterGroup(el);
|
|
8199
|
+
}
|
|
8200
|
+
function isNavbarLinksContainer(el) {
|
|
8201
|
+
return el.hasAttribute("data-ohw-nav-container");
|
|
8190
8202
|
}
|
|
8191
8203
|
function getFooterColumn(el) {
|
|
8192
|
-
return el.closest("[data-ohw-footer-
|
|
8204
|
+
return el.closest("[data-ohw-footer-column]");
|
|
8193
8205
|
}
|
|
8194
8206
|
function resolveFooterColumnSelectionTarget(target, clientX, clientY) {
|
|
8195
8207
|
if (getNavigationItemAnchor(target)) return null;
|
|
@@ -8213,7 +8225,7 @@ function isPointOverNavigation(x, y) {
|
|
|
8213
8225
|
function findHoveredNavOrFooterContainer(x, y) {
|
|
8214
8226
|
const candidates = [
|
|
8215
8227
|
...document.querySelectorAll("[data-ohw-nav-container]"),
|
|
8216
|
-
...document.querySelectorAll("[data-ohw-footer-
|
|
8228
|
+
...document.querySelectorAll("[data-ohw-footer-column]")
|
|
8217
8229
|
];
|
|
8218
8230
|
for (const container of candidates) {
|
|
8219
8231
|
const r2 = container.getBoundingClientRect();
|
|
@@ -8260,7 +8272,7 @@ function getNavigationSelectionParent(el) {
|
|
|
8260
8272
|
if (footerGroup) return footerGroup;
|
|
8261
8273
|
return getNavigationRoot(el);
|
|
8262
8274
|
}
|
|
8263
|
-
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-
|
|
8275
|
+
if (el.hasAttribute("data-ohw-nav-container") || el.hasAttribute("data-ohw-footer-column") || isInferredFooterGroup(el)) {
|
|
8264
8276
|
return getNavigationRoot(el);
|
|
8265
8277
|
}
|
|
8266
8278
|
return null;
|
|
@@ -8440,8 +8452,6 @@ var ICONS = {
|
|
|
8440
8452
|
insertUnorderedList: '<line x1="8" y1="6" x2="21" y2="6"/><line x1="8" y1="12" x2="21" y2="12"/><line x1="8" y1="18" x2="21" y2="18"/><line x1="3" y1="6" x2="3.01" y2="6"/><line x1="3" y1="12" x2="3.01" y2="12"/><line x1="3" y1="18" x2="3.01" y2="18"/>',
|
|
8441
8453
|
insertOrderedList: '<line x1="10" y1="6" x2="21" y2="6"/><line x1="10" y1="12" x2="21" y2="12"/><line x1="10" y1="18" x2="21" y2="18"/><path d="M4 6h1v4"/><path d="M4 10h2"/><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1"/>'
|
|
8442
8454
|
};
|
|
8443
|
-
var TOOLBAR_PILL_PADDING = 2;
|
|
8444
|
-
var TOOLBAR_TOGGLE_GAP = 4;
|
|
8445
8455
|
var SELECTION_CHROME_GAP2 = 4;
|
|
8446
8456
|
var TOOLBAR_STROKE_GAP2 = 4;
|
|
8447
8457
|
var TOOLBAR_OFFSET_FROM_ELEMENT = SELECTION_CHROME_GAP2 + TOOLBAR_STROKE_GAP2;
|
|
@@ -8656,15 +8666,6 @@ function FloatingToolbar({
|
|
|
8656
8666
|
left,
|
|
8657
8667
|
transform,
|
|
8658
8668
|
zIndex: 2147483647,
|
|
8659
|
-
background: "#fff",
|
|
8660
|
-
border: "1px solid #E7E5E4",
|
|
8661
|
-
borderRadius: 6,
|
|
8662
|
-
boxShadow: "0px 2px 4px -2px rgba(0,0,0,.1),0px 4px 6px -1px rgba(0,0,0,.1)",
|
|
8663
|
-
display: "flex",
|
|
8664
|
-
alignItems: "center",
|
|
8665
|
-
padding: TOOLBAR_PILL_PADDING,
|
|
8666
|
-
gap: TOOLBAR_TOGGLE_GAP,
|
|
8667
|
-
fontFamily: "sans-serif",
|
|
8668
8669
|
pointerEvents: "auto"
|
|
8669
8670
|
},
|
|
8670
8671
|
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(CustomToolbar, { children: [
|
|
@@ -8831,7 +8832,6 @@ function OhhwellsBridge() {
|
|
|
8831
8832
|
const dragOverElRef = (0, import_react9.useRef)(null);
|
|
8832
8833
|
const [mediaHover, setMediaHover] = (0, import_react9.useState)(null);
|
|
8833
8834
|
const [uploadingRects, setUploadingRects] = (0, import_react9.useState)({});
|
|
8834
|
-
const pendingUploadRectRef = (0, import_react9.useRef)(null);
|
|
8835
8835
|
const hoveredGapRef = (0, import_react9.useRef)(null);
|
|
8836
8836
|
const imageUnhoverTimerRef = (0, import_react9.useRef)(null);
|
|
8837
8837
|
const imageShowTimerRef = (0, import_react9.useRef)(null);
|
|
@@ -8991,7 +8991,6 @@ function OhhwellsBridge() {
|
|
|
8991
8991
|
body.style.overflow = prevBodyOverflow;
|
|
8992
8992
|
document.removeEventListener("wheel", preventBackgroundScroll, scrollOpts);
|
|
8993
8993
|
document.removeEventListener("touchmove", preventBackgroundScroll, scrollOpts);
|
|
8994
|
-
document.documentElement.removeAttribute("data-ohw-link-popover-open");
|
|
8995
8994
|
};
|
|
8996
8995
|
}, [linkPopover, postToParent2]);
|
|
8997
8996
|
(0, import_react9.useEffect)(() => {
|
|
@@ -9604,14 +9603,11 @@ function OhhwellsBridge() {
|
|
|
9604
9603
|
if (hoveredImageRef.current) {
|
|
9605
9604
|
hoveredImageRef.current = null;
|
|
9606
9605
|
setMediaHover(null);
|
|
9607
|
-
postToParentRef.current({ type: "ow:image-unhover" });
|
|
9608
9606
|
}
|
|
9609
9607
|
setToolbarVariant("rich-text");
|
|
9610
9608
|
siblingHintElRef.current = null;
|
|
9611
9609
|
setSiblingHintRect(null);
|
|
9612
|
-
setSiblingHintRects([]);
|
|
9613
9610
|
setIsItemDragging(false);
|
|
9614
|
-
setIsFooterFrameSelection(false);
|
|
9615
9611
|
el.setAttribute("contenteditable", "true");
|
|
9616
9612
|
el.setAttribute("data-ohw-editing", "");
|
|
9617
9613
|
el.removeAttribute("data-ohw-hovered");
|
|
@@ -9800,6 +9796,13 @@ function OhhwellsBridge() {
|
|
|
9800
9796
|
const observeRoots = () => [document.querySelector("nav"), document.querySelector("footer")].filter(
|
|
9801
9797
|
(el) => Boolean(el)
|
|
9802
9798
|
);
|
|
9799
|
+
const roots = observeRoots();
|
|
9800
|
+
if (roots.length === 0) {
|
|
9801
|
+
reconcileNavbarItemsFromContent(contentForNav());
|
|
9802
|
+
reconcileFooterOrderFromContent(contentForNav());
|
|
9803
|
+
if (isEditMode) syncNavigationDragCursorAttrs();
|
|
9804
|
+
return;
|
|
9805
|
+
}
|
|
9803
9806
|
let rafId = null;
|
|
9804
9807
|
let applying = false;
|
|
9805
9808
|
let observer = null;
|
|
@@ -9936,37 +9939,6 @@ function OhhwellsBridge() {
|
|
|
9936
9939
|
[data-ohw-href-key][data-ohw-selected] * {
|
|
9937
9940
|
cursor: text !important;
|
|
9938
9941
|
}
|
|
9939
|
-
/* Native <a> drag steals clicks \u2014 disable for edit links; reorder via press-to-drag / handle. */
|
|
9940
|
-
footer [data-ohw-href-key],
|
|
9941
|
-
nav [data-ohw-href-key],
|
|
9942
|
-
[data-ohw-nav-container] [data-ohw-href-key],
|
|
9943
|
-
[data-ohw-nav-drawer] [data-ohw-href-key] {
|
|
9944
|
-
-webkit-user-drag: none !important;
|
|
9945
|
-
}
|
|
9946
|
-
footer [data-ohw-footer-col]:hover {
|
|
9947
|
-
outline: 1.5px dashed ${PRIMARY2} !important;
|
|
9948
|
-
outline-offset: 6px;
|
|
9949
|
-
border-radius: 8px;
|
|
9950
|
-
}
|
|
9951
|
-
html[data-ohw-link-popover-open] footer [data-ohw-footer-col]:hover {
|
|
9952
|
-
outline: none !important;
|
|
9953
|
-
}
|
|
9954
|
-
html[data-ohw-footer-press-drag] footer,
|
|
9955
|
-
html[data-ohw-footer-press-drag] footer * {
|
|
9956
|
-
user-select: none !important;
|
|
9957
|
-
-webkit-user-select: none !important;
|
|
9958
|
-
}
|
|
9959
|
-
html[data-ohw-item-dragging] footer,
|
|
9960
|
-
html[data-ohw-item-dragging] footer *,
|
|
9961
|
-
html[data-ohw-item-dragging] nav,
|
|
9962
|
-
html[data-ohw-item-dragging] nav * {
|
|
9963
|
-
user-select: none !important;
|
|
9964
|
-
-webkit-user-select: none !important;
|
|
9965
|
-
pointer-events: none !important;
|
|
9966
|
-
}
|
|
9967
|
-
html[data-ohw-item-dragging] {
|
|
9968
|
-
cursor: grabbing !important;
|
|
9969
|
-
}
|
|
9970
9942
|
[data-ohw-editable="image"], [data-ohw-editable="image"] *,
|
|
9971
9943
|
[data-ohw-editable="video"], [data-ohw-editable="video"] *,
|
|
9972
9944
|
[data-ohw-editable="bg-image"], [data-ohw-editable="bg-image"] * { cursor: pointer !important; }
|
|
@@ -10109,15 +10081,7 @@ function OhhwellsBridge() {
|
|
|
10109
10081
|
if (isMediaEditable(editable)) {
|
|
10110
10082
|
e.preventDefault();
|
|
10111
10083
|
e.stopPropagation();
|
|
10112
|
-
|
|
10113
|
-
const r2 = editable.getBoundingClientRect();
|
|
10114
|
-
if (key && r2.width > 1 && r2.height > 1) {
|
|
10115
|
-
pendingUploadRectRef.current = {
|
|
10116
|
-
key,
|
|
10117
|
-
rect: { top: r2.top, left: r2.left, width: r2.width, height: r2.height }
|
|
10118
|
-
};
|
|
10119
|
-
}
|
|
10120
|
-
postToParentRef.current({ type: "ow:image-pick", key, elementType: editable.dataset.ohwEditable ?? "image" });
|
|
10084
|
+
postToParentRef.current({ type: "ow:image-pick", key: editable.dataset.ohwKey ?? "", elementType: editable.dataset.ohwEditable ?? "image" });
|
|
10121
10085
|
return;
|
|
10122
10086
|
}
|
|
10123
10087
|
const hrefCtx = getHrefKeyFromElement(editable);
|
|
@@ -10243,7 +10207,7 @@ function OhhwellsBridge() {
|
|
|
10243
10207
|
return;
|
|
10244
10208
|
}
|
|
10245
10209
|
if (toolbarVariantRef.current !== "select-frame") {
|
|
10246
|
-
const frameContainer = target.closest("[data-ohw-nav-container]") ?? target.closest("[data-ohw-footer-col]");
|
|
10210
|
+
const frameContainer = target.closest("[data-ohw-nav-container]") ?? target.closest("[data-ohw-footer-col]") ?? target.closest("[data-ohw-footer-column]");
|
|
10247
10211
|
if (frameContainer && !getNavigationItemAnchor(target)) {
|
|
10248
10212
|
hoveredNavContainerRef.current = frameContainer;
|
|
10249
10213
|
setHoveredNavContainerRect(frameContainer.getBoundingClientRect());
|
|
@@ -10251,20 +10215,11 @@ function OhhwellsBridge() {
|
|
|
10251
10215
|
setHoveredItemRect(null);
|
|
10252
10216
|
return;
|
|
10253
10217
|
}
|
|
10254
|
-
if (!target.closest("[data-ohw-nav-container], [data-ohw-footer-col]")) {
|
|
10218
|
+
if (!target.closest("[data-ohw-nav-container], [data-ohw-footer-col], [data-ohw-footer-column]")) {
|
|
10255
10219
|
hoveredNavContainerRef.current = null;
|
|
10256
10220
|
setHoveredNavContainerRect(null);
|
|
10257
10221
|
}
|
|
10258
10222
|
}
|
|
10259
|
-
const footerCol = target.closest("[data-ohw-footer-col]");
|
|
10260
|
-
if (footerCol) {
|
|
10261
|
-
hoveredNavContainerRef.current = null;
|
|
10262
|
-
setHoveredNavContainerRect(null);
|
|
10263
|
-
if (selectedElRef.current === footerCol) return;
|
|
10264
|
-
hoveredItemElRef.current = footerCol;
|
|
10265
|
-
setHoveredItemRect(footerCol.getBoundingClientRect());
|
|
10266
|
-
return;
|
|
10267
|
-
}
|
|
10268
10223
|
const navAnchor = getNavigationItemAnchor(target);
|
|
10269
10224
|
if (navAnchor) {
|
|
10270
10225
|
hoveredNavContainerRef.current = null;
|
|
@@ -10276,6 +10231,15 @@ function OhhwellsBridge() {
|
|
|
10276
10231
|
setHoveredItemRect(navAnchor.getBoundingClientRect());
|
|
10277
10232
|
return;
|
|
10278
10233
|
}
|
|
10234
|
+
const footerCol = target.closest("[data-ohw-footer-col]") ?? target.closest("[data-ohw-footer-column]");
|
|
10235
|
+
if (footerCol) {
|
|
10236
|
+
hoveredNavContainerRef.current = null;
|
|
10237
|
+
setHoveredNavContainerRect(null);
|
|
10238
|
+
if (selectedElRef.current === footerCol) return;
|
|
10239
|
+
hoveredItemElRef.current = footerCol;
|
|
10240
|
+
setHoveredItemRect(footerCol.getBoundingClientRect());
|
|
10241
|
+
return;
|
|
10242
|
+
}
|
|
10279
10243
|
const editable = target.closest("[data-ohw-editable]");
|
|
10280
10244
|
if (!editable) return;
|
|
10281
10245
|
const selected = selectedElRef.current;
|
|
@@ -10293,9 +10257,9 @@ function OhhwellsBridge() {
|
|
|
10293
10257
|
};
|
|
10294
10258
|
const handleMouseOut = (e) => {
|
|
10295
10259
|
const target = e.target;
|
|
10296
|
-
if (target.closest("[data-ohw-nav-container], [data-ohw-footer-
|
|
10260
|
+
if (target.closest("[data-ohw-nav-container], [data-ohw-footer-column]")) {
|
|
10297
10261
|
const related2 = e.relatedTarget instanceof Element ? e.relatedTarget : null;
|
|
10298
|
-
if (related2?.closest("[data-ohw-nav-container], [data-ohw-footer-
|
|
10262
|
+
if (related2?.closest("[data-ohw-nav-container], [data-ohw-footer-column], [data-ohw-navbar-container-chrome], [data-ohw-navbar-add-button]")) {
|
|
10299
10263
|
return;
|
|
10300
10264
|
}
|
|
10301
10265
|
hoveredNavContainerRef.current = null;
|
|
@@ -10421,12 +10385,12 @@ function OhhwellsBridge() {
|
|
|
10421
10385
|
const stickyPad = 48;
|
|
10422
10386
|
const withinPad = x >= pr.left - stickyPad && x <= pr.left + pr.width + stickyPad && y >= pr.top - stickyPad && y <= pr.top + pr.height + stickyPad;
|
|
10423
10387
|
if (withinPad) {
|
|
10424
|
-
|
|
10388
|
+
if (smallest !== pinned && candidatePool.includes(smallest)) {
|
|
10425
10389
|
const sr = getVisibleRect(smallest);
|
|
10426
|
-
const
|
|
10427
|
-
|
|
10428
|
-
}
|
|
10429
|
-
|
|
10390
|
+
const overOther = x >= sr.left && x <= sr.left + sr.width && y >= sr.top && y <= sr.top + sr.height;
|
|
10391
|
+
if (overOther) return smallest;
|
|
10392
|
+
}
|
|
10393
|
+
return pinned;
|
|
10430
10394
|
}
|
|
10431
10395
|
}
|
|
10432
10396
|
return smallest;
|
|
@@ -10438,7 +10402,6 @@ function OhhwellsBridge() {
|
|
|
10438
10402
|
resumeAnimTracks();
|
|
10439
10403
|
postToParentRef.current({ type: "ow:image-unhover" });
|
|
10440
10404
|
}
|
|
10441
|
-
clearImageHover();
|
|
10442
10405
|
};
|
|
10443
10406
|
const probeNavigationHoverAt = (x, y) => {
|
|
10444
10407
|
if (toolbarVariantRef.current === "select-frame") {
|
|
@@ -10448,7 +10411,7 @@ function OhhwellsBridge() {
|
|
|
10448
10411
|
}
|
|
10449
10412
|
const frameContainers = [
|
|
10450
10413
|
...document.querySelectorAll("[data-ohw-nav-container]"),
|
|
10451
|
-
...document.querySelectorAll("[data-ohw-footer-
|
|
10414
|
+
...document.querySelectorAll("[data-ohw-footer-column]")
|
|
10452
10415
|
];
|
|
10453
10416
|
let overFrame = null;
|
|
10454
10417
|
for (const container of frameContainers) {
|
|
@@ -10545,7 +10508,7 @@ function OhhwellsBridge() {
|
|
|
10545
10508
|
return;
|
|
10546
10509
|
}
|
|
10547
10510
|
const topEl = document.elementFromPoint(x2, y2);
|
|
10548
|
-
if (topEl?.closest('[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]
|
|
10511
|
+
if (topEl?.closest('[data-ohw-toolbar], [data-ohw-edit-chrome], [data-ohw-item-interaction], [data-ohw-drag-handle-container], [data-slot="drag-handle"]')) {
|
|
10549
10512
|
if (hoveredImageRef.current) {
|
|
10550
10513
|
hoveredImageRef.current = null;
|
|
10551
10514
|
resumeAnimTracks();
|
|
@@ -10829,7 +10792,6 @@ function OhhwellsBridge() {
|
|
|
10829
10792
|
if (!entry || entry.fadingOut) return prev;
|
|
10830
10793
|
return { ...prev, [key]: { ...entry, fadingOut: true } };
|
|
10831
10794
|
});
|
|
10832
|
-
if (pendingUploadRectRef.current?.key === key) pendingUploadRectRef.current = null;
|
|
10833
10795
|
};
|
|
10834
10796
|
let found = false;
|
|
10835
10797
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
@@ -10969,7 +10931,6 @@ function OhhwellsBridge() {
|
|
|
10969
10931
|
editContentRef.current = { ...editContentRef.current, ...content };
|
|
10970
10932
|
reconcileNavbarItemsFromContent(editContentRef.current);
|
|
10971
10933
|
syncNavigationDragCursorAttrs();
|
|
10972
|
-
reconcileFooterOrderFromContent(editContentRef.current);
|
|
10973
10934
|
enforceLinkHrefs();
|
|
10974
10935
|
postToParentRef.current({ type: "ow:hydrate-done" });
|
|
10975
10936
|
};
|
|
@@ -11242,43 +11203,23 @@ function OhhwellsBridge() {
|
|
|
11242
11203
|
activeStateElRef.current = null;
|
|
11243
11204
|
setToggleState(null);
|
|
11244
11205
|
};
|
|
11245
|
-
const resolveUploadRects = (key) => {
|
|
11246
|
-
const matches = Array.from(document.querySelectorAll(`[data-ohw-key="${key}"]`));
|
|
11247
|
-
const rects = matches.map((el) => {
|
|
11248
|
-
const r2 = el.getBoundingClientRect();
|
|
11249
|
-
return { top: r2.top, left: r2.left, width: r2.width, height: r2.height };
|
|
11250
|
-
}).filter((r2) => r2.width > 1 && r2.height > 1);
|
|
11251
|
-
if (rects.length > 0) return rects;
|
|
11252
|
-
const pending = pendingUploadRectRef.current;
|
|
11253
|
-
if (pending?.key === key && pending.rect.width > 1 && pending.rect.height > 1) {
|
|
11254
|
-
return [pending.rect];
|
|
11255
|
-
}
|
|
11256
|
-
const hovered = hoveredImageRef.current;
|
|
11257
|
-
if (hovered?.dataset.ohwKey === key) {
|
|
11258
|
-
const r2 = hovered.getBoundingClientRect();
|
|
11259
|
-
if (r2.width > 1 && r2.height > 1) {
|
|
11260
|
-
return [{ top: r2.top, left: r2.left, width: r2.width, height: r2.height }];
|
|
11261
|
-
}
|
|
11262
|
-
}
|
|
11263
|
-
return [];
|
|
11264
|
-
};
|
|
11265
11206
|
const handleImageUploading = (e) => {
|
|
11266
|
-
|
|
11267
|
-
|
|
11268
|
-
const key = e.data.key;
|
|
11269
|
-
if (!key) return;
|
|
11270
|
-
const uploading = type === "ow:anim-lock" ? true : !!e.data.uploading;
|
|
11207
|
+
if (e.data?.type !== "ow:image-uploading") return;
|
|
11208
|
+
const { key, uploading } = e.data;
|
|
11271
11209
|
setUploadingRects((prev) => {
|
|
11272
11210
|
if (!uploading) {
|
|
11273
|
-
if (pendingUploadRectRef.current?.key === key) pendingUploadRectRef.current = null;
|
|
11274
11211
|
if (!(key in prev)) return prev;
|
|
11275
11212
|
const next = { ...prev };
|
|
11276
11213
|
delete next[key];
|
|
11277
11214
|
return next;
|
|
11278
11215
|
}
|
|
11279
|
-
const
|
|
11280
|
-
if (
|
|
11281
|
-
|
|
11216
|
+
const el = document.querySelector(`[data-ohw-key="${key}"]`);
|
|
11217
|
+
if (!el) return prev;
|
|
11218
|
+
const r2 = getVisibleRect(el);
|
|
11219
|
+
return {
|
|
11220
|
+
...prev,
|
|
11221
|
+
[key]: { rect: { top: r2.top, left: r2.left, width: r2.width, height: r2.height } }
|
|
11222
|
+
};
|
|
11282
11223
|
});
|
|
11283
11224
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
11284
11225
|
const track = el.closest("[data-ohw-hover-pause]");
|
|
@@ -11395,7 +11336,7 @@ function OhhwellsBridge() {
|
|
|
11395
11336
|
}
|
|
11396
11337
|
}
|
|
11397
11338
|
const footerColumn = findHoveredNavOrFooterContainer(clientX, clientY);
|
|
11398
|
-
if (footerColumn?.hasAttribute("data-ohw-footer-
|
|
11339
|
+
if (footerColumn?.hasAttribute("data-ohw-footer-column")) {
|
|
11399
11340
|
selectFrameRef.current(footerColumn);
|
|
11400
11341
|
return;
|
|
11401
11342
|
}
|
|
@@ -11784,14 +11725,14 @@ function OhhwellsBridge() {
|
|
|
11784
11725
|
},
|
|
11785
11726
|
[postToParent2, sitePages, sectionsByPath]
|
|
11786
11727
|
);
|
|
11728
|
+
const showEditLink = toolbarShowEditLink;
|
|
11729
|
+
const currentSections = sectionsByPath[pathname] ?? [];
|
|
11730
|
+
linkPopoverOpenRef.current = linkPopover !== null;
|
|
11787
11731
|
const handleMediaReplace = (0, import_react9.useCallback)(
|
|
11788
11732
|
(key) => {
|
|
11789
|
-
if (mediaHover?.key === key) {
|
|
11790
|
-
pendingUploadRectRef.current = { key, rect: mediaHover.rect };
|
|
11791
|
-
}
|
|
11792
11733
|
postToParent2({ type: "ow:image-pick", key, elementType: mediaHover?.elementType ?? "image" });
|
|
11793
11734
|
},
|
|
11794
|
-
[postToParent2, mediaHover]
|
|
11735
|
+
[postToParent2, mediaHover?.elementType]
|
|
11795
11736
|
);
|
|
11796
11737
|
const handleMediaFadeOutComplete = (0, import_react9.useCallback)((key) => {
|
|
11797
11738
|
setUploadingRects((prev) => {
|
|
@@ -11823,25 +11764,20 @@ function OhhwellsBridge() {
|
|
|
11823
11764
|
},
|
|
11824
11765
|
[postToParent2]
|
|
11825
11766
|
);
|
|
11826
|
-
const showEditLink = toolbarShowEditLink;
|
|
11827
|
-
const currentSections = sectionsByPath[pathname] ?? [];
|
|
11828
|
-
linkPopoverOpenRef.current = linkPopover !== null;
|
|
11829
11767
|
return bridgeRoot ? (0, import_react_dom3.createPortal)(
|
|
11830
11768
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
11831
11769
|
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ref: attachVisibleViewport, "data-ohw-visible-viewport": "", "aria-hidden": true }),
|
|
11832
|
-
Object.entries(uploadingRects).
|
|
11833
|
-
|
|
11834
|
-
|
|
11835
|
-
{
|
|
11836
|
-
|
|
11837
|
-
|
|
11838
|
-
|
|
11839
|
-
|
|
11840
|
-
|
|
11841
|
-
|
|
11842
|
-
|
|
11843
|
-
))
|
|
11844
|
-
),
|
|
11770
|
+
Object.entries(uploadingRects).map(([key, { rect, fadingOut }]) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11771
|
+
MediaOverlay,
|
|
11772
|
+
{
|
|
11773
|
+
hover: { key, rect, elementType: "image", isDragOver: false, hasTextOverlap: false },
|
|
11774
|
+
isUploading: true,
|
|
11775
|
+
fadingOut,
|
|
11776
|
+
onFadeOutComplete: handleMediaFadeOutComplete,
|
|
11777
|
+
onReplace: handleMediaReplace
|
|
11778
|
+
},
|
|
11779
|
+
`uploading-${key}`
|
|
11780
|
+
)),
|
|
11845
11781
|
mediaHover && !(mediaHover.key in uploadingRects) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11846
11782
|
MediaOverlay,
|
|
11847
11783
|
{
|
|
@@ -11896,9 +11832,9 @@ function OhhwellsBridge() {
|
|
|
11896
11832
|
},
|
|
11897
11833
|
`nav-drop-${slot.direction}-${slot.parentId ?? "root"}-${slot.insertIndex}-${i}`
|
|
11898
11834
|
)),
|
|
11899
|
-
hoveredNavContainerRect && toolbarVariant !== "select-frame" && !linkPopover && !isItemDragging &&
|
|
11900
|
-
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
11901
|
-
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !
|
|
11835
|
+
hoveredNavContainerRect && toolbarVariant !== "select-frame" && !linkPopover && !isItemDragging && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: hoveredNavContainerRect, state: "hover" }),
|
|
11836
|
+
toolbarVariant === "select-frame" && toolbarRect && !linkPopover && !isItemDragging && !isFooterFrameSelection && selectedElRef.current && isNavbarLinksContainer(selectedElRef.current) && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(NavbarContainerChrome, { rect: toolbarRect, onAdd: handleAddTopLevelNavItem }),
|
|
11837
|
+
hoveredItemRect && !linkPopover && !hoveredNavContainerRect && !isItemDragging && hoveredItemElRef.current !== selectedElRef.current && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ItemInteractionLayer, { rect: hoveredItemRect, state: "hover" }),
|
|
11902
11838
|
toolbarRect && (toolbarVariant === "link-action" || toolbarVariant === "select-frame") && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
11903
11839
|
ItemInteractionLayer,
|
|
11904
11840
|
{
|