@innovastudio/contentbuilder 1.3.20 → 1.3.22

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.20",
4
+ "version": "1.3.22",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -49327,10 +49327,10 @@ class Image$1 {
49327
49327
  <form class="form-upload-larger" target="frameTargetImageUpload" method="post" action="${this.builder.opts.largerImageHandler}" enctype="multipart/form-data" style="border-radius:1px;position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;">
49328
49328
  <input id="hidRefId1" name="hidRefId" type="hidden" value="" />
49329
49329
  <svg class="is-icon-flex" style="width:18px;height:18px;"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
49330
- <input title="${util.out('Select')}" id="fileImage1" name="fileImage" type="file" accept="image/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">
49330
+ <input onclick="blur()" title="${util.out('Select')}" id="fileImage1" name="fileImage" type="file" accept="image/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">
49331
49331
  </form>
49332
49332
 
49333
- <iframe tabindex="0" id="frameTargetImageUpload" name="frameTargetImageUpload" tabindex="-1" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>
49333
+ <iframe id="frameTargetImageUpload" name="frameTargetImageUpload" tabindex="-1" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>
49334
49334
  </div>
49335
49335
  </div>
49336
49336
 
@@ -49345,7 +49345,7 @@ class Image$1 {
49345
49345
  <form class="form-upload-larger" target="frameTargetImageUpload" method="post" action="${this.builder.opts.largerImageHandler}" enctype="multipart/form-data" style="border-radius:1px;position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;">
49346
49346
  <input id="hidRefId2" name="hidRefId" type="hidden" value="" />
49347
49347
  <svg class="is-icon-flex"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
49348
- <input title="${util.out('Select')}" id="fileImage2" name="fileImage" type="file" accept="image/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">
49348
+ <input onclick="blur()" title="${util.out('Select')}" id="fileImage2" name="fileImage" type="file" accept="image/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">
49349
49349
  </form>
49350
49350
  </div>
49351
49351
  </div>
@@ -57122,6 +57122,7 @@ class ColumnTool {
57122
57122
  <svg class="is-icon-flex"><use xlink:href="#ion-image"></use></svg>
57123
57123
  <span>${util.out('Image')}</span>
57124
57124
  </button>
57125
+ <button title="${util.out('Select')}" class="input-select"><svg class="is-icon-flex"><use xlink:href="#ion-more"></use></svg></button>
57125
57126
  <button title="${util.out('Remove')}" class="input-cell-bgremove"><svg class="is-icon-flex" style="width:11px;height:11px;"><use xlink:href="#icon-clean"></use></svg></button>
57126
57127
  <button title="${util.out('Adjust')}" class="input-cell-bgimageadjust"><svg class="is-icon-flex"><use xlink:href="#ion-wrench"></use></svg></button>
57127
57128
  </div>
@@ -57256,11 +57257,11 @@ class ColumnTool {
57256
57257
  <div class="image-larger4" style="position: relative; flex: 0 0 auto; width: 40px; height: 38px; box-shadow: rgba(0, 0, 0, 0.32) 0px 3px 6px -6px;">
57257
57258
  <form class="form-upload-larger" target="frameTargetLinkUpload" method="post" action="${this.builder.opts.largerImageHandler}" enctype="multipart/form-data" style="position:absolute;top:0;left:0;width:100%;height:100%;border-radius:1px;display:flex;align-items: center;justify-content: center;">
57258
57259
  <input id="hidRefId4" name="hidRefId" type="hidden" value="">
57259
- <svg class="is-icon-flex"><use xlink:href="#ion-image"></use></svg>
57260
- <input title="${util.out('Select')}" id="fileImage4" name="fileImage" type="file" accept="image/*,video/mp4" style="position:absolute;top:-30px;left:0;width:100%;height:68px;opacity: 0;cursor: pointer;">
57260
+ <svg class="is-icon-flex" style="width:18px;height:18px;"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
57261
+ <input onclick="blur()" title="${util.out('Select')}" id="fileImage4" name="fileImage" type="file" accept="image/*,video/mp4" style="position:absolute;top:-30px;left:0;width:100%;height:68px;opacity: 0;cursor: pointer;">
57261
57262
  </form>
57262
57263
 
57263
- <iframe tabindex="0" id="frameTargetLinkUpload" name="frameTargetLinkUpload" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>
57264
+ <iframe tabindex="-1" id="frameTargetLinkUpload" name="frameTargetLinkUpload" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>
57264
57265
  </div>
57265
57266
  </div>
57266
57267
  <div style="padding-top:20px">
@@ -57353,11 +57354,11 @@ class ColumnTool {
57353
57354
  <div class="image-larger3 input-upload" style="position: relative; flex: 0 0 auto;box-shadow: rgba(0, 0, 0, 0.32) 0px 3px 6px -6px;">
57354
57355
  <form class="form-upload-larger" target="frameTargetCellImageUpload" method="post" action="${this.builder.opts.largerImageHandler}" enctype="multipart/form-data" style="position:absolute;display:flex;justify-content: center;align-items: center;top:0;left:0;width:100%;height:100%;">
57355
57356
  <input id="hidRefId3" name="hidRefId" type="hidden" value="">
57356
- <svg class="is-icon-flex"><use xlink:href="#ion-image"></use></svg>
57357
- <input title="${util.out('Select')}" id="fileImage3" name="fileImage" type="file" accept="image/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">
57357
+ <svg class="is-icon-flex" style="width:18px;height:18px;"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
57358
+ <input onclick="blur()" title="${util.out('Select')}" id="fileImage3" name="fileImage" type="file" accept="image/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">
57358
57359
  </form>
57359
57360
 
57360
- <iframe tabIndex="0" id="frameTargetCellImageUpload" name="frameTargetCellImageUpload" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>
57361
+ <iframe tabindex="-1" tabIndex="0" id="frameTargetCellImageUpload" name="frameTargetCellImageUpload" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>
57361
57362
  </div>
57362
57363
  </div>
57363
57364
 
@@ -57385,6 +57386,8 @@ class ColumnTool {
57385
57386
 
57386
57387
  columnMore = builderStuff.querySelector('.columnmore');
57387
57388
  this.cellSettings = builderStuff.querySelector('.is-modal.columnsettings');
57389
+ this.divCellClick = builderStuff.querySelector('#divCellClick');
57390
+ this.divCellGeneral = builderStuff.querySelector('#divCellGeneral');
57388
57391
  const quickadd = renderQuickAdd(builder); // Prepare for tooltip
57389
57392
 
57390
57393
  let elms = columnTool.querySelectorAll('[title]');
@@ -57725,6 +57728,36 @@ class ColumnTool {
57725
57728
  btnImageRemove.style.display = 'none';
57726
57729
  div.innerHTML = ''; //Trigger Change event
57727
57730
 
57731
+ this.builder.opts.onChange();
57732
+ }); // Column Background Image Open Asset
57733
+
57734
+ if (!this.builder.opts.onImageSelectClick && this.builder.opts.imageselect === '') {
57735
+ this.divCellGeneral.querySelector('.input-select').style.display = 'none';
57736
+ }
57737
+
57738
+ const btnCellBgImageOpenAsset = this.divCellGeneral.querySelector('.input-select');
57739
+ this.builder.renderSelectAsset(btnCellBgImageOpenAsset, 'image', url => {
57740
+ let cell = util.cellSelected();
57741
+ if (!cell) return;
57742
+ this.builder.uo.saveForUndo();
57743
+ cell.style.backgroundImage = `url("${url}")`;
57744
+ cell.style.backgroundSize = 'cover';
57745
+ cell.style.backgroundRepeat = 'no-repeat';
57746
+ const div = cellSettings.querySelector('.cell-bgimage-preview');
57747
+ const btnImageAdjust = this.cellSettings.querySelector('.input-cell-bgimageadjust');
57748
+ const btnImageRemove = this.cellSettings.querySelector('.input-cell-bgremove');
57749
+ btnImageAdjust.style.display = 'none';
57750
+ btnImageRemove.style.display = 'none';
57751
+
57752
+ if (url !== '') {
57753
+ div.innerHTML = `<img src="${url}">`;
57754
+ btnImageAdjust.style.display = 'flex';
57755
+ btnImageRemove.style.display = 'flex';
57756
+ } else {
57757
+ div.innerHTML = '';
57758
+ } //Trigger Change event
57759
+
57760
+
57728
57761
  this.builder.opts.onChange();
57729
57762
  }); // Column Background Image Select Dialog (.is-modal.imagesource)
57730
57763
 
@@ -58522,13 +58555,13 @@ class ColumnTool {
58522
58555
  }
58523
58556
 
58524
58557
  if (!this.builder.opts.onImageSelectClick && this.builder.opts.imageselect === '') {
58525
- this.cellSettings.querySelector('.input-select').style.display = 'none';
58558
+ this.divCellClick.querySelector('.input-select').style.display = 'none';
58526
58559
  } // Select image (opens Asset Manager plugin or custom dialog)
58527
58560
 
58528
58561
 
58529
58562
  if (this.builder.opts.onImageSelectClick || this.builder.opts.imageselect || this.builder.opts.onFileSelectClick || this.builder.opts.fileselect) {
58530
58563
  const inpSrc = this.cellSettings.querySelector('.input-src');
58531
- elm = this.cellSettings.querySelector('.input-select');
58564
+ elm = this.divCellClick.querySelector('.input-select');
58532
58565
  if (elm) dom.addEventListener(elm, 'click', () => {
58533
58566
  //---default
58534
58567
  this.builder.targetInput = inpSrc; // used by selectAsset() (see contentbuilder.js)
@@ -73723,8 +73756,7 @@ class MediaPicker {
73723
73756
  });
73724
73757
  elm.setAttribute('data-focus', true);
73725
73758
  this.builder.targetInput = inpSrc;
73726
- this.builder.targetCallback = null;
73727
- this.builder.targetAssetType = 'media';
73759
+ this.builder.targetCallback = null; // this.builder.targetAssetType = 'media';
73728
73760
  } else if (this.builder.opts.imageselect) {
73729
73761
  let modalImageSelect = builderStuff.querySelector('.is-modal.imageselect');
73730
73762
  let iframe = modalImageSelect.querySelector('iframe');
@@ -73744,8 +73776,7 @@ class MediaPicker {
73744
73776
  });
73745
73777
  elm.setAttribute('data-focus', true);
73746
73778
  this.builder.targetInput = inpSrc;
73747
- this.builder.targetCallback = null;
73748
- this.builder.targetAssetType = 'media';
73779
+ this.builder.targetCallback = null; // this.builder.targetAssetType = 'media';
73749
73780
  }
73750
73781
  });
73751
73782
  }
@@ -73783,9 +73814,22 @@ class MediaPicker {
73783
73814
  });
73784
73815
  }
73785
73816
 
73786
- openMediaPicker(currentUrl, callback, btn) {
73787
- //Current value
73817
+ openMediaPicker(currentUrl, assetType, callback, btn) {
73818
+ this.builder.targetAssetType = assetType;
73788
73819
  const modalMediaSelect = this.modalMediaSelect;
73820
+ let inputFileSelect = modalMediaSelect.querySelector('.input-file-select');
73821
+
73822
+ if (assetType === 'media') {
73823
+ inputFileSelect.setAttribute('accept', 'image/*,video/mp4');
73824
+ } else if (assetType === 'video') {
73825
+ inputFileSelect.setAttribute('accept', 'video/mp4');
73826
+ } else if (assetType === 'image') {
73827
+ inputFileSelect.setAttribute('accept', 'image/*');
73828
+ } else if (assetType === 'audio') {
73829
+ inputFileSelect.setAttribute('accept', 'audio/mp3');
73830
+ } //Current value
73831
+
73832
+
73789
73833
  const inpSrc = modalMediaSelect.querySelector('.input-src');
73790
73834
  inpSrc.value = currentUrl; //mediaSelectedCallback
73791
73835
 
@@ -75444,8 +75488,8 @@ class ContentBuilder {
75444
75488
  this.opts.assetRefresh = true; // After file upload, make open asset refreshed
75445
75489
  }
75446
75490
 
75447
- openMediaPicker(currentUrl, callback, btn) {
75448
- this.mediaPicker.openMediaPicker(currentUrl, callback, btn);
75491
+ openMediaPicker(currentUrl, assetType = 'media', callback, btn) {
75492
+ this.mediaPicker.openMediaPicker(currentUrl, assetType, callback, btn);
75449
75493
  }
75450
75494
 
75451
75495
  openImagePicker(currentUrl, callback, btn) {
@@ -75533,6 +75577,65 @@ class ContentBuilder {
75533
75577
  return this.targetAssetType; // not used yet
75534
75578
  }
75535
75579
 
75580
+ renderSelectAsset(btn, targetAssetType, callback) {
75581
+ const _id = 'inp_' + this.util.makeId();
75582
+
75583
+ btn.insertAdjacentHTML('afterend', `<input type="hidden" id="${_id}">`);
75584
+ const inpUrl = btn.parentNode.querySelector(`#${_id}`);
75585
+ btn.addEventListener('click', () => {
75586
+ this.openAsset(inpUrl, targetAssetType, btn);
75587
+ });
75588
+
75589
+ let out = s => this.util.out(s);
75590
+
75591
+ const desc = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
75592
+ Object.defineProperty(inpUrl, 'value', {
75593
+ get: desc.get,
75594
+ set: function (s) {
75595
+ // Additional protection if normal selectAsset() is not used in asset dialog.
75596
+ // This is used if onImageSelectClick or onFileSelectClick are used.
75597
+ const filename = s.substring(s.lastIndexOf('/') + 1);
75598
+ let extension = filename.split('.').pop();
75599
+ extension = extension.toLowerCase();
75600
+ let ok = false;
75601
+
75602
+ if (targetAssetType === 'all') {
75603
+ ok = true;
75604
+ } else if (targetAssetType === 'media') {
75605
+ if (extension === 'jpg' || extension === 'jpeg' || extension === 'png' || extension === 'gif' || extension === 'webm' || extension === 'mp4') {
75606
+ ok = true;
75607
+ } else {
75608
+ alert(out('Please select an image or video file.'));
75609
+ }
75610
+ } else if (targetAssetType === 'video') {
75611
+ if (extension === 'mp4') {
75612
+ ok = true;
75613
+ } else {
75614
+ alert(out('Please select an mp4 file.'));
75615
+ }
75616
+ } else if (targetAssetType === 'image') {
75617
+ if (extension === 'jpg' || extension === 'jpeg' || extension === 'png' || extension === 'gif' || extension === 'webm') {
75618
+ ok = true;
75619
+ } else {
75620
+ alert(out('Please select an image file.'));
75621
+ }
75622
+ } else if (targetAssetType === 'audio') {
75623
+ if (extension === 'mp3') {
75624
+ ok = true;
75625
+ } else {
75626
+ alert(out('Please select an mp3 file.'));
75627
+ }
75628
+ }
75629
+
75630
+ if (ok) {
75631
+ if (callback) callback(s);
75632
+ }
75633
+
75634
+ desc.set.call(this, s);
75635
+ }
75636
+ });
75637
+ }
75638
+
75536
75639
  openAsset(targetInput, targetAssetType, theTrigger) {
75537
75640
  if (targetAssetType === 'media' && (this.opts.onFileSelectClick || this.opts.onImageSelectClick)) {
75538
75641
  if (this.opts.onFileSelectClick) {