@innovastudio/contentbox 1.6.61 → 1.6.63

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.61",
4
+ "version": "1.6.63",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -52,7 +52,7 @@
52
52
  "ws": "^8.13.0"
53
53
  },
54
54
  "dependencies": {
55
- "@innovastudio/contentbuilder": "^1.5.53",
55
+ "@innovastudio/contentbuilder": "^1.5.55",
56
56
  "js-beautify": "^1.14.0"
57
57
  }
58
58
  }
@@ -14960,7 +14960,7 @@ class PanelBlock {
14960
14960
  this.builder.editor.eb.common.clearBreakpoint(target);
14961
14961
  this.builder.editor.eb.common.applyPixels(target); // this.builder.editor.eb.common.applyPercentage(target);
14962
14962
 
14963
- this.builder.editor.eb.resizable.updateBlockStyle(target);
14963
+ this.builder.editor.eb.draggable.updateBlockStyle(target);
14964
14964
  });
14965
14965
  } else {
14966
14966
  elms.forEach(target => {
@@ -14968,7 +14968,7 @@ class PanelBlock {
14968
14968
  this.builder.editor.eb.common.clearBreakpoint(target);
14969
14969
  this.builder.editor.eb.common.applyPixels(target); // this.builder.editor.eb.common.applyPercentage(target);
14970
14970
 
14971
- this.builder.editor.eb.resizable.updateBlockStyle(target);
14971
+ this.builder.editor.eb.draggable.updateBlockStyle(target);
14972
14972
  });
14973
14973
  }
14974
14974
  });
@@ -107018,12 +107018,14 @@ ${answer}
107018
107018
  };
107019
107019
  try {
107020
107020
  /*
107021
+ let headers = {
107022
+ ...this.builder.headers,
107023
+ ...this.builder.defaultHeaders
107024
+ };
107021
107025
  const response = await fetch(this.builder.sendCommandUrl, {
107022
107026
  signal: this.signal, // Abort
107023
107027
  method: 'POST',
107024
- headers: {
107025
- 'Content-Type': 'application/json',
107026
- },
107028
+ headers,
107027
107029
  body: JSON.stringify(messages),
107028
107030
  });
107029
107031
  const data = await response.json();
@@ -107033,13 +107035,15 @@ ${answer}
107033
107035
  if (this.builder.sendCommand) {
107034
107036
  data = await this.builder.sendCommand(messages);
107035
107037
  } else {
107038
+ let headers = {
107039
+ ...this.builder.headers,
107040
+ ...this.builder.defaultHeaders
107041
+ };
107036
107042
  const response = await fetch(this.builder.sendCommandUrl, {
107037
107043
  signal: this.signal,
107038
107044
  // Abort
107039
107045
  method: 'POST',
107040
- headers: {
107041
- 'Content-Type': 'application/json'
107042
- },
107046
+ headers,
107043
107047
  body: JSON.stringify(messages)
107044
107048
  });
107045
107049
  data = await response.json();
@@ -107103,11 +107107,13 @@ ${answer}
107103
107107
  if (this.builder.consoleLog) {
107104
107108
  if (!(error + '').includes('Failed to fetch')) {
107105
107109
  // Only if not CORS error
107110
+ let headers = {
107111
+ ...this.builder.headers,
107112
+ ...this.builder.defaultHeaders
107113
+ };
107106
107114
  const response = await fetch(this.builder.sendCommandUrl, {
107107
107115
  method: 'POST',
107108
- headers: {
107109
- 'Content-Type': 'application/json'
107110
- },
107116
+ headers,
107111
107117
  body: JSON.stringify(messages)
107112
107118
  });
107113
107119
  const data = await response.text();
@@ -113150,6 +113156,11 @@ class ContentBuilder {
113150
113156
  enableDragResize: true,
113151
113157
  simpleTextSettings: false,
113152
113158
  enableColumnsPerLine: true,
113159
+ // For fetch
113160
+ defaultHeaders: {
113161
+ 'Content-Type': 'application/json'
113162
+ },
113163
+ headers: {},
113153
113164
  /* Prompt/Command Stuff for AI Assistant */
113154
113165
  startAIAssistant: false,
113155
113166
  isContentBox: false,
@@ -117484,13 +117495,15 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117484
117495
  image: image,
117485
117496
  folder_path: ''
117486
117497
  };
117498
+ let headers = {
117499
+ ...this.headers,
117500
+ ...this.defaultHeaders
117501
+ };
117487
117502
  const response = await fetch(this.upscaleImageUrl, {
117488
117503
  signal: this.signal,
117489
117504
  // Abort
117490
117505
  method: 'POST',
117491
- headers: {
117492
- 'Content-Type': 'application/json'
117493
- },
117506
+ headers,
117494
117507
  body: JSON.stringify(messages)
117495
117508
  });
117496
117509
  const result = await response.json();
@@ -117520,13 +117533,15 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117520
117533
  };
117521
117534
  try {
117522
117535
  let url = this.textToImageUrl;
117536
+ let headers = {
117537
+ ...this.headers,
117538
+ ...this.defaultHeaders
117539
+ };
117523
117540
  const response = await fetch(url, {
117524
117541
  signal: this.signal,
117525
117542
  // Abort
117526
117543
  method: 'POST',
117527
- headers: {
117528
- 'Content-Type': 'application/json'
117529
- },
117544
+ headers,
117530
117545
  body: JSON.stringify(messages)
117531
117546
  });
117532
117547
  const result = await response.json();
@@ -117561,12 +117576,14 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117561
117576
  this.signal = this.controller.signal; // Get a new signal object
117562
117577
  const messages = { prompt, num };
117563
117578
  try {
117564
- const response = await fetch(this.generateImageUrl, {
117579
+ let headers = {
117580
+ ...this.headers,
117581
+ ...this.defaultHeaders
117582
+ };
117583
+ const response = await fetch(this.generateImageUrl, {
117565
117584
  signal: this.signal, // Abort
117566
117585
  method: 'POST',
117567
- headers: {
117568
- 'Content-Type': 'application/json',
117569
- },
117586
+ headers,
117570
117587
  body: JSON.stringify(messages),
117571
117588
  });
117572
117589
 
@@ -117605,13 +117622,15 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117605
117622
  let image = resizedBase64;
117606
117623
  image = image.replace(/^data:image\/(png|jpeg);base64,/, '');
117607
117624
 
117608
- const reqBody = { image: image, filename: filename };
117625
+ let headers = {
117626
+ ...this.headers,
117627
+ ...this.defaultHeaders
117628
+ };
117629
+ const reqBody = { image: image, filename: filename };
117609
117630
  fetch(this.uploadBase64Url, {
117610
117631
  method:'POST',
117611
117632
  body: JSON.stringify(reqBody),
117612
- headers: {
117613
- 'Content-Type': 'application/json',
117614
- }
117633
+ headers
117615
117634
  })
117616
117635
  .then(response=>response.json())
117617
117636
  .then(response=>{
@@ -145080,13 +145099,14 @@ ${currentHtml}
145080
145099
  if (this.builder.sendCommand) {
145081
145100
  data = await this.builder.sendCommand(messages);
145082
145101
  } else {
145102
+ let headers = { ...this.builder.headers,
145103
+ ...this.builder.defaultHeaders
145104
+ };
145083
145105
  const response = await fetch(this.builder.sendCommandUrl, {
145084
145106
  signal: this.signal,
145085
145107
  // Abort
145086
145108
  method: 'POST',
145087
- headers: {
145088
- 'Content-Type': 'application/json'
145089
- },
145109
+ headers,
145090
145110
  body: JSON.stringify(messages)
145091
145111
  });
145092
145112
  data = await response.json();
@@ -145155,11 +145175,12 @@ ${currentHtml}
145155
145175
  if (this.builder.consoleLog) {
145156
145176
  if (!(error + '').includes('Failed to fetch')) {
145157
145177
  // Only if not CORS error
145178
+ let headers = { ...this.builder.headers,
145179
+ ...this.builder.defaultHeaders
145180
+ };
145158
145181
  const response = await fetch(this.builder.sendCommandUrl, {
145159
145182
  method: 'POST',
145160
- headers: {
145161
- 'Content-Type': 'application/json'
145162
- },
145183
+ headers,
145163
145184
  body: JSON.stringify(messages)
145164
145185
  });
145165
145186
  const data = await response.text();
@@ -149223,6 +149244,11 @@ class ContentBox {
149223
149244
  // mode: 'dark',
149224
149245
  // css: 'contentbuilder/themes/dark.css'
149225
149246
  // },
149247
+ // For fetch
149248
+ defaultHeaders: {
149249
+ 'Content-Type': 'application/json'
149250
+ },
149251
+ headers: {},
149226
149252
 
149227
149253
  /* Prompt/Command Stuff */
149228
149254
  consoleLog: false,
@@ -150240,6 +150266,8 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
150240
150266
  canvas: this.settings.canvas,
150241
150267
  docContainer: this.settings.wrapper,
150242
150268
  consoleLog: this.settings.consoleLog,
150269
+ defaultHeaders: this.settings.defaultHeaders,
150270
+ headers: this.settings.headers,
150243
150271
  isContentBox: true,
150244
150272
  speechTranscribeUrl: this.settings.speechTranscribeUrl,
150245
150273
  autoSendDelay: this.settings.autoSendDelay,
@@ -153966,7 +153994,7 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
153966
153994
  }
153967
153995
 
153968
153996
  cleanupUnused() {
153969
- this.editor.rte.cleanupFontCssLink(); //Cleanup unused contentstyles
153997
+ if (this.editor) this.editor.rte.cleanupFontCssLink(); //Cleanup unused contentstyles
153970
153998
 
153971
153999
  let links = this.doc.getElementsByTagName('link');
153972
154000