@ohhwells/bridge 0.1.36-next.51 → 0.1.36-next.54
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 +18 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -6544,6 +6544,11 @@ function fadeInImageElement(img, onReady) {
|
|
|
6544
6544
|
img.style.opacity = "";
|
|
6545
6545
|
});
|
|
6546
6546
|
}
|
|
6547
|
+
function applyEditableImageSrc(img, url) {
|
|
6548
|
+
img.removeAttribute("srcset");
|
|
6549
|
+
img.removeAttribute("sizes");
|
|
6550
|
+
img.src = url;
|
|
6551
|
+
}
|
|
6547
6552
|
function fadeInBgImage(el, url, onReady) {
|
|
6548
6553
|
const prevPos = el.style.position;
|
|
6549
6554
|
if (!prevPos || prevPos === "static") el.style.position = "relative";
|
|
@@ -7850,7 +7855,7 @@ function OhhwellsBridge() {
|
|
|
7850
7855
|
if (el.dataset.ohwEditable === "image") {
|
|
7851
7856
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
7852
7857
|
if (img && img.src !== val) {
|
|
7853
|
-
img
|
|
7858
|
+
applyEditableImageSrc(img, val);
|
|
7854
7859
|
imageLoads.push(new Promise((resolve) => {
|
|
7855
7860
|
img.onload = () => resolve();
|
|
7856
7861
|
img.onerror = () => resolve();
|
|
@@ -7876,6 +7881,7 @@ function OhhwellsBridge() {
|
|
|
7876
7881
|
});
|
|
7877
7882
|
applyLinkByKey(key, val);
|
|
7878
7883
|
}
|
|
7884
|
+
reconcileNavbarItemsFromContent(content);
|
|
7879
7885
|
enforceLinkHrefs();
|
|
7880
7886
|
initSectionsFromContent(content, true);
|
|
7881
7887
|
sectionsLoadedRef.current = true;
|
|
@@ -7920,7 +7926,7 @@ function OhhwellsBridge() {
|
|
|
7920
7926
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
7921
7927
|
if (el.dataset.ohwEditable === "image") {
|
|
7922
7928
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
7923
|
-
if (img && img.src !== val) img
|
|
7929
|
+
if (img && img.src !== val) applyEditableImageSrc(img, val);
|
|
7924
7930
|
} else if (el.dataset.ohwEditable === "bg-image") {
|
|
7925
7931
|
const next = `url('${val}')`;
|
|
7926
7932
|
if (el.style.backgroundImage !== next) el.style.backgroundImage = next;
|
|
@@ -7935,6 +7941,7 @@ function OhhwellsBridge() {
|
|
|
7935
7941
|
});
|
|
7936
7942
|
applyLinkByKey(key, val);
|
|
7937
7943
|
}
|
|
7944
|
+
reconcileNavbarItemsFromContent(content);
|
|
7938
7945
|
} finally {
|
|
7939
7946
|
observer?.observe(document.body, { childList: true, subtree: true });
|
|
7940
7947
|
}
|
|
@@ -7970,8 +7977,12 @@ function OhhwellsBridge() {
|
|
|
7970
7977
|
deactivateRef.current();
|
|
7971
7978
|
}, [pathname, isEditMode]);
|
|
7972
7979
|
(0, import_react8.useEffect)(() => {
|
|
7973
|
-
|
|
7974
|
-
|
|
7980
|
+
const contentForNav = () => {
|
|
7981
|
+
if (isEditMode) return editContentRef.current;
|
|
7982
|
+
if (!subdomain) return {};
|
|
7983
|
+
return contentCache.get(subdomain) ?? {};
|
|
7984
|
+
};
|
|
7985
|
+
const run = () => reconcileNavbarItemsFromContent(contentForNav());
|
|
7975
7986
|
run();
|
|
7976
7987
|
const nav = document.querySelector("nav");
|
|
7977
7988
|
if (!nav) return;
|
|
@@ -7980,7 +7991,7 @@ function OhhwellsBridge() {
|
|
|
7980
7991
|
});
|
|
7981
7992
|
observer.observe(nav, { childList: true, subtree: true });
|
|
7982
7993
|
return () => observer.disconnect();
|
|
7983
|
-
}, [isEditMode, pathname]);
|
|
7994
|
+
}, [isEditMode, pathname, subdomain, fetchState]);
|
|
7984
7995
|
(0, import_react8.useEffect)(() => {
|
|
7985
7996
|
if (!isEditMode) return;
|
|
7986
7997
|
const measure = () => {
|
|
@@ -8762,7 +8773,7 @@ function OhhwellsBridge() {
|
|
|
8762
8773
|
};
|
|
8763
8774
|
img.onload = onReady;
|
|
8764
8775
|
img.onerror = onReady;
|
|
8765
|
-
img
|
|
8776
|
+
applyEditableImageSrc(img, url);
|
|
8766
8777
|
if (img.complete && img.naturalWidth > 0) {
|
|
8767
8778
|
requestAnimationFrame(() => onReady());
|
|
8768
8779
|
}
|
|
@@ -8850,7 +8861,7 @@ function OhhwellsBridge() {
|
|
|
8850
8861
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
8851
8862
|
if (el.dataset.ohwEditable === "image") {
|
|
8852
8863
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
8853
|
-
if (img) img
|
|
8864
|
+
if (img) applyEditableImageSrc(img, val);
|
|
8854
8865
|
} else if (el.dataset.ohwEditable === "bg-image") {
|
|
8855
8866
|
el.style.backgroundImage = `url('${val}')`;
|
|
8856
8867
|
} else if (el.dataset.ohwEditable === "video") {
|