@innovastudio/contentbuilder 1.3.18 → 1.3.20

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.3.18",
4
+ "version": "1.3.20",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -1969,6 +1969,8 @@ button:focus-visible {
1969
1969
  text-align: center;
1970
1970
  cursor: pointer;
1971
1971
  box-shadow: none;
1972
+ background: transparent;
1973
+ border: none;
1972
1974
  }
1973
1975
  #_cbhtml .is-modal div.is-modal-footer button,
1974
1976
  .is-ui .is-modal div.is-modal-footer button {
@@ -2562,27 +2564,32 @@ button:focus-visible {
2562
2564
  font-size: 13px;
2563
2565
  line-height: 1.7;
2564
2566
  }
2565
- #_cbhtml .is-modal.imagesource .is-modal-content,
2566
- .is-ui .is-modal.imagesource .is-modal-content {
2567
+ #_cbhtml .is-modal.imagesource .is-modal-content, #_cbhtml .is-modal.mediasource .is-modal-content,
2568
+ .is-ui .is-modal.imagesource .is-modal-content,
2569
+ .is-ui .is-modal.mediasource .is-modal-content {
2567
2570
  padding: 20px;
2568
2571
  }
2569
- #_cbhtml .is-modal.imagesource .image-src,
2570
- .is-ui .is-modal.imagesource .image-src {
2572
+ #_cbhtml .is-modal.imagesource .image-src, #_cbhtml .is-modal.mediasource .image-src,
2573
+ .is-ui .is-modal.imagesource .image-src,
2574
+ .is-ui .is-modal.mediasource .image-src {
2571
2575
  display: flex;
2572
2576
  }
2573
- #_cbhtml .is-modal.imagesource .image-src > button,
2574
- .is-ui .is-modal.imagesource .image-src > button {
2577
+ #_cbhtml .is-modal.imagesource .image-src > button, #_cbhtml .is-modal.mediasource .image-src > button,
2578
+ .is-ui .is-modal.imagesource .image-src > button,
2579
+ .is-ui .is-modal.mediasource .image-src > button {
2575
2580
  background: transparent !important;
2576
2581
  width: 50px;
2577
2582
  height: 43px;
2578
2583
  }
2579
- #_cbhtml .is-modal.imagesource .input-select,
2580
- .is-ui .is-modal.imagesource .input-select {
2584
+ #_cbhtml .is-modal.imagesource .input-select, #_cbhtml .is-modal.mediasource .input-select,
2585
+ .is-ui .is-modal.imagesource .input-select,
2586
+ .is-ui .is-modal.mediasource .input-select {
2581
2587
  width: 50px;
2582
2588
  height: 43px;
2583
2589
  }
2584
- #_cbhtml .is-modal.imagesource .input-upload,
2585
- .is-ui .is-modal.imagesource .input-upload {
2590
+ #_cbhtml .is-modal.imagesource .input-upload, #_cbhtml .is-modal.mediasource .input-upload,
2591
+ .is-ui .is-modal.imagesource .input-upload,
2592
+ .is-ui .is-modal.mediasource .input-upload {
2586
2593
  width: 50px;
2587
2594
  height: 43px;
2588
2595
  }
@@ -5169,6 +5176,5 @@ button:focus-visible {
5169
5176
 
5170
5177
  /* Make slider block resizable */
5171
5178
  .is-builder > div > div[data-module=slider-builder].cell-active {
5172
- padding: 0 2px 4px !important;
5173
5179
  z-index: 1 !important;
5174
5180
  }
@@ -15783,7 +15783,7 @@ class Snippets {
15783
15783
  z-index:10;width:30px;height:30px;position:absolute;
15784
15784
  top:2px;right:2px;box-sizing:border-box;padding:0;line-height:40px;font-size: 12px;text-align:center;cursor:pointer;
15785
15785
  }
15786
- .is-pop-close:focus {
15786
+ .is-pop-close:focus-visible {
15787
15787
  outline: ${this.builder.styleOutlineColor} 2px solid;
15788
15788
  }
15789
15789
 
@@ -15924,7 +15924,7 @@ class Snippets {
15924
15924
  border-radius: 2px;
15925
15925
  }
15926
15926
 
15927
- .is-design-list>li:focus {
15927
+ .is-design-list>li:focus-visible {
15928
15928
  outline: ${this.builder.styleOutlineColor} 2px solid;
15929
15929
  }
15930
15930
 
@@ -16023,7 +16023,7 @@ class Snippets {
16023
16023
  cursor: default;
16024
16024
  }
16025
16025
 
16026
- .is-category-list a:focus {
16026
+ .is-category-list a:focus-visible {
16027
16027
  outline: ${this.builder.styleOutlineColor} 2px solid;
16028
16028
  }
16029
16029
 
@@ -53080,9 +53080,13 @@ class Module {
53080
53080
  var moduleDesc = module.getAttribute('data-module-desc');
53081
53081
 
53082
53082
  if (moduleDesc) {
53083
- moduleModal.querySelector('.is-modal-bar').innerHTML = moduleDesc + `<button class="is-modal-close" tabindex="-1" title="${util.out('Close')}">&#10005;</button>`;
53083
+ moduleModal.querySelector('.is-modal-bar').innerHTML = moduleDesc + `<button class="is-modal-close" tabindex="-1" title="${util.out('Close')}">
53084
+ <svg class="is-icon-flex" style="width:30px;height:30px;"><use xlink:href="#ion-ios-close-empty"></use></svg>
53085
+ </button>`;
53084
53086
  } else {
53085
- moduleModal.querySelector('.is-modal-bar').innerHTML = this.util.out('Module Settings') + `<button class="is-modal-close" tabindex="-1" title="${util.out('Close')}">&#10005;</button>`;
53087
+ moduleModal.querySelector('.is-modal-bar').innerHTML = this.util.out('Module Settings') + `<button class="is-modal-close" tabindex="-1" title="${util.out('Close')}">
53088
+ <svg class="is-icon-flex" style="width:30px;height:30px;"><use xlink:href="#ion-ios-close-empty"></use></svg>
53089
+ </button>`;
53086
53090
  }
53087
53091
 
53088
53092
  var w = module.getAttribute('data-dialog-width');
@@ -53097,6 +53101,12 @@ class Module {
53097
53101
  h = '570px';
53098
53102
  }
53099
53103
 
53104
+ if (modulename === 'slider-builder') {
53105
+ moduleModal.querySelector('div:not(.is-modal-overlay)').style.width = '90vw';
53106
+ w = '1500px';
53107
+ h = '80vh';
53108
+ }
53109
+
53100
53110
  moduleModal.querySelector('div:not(.is-modal-overlay)').style.maxWidth = w;
53101
53111
  moduleModal.querySelector('div:not(.is-modal-overlay)').style.height = h;
53102
53112
  let btnClose = moduleModal.querySelector('.is-modal-close');
@@ -54373,6 +54383,12 @@ class Video {
54373
54383
  let elm = e.target;
54374
54384
 
54375
54385
  if (elm.tagName.toLowerCase() === 'video') {
54386
+ if (elm.closest('[data-html]')) {
54387
+ this.builder.activeVideo = null;
54388
+ this.videoTool.style.display = '';
54389
+ return;
54390
+ }
54391
+
54376
54392
  this.builder.activeVideo = elm;
54377
54393
  this.videoTool.style.display = 'flex';
54378
54394
  let _toolwidth = this.videoTool.offsetWidth; //to get value, element must not hidden (display:none). So set display:flex before this.
@@ -54380,7 +54396,8 @@ class Video {
54380
54396
  let w = elm.offsetWidth * this.builder.opts.zoom;
54381
54397
  let top = elm.getBoundingClientRect().top + this.builder.win.pageYOffset;
54382
54398
  let left = elm.getBoundingClientRect().left;
54383
- left = left + (w - _toolwidth); //Adjust left in case an element is outside the screen
54399
+ left = left + (w - _toolwidth); // left = left + (w/2 - _toolwidth/2);
54400
+ //Adjust left in case an element is outside the screen
54384
54401
 
54385
54402
  const _screenwidth = window.innerWidth;
54386
54403
  if (_toolwidth + left > _screenwidth) left = elm.getBoundingClientRect().left;
@@ -73626,6 +73643,166 @@ class ContentStuff {
73626
73643
 
73627
73644
  }
73628
73645
 
73646
+ class MediaPicker {
73647
+ constructor(builder) {
73648
+ this.builder = builder;
73649
+ const util = this.builder.util;
73650
+ this.util = util;
73651
+ const builderStuff = this.builder.builderStuff;
73652
+ const dom = this.builder.dom;
73653
+ this.dom = dom;
73654
+ this.id = this.builder.util.makeId();
73655
+ const html = `
73656
+ <div class="is-modal mediasource" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
73657
+ <div class="is-modal-content" style="max-width:550px;">
73658
+
73659
+ <label for="inpMediaSource" style="display:block">${util.out('Source')}:</label>
73660
+ <div class="image-src">
73661
+ <input id="inpMediaSource" class="input-src" type="text">
73662
+ <button title="${util.out('Select')}" class="input-select" style="flex:none;"><svg class="is-icon-flex"><use xlink:href="#ion-more"></use></svg></button>
73663
+ <div class="input-upload" style="position: relative; flex: 0 0 auto;box-shadow: rgba(0, 0, 0, 0.32) 0px 3px 6px -6px;">
73664
+ <form class="form-upload-larger" target="frameTarget${this.id}" method="post" action="${this.builder.opts.onLargerImageUpload}" enctype="multipart/form-data" style="position:absolute;display:flex;justify-content: center;align-items: center;top:0;left:0;width:100%;height:100%;">
73665
+ <input name="hidRefId" class="input-ref-id" type="hidden" value="">
73666
+ <svg class="is-icon-flex" style="width:18px;height:18px;"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
73667
+ <input title="${util.out('Select')}" name="fileImage" class="input-file-select" type="file" accept="image/*,video/mp4" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">
73668
+ </form>
73669
+ <iframe tabIndex="0" id="frameTarget${this.id}" name="frameTarget${this.id}" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>
73670
+ </div>
73671
+ </div>
73672
+
73673
+ <div style="text-align:right;margin-top:20px;">
73674
+ <button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
73675
+ <button title="${util.out('Ok')}" class="input-ok classic-primary">${util.out('Ok')}</button>
73676
+ </div>
73677
+
73678
+ </div>
73679
+ </div>
73680
+ `;
73681
+ dom.appendHtml(builderStuff, html);
73682
+ const modalMediaSelect = document.querySelector('.mediasource');
73683
+ this.modalMediaSelect = modalMediaSelect;
73684
+
73685
+ if (this.builder.opts.largerImageHandler === '' && !this.builder.opts.onLargerImageUpload) {
73686
+ modalMediaSelect.querySelector('.input-upload').style.display = 'none';
73687
+ }
73688
+
73689
+ if (!this.builder.opts.onImageSelectClick && this.builder.opts.imageselect === '') {
73690
+ modalMediaSelect.querySelector('.input-select').style.display = 'none';
73691
+ }
73692
+
73693
+ if (this.builder.opts.onImageSelectClick || this.builder.opts.imageselect || this.builder.opts.onFileSelectClick || this.builder.opts.fileselect) {
73694
+ const inpSrc = modalMediaSelect.querySelector('.input-src');
73695
+ const elm = modalMediaSelect.querySelector('.input-select');
73696
+ if (elm) dom.addEventListener(elm, 'click', () => {
73697
+ if (this.builder.opts.onFileSelectClick) {
73698
+ this.builder.opts.onFileSelectClick({
73699
+ targetInput: inpSrc,
73700
+ theTrigger: elm
73701
+ });
73702
+ } else if (this.builder.opts.onImageSelectClick) {
73703
+ this.builder.opts.onImageSelectClick({
73704
+ targetInput: inpSrc,
73705
+ theTrigger: elm
73706
+ });
73707
+ } else if (this.builder.opts.fileselect) {
73708
+ let modalFileSelect = builderStuff.querySelector('.is-modal.fileselect');
73709
+ let iframe = modalFileSelect.querySelector('iframe');
73710
+
73711
+ if (this.builder.opts.assetRefresh) {
73712
+ iframe.src = this.builder.opts.fileselect;
73713
+ this.builder.opts.assetRefresh = false;
73714
+ }
73715
+
73716
+ if (iframe.src === 'about:blank') {
73717
+ iframe.src = this.builder.opts.fileselect;
73718
+ }
73719
+
73720
+ util.showModal(modalFileSelect, false, () => {
73721
+ elm.removeAttribute('data-focus');
73722
+ elm.focus();
73723
+ });
73724
+ elm.setAttribute('data-focus', true);
73725
+ this.builder.targetInput = inpSrc;
73726
+ this.builder.targetCallback = null;
73727
+ this.builder.targetAssetType = 'media';
73728
+ } else if (this.builder.opts.imageselect) {
73729
+ let modalImageSelect = builderStuff.querySelector('.is-modal.imageselect');
73730
+ let iframe = modalImageSelect.querySelector('iframe');
73731
+
73732
+ if (this.builder.opts.assetRefresh) {
73733
+ iframe.src = this.builder.opts.imageselect;
73734
+ this.builder.opts.assetRefresh = false;
73735
+ }
73736
+
73737
+ if (iframe.src === 'about:blank') {
73738
+ iframe.src = this.builder.opts.imageselect;
73739
+ }
73740
+
73741
+ util.showModal(modalImageSelect, false, () => {
73742
+ elm.removeAttribute('data-focus');
73743
+ elm.focus();
73744
+ });
73745
+ elm.setAttribute('data-focus', true);
73746
+ this.builder.targetInput = inpSrc;
73747
+ this.builder.targetCallback = null;
73748
+ this.builder.targetAssetType = 'media';
73749
+ }
73750
+ });
73751
+ }
73752
+
73753
+ let inputFileSelect = modalMediaSelect.querySelector('.input-file-select');
73754
+ dom.addEventListener(inputFileSelect, 'change', e => {
73755
+ let element = inputFileSelect;
73756
+
73757
+ while (element.nodeName.toLowerCase() !== 'form') {
73758
+ element = element.parentNode;
73759
+ }
73760
+
73761
+ let frmUpload = element;
73762
+ dom.addClass(frmUpload, 'please-wait');
73763
+ modalMediaSelect.querySelector('.input-ref-id').value = this.builder.opts.customval;
73764
+
73765
+ if (this.builder.opts.onLargerImageUpload) {
73766
+ this.builder.opts.onLargerImageUpload(e);
73767
+ } else {
73768
+ frmUpload.submit();
73769
+ }
73770
+
73771
+ inputFileSelect.value = ''; // Clear Input
73772
+ });
73773
+ const btnImageOk = modalMediaSelect.querySelector('.input-ok');
73774
+ dom.addEventListener(btnImageOk, 'click', () => {
73775
+ const inpSrc = modalMediaSelect.querySelector('.input-src');
73776
+ const url = inpSrc.value;
73777
+ if (this.builder.mediaSelectedCallback) this.builder.mediaSelectedCallback(url);
73778
+ this.builder.hideModal(modalMediaSelect);
73779
+ });
73780
+ const btnImageCancel = modalMediaSelect.querySelector('.input-cancel');
73781
+ dom.addEventListener(btnImageCancel, 'click', () => {
73782
+ this.builder.hideModal(modalMediaSelect);
73783
+ });
73784
+ }
73785
+
73786
+ openMediaPicker(currentUrl, callback, btn) {
73787
+ //Current value
73788
+ const modalMediaSelect = this.modalMediaSelect;
73789
+ const inpSrc = modalMediaSelect.querySelector('.input-src');
73790
+ inpSrc.value = currentUrl; //mediaSelectedCallback
73791
+
73792
+ this.builder.mediaSelectedCallback = callback; //Show modal
73793
+
73794
+ modalMediaSelect.style.zIndex = '10005';
73795
+ this.util.showModal(modalMediaSelect, false, () => {
73796
+ if (btn) {
73797
+ btn.removeAttribute('data-focus');
73798
+ btn.focus();
73799
+ }
73800
+ });
73801
+ if (btn) btn.setAttribute('data-focus', true);
73802
+ }
73803
+
73804
+ }
73805
+
73629
73806
  class ContentBuilder {
73630
73807
  constructor(opts = {}) {
73631
73808
  let defaults = {
@@ -74372,7 +74549,8 @@ class ContentBuilder {
74372
74549
  }
74373
74550
 
74374
74551
  this.colTool = new ColumnTool(this); // Render Column Tool
74375
- // Extend the onChange function
74552
+
74553
+ this.mediaPicker = new MediaPicker(this); // Extend the onChange function
74376
74554
 
74377
74555
  var oldget = this.opts.onChange;
74378
74556
 
@@ -75266,6 +75444,10 @@ class ContentBuilder {
75266
75444
  this.opts.assetRefresh = true; // After file upload, make open asset refreshed
75267
75445
  }
75268
75446
 
75447
+ openMediaPicker(currentUrl, callback, btn) {
75448
+ this.mediaPicker.openMediaPicker(currentUrl, callback, btn);
75449
+ }
75450
+
75269
75451
  openImagePicker(currentUrl, callback, btn) {
75270
75452
  this.colTool.openImagePicker(currentUrl, callback, btn);
75271
75453
  }