@innovastudio/contentbuilder 1.4.26 → 1.4.28

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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.4.26",
4
+ "version": "1.4.28",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -77219,14 +77219,19 @@ class LivePreview {
77219
77219
  });
77220
77220
  const btnModalRefresh = modal.querySelector('.is-modal-refresh');
77221
77221
  btnModalRefresh.addEventListener('click', () => {
77222
- this.previewRefresh();
77222
+ this.previewRefresh(false, true);
77223
77223
  }); //Extend onChange
77224
77224
 
77225
77225
  let old2 = this.builder.settings.onChange;
77226
77226
 
77227
77227
  this.builder.settings.onChange = () => {
77228
77228
  old2.call(this);
77229
- this.previewRefresh();
77229
+
77230
+ if (!this.builder.doc.querySelector('.is-wrapper')) {
77231
+ // ContentBuilder
77232
+ this.previewRefresh();
77233
+ } // For ContentBox, this onChange will trigger ContentBox onChange (which has previewRefresh called)
77234
+
77230
77235
  };
77231
77236
  }
77232
77237
  }
@@ -77272,7 +77277,7 @@ class LivePreview {
77272
77277
  this.previewRefresh(true);
77273
77278
  }
77274
77279
 
77275
- previewRefresh(disableOnContentLoad) {
77280
+ previewRefresh(disableOnContentLoad, hardReload) {
77276
77281
  if (this.modal.classList.contains('active')) {
77277
77282
  // let html = this.builder.html();
77278
77283
  // localStorage.setItem('preview-html', html);
@@ -77312,7 +77317,16 @@ class LivePreview {
77312
77317
  }
77313
77318
  } else {
77314
77319
  // ContentBox
77315
- if (this.builder.livePreviewAlwaysReload) {
77320
+ if (!this.builder.count) this.builder.count = 0;
77321
+ this.builder.count++;
77322
+ let oriVal = this.builder.livePreviewAlwaysReload;
77323
+
77324
+ if (this.builder.count === this.builder.livePreviewReloadEvery) {
77325
+ this.builder.livePreviewAlwaysReload = true;
77326
+ this.builder.count = 0;
77327
+ }
77328
+
77329
+ if (this.builder.livePreviewAlwaysReload || hardReload) {
77316
77330
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77317
77331
  } else {
77318
77332
  let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
@@ -77397,6 +77411,8 @@ class LivePreview {
77397
77411
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77398
77412
  }
77399
77413
  }
77414
+
77415
+ this.builder.livePreviewAlwaysReload = oriVal;
77400
77416
  }
77401
77417
 
77402
77418
  iframe.onload = () => {
@@ -77532,6 +77548,8 @@ class ContentBuilder {
77532
77548
  previewStyle: 'top:auto;bottom:50px;left:50px;right:auto;',
77533
77549
  livePreviewOpen: false,
77534
77550
  livePreviewAlwaysReload: false,
77551
+ livePreviewReloadEvery: 30,
77552
+ // always reload every 30 onChange triggered (to clearup iframe resource for faster performance)
77535
77553
  scriptPath: '',
77536
77554
  // Deprecated
77537
77555
  // Old way: