@innovastudio/contentbuilder 1.4.137 → 1.4.138
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/package.json
CHANGED
|
@@ -45837,6 +45837,7 @@ class Image$1 {
|
|
|
45837
45837
|
|
|
45838
45838
|
//Check if image is part of module snippet. If so, refresh the (active) module (hide imageTool). If not, refresh imageTool position
|
|
45839
45839
|
this.refreshIfIsModule(img);
|
|
45840
|
+
this.startImageMonitor(img);
|
|
45840
45841
|
|
|
45841
45842
|
//Trigger Change event
|
|
45842
45843
|
this.builder.opts.onChange();
|
|
@@ -46371,6 +46372,30 @@ class Image$1 {
|
|
|
46371
46372
|
this.builder.imgs = [];
|
|
46372
46373
|
} //constructor
|
|
46373
46374
|
|
|
46375
|
+
startImageMonitor(target) {
|
|
46376
|
+
let observer;
|
|
46377
|
+
const config = {
|
|
46378
|
+
attributes: true
|
|
46379
|
+
};
|
|
46380
|
+
observer = new MutationObserver(mutations => {
|
|
46381
|
+
mutations.forEach(mutation => {
|
|
46382
|
+
if (mutation.attributeName === 'src') {
|
|
46383
|
+
// console.log('Image Changed:' + target.src);
|
|
46384
|
+
|
|
46385
|
+
if (this.builder.onImageSrcChange) this.builder.onImageSrcChange();
|
|
46386
|
+
stopImageMonitor(); // Stop the monitor when the image changes
|
|
46387
|
+
}
|
|
46388
|
+
});
|
|
46389
|
+
});
|
|
46390
|
+
|
|
46391
|
+
observer.observe(target, config);
|
|
46392
|
+
function stopImageMonitor() {
|
|
46393
|
+
if (observer) {
|
|
46394
|
+
observer.disconnect();
|
|
46395
|
+
// console.log('Monitor Stopped');
|
|
46396
|
+
}
|
|
46397
|
+
}
|
|
46398
|
+
}
|
|
46374
46399
|
open() {
|
|
46375
46400
|
const movControlBox = document.querySelector('.moveable-control-box');
|
|
46376
46401
|
if (movControlBox) movControlBox.style.display = 'none'; //needed by Safari (prevent z-index problem)
|