@innovastudio/contentbox 1.6.148 → 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,6 +148,9 @@ interface ContentBoxOptions {
148
148
  photoselect?: string;
149
149
  moduleConfig?: any[];
150
150
 
151
+ upload?: (file: File) => Promise<any>;
152
+ uploadFile?: (e: Event) => Promise<any>;
153
+
151
154
  largerImageHandler?: string;
152
155
  onLargerImageUpload?: () => void;
153
156
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.148",
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.143",
62
+ "@innovastudio/contentbuilder": "^1.5.147",
63
63
  "js-beautify": "^1.14.0",
64
64
  "sortablejs": "^1.15.2"
65
65
  }
@@ -120458,6 +120458,29 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
120458
120458
  // obj.preserveSelection = true; (can be set programmatically) to prevent click that clears selection on external custom modal.
120459
120459
 
120460
120460
  this.opts = Object.assign(this, defaults, opts);
120461
+ if (this.opts.uploadFile) {
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);
120477
+ };
120478
+ this.onImageUpload = uploadHandler;
120479
+ this.onVideoUpload = uploadHandler;
120480
+ this.onAudioUpload = uploadHandler;
120481
+ this.onMediaUpload = uploadHandler;
120482
+ this.onFileUpload = uploadHandler;
120483
+ }
120461
120484
  if (this.opts.basePath) {
120462
120485
  this.opts.assetPath = this.opts.basePath + 'assets/';
120463
120486
  this.opts.fontAssetPath = this.opts.basePath + 'assets/fonts/';
@@ -157494,6 +157517,8 @@ class ContentBox {
157494
157517
  framework: '',
157495
157518
  imageRenameOnEdit: true,
157496
157519
  imageResizeOnBlock: false,
157520
+ iframeCentered: true,
157521
+ // Centers the page view area within the workspace
157497
157522
  htmlButton: true,
157498
157523
  // HTML button on left sidebar
157499
157524
  undoRedoButtons: true,
@@ -160771,6 +160796,53 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
160771
160796
  localStorage.removeItem('_disableanimation');
160772
160797
  }
160773
160798
 
160799
+ if (this.uploadFile) {
160800
+ const uploadHandler = async e => {
160801
+ const data = await this.uploadFile(e);
160802
+ this.returnUrl(data.url);
160803
+ };
160804
+
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);
160822
+ };
160823
+
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
+ };
160835
+ }
160836
+
160837
+ if (this.topSpace) {
160838
+ // Disable built-in buttons that will be handled by the topbar:
160839
+ this.undoRedoButtons = false; // Hide undo/redo from the side panel
160840
+
160841
+ this.toggleDeviceButton = false; // Hide device toggle button
160842
+
160843
+ this.deviceButtons = false; // Hide device buttons from top of page view area
160844
+ }
160845
+
160774
160846
  this.templateJSON = [{
160775
160847
  url: this.settings.designUrl1,
160776
160848
  path: this.settings.designPath,
@@ -161356,6 +161428,7 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
161356
161428
  videoHandler: this.settings.videoHandler,
161357
161429
  audioHandler: this.settings.audioHandler,
161358
161430
  fileHandler: this.settings.fileHandler,
161431
+ uploadFile: this.settings.uploadFile,
161359
161432
  onVideoUpload: this.settings.onVideoUpload,
161360
161433
  onAudioUpload: this.settings.onAudioUpload,
161361
161434
  onImageUpload: this.settings.onImageUpload,