@innovastudio/contentbuilder 1.3.39 → 1.3.40

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.40",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -73948,7 +73948,7 @@ class MediaPicker {
73948
73948
  <input id="inpMediaSource" class="input-src" type="text">
73949
73949
  <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
73950
  <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%;">
73951
+ <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
73952
  <input name="hidRefId" class="input-ref-id" type="hidden" value="">
73953
73953
  <svg class="is-icon-flex" style="width:18px;height:18px;"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
73954
73954
  <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 +73981,128 @@ class MediaPicker {
73981
73981
  const inpSrc = modalMediaSelect.querySelector('.input-src');
73982
73982
  const elm = modalMediaSelect.querySelector('.input-select');
73983
73983
  if (elm) dom.addEventListener(elm, 'click', () => {
73984
- if (this.builder.opts.onFileSelectClick) {
73985
- this.builder.opts.onFileSelectClick({
73986
- targetInput: inpSrc,
73987
- theTrigger: elm
73984
+ let targetAssetType = this.builder.targetAssetType;
73985
+ let targetInput = inpSrc;
73986
+ let theTrigger = elm; //--- Same ass openAsset() in contentbuilder.js 2098
73987
+
73988
+ if (targetAssetType === 'media' && (this.builder.opts.onMediaSelectClick || this.builder.opts.onImageSelectClick)) {
73989
+ if (this.builder.opts.onMediaSelectClick) {
73990
+ this.builder.opts.onMediaSelectClick({
73991
+ targetInput: targetInput,
73992
+ theTrigger: theTrigger
73993
+ });
73994
+ } else {
73995
+ this.builder.opts.onImageSelectClick({
73996
+ targetInput: targetInput,
73997
+ theTrigger: theTrigger
73998
+ });
73999
+ }
74000
+ } else if (targetAssetType === 'video' && this.builder.opts.onVideoSelectClick) {
74001
+ this.builder.opts.onVideoSelectClick({
74002
+ targetInput: targetInput,
74003
+ theTrigger: theTrigger
73988
74004
  });
73989
- } else if (this.builder.opts.onImageSelectClick) {
74005
+ } else if (targetAssetType === 'image' && this.builder.opts.onImageSelectClick) {
73990
74006
  this.builder.opts.onImageSelectClick({
73991
- targetInput: inpSrc,
73992
- theTrigger: elm
74007
+ targetInput: targetInput,
74008
+ theTrigger: theTrigger
73993
74009
  });
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
- }
74010
+ } else if (targetAssetType === 'audio' && this.builder.opts.onAudioSelectClick) {
74011
+ this.builder.opts.onAudioSelectClick({
74012
+ targetInput: targetInput,
74013
+ theTrigger: theTrigger
74014
+ });
74015
+ } else if (targetAssetType === 'all' && this.builder.opts.onFileSelectClick) {
74016
+ this.builder.opts.onFileSelectClick({
74017
+ targetInput: targetInput,
74018
+ theTrigger: theTrigger
74019
+ });
74020
+ } else {
74021
+ let iframe;
74022
+ let modal;
74002
74023
 
74003
- if (iframe.src === 'about:blank') {
74004
- iframe.src = this.builder.opts.fileselect;
74005
- }
74024
+ if (targetAssetType === 'media') {
74025
+ modal = this.builder.builderStuff.querySelector('.is-modal.mediaselect');
74026
+ iframe = modal.querySelector('iframe');
74006
74027
 
74007
- util.showModal(modalFileSelect, false, () => {
74028
+ if (iframe.src === 'about:blank') {
74029
+ if (this.builder.opts.mediaSelect) iframe.src = this.builder.opts.mediaSelect;else if (this.builder.opts.imageSelect) iframe.src = this.builder.opts.imageSelect;
74030
+ }
74031
+ } else if (targetAssetType === 'video') {
74032
+ modal = this.builder.builderStuff.querySelector('.is-modal.videoselect');
74033
+ iframe = modal.querySelector('iframe');
74034
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.videoSelect;
74035
+ } else if (targetAssetType === 'image') {
74036
+ modal = this.builder.builderStuff.querySelector('.is-modal.imageselect');
74037
+ iframe = modal.querySelector('iframe');
74038
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.imageSelect;
74039
+ } else if (targetAssetType === 'audio') {
74040
+ modal = this.builder.builderStuff.querySelector('.is-modal.audioselect');
74041
+ iframe = modal.querySelector('iframe');
74042
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.audioSelect;
74043
+ } else if (targetAssetType === 'all') {
74044
+ modal = this.builder.builderStuff.querySelector('.is-modal.fileselect');
74045
+ iframe = modal.querySelector('iframe');
74046
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.fileSelect;
74047
+ } // this.builder.util.showModal(modal);
74048
+
74049
+
74050
+ this.builder.util.showModal(modal, false, () => {
74008
74051
  elm.removeAttribute('data-focus');
74009
74052
  elm.focus();
74010
74053
  });
74011
74054
  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
- }
74055
+ this.builder.targetInput = inpSrc; // used by selectAsset() (see contentbuilder.js)
74022
74056
 
74023
- if (iframe.src === 'about:blank') {
74024
- iframe.src = this.builder.opts.imageselect;
74025
- }
74057
+ this.builder.targetCallback = null; // this.targetAssetType = targetAssetType;
74058
+ } //---
74059
+ // if(this.builder.opts.onFileSelectClick) {
74060
+ // this.builder.opts.onFileSelectClick({targetInput: inpSrc, theTrigger: elm});
74061
+ // } else if (this.builder.opts.onImageSelectClick) {
74062
+ // this.builder.opts.onImageSelectClick({targetInput: inpSrc, theTrigger: elm});
74063
+ // } else if(this.builder.opts.fileselect) {
74064
+ // let modalFileSelect = builderStuff.querySelector('.is-modal.fileselect');
74065
+ // let iframe = modalFileSelect.querySelector('iframe');
74066
+ // if(this.builder.opts.assetRefresh) {
74067
+ // iframe.src = this.builder.opts.fileselect;
74068
+ // this.builder.opts.assetRefresh = false;
74069
+ // }
74070
+ // if(iframe.src === 'about:blank') {
74071
+ // iframe.src = this.builder.opts.fileselect;
74072
+ // }
74073
+ // util.showModal(modalFileSelect, false, ()=>{
74074
+ // elm.removeAttribute('data-focus');
74075
+ // elm.focus();
74076
+ // });
74077
+ // elm.setAttribute('data-focus', true);
74078
+ // this.builder.targetInput = inpSrc;
74079
+ // this.builder.targetCallback = null;
74080
+ // // this.builder.targetAssetType = 'media';
74081
+ // } else if(this.builder.opts.imageselect) {
74082
+ // let modalImageSelect = builderStuff.querySelector('.is-modal.imageselect');
74083
+ // let iframe = modalImageSelect.querySelector('iframe');
74084
+ // if(this.builder.opts.assetRefresh) {
74085
+ // iframe.src = this.builder.opts.imageselect;
74086
+ // this.builder.opts.assetRefresh = false;
74087
+ // }
74088
+ // if(iframe.src === 'about:blank'){
74089
+ // iframe.src = this.builder.opts.imageselect;
74090
+ // }
74091
+ // util.showModal(modalImageSelect, false, ()=>{
74092
+ // elm.removeAttribute('data-focus');
74093
+ // elm.focus();
74094
+ // });
74095
+ // elm.setAttribute('data-focus', true);
74096
+ // this.builder.targetInput = inpSrc;
74097
+ // this.builder.targetCallback = null;
74098
+ // // this.builder.targetAssetType = 'media';
74099
+ // }
74026
74100
 
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
74101
  });
74036
74102
  }
74037
74103
 
74038
74104
  let inputFileSelect = modalMediaSelect.querySelector('.input-file-select');
74105
+ let frm = modalMediaSelect.querySelector('.form-upload-larger');
74039
74106
  dom.addEventListener(inputFileSelect, 'change', e => {
74040
74107
  let element = inputFileSelect;
74041
74108
 
@@ -74046,12 +74113,42 @@ class MediaPicker {
74046
74113
  let frmUpload = element;
74047
74114
  dom.addClass(frmUpload, 'please-wait');
74048
74115
  modalMediaSelect.querySelector('.input-ref-id').value = this.builder.opts.customval;
74116
+ let targetAssetType = this.builder.targetAssetType;
74049
74117
 
74050
- if (this.builder.opts.onLargerImageUpload) {
74118
+ if (targetAssetType === 'media' && this.builder.opts.onMediaUpload) {
74119
+ this.builder.opts.onMediaUpload(e);
74120
+ } else if (targetAssetType === 'video' && this.builder.opts.onVideoUpload) {
74121
+ this.builder.opts.onVideoUpload(e);
74122
+ } else if (targetAssetType === 'image' && this.builder.opts.onLargerImageUpload) {
74123
+ this.builder.opts.onLargerImageUpload(e);
74124
+ } else if (targetAssetType === 'audio' && this.builder.opts.onAudioUpload) {
74125
+ this.builder.opts.onAudioUpload(e);
74126
+ } else if (targetAssetType === 'all' && this.builder.opts.onFileUpload) {
74127
+ this.builder.opts.onFileUpload(e);
74128
+ } else if (this.builder.opts.onLargerImageUpload) {
74129
+ // backward
74051
74130
  this.builder.opts.onLargerImageUpload(e);
74052
74131
  } else {
74132
+ if (targetAssetType === 'media') {
74133
+ frm.setAttribute('action', this.builder.opts.mediaHandler);
74134
+ } else if (targetAssetType === 'video') {
74135
+ frm.setAttribute('action', this.builder.opts.videoHandler);
74136
+ } else if (targetAssetType === 'image') {
74137
+ frm.setAttribute('action', this.builder.opts.largerImageHandler);
74138
+ } else if (targetAssetType === 'audio') {
74139
+ frm.setAttribute('action', this.builder.opts.audioHandler);
74140
+ } else if (targetAssetType === 'all') {
74141
+ frm.setAttribute('action', this.builder.opts.fileHandler);
74142
+ if (!this.builder.opts.fileHandler) frm.setAttribute('action', this.builder.opts.mediaHandler); //backward
74143
+ }
74144
+
74053
74145
  frmUpload.submit();
74054
- }
74146
+ } // if(this.builder.opts.onLargerImageUpload) {
74147
+ // this.builder.opts.onLargerImageUpload(e);
74148
+ // } else {
74149
+ // frmUpload.submit();
74150
+ // }
74151
+
74055
74152
 
74056
74153
  inputFileSelect.value = ''; // Clear Input
74057
74154
  });
@@ -74073,7 +74170,9 @@ class MediaPicker {
74073
74170
  const modalMediaSelect = this.modalMediaSelect;
74074
74171
  let inputFileSelect = modalMediaSelect.querySelector('.input-file-select');
74075
74172
 
74076
- if (assetType === 'media') {
74173
+ if (assetType === 'all') {
74174
+ inputFileSelect.setAttribute('accept', '*');
74175
+ } else if (assetType === 'media') {
74077
74176
  inputFileSelect.setAttribute('accept', 'image/*,video/mp4');
74078
74177
  } else if (assetType === 'video') {
74079
74178
  inputFileSelect.setAttribute('accept', 'video/mp4');
@@ -75271,6 +75370,7 @@ class ContentBuilder {
75271
75370
  .is-col-tool svg {
75272
75371
  display: initial !important;
75273
75372
  }
75373
+
75274
75374
  `;
75275
75375
 
75276
75376
  if (!this.builderStuff.querySelector('style[data-rel="css-new"]')) {