@ohhwells/bridge 0.1.36 → 0.1.37
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 +9 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -5657,6 +5657,11 @@ function fadeInImageElement(img, onReady) {
|
|
|
5657
5657
|
img.style.opacity = "";
|
|
5658
5658
|
});
|
|
5659
5659
|
}
|
|
5660
|
+
function applyEditableImageSrc(img, url) {
|
|
5661
|
+
img.removeAttribute("srcset");
|
|
5662
|
+
img.removeAttribute("sizes");
|
|
5663
|
+
img.src = url;
|
|
5664
|
+
}
|
|
5660
5665
|
function fadeInBgImage(el, url, onReady) {
|
|
5661
5666
|
const prevPos = el.style.position;
|
|
5662
5667
|
if (!prevPos || prevPos === "static") el.style.position = "relative";
|
|
@@ -6770,7 +6775,7 @@ function OhhwellsBridge() {
|
|
|
6770
6775
|
if (el.dataset.ohwEditable === "image") {
|
|
6771
6776
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
6772
6777
|
if (img && img.src !== val) {
|
|
6773
|
-
img
|
|
6778
|
+
applyEditableImageSrc(img, val);
|
|
6774
6779
|
imageLoads.push(new Promise((resolve) => {
|
|
6775
6780
|
img.onload = () => resolve();
|
|
6776
6781
|
img.onerror = () => resolve();
|
|
@@ -6830,7 +6835,7 @@ function OhhwellsBridge() {
|
|
|
6830
6835
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
6831
6836
|
if (el.dataset.ohwEditable === "image") {
|
|
6832
6837
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
6833
|
-
if (img && img.src !== val) img
|
|
6838
|
+
if (img && img.src !== val) applyEditableImageSrc(img, val);
|
|
6834
6839
|
} else if (el.dataset.ohwEditable === "bg-image") {
|
|
6835
6840
|
const next = `url('${val}')`;
|
|
6836
6841
|
if (el.style.backgroundImage !== next) el.style.backgroundImage = next;
|
|
@@ -7528,7 +7533,7 @@ function OhhwellsBridge() {
|
|
|
7528
7533
|
};
|
|
7529
7534
|
img.onload = onReady;
|
|
7530
7535
|
img.onerror = onReady;
|
|
7531
|
-
img
|
|
7536
|
+
applyEditableImageSrc(img, url);
|
|
7532
7537
|
if (img.complete && img.naturalWidth > 0) {
|
|
7533
7538
|
requestAnimationFrame(() => onReady());
|
|
7534
7539
|
}
|
|
@@ -7602,7 +7607,7 @@ function OhhwellsBridge() {
|
|
|
7602
7607
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
7603
7608
|
if (el.dataset.ohwEditable === "image") {
|
|
7604
7609
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
7605
|
-
if (img) img
|
|
7610
|
+
if (img) applyEditableImageSrc(img, val);
|
|
7606
7611
|
} else if (el.dataset.ohwEditable === "bg-image") {
|
|
7607
7612
|
el.style.backgroundImage = `url('${val}')`;
|
|
7608
7613
|
} else if (el.dataset.ohwEditable === "link") {
|