@innovastudio/contentbox 1.6.149 → 1.6.150

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/index.d.ts CHANGED
@@ -148,7 +148,8 @@ interface ContentBoxOptions {
148
148
  photoselect?: string;
149
149
  moduleConfig?: any[];
150
150
 
151
- uploadFile?: (file: File) => Promise<any>;
151
+ upload?: (file: File) => Promise<any>;
152
+ uploadFile?: (e: Event) => Promise<any>;
152
153
 
153
154
  largerImageHandler?: string;
154
155
  onLargerImageUpload?: () => void;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.149",
4
+ "version": "1.6.150",
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.144",
62
+ "@innovastudio/contentbuilder": "^1.5.147",
63
63
  "js-beautify": "^1.14.0",
64
64
  "sortablejs": "^1.15.2"
65
65
  }
@@ -120459,17 +120459,27 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
120459
120459
 
120460
120460
  this.opts = Object.assign(this, defaults, opts);
120461
120461
  if (this.opts.uploadFile) {
120462
- const uploadHandler = () => {
120463
- return async file => {
120464
- const data = await this.opts.uploadFile(file);
120465
- this.returnUrl(data.url);
120466
- };
120462
+ const uploadHandler = async e => {
120463
+ const data = await this.opts.uploadFile(e);
120464
+ this.returnUrl(data.url);
120465
+ };
120466
+ this.onImageUpload = uploadHandler;
120467
+ this.onVideoUpload = uploadHandler;
120468
+ this.onAudioUpload = uploadHandler;
120469
+ this.onMediaUpload = uploadHandler;
120470
+ this.onFileUpload = uploadHandler;
120471
+ }
120472
+ if (this.opts.upload) {
120473
+ const uploadHandler = async e => {
120474
+ const file = e.target.files[0];
120475
+ const data = await this.opts.upload(file);
120476
+ this.returnUrl(data.url);
120467
120477
  };
120468
- this.onImageUpload = uploadHandler();
120469
- this.onVideoUpload = uploadHandler();
120470
- this.onAudioUpload = uploadHandler();
120471
- this.onMediaUpload = uploadHandler();
120472
- this.onFileUpload = uploadHandler();
120478
+ this.onImageUpload = uploadHandler;
120479
+ this.onVideoUpload = uploadHandler;
120480
+ this.onAudioUpload = uploadHandler;
120481
+ this.onMediaUpload = uploadHandler;
120482
+ this.onFileUpload = uploadHandler;
120473
120483
  }
120474
120484
  if (this.opts.basePath) {
120475
120485
  this.opts.assetPath = this.opts.basePath + 'assets/';
@@ -160787,24 +160797,41 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
160787
160797
  }
160788
160798
 
160789
160799
  if (this.uploadFile) {
160790
- const uploadHandler = type => {
160791
- return async file => {
160792
- const data = await this.uploadFile(file);
160800
+ const uploadHandler = async e => {
160801
+ const data = await this.uploadFile(e);
160802
+ this.returnUrl(data.url);
160803
+ };
160793
160804
 
160794
- if (type === 'cover') {
160795
- this.boxImage(data.url);
160796
- } else {
160797
- this.returnUrl(data.url);
160798
- }
160799
- };
160805
+ this.onImageUpload = uploadHandler;
160806
+ this.onVideoUpload = uploadHandler;
160807
+ this.onAudioUpload = uploadHandler;
160808
+ this.onMediaUpload = uploadHandler;
160809
+ this.onFileUpload = uploadHandler; // Cover upload needs special handling
160810
+
160811
+ this.onUploadCoverImage = async e => {
160812
+ const data = await this.uploadFile(e);
160813
+ this.boxImage(data.url);
160814
+ };
160815
+ }
160816
+
160817
+ if (this.upload) {
160818
+ const uploadHandler = async e => {
160819
+ const file = e.target.files[0];
160820
+ const data = await this.upload(file);
160821
+ this.returnUrl(data.url);
160800
160822
  };
160801
160823
 
160802
- this.onUploadCoverImage = uploadHandler('cover');
160803
- this.onImageUpload = uploadHandler('image');
160804
- this.onVideoUpload = uploadHandler('video');
160805
- this.onAudioUpload = uploadHandler('audio');
160806
- this.onMediaUpload = uploadHandler('media');
160807
- this.onFileUpload = uploadHandler('file');
160824
+ this.onImageUpload = uploadHandler;
160825
+ this.onVideoUpload = uploadHandler;
160826
+ this.onAudioUpload = uploadHandler;
160827
+ this.onMediaUpload = uploadHandler;
160828
+ this.onFileUpload = uploadHandler; // Cover upload needs special handling
160829
+
160830
+ this.onUploadCoverImage = async e => {
160831
+ const file = e.target.files[0];
160832
+ const data = await this.upload(file);
160833
+ this.boxImage(data.url);
160834
+ };
160808
160835
  }
160809
160836
 
160810
160837
  if (this.topSpace) {