@innovastudio/contentbuilder 1.4.25 → 1.4.27

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.25",
4
+ "version": "1.4.27",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -58721,6 +58721,7 @@ class ColumnTool {
58721
58721
  const util = this.builder.util;
58722
58722
  const builderStuff = this.builder.builderStuff;
58723
58723
  this.util = util;
58724
+ this.builderStuff = builderStuff;
58724
58725
  const dom = this.builder.dom;
58725
58726
  this.dom = dom;
58726
58727
  let columnMore = builderStuff.querySelector('.is-pop.columnmore');
@@ -58829,9 +58830,6 @@ class ColumnTool {
58829
58830
  <button title="${util.out('Desktop')}" class="input-device on" data-value="" style="width:40px;height:25px;">
58830
58831
  <svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-desktop"></use></svg>
58831
58832
  </button>
58832
- <!--<button title="${util.out('Laptop/Tablet (Landscape)')}" class="input-device" data-value="md" style="width:40px;height:25px;">
58833
- <svg class="is-icon-flex" style="width:19px;height:19px;"><use xlink:href="#icon-device-laptop"></use></svg>
58834
- </button>-->
58835
58833
  <button title="${util.out('Laptop/Tablet (Landscape)')}" class="input-device" data-value="md" style="width:40px;height:25px;">
58836
58834
  <svg class="is-icon-flex" style="width:16px;height:16px;transform:rotate(-90deg)"><use xlink:href="#icon-device-tablet"></use></svg>
58837
58835
  </button>
@@ -59022,6 +59020,21 @@ class ColumnTool {
59022
59020
 
59023
59021
  <div style="padding:0;margin-top:25px;">
59024
59022
 
59023
+ <div class="div-target" style="display: flex;justify-content: flex-end;padding: 5px 0 0;">
59024
+ <button title="${util.out('Desktop')}" class="input-device on" data-value="" style="width:40px;height:25px;">
59025
+ <svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-desktop"></use></svg>
59026
+ </button>
59027
+ <button title="${util.out('Laptop/Tablet (Landscape)')}" class="input-device" data-value="md" style="width:40px;height:25px;">
59028
+ <svg class="is-icon-flex" style="width:16px;height:16px;transform:rotate(-90deg)"><use xlink:href="#icon-device-tablet"></use></svg>
59029
+ </button>
59030
+ <button title="${util.out('Tablet (Portrait)')}" class="input-device" data-value="sm" style="width:40px;height:25px;">
59031
+ <svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-tablet"></use></svg>
59032
+ </button>
59033
+ <button title="${util.out('Mobile')}" class="input-device" data-value="xs" style="width:40px;height:25px;">
59034
+ <svg class="is-icon-flex" style="width:13px;height:13px"><use xlink:href="#icon-device-mobile"></use></svg>
59035
+ </button>
59036
+ </div>
59037
+
59025
59038
  <div style="padding-bottom:3px;">${util.out('Scale')}:</div>
59026
59039
  <div style="padding-top:4px">
59027
59040
  <input type="range" min="100" max="500" value="0" class="image-scale-slider is-rangeslider">
@@ -60640,6 +60653,25 @@ class ColumnTool {
60640
60653
  btnHidden.classList.add('on'); //Trigger Change event
60641
60654
 
60642
60655
  this.builder.opts.onChange();
60656
+ }); // Responsive Image Adjust
60657
+
60658
+ btns = this.imageAdjust.querySelectorAll('.input-device');
60659
+ btns.forEach(btn => {
60660
+ btn.addEventListener('click', () => {
60661
+ let elms = this.imageAdjust.querySelectorAll('.input-device');
60662
+ elms.forEach(elm => {
60663
+ elm.classList.remove('on');
60664
+ });
60665
+ btn.classList.add('on');
60666
+ const modal = builderStuff.querySelector('.is-modal.content-preview');
60667
+
60668
+ if (!modal.classList.contains('active')) {
60669
+ this.builder.openPreview();
60670
+ }
60671
+
60672
+ this.realtimeImageAdjust();
60673
+ this.readImageAdjust(this.builder.elementSelected, this.useTarget);
60674
+ });
60643
60675
  });
60644
60676
  }
60645
60677
 
@@ -60907,9 +60939,8 @@ class ColumnTool {
60907
60939
  if (btn) btn.setAttribute('data-focus', true);
60908
60940
  }
60909
60941
 
60910
- openImageAdjust(elm, btn, useTarget) {
60911
- if (useTarget) this.useTarget = true;else this.useTarget = false; //Current value
60912
-
60942
+ readImageAdjust(elm, useTarget) {
60943
+ //Current value
60913
60944
  const imageAdjust = this.imageAdjust;
60914
60945
  const inpImageScaleSlider = imageAdjust.querySelector('.image-scale-slider');
60915
60946
  const inpImageHorSlider = imageAdjust.querySelector('.image-hor-slider');
@@ -60917,6 +60948,7 @@ class ColumnTool {
60917
60948
  inpImageScaleSlider.value = 100;
60918
60949
  inpImageHorSlider.value = 0;
60919
60950
  inpImageVertSlider.value = 0;
60951
+ inpImageScaleSlider.disabled = false;
60920
60952
 
60921
60953
  if (useTarget) {
60922
60954
  inpImageHorSlider.value = 50;
@@ -60995,16 +61027,79 @@ class ColumnTool {
60995
61027
  } //elementSelected
60996
61028
 
60997
61029
 
60998
- this.builder.elementSelected = elm; //Show modal
61030
+ this.builder.elementSelected = elm;
61031
+ }
61032
+
61033
+ openImageAdjust(elm, btn, useTarget) {
61034
+ if (useTarget) this.useTarget = true;else this.useTarget = false;
61035
+ const divTarget = this.imageAdjust.querySelector('.div-target');
61036
+
61037
+ if (useTarget) {
61038
+ divTarget.style.display = 'flex';
61039
+ } else {
61040
+ divTarget.style.display = 'none';
61041
+ }
61042
+
61043
+ const modal = this.builderStuff.querySelector('.is-modal.content-preview');
61044
+ let elms = this.imageAdjust.querySelectorAll('.input-device');
61045
+ elms.forEach(elm => {
61046
+ elm.classList.remove('on');
61047
+ });
61048
+
61049
+ if (!modal.classList.contains('active')) {
61050
+ this.imageAdjust.querySelector('.input-device[data-value=""]').classList.add('on');
61051
+ }
61052
+
61053
+ this.readImageAdjust(elm, useTarget); //Show modal
60999
61054
 
61000
- imageAdjust.style.zIndex = '10005';
61001
- this.util.showModal(imageAdjust, false, () => {
61055
+ this.imageAdjust.style.zIndex = '10005';
61056
+ this.util.showModal(this.imageAdjust, false, () => {
61002
61057
  if (btn) {
61003
61058
  btn.removeAttribute('data-focus');
61004
61059
  btn.focus();
61005
61060
  }
61006
61061
  });
61007
61062
  if (btn) btn.setAttribute('data-focus', true);
61063
+ this.realtimeImageAdjust(true);
61064
+ }
61065
+
61066
+ realtimeImageAdjust(initialOpen) {
61067
+ if (initialOpen) {
61068
+ const builderStuff = this.builder.builderStuff;
61069
+ const modal = builderStuff.querySelector('.is-modal.content-preview.active');
61070
+
61071
+ if (modal) {
61072
+ let elms = this.imageAdjust.querySelectorAll('.input-device');
61073
+ elms.forEach(elm => {
61074
+ elm.classList.remove('on');
61075
+ });
61076
+
61077
+ if (modal.classList.contains('is-screen-1920')) {
61078
+ this.imageAdjust.querySelector('.input-device[data-value=""]').classList.add('on');
61079
+ } else if (modal.classList.contains('is-screen-1440')) {
61080
+ this.imageAdjust.querySelector('.input-device[data-value=""]').classList.add('on');
61081
+ } else if (modal.classList.contains('is-screen-1024')) {
61082
+ this.imageAdjust.querySelector('.input-device[data-value="md"]').classList.add('on');
61083
+ } else if (modal.classList.contains('is-screen-768')) {
61084
+ this.imageAdjust.querySelector('.input-device[data-value="sm"]').classList.add('on');
61085
+ } else if (modal.classList.contains('is-screen-375')) {
61086
+ this.imageAdjust.querySelector('.input-device[data-value="xs"]').classList.add('on');
61087
+ }
61088
+ }
61089
+ }
61090
+
61091
+ let divTarget = this.imageAdjust.querySelector('.div-target');
61092
+ let target = this.builder.responsive.readTarget(divTarget); // Live Preview Sync
61093
+
61094
+ if (target === 'xs') {
61095
+ if (!initialOpen) this.builder.livePreview.resizePreview(375);
61096
+ } else if (target === 'sm') {
61097
+ if (!initialOpen) this.builder.livePreview.resizePreview(768);
61098
+ } else if (target === 'md') {
61099
+ if (!initialOpen) this.builder.livePreview.resizePreview(1024);
61100
+ } else {
61101
+ if (!initialOpen) this.builder.livePreview.resizePreview(1920);
61102
+ }
61008
61103
  }
61009
61104
 
61010
61105
  resetImage(elm) {
@@ -77131,7 +77226,12 @@ class LivePreview {
77131
77226
 
77132
77227
  this.builder.settings.onChange = () => {
77133
77228
  old2.call(this);
77134
- 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
+
77135
77235
  };
77136
77236
  }
77137
77237
  }
@@ -77217,6 +77317,15 @@ class LivePreview {
77217
77317
  }
77218
77318
  } else {
77219
77319
  // ContentBox
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
+
77220
77329
  if (this.builder.livePreviewAlwaysReload) {
77221
77330
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77222
77331
  } else {
@@ -77302,6 +77411,8 @@ class LivePreview {
77302
77411
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77303
77412
  }
77304
77413
  }
77414
+
77415
+ this.builder.livePreviewAlwaysReload = oriVal;
77305
77416
  }
77306
77417
 
77307
77418
  iframe.onload = () => {
@@ -77437,6 +77548,8 @@ class ContentBuilder {
77437
77548
  previewStyle: 'top:auto;bottom:50px;left:50px;right:auto;',
77438
77549
  livePreviewOpen: false,
77439
77550
  livePreviewAlwaysReload: false,
77551
+ livePreviewReloadEvery: 30,
77552
+ // always reload every 30 onChange triggered (to clearup iframe resource for faster performance)
77440
77553
  scriptPath: '',
77441
77554
  // Deprecated
77442
77555
  // Old way: