@innovastudio/contentbox 1.6.148 → 1.6.149

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,8 @@ interface ContentBoxOptions {
148
148
  photoselect?: string;
149
149
  moduleConfig?: any[];
150
150
 
151
+ uploadFile?: (file: File) => Promise<any>;
152
+
151
153
  largerImageHandler?: string;
152
154
  onLargerImageUpload?: () => void;
153
155
 
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.149",
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.144",
63
63
  "js-beautify": "^1.14.0",
64
64
  "sortablejs": "^1.15.2"
65
65
  }
@@ -120458,6 +120458,19 @@ 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 = () => {
120463
+ return async file => {
120464
+ const data = await this.opts.uploadFile(file);
120465
+ this.returnUrl(data.url);
120466
+ };
120467
+ };
120468
+ this.onImageUpload = uploadHandler();
120469
+ this.onVideoUpload = uploadHandler();
120470
+ this.onAudioUpload = uploadHandler();
120471
+ this.onMediaUpload = uploadHandler();
120472
+ this.onFileUpload = uploadHandler();
120473
+ }
120461
120474
  if (this.opts.basePath) {
120462
120475
  this.opts.assetPath = this.opts.basePath + 'assets/';
120463
120476
  this.opts.fontAssetPath = this.opts.basePath + 'assets/fonts/';
@@ -157494,6 +157507,8 @@ class ContentBox {
157494
157507
  framework: '',
157495
157508
  imageRenameOnEdit: true,
157496
157509
  imageResizeOnBlock: false,
157510
+ iframeCentered: true,
157511
+ // Centers the page view area within the workspace
157497
157512
  htmlButton: true,
157498
157513
  // HTML button on left sidebar
157499
157514
  undoRedoButtons: true,
@@ -160771,6 +160786,36 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
160771
160786
  localStorage.removeItem('_disableanimation');
160772
160787
  }
160773
160788
 
160789
+ if (this.uploadFile) {
160790
+ const uploadHandler = type => {
160791
+ return async file => {
160792
+ const data = await this.uploadFile(file);
160793
+
160794
+ if (type === 'cover') {
160795
+ this.boxImage(data.url);
160796
+ } else {
160797
+ this.returnUrl(data.url);
160798
+ }
160799
+ };
160800
+ };
160801
+
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');
160808
+ }
160809
+
160810
+ if (this.topSpace) {
160811
+ // Disable built-in buttons that will be handled by the topbar:
160812
+ this.undoRedoButtons = false; // Hide undo/redo from the side panel
160813
+
160814
+ this.toggleDeviceButton = false; // Hide device toggle button
160815
+
160816
+ this.deviceButtons = false; // Hide device buttons from top of page view area
160817
+ }
160818
+
160774
160819
  this.templateJSON = [{
160775
160820
  url: this.settings.designUrl1,
160776
160821
  path: this.settings.designPath,
@@ -161356,6 +161401,7 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
161356
161401
  videoHandler: this.settings.videoHandler,
161357
161402
  audioHandler: this.settings.audioHandler,
161358
161403
  fileHandler: this.settings.fileHandler,
161404
+ uploadFile: this.settings.uploadFile,
161359
161405
  onVideoUpload: this.settings.onVideoUpload,
161360
161406
  onAudioUpload: this.settings.onAudioUpload,
161361
161407
  onImageUpload: this.settings.onImageUpload,