@innovastudio/contentbuilder 1.4.12 → 1.4.14

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.12",
4
+ "version": "1.4.14",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -57467,16 +57467,20 @@ class RowTool {
57467
57467
 
57468
57468
  <div class="div-row-wrapcolumns" style="display:flex;flex-direction:column;padding-bottom:7px">
57469
57469
  <div style="padding-top:20px;padding-bottom:3px;">${util.out('Wrap Columns (Breakpoint)')}:</div>
57470
- <div style="padding-top:3px;display:flex;align-items: center;">
57471
- <button title="${util.out('Tablet (Landscape)')}" class="input-breakpoint" data-value="md" style="width:40px;height:25px;">
57472
- <svg class="is-icon-flex" style="width:16px;height:16px;transform:rotate(-90deg)"><use xlink:href="#icon-device-tablet"></use></svg>
57473
- </button>
57474
- <button title="${util.out('Tablet (Portrait)')}" class="input-breakpoint" data-value="sm" style="width:40px;height:25px;">
57475
- <svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-tablet"></use></svg>
57476
- </button>
57477
- <button title="${util.out('Mobile')}" class="input-breakpoint on" data-value="xs" style="width:40px;height:25px;">
57478
- <svg class="is-icon-flex" style="width:13px;height:13px"><use xlink:href="#icon-device-mobile"></use></svg>
57479
- </button>
57470
+ <div style="padding-top:3px;padding-bottom:5px;display:flex;align-items: center;">
57471
+
57472
+ <label class="flex mr-3" title="${util.out('Tablet (Landscape)')}">
57473
+ <input type="radio" id="rdoColMdWrap" name="boxWrap" value="md">
57474
+ <svg class="is-icon-flex" style="margin-left:3px;width:16px;height:16px;transform:rotate(-90deg)"><use xlink:href="#icon-device-tablet"></use></svg>
57475
+ </label>
57476
+ <label class="flex mr-3" title="${util.out('Tablet (Portrait)')}">
57477
+ <input type="radio" id="rdoColSmWrap" name="boxWrap" value="sm">
57478
+ <svg class="is-icon-flex" style="margin-left:3px;width:16px;height:16px"><use xlink:href="#icon-device-tablet"></use></svg>
57479
+ </label>
57480
+ <label class="flex" title="${util.out('Mobile')}">
57481
+ <input type="radio" id="rdoColXsWrap" name="boxWrap" value="xs">
57482
+ <svg class="is-icon-flex" style="margin-left:3px;width:16px;height:16px"><use xlink:href="#icon-device-tablet"></use></svg>
57483
+ </label>
57480
57484
 
57481
57485
  </div>
57482
57486
  </div>
@@ -57513,8 +57517,9 @@ class RowTool {
57513
57517
  </button>
57514
57518
  </div>
57515
57519
 
57516
- <label for="chkReverseColumns" style="margin:20px 0 0;display:flex"><input id="chkReverseColumns" type="checkbox" style="margin:0 7px 0 0"/><span>${util.out('Reverse Columns')}</span></label>
57517
-
57520
+ <div id="divReverseColumns" style="diplay:none">
57521
+ <label for="chkReverseColumns" style="margin:20px 0 0;display:flex"><input id="chkReverseColumns" type="checkbox" style="margin:0 7px 0 0"/><span>${util.out('Reverse Columns')}</span></label>
57522
+ </div>
57518
57523
  </div>
57519
57524
 
57520
57525
  <div id="divRowMore" class="is-tab-content" data-group="rowsettings" tabindex="-1">
@@ -57729,32 +57734,25 @@ class RowTool {
57729
57734
  this.builder.opts.onChange();
57730
57735
  }); // Breakpoint
57731
57736
 
57732
- let btns = this.rowSettings.querySelectorAll('.input-breakpoint');
57733
- btns.forEach(btn => {
57734
- btn.addEventListener('click', () => {
57737
+ rowSettings.querySelectorAll('input[name="boxWrap"]').forEach(input => {
57738
+ input.addEventListener('change', () => {
57735
57739
  let row = util.rowSelected();
57736
57740
  if (!row) return;
57737
57741
  this.builder.uo.saveForUndo();
57738
- let elms = this.rowSettings.querySelectorAll('.input-breakpoint');
57739
- elms.forEach(elm => {
57740
- elm.classList.remove('on');
57741
- });
57742
- btn.classList.add('on');
57743
- let target = btn.getAttribute('data-value');
57744
57742
 
57745
- if (target === 'xs') {
57743
+ if (input.value === 'xs') {
57746
57744
  row.classList.remove('sm-wrap');
57747
57745
  row.classList.remove('md-wrap');
57748
- } else if (target === 'sm') {
57746
+ } else if (input.value === 'sm') {
57749
57747
  row.classList.remove('md-wrap');
57750
57748
  row.classList.add('sm-wrap');
57751
- } else if (target === 'md') {
57752
- row.classList.remove('smd-wrap');
57749
+ } else if (input.value === 'md') {
57750
+ row.classList.remove('sm-wrap');
57753
57751
  row.classList.add('md-wrap');
57754
57752
  } //Trigger Change event
57755
57753
 
57756
57754
 
57757
- this.builder.onChange();
57755
+ this.builder.opts.onChange();
57758
57756
  });
57759
57757
  });
57760
57758
  const chkReverseBoxes = this.rowSettings.querySelector('#chkReverseColumns');
@@ -57795,7 +57793,7 @@ class RowTool {
57795
57793
  this.builder.settings.onChange();
57796
57794
  }); // Responsive Visibility
57797
57795
 
57798
- btns = this.rowSettings.querySelectorAll('.input-device');
57796
+ let btns = this.rowSettings.querySelectorAll('.input-device');
57799
57797
  btns.forEach(btn => {
57800
57798
  btn.addEventListener('click', () => {
57801
57799
  let row = util.rowSelected();
@@ -57995,7 +57993,31 @@ class RowTool {
57995
57993
  // });
57996
57994
  }
57997
57995
 
57998
- realtimeVisibility(row) {
57996
+ realtimeVisibility(row, initialOpen) {
57997
+ if (initialOpen) {
57998
+ const builderStuff = this.builder.builderStuff;
57999
+ const modal = builderStuff.querySelector('.is-modal.content-preview.active');
58000
+
58001
+ if (modal) {
58002
+ let elms = this.rowSettings.querySelectorAll('.input-device');
58003
+ elms.forEach(elm => {
58004
+ elm.classList.remove('on');
58005
+ });
58006
+
58007
+ if (modal.classList.contains('is-screen-1920')) {
58008
+ this.rowSettings.querySelector('.input-device[data-value=""]').classList.add('on');
58009
+ } else if (modal.classList.contains('is-screen-1440')) {
58010
+ this.rowSettings.querySelector('.input-device[data-value=""]').classList.add('on');
58011
+ } else if (modal.classList.contains('is-screen-1024')) {
58012
+ this.rowSettings.querySelector('.input-device[data-value="md"]').classList.add('on');
58013
+ } else if (modal.classList.contains('is-screen-768')) {
58014
+ this.rowSettings.querySelector('.input-device[data-value="sm"]').classList.add('on');
58015
+ } else if (modal.classList.contains('is-screen-375')) {
58016
+ this.rowSettings.querySelector('.input-device[data-value="xs"]').classList.add('on');
58017
+ }
58018
+ }
58019
+ }
58020
+
57999
58021
  let divTarget = this.rowSettings.querySelector('.div-target');
58000
58022
  let divVisibility = this.rowSettings.querySelector('.div-visibility');
58001
58023
  let target = this.builder.responsive.readTarget(divTarget);
@@ -58006,12 +58028,16 @@ class RowTool {
58006
58028
 
58007
58029
  if (target === 'xs') {
58008
58030
  valReverse = row.classList.contains('xs-column-reverse');
58031
+ if (!initialOpen) this.builder.livePreview.resizePreview(375);
58009
58032
  } else if (target === 'sm') {
58010
58033
  valReverse = row.classList.contains('sm-column-reverse');
58034
+ if (!initialOpen) this.builder.livePreview.resizePreview(768);
58011
58035
  } else if (target === 'md') {
58012
58036
  valReverse = row.classList.contains('md-column-reverse');
58037
+ if (!initialOpen) this.builder.livePreview.resizePreview(1024);
58013
58038
  } else {
58014
58039
  valReverse = row.classList.contains('desktop-column-reverse');
58040
+ if (!initialOpen) this.builder.livePreview.resizePreview(1920);
58015
58041
  }
58016
58042
 
58017
58043
  const chkReverseColumns = this.rowSettings.querySelector('#chkReverseColumns');
@@ -58324,18 +58350,26 @@ class RowTool {
58324
58350
 
58325
58351
  let actualRow = row.parentNode; // row is actually row overlay
58326
58352
 
58327
- this.realtimeVisibility(actualRow);
58328
- let elms = this.rowSettings.querySelectorAll('.input-breakpoint');
58329
- elms.forEach(elm => {
58330
- elm.classList.remove('on');
58331
- });
58353
+ this.realtimeVisibility(actualRow, true);
58354
+ const divReverseBoxes = this.rowSettings.querySelector('#divReverseColumns');
58355
+ let num = 3; //is-row-tool, is-col-tool & is-rowadd-tool
58356
+
58357
+ if (actualRow.querySelector('.is-row-overlay')) {
58358
+ num = 4; //is-row-tool, is-col-tool, is-rowadd-tool & is-row-overlay
58359
+ }
58360
+
58361
+ if (actualRow.childElementCount - num > 1) {
58362
+ divReverseBoxes.style.display = 'flex';
58363
+ } else {
58364
+ divReverseBoxes.style.display = 'none';
58365
+ }
58332
58366
 
58333
58367
  if (actualRow.classList.contains('md-wrap')) {
58334
- this.rowSettings.querySelector('.input-breakpoint[data-value="md"]').classList.add('on');
58368
+ this.rowSettings.querySelector('#rdoColMdWrap').checked = true;
58335
58369
  } else if (actualRow.classList.contains('sm-wrap')) {
58336
- this.rowSettings.querySelector('.input-breakpoint[data-value="sm"]').classList.add('on');
58370
+ this.rowSettings.querySelector('#rdoColSmWrap').checked = true;
58337
58371
  } else {
58338
- this.rowSettings.querySelector('.input-breakpoint[data-value="xs"]').classList.add('on');
58372
+ this.rowSettings.querySelector('#rdoColXsWrap').checked = true;
58339
58373
  } //More
58340
58374
 
58341
58375
 
@@ -60283,6 +60317,12 @@ class ColumnTool {
60283
60317
  });
60284
60318
  let btnVisible = this.cellSettings.querySelector('.input-visible');
60285
60319
  let btnHidden = this.cellSettings.querySelector('.input-hidden');
60320
+
60321
+ const rowHasHiddenColumns = (row, target) => {
60322
+ let cols = row.querySelectorAll(`.${target}-hidden`);
60323
+ return cols.length > 0;
60324
+ };
60325
+
60286
60326
  btnVisible.addEventListener('click', () => {
60287
60327
  let cell = this.util.cellSelected();
60288
60328
  if (!cell) return;
@@ -60295,12 +60335,13 @@ class ColumnTool {
60295
60335
  cell.classList.remove('xs-hidden');
60296
60336
  } else if (target === 'sm') {
60297
60337
  cell.classList.remove('sm-hidden');
60298
- cell.parentNode.classList.remove('sm-autofit');
60338
+ if (!rowHasHiddenColumns(cell.parentNode, 'sm')) cell.parentNode.classList.remove('sm-autofit');
60299
60339
  } else if (target === 'md') {
60300
60340
  cell.classList.remove('md-hidden');
60301
- cell.parentNode.classList.remove('md-autofit');
60341
+ if (!rowHasHiddenColumns(cell.parentNode, 'md')) cell.parentNode.classList.remove('md-autofit');
60302
60342
  } else if (target === '') {
60303
60343
  cell.classList.remove('desktop-hidden');
60344
+ if (!rowHasHiddenColumns(cell.parentNode, 'desktop')) cell.parentNode.classList.remove('desktop-autofit');
60304
60345
  }
60305
60346
 
60306
60347
  btnVisible.classList.add('on');
@@ -60326,6 +60367,7 @@ class ColumnTool {
60326
60367
  cell.parentNode.classList.add('md-autofit');
60327
60368
  } else if (target === '') {
60328
60369
  cell.classList.add('desktop-hidden');
60370
+ cell.parentNode.classList.add('desktop-autofit');
60329
60371
  }
60330
60372
 
60331
60373
  btnVisible.classList.remove('on');
@@ -60523,7 +60565,7 @@ class ColumnTool {
60523
60565
  dom.addClass(btn, 'on');
60524
60566
  }
60525
60567
 
60526
- this.realtimeVisibility(cell); //More
60568
+ this.realtimeVisibility(cell, true); //More
60527
60569
 
60528
60570
  let inpCellId = this.cellSettings.querySelector('.input-cell-id');
60529
60571
  inpCellId.value = '';
@@ -60539,12 +60581,46 @@ class ColumnTool {
60539
60581
  inpCellClasses.value = classes;
60540
60582
  }
60541
60583
 
60542
- realtimeVisibility(cell) {
60584
+ realtimeVisibility(cell, initialOpen) {
60585
+ if (initialOpen) {
60586
+ const builderStuff = this.builder.builderStuff;
60587
+ const modal = builderStuff.querySelector('.is-modal.content-preview.active');
60588
+
60589
+ if (modal) {
60590
+ let elms = this.cellSettings.querySelectorAll('.input-device');
60591
+ elms.forEach(elm => {
60592
+ elm.classList.remove('on');
60593
+ });
60594
+
60595
+ if (modal.classList.contains('is-screen-1920')) {
60596
+ this.cellSettings.querySelector('.input-device[data-value=""]').classList.add('on');
60597
+ } else if (modal.classList.contains('is-screen-1440')) {
60598
+ this.cellSettings.querySelector('.input-device[data-value=""]').classList.add('on');
60599
+ } else if (modal.classList.contains('is-screen-1024')) {
60600
+ this.cellSettings.querySelector('.input-device[data-value="md"]').classList.add('on');
60601
+ } else if (modal.classList.contains('is-screen-768')) {
60602
+ this.cellSettings.querySelector('.input-device[data-value="sm"]').classList.add('on');
60603
+ } else if (modal.classList.contains('is-screen-375')) {
60604
+ this.cellSettings.querySelector('.input-device[data-value="xs"]').classList.add('on');
60605
+ }
60606
+ }
60607
+ }
60608
+
60543
60609
  let divTarget = this.cellSettings.querySelector('.div-target');
60544
60610
  let divVisibility = this.cellSettings.querySelector('.div-visibility');
60545
60611
  let target = this.builder.responsive.readTarget(divTarget);
60546
60612
  let valVisibility = this.builder.responsive.getVisibility(cell, target);
60547
- this.builder.responsive.showVisibility(divVisibility, valVisibility);
60613
+ this.builder.responsive.showVisibility(divVisibility, valVisibility); // Live Preview Sync
60614
+
60615
+ if (target === 'xs') {
60616
+ if (!initialOpen) this.builder.livePreview.resizePreview(375);
60617
+ } else if (target === 'sm') {
60618
+ if (!initialOpen) this.builder.livePreview.resizePreview(768);
60619
+ } else if (target === 'md') {
60620
+ if (!initialOpen) this.builder.livePreview.resizePreview(1024);
60621
+ } else {
60622
+ if (!initialOpen) this.builder.livePreview.resizePreview(1920);
60623
+ }
60548
60624
  }
60549
60625
 
60550
60626
  openImagePicker(currentUrl, callback, btn) {
@@ -76694,7 +76770,7 @@ class LivePreview {
76694
76770
  z-index:100021 !important
76695
76771
  }
76696
76772
  </style>
76697
- <div style="z-index:10002;${this.builder.previewStyle}" class="is-modal is-modal-content content-preview is-screen-1920" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
76773
+ <div style="z-index:10004;${this.builder.previewStyle}" class="is-modal is-modal-content content-preview is-screen-1920" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
76698
76774
  <div class="is-modal-bar is-draggable" draggable="">
76699
76775
  <span>${util.out('Live Preview')}</span>
76700
76776
  <button class="is-modal-device" tabindex="-1" style="user-select:none;cursor:default">
@@ -76727,41 +76803,18 @@ class LivePreview {
76727
76803
  this.closePreview();
76728
76804
  });
76729
76805
  const btnModalSize = modal.querySelector('.is-modal-size');
76730
- const infoDevice = modal.querySelector('.is-modal-device');
76731
76806
  btnModalSize.addEventListener('click', () => {
76732
76807
  if (modal.classList.contains('is-screen-1920')) {
76733
- modal.classList.remove('is-screen-1920');
76734
- modal.classList.add('is-screen-1440');
76735
- localStorage.setItem('_livepreviewscreen', 'is-screen-1440');
76736
- infoDevice.setAttribute('title', util.out('Laptop'));
76737
- infoDevice.innerHTML = '<svg class="is-icon-flex" style="width:18px;height:18px"><use xlink:href="#icon-device-laptop"></use></svg>';
76808
+ this.resizePreview(1440);
76738
76809
  } else if (modal.classList.contains('is-screen-1440')) {
76739
- modal.classList.remove('is-screen-1440');
76740
- modal.classList.add('is-screen-1024');
76741
- infoDevice.setAttribute('title', util.out('Tablet (Landscape)'));
76742
- localStorage.setItem('_livepreviewscreen', 'is-screen-1024');
76743
- infoDevice.innerHTML = '<svg class="is-icon-flex" style="width:16px;height:16px;transform:rotate(-90deg)"><use xlink:href="#icon-device-tablet"></use></svg>';
76810
+ this.resizePreview(1024);
76744
76811
  } else if (modal.classList.contains('is-screen-1024')) {
76745
- modal.classList.remove('is-screen-1024');
76746
- modal.classList.add('is-screen-768');
76747
- localStorage.setItem('_livepreviewscreen', 'is-screen-768');
76748
- infoDevice.setAttribute('title', util.out('Tablet (Portrait)'));
76749
- infoDevice.innerHTML = '<svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-tablet"></use></svg>';
76812
+ this.resizePreview(768);
76750
76813
  } else if (modal.classList.contains('is-screen-768')) {
76751
- modal.classList.remove('is-screen-768');
76752
- modal.classList.add('is-screen-375');
76753
- localStorage.setItem('_livepreviewscreen', 'is-screen-375');
76754
- infoDevice.setAttribute('title', util.out('Mobile'));
76755
- infoDevice.innerHTML = '<svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-mobile"></use></svg>';
76814
+ this.resizePreview(375);
76756
76815
  } else if (modal.classList.contains('is-screen-375')) {
76757
- modal.classList.remove('is-screen-375');
76758
- modal.classList.add('is-screen-1920');
76759
- localStorage.setItem('_livepreviewscreen', 'is-screen-1920');
76760
- infoDevice.setAttribute('title', util.out('Desktop'));
76761
- infoDevice.innerHTML = '<svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-desktop"></use></svg>';
76816
+ this.resizePreview(1920);
76762
76817
  }
76763
-
76764
- this.previewRefresh(true);
76765
76818
  });
76766
76819
  const btnModalRefresh = modal.querySelector('.is-modal-refresh');
76767
76820
  btnModalRefresh.addEventListener('click', () => {
@@ -76777,6 +76830,47 @@ class LivePreview {
76777
76830
  }
76778
76831
  }
76779
76832
 
76833
+ resizePreview(size) {
76834
+ let modal = this.modal;
76835
+ let util = this.util;
76836
+ modal.classList.remove('is-screen-1440');
76837
+ modal.classList.remove('is-screen-1920');
76838
+ modal.classList.remove('is-screen-1024');
76839
+ modal.classList.remove('is-screen-768');
76840
+ modal.classList.remove('is-screen-375');
76841
+ const infoDevice = modal.querySelector('.is-modal-device');
76842
+
76843
+ if (size === 1440) {
76844
+ modal.classList.add('is-screen-1440');
76845
+ localStorage.setItem('_livepreviewscreen', 'is-screen-1440');
76846
+ infoDevice.setAttribute('title', util.out('Laptop'));
76847
+ infoDevice.innerHTML = '<svg class="is-icon-flex" style="width:18px;height:18px"><use xlink:href="#icon-device-laptop"></use></svg>';
76848
+ } else if (size === 1024) {
76849
+ modal.classList.remove('is-screen-1440');
76850
+ modal.classList.add('is-screen-1024');
76851
+ infoDevice.setAttribute('title', util.out('Tablet (Landscape)'));
76852
+ localStorage.setItem('_livepreviewscreen', 'is-screen-1024');
76853
+ infoDevice.innerHTML = '<svg class="is-icon-flex" style="width:16px;height:16px;transform:rotate(-90deg)"><use xlink:href="#icon-device-tablet"></use></svg>';
76854
+ } else if (size === 768) {
76855
+ modal.classList.add('is-screen-768');
76856
+ localStorage.setItem('_livepreviewscreen', 'is-screen-768');
76857
+ infoDevice.setAttribute('title', util.out('Tablet (Portrait)'));
76858
+ infoDevice.innerHTML = '<svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-tablet"></use></svg>';
76859
+ } else if (size === 375) {
76860
+ modal.classList.add('is-screen-375');
76861
+ localStorage.setItem('_livepreviewscreen', 'is-screen-375');
76862
+ infoDevice.setAttribute('title', util.out('Mobile'));
76863
+ infoDevice.innerHTML = '<svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-mobile"></use></svg>';
76864
+ } else if (size === 1920) {
76865
+ modal.classList.add('is-screen-1920');
76866
+ localStorage.setItem('_livepreviewscreen', 'is-screen-1920');
76867
+ infoDevice.setAttribute('title', util.out('Desktop'));
76868
+ infoDevice.innerHTML = '<svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-desktop"></use></svg>';
76869
+ }
76870
+
76871
+ this.previewRefresh(true);
76872
+ }
76873
+
76780
76874
  previewRefresh(disableOnContentLoad) {
76781
76875
  if (this.modal.classList.contains('active')) {
76782
76876
  // let html = this.builder.html();