@innovastudio/contentbox 1.6.113 → 1.6.114

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/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.113",
4
+ "version": "1.6.114",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "types": "index.d.ts",
@@ -59,7 +59,7 @@
59
59
  "ws": "^8.13.0"
60
60
  },
61
61
  "dependencies": {
62
- "@innovastudio/contentbuilder": "^1.5.112",
62
+ "@innovastudio/contentbuilder": "^1.5.113",
63
63
  "js-beautify": "^1.14.0",
64
64
  "sortablejs": "^1.15.2"
65
65
  }
@@ -11664,11 +11664,13 @@ class PanelImage {
11664
11664
  this.updatePreview(src);
11665
11665
  const inpSrc = panel.querySelector('.inp-src');
11666
11666
 
11667
- if (src.indexOf('base64') === -1) {
11668
- inpSrc.value = src;
11669
- } else {
11667
+ if (src.startsWith('data:')) {
11668
+ const mime = src.split(';')[0].slice(5); // e.g., "image/png"
11670
11669
  // inpSrc.value = '[Image Data]';
11671
- inpSrc.value = 'image/jpeg (base64)';
11670
+
11671
+ inpSrc.value = `${mime} (base64)`;
11672
+ } else {
11673
+ inpSrc.value = src;
11672
11674
  }
11673
11675
 
11674
11676
  const divSettings = panel.querySelector('.div-image-settings');
@@ -11686,7 +11688,16 @@ class PanelImage {
11686
11688
  updateImageSrc(src) {
11687
11689
  this.builder.editor.saveForUndo();
11688
11690
  const inpSrc = this.panel.querySelector('.inp-src');
11689
- inpSrc.value = src;
11691
+
11692
+ if (src.startsWith('data:')) {
11693
+ const mime = src.split(';')[0].slice(5); // e.g., "image/png"
11694
+ // inpSrc.value = '[Image Data]';
11695
+
11696
+ inpSrc.value = `${mime} (base64)`;
11697
+ } else {
11698
+ inpSrc.value = src;
11699
+ }
11700
+
11690
11701
  this.updatePreview(src);
11691
11702
  this.refreshImage(src);
11692
11703
  this.builder.editor.onChange();
@@ -11856,11 +11867,13 @@ class PanelVideo {
11856
11867
  this.updatePreview(src);
11857
11868
  const inpSrc = panel.querySelector('.inp-src');
11858
11869
 
11859
- if (src.indexOf('base64') === -1) {
11860
- inpSrc.value = src;
11861
- } else {
11870
+ if (src.startsWith('data:')) {
11871
+ const mime = src.split(';')[0].slice(5); // e.g., "image/png"
11862
11872
  // inpSrc.value = '[Image Data]';
11863
- inpSrc.value = 'video/mp4 (base64)';
11873
+
11874
+ inpSrc.value = `${mime} (base64)`;
11875
+ } else {
11876
+ inpSrc.value = src;
11864
11877
  }
11865
11878
 
11866
11879
  const divSettings = panel.querySelector('.div-video-settings');
@@ -11899,7 +11912,16 @@ class PanelVideo {
11899
11912
  updateVideoSrc(src) {
11900
11913
  this.builder.editor.saveForUndo();
11901
11914
  const inpSrc = this.panel.querySelector('.inp-src');
11902
- inpSrc.value = src;
11915
+
11916
+ if (src.startsWith('data:')) {
11917
+ const mime = src.split(';')[0].slice(5); // e.g., "image/png"
11918
+ // inpSrc.value = '[Image Data]';
11919
+
11920
+ inpSrc.value = `${mime} (base64)`;
11921
+ } else {
11922
+ inpSrc.value = src;
11923
+ }
11924
+
11903
11925
  this.updatePreview(src);
11904
11926
  this.refreshVideo(src);
11905
11927
  this.builder.editor.onChange();
@@ -11947,7 +11969,7 @@ class PanelAudio {
11947
11969
  </label>
11948
11970
 
11949
11971
  <div class="group mt-4">
11950
- <input class="inp-file" type="file" accept="audio/mp3" style="display:none"/>
11972
+ <input class="inp-file" type="file" accept="audio/*" style="display:none"/>
11951
11973
  <button title="${out('Upload')}" class="btn-upload"><svg><use xlink:href="#icon-upload"></use></svg></button>
11952
11974
  <button title="${out('Select')}" class="btn-asset"><svg><use xlink:href="#icon-folder"></use></svg></button>
11953
11975
  </div>
@@ -12017,13 +12039,30 @@ class PanelAudio {
12017
12039
  const src = source ? source.getAttribute('src') : '';
12018
12040
  this.updatePreview(src);
12019
12041
  const inpSrc = panel.querySelector('.inp-src');
12020
- inpSrc.value = src;
12042
+
12043
+ if (src.startsWith('data:')) {
12044
+ const mime = src.split(';')[0].slice(5); // e.g., "image/png"
12045
+ // inpSrc.value = '[Image Data]';
12046
+
12047
+ inpSrc.value = `${mime} (base64)`;
12048
+ } else {
12049
+ inpSrc.value = src;
12050
+ }
12021
12051
  }
12022
12052
 
12023
12053
  updateAudioSrc(src) {
12024
12054
  this.builder.editor.saveForUndo();
12025
12055
  const inpSrc = this.panel.querySelector('.inp-src');
12026
- inpSrc.value = src;
12056
+
12057
+ if (src.startsWith('data:')) {
12058
+ const mime = src.split(';')[0].slice(5); // e.g., "image/png"
12059
+ // inpSrc.value = '[Image Data]';
12060
+
12061
+ inpSrc.value = `${mime} (base64)`;
12062
+ } else {
12063
+ inpSrc.value = src;
12064
+ }
12065
+
12027
12066
  this.updatePreview(src);
12028
12067
  this.refreshAudio(src);
12029
12068
  this.builder.editor.onChange();
@@ -14161,7 +14200,16 @@ class PanelBox {
14161
14200
  }
14162
14201
  }
14163
14202
  const inpSrc = panel.querySelector('.inp-src');
14164
- inpSrc.value = src; // Show/hide grayscale
14203
+
14204
+ if (src.startsWith('data:')) {
14205
+ const mime = src.split(';')[0].slice(5); // e.g., "image/png"
14206
+ // inpSrc.value = '[Image Data]';
14207
+
14208
+ inpSrc.value = `${mime} (base64)`;
14209
+ } else {
14210
+ inpSrc.value = src;
14211
+ } // Show/hide grayscale
14212
+
14165
14213
 
14166
14214
  const divGrayscale = panel.querySelector('.label.grayscale');
14167
14215
 
@@ -14674,7 +14722,16 @@ class PanelBox {
14674
14722
  this.imagePreview.innerHTML = previewHtml;
14675
14723
  const panel = this.panel;
14676
14724
  const inpSrc = panel.querySelector('.inp-src');
14677
- inpSrc.value = src; // Show/hide image-related controls
14725
+
14726
+ if (src.startsWith('data:')) {
14727
+ const mime = src.split(';')[0].slice(5); // e.g., "image/png"
14728
+ // inpSrc.value = '[Image Data]';
14729
+
14730
+ inpSrc.value = `${mime} (base64)`;
14731
+ } else {
14732
+ inpSrc.value = src;
14733
+ } // Show/hide image-related controls
14734
+
14678
14735
 
14679
14736
  const btnClear = panel.querySelector('.btn-clear');
14680
14737
  const btnAdjust = panel.querySelector('.btn-adjust');
@@ -77635,6 +77692,12 @@ class Video {
77635
77692
  let source = video.querySelector('source');
77636
77693
  let url = '';
77637
77694
  if (source) url = source.getAttribute('src');
77695
+
77696
+ // base64 handling: save the value and display "[Image Data]"
77697
+ if (url.startsWith('data:')) {
77698
+ this.builder.base64Data = url;
77699
+ url = '[Image Data]';
77700
+ }
77638
77701
  videoModal.querySelector('.input-url').value = url;
77639
77702
  const inpShowControls = videoModal.querySelector('.input-video-controls');
77640
77703
  if (video.hasAttribute('controls')) {
@@ -77811,6 +77874,12 @@ class Video {
77811
77874
  }
77812
77875
  if (videoModal.querySelector('.input-url').value !== '') {
77813
77876
  let url = videoModal.querySelector('.input-url').value;
77877
+
77878
+ // base64 handling: Apply base64 data
77879
+ if (url === '[Image Data]') {
77880
+ url = this.builder.base64Data;
77881
+ this.builder.base64Data = '';
77882
+ }
77814
77883
  let source = video.querySelector('source');
77815
77884
  if (url !== source.getAttribute('src')) {
77816
77885
  if (source) source.setAttribute('src', url);
@@ -77828,6 +77897,8 @@ class Video {
77828
77897
  });
77829
77898
  let btnCancel = videoModal.querySelector('.input-cancel');
77830
77899
  dom.addEventListener(btnCancel, 'click', () => {
77900
+ // base64 handling: Clear previously saved base64 data
77901
+ this.builder.base64Data = '';
77831
77902
  this.builder.hideModal(videoModal);
77832
77903
  });
77833
77904
  }
@@ -77912,6 +77983,12 @@ class Audio {
77912
77983
  if (source) url = source.getAttribute('src');
77913
77984
  this.renderPanel();
77914
77985
  const audioModal = this.audioModal;
77986
+
77987
+ // base64 handling: save the value and display "[Image Data]"
77988
+ if (url.startsWith('data:')) {
77989
+ this.builder.base64Data = url;
77990
+ url = '[Image Data]';
77991
+ }
77915
77992
  audioModal.querySelector('.input-url').value = url;
77916
77993
  util.showModal(audioModal, true, () => {
77917
77994
  btn.removeAttribute('data-focus');
@@ -77940,7 +78017,7 @@ class Audio {
77940
78017
  <form class="form-upload-larger" target="frameTargetAudioUpload" method="post" action="${this.builder.opts.audioHandler}" enctype="multipart/form-data" style="position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%;">
77941
78018
  <input id="hidRefAudio" name="hidRefId" type="hidden" value="" />
77942
78019
  <svg style="width:16px;height:16px;"><use xlink:href="#icon-upload"></use></svg>
77943
- <input title="${util.out('Select')}" id="fileAudio1" name="fileImage" type="file" accept="audio/mp3" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">
78020
+ <input title="${util.out('Select')}" id="fileAudio1" name="fileImage" type="file" accept="audio/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">
77944
78021
  </form>
77945
78022
 
77946
78023
  <iframe tabindex="0" id="frameTargetAudioUpload" name="frameTargetAudioUpload" tabIndex="-1" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>
@@ -78033,6 +78110,12 @@ class Audio {
78033
78110
  if (audioModal.querySelector('.input-url').value !== '') {
78034
78111
  let url = audioModal.querySelector('.input-url').value;
78035
78112
 
78113
+ // base64 handling: Apply base64 data
78114
+ if (url === '[Image Data]') {
78115
+ url = this.builder.base64Data;
78116
+ this.builder.base64Data = '';
78117
+ }
78118
+
78036
78119
  //Render
78037
78120
  let source = audio.querySelector('source');
78038
78121
  if (url !== source.getAttribute('src')) {
@@ -78052,6 +78135,8 @@ class Audio {
78052
78135
  });
78053
78136
  let btnCancel = audioModal.querySelector('.input-cancel');
78054
78137
  dom.addEventListener(btnCancel, 'click', () => {
78138
+ // base64 handling: Clear previously saved base64 data
78139
+ this.builder.base64Data = '';
78055
78140
  this.builder.hideModal(audioModal);
78056
78141
  });
78057
78142
  }
@@ -107216,12 +107301,20 @@ class MediaPicker {
107216
107301
  const btnImageOk = modalMediaSelect.querySelector('.input-ok');
107217
107302
  dom.addEventListener(btnImageOk, 'click', () => {
107218
107303
  const inpSrc = modalMediaSelect.querySelector('.input-src');
107219
- const url = inpSrc.value;
107304
+ let url = inpSrc.value;
107305
+
107306
+ // base64 handling: Apply base64 data
107307
+ if (url === '[Image Data]') {
107308
+ url = this.builder.base64Data;
107309
+ this.builder.base64Data = '';
107310
+ }
107220
107311
  if (this.builder.mediaSelectedCallback) this.builder.mediaSelectedCallback(url);
107221
107312
  this.builder.hideModal(modalMediaSelect);
107222
107313
  });
107223
107314
  const btnImageCancel = modalMediaSelect.querySelector('.input-cancel');
107224
107315
  dom.addEventListener(btnImageCancel, 'click', () => {
107316
+ // base64 handling: Clear previously saved base64 data
107317
+ this.builder.base64Data = '';
107225
107318
  this.builder.hideModal(modalMediaSelect);
107226
107319
  });
107227
107320
  }
@@ -122943,7 +123036,14 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
122943
123036
  Array.prototype.forEach.call(forms, formUpload => {
122944
123037
  if (this.dom.hasClass(formUpload, 'please-wait')) {
122945
123038
  this.dom.removeClass(formUpload, 'please-wait');
122946
- if (s) formUpload.parentNode.parentNode.querySelector('input[type="text"]').value = s;
123039
+ if (s) {
123040
+ // base64 handling: save the value and display "[Image Data]"
123041
+ if (s.startsWith('data:')) {
123042
+ this.base64Data = s;
123043
+ s = '[Image Data]';
123044
+ }
123045
+ formUpload.parentNode.parentNode.querySelector('input[type="text"]').value = s;
123046
+ }
122947
123047
  formUpload.parentNode.parentNode.querySelector('input[type="file"]').value = '';
122948
123048
  }
122949
123049
  });
@@ -123009,7 +123109,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
123009
123109
  alert(this.util.out('Please select an mp4 file.'));
123010
123110
  }
123011
123111
  } else if (this.targetAssetType === 'audio') {
123012
- if (extension === 'mp3') {
123112
+ if (extension === 'mp3' || extension === 'wav') {
123013
123113
  ok = true;
123014
123114
  } else {
123015
123115
  alert(this.util.out('Please select an mp3 file.'));
@@ -123099,7 +123199,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
123099
123199
  ok = true;
123100
123200
  } else if (targetAssetType === 'video' && ext === 'mp4') {
123101
123201
  ok = true;
123102
- } else if (targetAssetType === 'audio' && ext === 'mp3') {
123202
+ } else if (targetAssetType === 'audio' && (ext === 'mp3' || ext === 'wav')) {
123103
123203
  ok = true;
123104
123204
  } else if (targetAssetType === 'media' && (s.includes('base64') || ext === 'mp4' || ext === 'jpg' || ext === 'jpeg' || ext === 'png' || ext === 'gif' || ext === 'webm' || ext === 'webp')) {
123105
123205
  ok = true;
@@ -123163,7 +123263,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
123163
123263
  alert(out('Please select an image file.'));
123164
123264
  }
123165
123265
  } else if (targetAssetType === 'audio') {
123166
- if (extension === 'mp3') {
123266
+ if (extension === 'mp3' || extension === 'wav') {
123167
123267
  ok = true;
123168
123268
  } else {
123169
123269
  alert(out('Please select an mp3 file.'));