@innovastudio/contentbuilder 1.3.39 → 1.3.41

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
- "type":"module",
4
- "version": "1.3.39",
3
+ "type": "module",
4
+ "version": "1.3.41",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -15294,6 +15294,14 @@ class HtmlUtil {
15294
15294
  Array.prototype.forEach.call(elms, elm => {
15295
15295
  dom$h.removeClass(elm, 'section-active');
15296
15296
  });
15297
+ elms = tmp.querySelectorAll('.section-select');
15298
+ Array.prototype.forEach.call(elms, elm => {
15299
+ dom$h.removeClass(elm, 'section-select');
15300
+ });
15301
+ elms = tmp.querySelectorAll('.box-select');
15302
+ Array.prototype.forEach.call(elms, elm => {
15303
+ dom$h.removeClass(elm, 'box-select');
15304
+ });
15297
15305
  elms = tmp.querySelectorAll('.is-section-tool');
15298
15306
  dom$h.removeElements(elms);
15299
15307
  elms = tmp.querySelectorAll('.is-box-tool');
@@ -73948,7 +73956,7 @@ class MediaPicker {
73948
73956
  <input id="inpMediaSource" class="input-src" type="text">
73949
73957
  <button title="${util.out('Select')}" class="input-select" style="flex:none;"><svg class="is-icon-flex"><use xlink:href="#ion-more"></use></svg></button>
73950
73958
  <div class="input-upload" style="position: relative; flex: 0 0 auto;box-shadow: rgba(0, 0, 0, 0.32) 0px 3px 6px -6px;">
73951
- <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%;">
73959
+ <form class="form-upload-larger" target="frameTarget${this.id}" 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%;">
73952
73960
  <input name="hidRefId" class="input-ref-id" type="hidden" value="">
73953
73961
  <svg class="is-icon-flex" style="width:18px;height:18px;"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
73954
73962
  <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;">
@@ -73981,61 +73989,128 @@ class MediaPicker {
73981
73989
  const inpSrc = modalMediaSelect.querySelector('.input-src');
73982
73990
  const elm = modalMediaSelect.querySelector('.input-select');
73983
73991
  if (elm) dom.addEventListener(elm, 'click', () => {
73984
- if (this.builder.opts.onFileSelectClick) {
73985
- this.builder.opts.onFileSelectClick({
73986
- targetInput: inpSrc,
73987
- theTrigger: elm
73992
+ let targetAssetType = this.builder.targetAssetType;
73993
+ let targetInput = inpSrc;
73994
+ let theTrigger = elm; //--- Same ass openAsset() in contentbuilder.js 2098
73995
+
73996
+ if (targetAssetType === 'media' && (this.builder.opts.onMediaSelectClick || this.builder.opts.onImageSelectClick)) {
73997
+ if (this.builder.opts.onMediaSelectClick) {
73998
+ this.builder.opts.onMediaSelectClick({
73999
+ targetInput: targetInput,
74000
+ theTrigger: theTrigger
74001
+ });
74002
+ } else {
74003
+ this.builder.opts.onImageSelectClick({
74004
+ targetInput: targetInput,
74005
+ theTrigger: theTrigger
74006
+ });
74007
+ }
74008
+ } else if (targetAssetType === 'video' && this.builder.opts.onVideoSelectClick) {
74009
+ this.builder.opts.onVideoSelectClick({
74010
+ targetInput: targetInput,
74011
+ theTrigger: theTrigger
73988
74012
  });
73989
- } else if (this.builder.opts.onImageSelectClick) {
74013
+ } else if (targetAssetType === 'image' && this.builder.opts.onImageSelectClick) {
73990
74014
  this.builder.opts.onImageSelectClick({
73991
- targetInput: inpSrc,
73992
- theTrigger: elm
74015
+ targetInput: targetInput,
74016
+ theTrigger: theTrigger
73993
74017
  });
73994
- } else if (this.builder.opts.fileselect) {
73995
- let modalFileSelect = builderStuff.querySelector('.is-modal.fileselect');
73996
- let iframe = modalFileSelect.querySelector('iframe');
73997
-
73998
- if (this.builder.opts.assetRefresh) {
73999
- iframe.src = this.builder.opts.fileselect;
74000
- this.builder.opts.assetRefresh = false;
74001
- }
74018
+ } else if (targetAssetType === 'audio' && this.builder.opts.onAudioSelectClick) {
74019
+ this.builder.opts.onAudioSelectClick({
74020
+ targetInput: targetInput,
74021
+ theTrigger: theTrigger
74022
+ });
74023
+ } else if (targetAssetType === 'all' && this.builder.opts.onFileSelectClick) {
74024
+ this.builder.opts.onFileSelectClick({
74025
+ targetInput: targetInput,
74026
+ theTrigger: theTrigger
74027
+ });
74028
+ } else {
74029
+ let iframe;
74030
+ let modal;
74002
74031
 
74003
- if (iframe.src === 'about:blank') {
74004
- iframe.src = this.builder.opts.fileselect;
74005
- }
74032
+ if (targetAssetType === 'media') {
74033
+ modal = this.builder.builderStuff.querySelector('.is-modal.mediaselect');
74034
+ iframe = modal.querySelector('iframe');
74006
74035
 
74007
- util.showModal(modalFileSelect, false, () => {
74036
+ if (iframe.src === 'about:blank') {
74037
+ if (this.builder.opts.mediaSelect) iframe.src = this.builder.opts.mediaSelect;else if (this.builder.opts.imageSelect) iframe.src = this.builder.opts.imageSelect;
74038
+ }
74039
+ } else if (targetAssetType === 'video') {
74040
+ modal = this.builder.builderStuff.querySelector('.is-modal.videoselect');
74041
+ iframe = modal.querySelector('iframe');
74042
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.videoSelect;
74043
+ } else if (targetAssetType === 'image') {
74044
+ modal = this.builder.builderStuff.querySelector('.is-modal.imageselect');
74045
+ iframe = modal.querySelector('iframe');
74046
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.imageSelect;
74047
+ } else if (targetAssetType === 'audio') {
74048
+ modal = this.builder.builderStuff.querySelector('.is-modal.audioselect');
74049
+ iframe = modal.querySelector('iframe');
74050
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.audioSelect;
74051
+ } else if (targetAssetType === 'all') {
74052
+ modal = this.builder.builderStuff.querySelector('.is-modal.fileselect');
74053
+ iframe = modal.querySelector('iframe');
74054
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.fileSelect;
74055
+ } // this.builder.util.showModal(modal);
74056
+
74057
+
74058
+ this.builder.util.showModal(modal, false, () => {
74008
74059
  elm.removeAttribute('data-focus');
74009
74060
  elm.focus();
74010
74061
  });
74011
74062
  elm.setAttribute('data-focus', true);
74012
- this.builder.targetInput = inpSrc;
74013
- this.builder.targetCallback = null; // this.builder.targetAssetType = 'media';
74014
- } else if (this.builder.opts.imageselect) {
74015
- let modalImageSelect = builderStuff.querySelector('.is-modal.imageselect');
74016
- let iframe = modalImageSelect.querySelector('iframe');
74017
-
74018
- if (this.builder.opts.assetRefresh) {
74019
- iframe.src = this.builder.opts.imageselect;
74020
- this.builder.opts.assetRefresh = false;
74021
- }
74063
+ this.builder.targetInput = inpSrc; // used by selectAsset() (see contentbuilder.js)
74022
74064
 
74023
- if (iframe.src === 'about:blank') {
74024
- iframe.src = this.builder.opts.imageselect;
74025
- }
74065
+ this.builder.targetCallback = null; // this.targetAssetType = targetAssetType;
74066
+ } //---
74067
+ // if(this.builder.opts.onFileSelectClick) {
74068
+ // this.builder.opts.onFileSelectClick({targetInput: inpSrc, theTrigger: elm});
74069
+ // } else if (this.builder.opts.onImageSelectClick) {
74070
+ // this.builder.opts.onImageSelectClick({targetInput: inpSrc, theTrigger: elm});
74071
+ // } else if(this.builder.opts.fileselect) {
74072
+ // let modalFileSelect = builderStuff.querySelector('.is-modal.fileselect');
74073
+ // let iframe = modalFileSelect.querySelector('iframe');
74074
+ // if(this.builder.opts.assetRefresh) {
74075
+ // iframe.src = this.builder.opts.fileselect;
74076
+ // this.builder.opts.assetRefresh = false;
74077
+ // }
74078
+ // if(iframe.src === 'about:blank') {
74079
+ // iframe.src = this.builder.opts.fileselect;
74080
+ // }
74081
+ // util.showModal(modalFileSelect, false, ()=>{
74082
+ // elm.removeAttribute('data-focus');
74083
+ // elm.focus();
74084
+ // });
74085
+ // elm.setAttribute('data-focus', true);
74086
+ // this.builder.targetInput = inpSrc;
74087
+ // this.builder.targetCallback = null;
74088
+ // // this.builder.targetAssetType = 'media';
74089
+ // } else if(this.builder.opts.imageselect) {
74090
+ // let modalImageSelect = builderStuff.querySelector('.is-modal.imageselect');
74091
+ // let iframe = modalImageSelect.querySelector('iframe');
74092
+ // if(this.builder.opts.assetRefresh) {
74093
+ // iframe.src = this.builder.opts.imageselect;
74094
+ // this.builder.opts.assetRefresh = false;
74095
+ // }
74096
+ // if(iframe.src === 'about:blank'){
74097
+ // iframe.src = this.builder.opts.imageselect;
74098
+ // }
74099
+ // util.showModal(modalImageSelect, false, ()=>{
74100
+ // elm.removeAttribute('data-focus');
74101
+ // elm.focus();
74102
+ // });
74103
+ // elm.setAttribute('data-focus', true);
74104
+ // this.builder.targetInput = inpSrc;
74105
+ // this.builder.targetCallback = null;
74106
+ // // this.builder.targetAssetType = 'media';
74107
+ // }
74026
74108
 
74027
- util.showModal(modalImageSelect, false, () => {
74028
- elm.removeAttribute('data-focus');
74029
- elm.focus();
74030
- });
74031
- elm.setAttribute('data-focus', true);
74032
- this.builder.targetInput = inpSrc;
74033
- this.builder.targetCallback = null; // this.builder.targetAssetType = 'media';
74034
- }
74035
74109
  });
74036
74110
  }
74037
74111
 
74038
74112
  let inputFileSelect = modalMediaSelect.querySelector('.input-file-select');
74113
+ let frm = modalMediaSelect.querySelector('.form-upload-larger');
74039
74114
  dom.addEventListener(inputFileSelect, 'change', e => {
74040
74115
  let element = inputFileSelect;
74041
74116
 
@@ -74046,12 +74121,42 @@ class MediaPicker {
74046
74121
  let frmUpload = element;
74047
74122
  dom.addClass(frmUpload, 'please-wait');
74048
74123
  modalMediaSelect.querySelector('.input-ref-id').value = this.builder.opts.customval;
74124
+ let targetAssetType = this.builder.targetAssetType;
74049
74125
 
74050
- if (this.builder.opts.onLargerImageUpload) {
74126
+ if (targetAssetType === 'media' && this.builder.opts.onMediaUpload) {
74127
+ this.builder.opts.onMediaUpload(e);
74128
+ } else if (targetAssetType === 'video' && this.builder.opts.onVideoUpload) {
74129
+ this.builder.opts.onVideoUpload(e);
74130
+ } else if (targetAssetType === 'image' && this.builder.opts.onLargerImageUpload) {
74131
+ this.builder.opts.onLargerImageUpload(e);
74132
+ } else if (targetAssetType === 'audio' && this.builder.opts.onAudioUpload) {
74133
+ this.builder.opts.onAudioUpload(e);
74134
+ } else if (targetAssetType === 'all' && this.builder.opts.onFileUpload) {
74135
+ this.builder.opts.onFileUpload(e);
74136
+ } else if (this.builder.opts.onLargerImageUpload) {
74137
+ // backward
74051
74138
  this.builder.opts.onLargerImageUpload(e);
74052
74139
  } else {
74140
+ if (targetAssetType === 'media') {
74141
+ frm.setAttribute('action', this.builder.opts.mediaHandler);
74142
+ } else if (targetAssetType === 'video') {
74143
+ frm.setAttribute('action', this.builder.opts.videoHandler);
74144
+ } else if (targetAssetType === 'image') {
74145
+ frm.setAttribute('action', this.builder.opts.largerImageHandler);
74146
+ } else if (targetAssetType === 'audio') {
74147
+ frm.setAttribute('action', this.builder.opts.audioHandler);
74148
+ } else if (targetAssetType === 'all') {
74149
+ frm.setAttribute('action', this.builder.opts.fileHandler);
74150
+ if (!this.builder.opts.fileHandler) frm.setAttribute('action', this.builder.opts.mediaHandler); //backward
74151
+ }
74152
+
74053
74153
  frmUpload.submit();
74054
- }
74154
+ } // if(this.builder.opts.onLargerImageUpload) {
74155
+ // this.builder.opts.onLargerImageUpload(e);
74156
+ // } else {
74157
+ // frmUpload.submit();
74158
+ // }
74159
+
74055
74160
 
74056
74161
  inputFileSelect.value = ''; // Clear Input
74057
74162
  });
@@ -74073,7 +74178,9 @@ class MediaPicker {
74073
74178
  const modalMediaSelect = this.modalMediaSelect;
74074
74179
  let inputFileSelect = modalMediaSelect.querySelector('.input-file-select');
74075
74180
 
74076
- if (assetType === 'media') {
74181
+ if (assetType === 'all') {
74182
+ inputFileSelect.setAttribute('accept', '*');
74183
+ } else if (assetType === 'media') {
74077
74184
  inputFileSelect.setAttribute('accept', 'image/*,video/mp4');
74078
74185
  } else if (assetType === 'video') {
74079
74186
  inputFileSelect.setAttribute('accept', 'video/mp4');
@@ -75271,6 +75378,7 @@ class ContentBuilder {
75271
75378
  .is-col-tool svg {
75272
75379
  display: initial !important;
75273
75380
  }
75381
+
75274
75382
  `;
75275
75383
 
75276
75384
  if (!this.builderStuff.querySelector('style[data-rel="css-new"]')) {