@innovastudio/contentbuilder 1.5.144 → 1.5.146
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
@@ -46,7 +46,9 @@ interface ContentBuilderOptions {
|
|
46
46
|
onContentClick?: () => void;
|
47
47
|
onChange?: () => void;
|
48
48
|
onAdd?: () => void;
|
49
|
-
|
49
|
+
upload?: (file: File) => Promise<any>;
|
50
|
+
uploadFile?: (e: Event) => Promise<any>;
|
51
|
+
uploadFile?: (e: Event) => Promise<any>;
|
50
52
|
largerImageHandler?: string;
|
51
53
|
onLargerImageUpload?: () => void;
|
52
54
|
imageHandler?: string;
|
package/package.json
CHANGED
@@ -93940,17 +93940,27 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
93940
93940
|
|
93941
93941
|
this.opts = Object.assign(this, defaults, opts);
|
93942
93942
|
if (this.opts.uploadFile) {
|
93943
|
-
const uploadHandler =
|
93944
|
-
|
93945
|
-
|
93946
|
-
|
93947
|
-
|
93943
|
+
const uploadHandler = async e => {
|
93944
|
+
const data = await this.opts.uploadFile(e);
|
93945
|
+
this.returnUrl(data.url);
|
93946
|
+
};
|
93947
|
+
this.onImageUpload = uploadHandler;
|
93948
|
+
this.onVideoUpload = uploadHandler;
|
93949
|
+
this.onAudioUpload = uploadHandler;
|
93950
|
+
this.onMediaUpload = uploadHandler;
|
93951
|
+
this.onFileUpload = uploadHandler;
|
93952
|
+
}
|
93953
|
+
if (this.opts.upload) {
|
93954
|
+
const uploadHandler = async e => {
|
93955
|
+
const file = e.target.files[0];
|
93956
|
+
const data = await this.opts.upload(file);
|
93957
|
+
this.returnUrl(data.url);
|
93948
93958
|
};
|
93949
|
-
this.onImageUpload = uploadHandler
|
93950
|
-
this.onVideoUpload = uploadHandler
|
93951
|
-
this.onAudioUpload = uploadHandler
|
93952
|
-
this.onMediaUpload = uploadHandler
|
93953
|
-
this.onFileUpload = uploadHandler
|
93959
|
+
this.onImageUpload = uploadHandler;
|
93960
|
+
this.onVideoUpload = uploadHandler;
|
93961
|
+
this.onAudioUpload = uploadHandler;
|
93962
|
+
this.onMediaUpload = uploadHandler;
|
93963
|
+
this.onFileUpload = uploadHandler;
|
93954
93964
|
}
|
93955
93965
|
if (this.opts.basePath) {
|
93956
93966
|
this.opts.assetPath = this.opts.basePath + 'assets/';
|