@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.js
CHANGED
|
@@ -5598,6 +5598,11 @@ function fadeInImageElement(img, onReady) {
|
|
|
5598
5598
|
img.style.opacity = "";
|
|
5599
5599
|
});
|
|
5600
5600
|
}
|
|
5601
|
+
function applyEditableImageSrc(img, url) {
|
|
5602
|
+
img.removeAttribute("srcset");
|
|
5603
|
+
img.removeAttribute("sizes");
|
|
5604
|
+
img.src = url;
|
|
5605
|
+
}
|
|
5601
5606
|
function fadeInBgImage(el, url, onReady) {
|
|
5602
5607
|
const prevPos = el.style.position;
|
|
5603
5608
|
if (!prevPos || prevPos === "static") el.style.position = "relative";
|
|
@@ -6711,7 +6716,7 @@ function OhhwellsBridge() {
|
|
|
6711
6716
|
if (el.dataset.ohwEditable === "image") {
|
|
6712
6717
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
6713
6718
|
if (img && img.src !== val) {
|
|
6714
|
-
img
|
|
6719
|
+
applyEditableImageSrc(img, val);
|
|
6715
6720
|
imageLoads.push(new Promise((resolve) => {
|
|
6716
6721
|
img.onload = () => resolve();
|
|
6717
6722
|
img.onerror = () => resolve();
|
|
@@ -6771,7 +6776,7 @@ function OhhwellsBridge() {
|
|
|
6771
6776
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
6772
6777
|
if (el.dataset.ohwEditable === "image") {
|
|
6773
6778
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
6774
|
-
if (img && img.src !== val) img
|
|
6779
|
+
if (img && img.src !== val) applyEditableImageSrc(img, val);
|
|
6775
6780
|
} else if (el.dataset.ohwEditable === "bg-image") {
|
|
6776
6781
|
const next = `url('${val}')`;
|
|
6777
6782
|
if (el.style.backgroundImage !== next) el.style.backgroundImage = next;
|
|
@@ -7469,7 +7474,7 @@ function OhhwellsBridge() {
|
|
|
7469
7474
|
};
|
|
7470
7475
|
img.onload = onReady;
|
|
7471
7476
|
img.onerror = onReady;
|
|
7472
|
-
img
|
|
7477
|
+
applyEditableImageSrc(img, url);
|
|
7473
7478
|
if (img.complete && img.naturalWidth > 0) {
|
|
7474
7479
|
requestAnimationFrame(() => onReady());
|
|
7475
7480
|
}
|
|
@@ -7543,7 +7548,7 @@ function OhhwellsBridge() {
|
|
|
7543
7548
|
document.querySelectorAll(`[data-ohw-key="${key}"]`).forEach((el) => {
|
|
7544
7549
|
if (el.dataset.ohwEditable === "image") {
|
|
7545
7550
|
const img = el instanceof HTMLImageElement ? el : el.querySelector("img");
|
|
7546
|
-
if (img) img
|
|
7551
|
+
if (img) applyEditableImageSrc(img, val);
|
|
7547
7552
|
} else if (el.dataset.ohwEditable === "bg-image") {
|
|
7548
7553
|
el.style.backgroundImage = `url('${val}')`;
|
|
7549
7554
|
} else if (el.dataset.ohwEditable === "link") {
|