@innovastudio/contentbox 1.6.60 → 1.6.62

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.60",
4
+ "version": "1.6.62",
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.52",
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
  });
@@ -103197,10 +103197,16 @@ class Dictation {
103197
103197
  };
103198
103198
  this.opts = Object.assign(this, defaults, opts);
103199
103199
  this.builder = builder;
103200
- const util = this.builder.util;
103201
- this.util = util;
103200
+ } // constructor
103201
+
103202
+ renderPanel() {
103202
103203
  const builderStuff = this.builder.builderStuff;
103203
103204
  this.builderStuff = builderStuff;
103205
+ const util = this.builder.util;
103206
+ this.util = util;
103207
+
103208
+ // const dom = this.builder.dom;
103209
+
103204
103210
  if (localStorage.getItem('_mic') === null) {
103205
103211
  localStorage.setItem('_mic', '0'); // make mic disable by default
103206
103212
  }
@@ -104000,6 +104006,7 @@ class Dictation {
104000
104006
  }
104001
104007
  }
104002
104008
  openDictation() {
104009
+ this.renderPanel();
104003
104010
  if (this.builder.showDisclaimer) {
104004
104011
  if (localStorage.getItem('_disclaimershown') === null) {
104005
104012
  this.builder.util.showModal(this.modalDisclaimer, true, () => {
@@ -107011,12 +107018,14 @@ ${answer}
107011
107018
  };
107012
107019
  try {
107013
107020
  /*
107021
+ let headers = {
107022
+ ...this.builder.headers,
107023
+ ...this.builder.defaultHeaders
107024
+ };
107014
107025
  const response = await fetch(this.builder.sendCommandUrl, {
107015
107026
  signal: this.signal, // Abort
107016
107027
  method: 'POST',
107017
- headers: {
107018
- 'Content-Type': 'application/json',
107019
- },
107028
+ headers,
107020
107029
  body: JSON.stringify(messages),
107021
107030
  });
107022
107031
  const data = await response.json();
@@ -107026,13 +107035,15 @@ ${answer}
107026
107035
  if (this.builder.sendCommand) {
107027
107036
  data = await this.builder.sendCommand(messages);
107028
107037
  } else {
107038
+ let headers = {
107039
+ ...this.builder.headers,
107040
+ ...this.builder.defaultHeaders
107041
+ };
107029
107042
  const response = await fetch(this.builder.sendCommandUrl, {
107030
107043
  signal: this.signal,
107031
107044
  // Abort
107032
107045
  method: 'POST',
107033
- headers: {
107034
- 'Content-Type': 'application/json'
107035
- },
107046
+ headers,
107036
107047
  body: JSON.stringify(messages)
107037
107048
  });
107038
107049
  data = await response.json();
@@ -107096,11 +107107,13 @@ ${answer}
107096
107107
  if (this.builder.consoleLog) {
107097
107108
  if (!(error + '').includes('Failed to fetch')) {
107098
107109
  // Only if not CORS error
107110
+ let headers = {
107111
+ ...this.builder.headers,
107112
+ ...this.builder.defaultHeaders
107113
+ };
107099
107114
  const response = await fetch(this.builder.sendCommandUrl, {
107100
107115
  method: 'POST',
107101
- headers: {
107102
- 'Content-Type': 'application/json'
107103
- },
107116
+ headers,
107104
107117
  body: JSON.stringify(messages)
107105
107118
  });
107106
107119
  const data = await response.text();
@@ -112479,7 +112492,7 @@ class ContentBuilder {
112479
112492
  // { name: 'buttoneditor', showInMainToolbar: false, showInElementToolbar: false },
112480
112493
  // ],
112481
112494
  // pluginPath: 'contentbuilder/', // Location of the plugin scripts
112482
- disableConfig: false,
112495
+ disableConfig: true,
112483
112496
  // If you don't specify the plugins param and set the disableConfig to true, then no plugins will be loaded.
112484
112497
 
112485
112498
  modulePath: 'assets/modules/',
@@ -113143,6 +113156,11 @@ class ContentBuilder {
113143
113156
  enableDragResize: true,
113144
113157
  simpleTextSettings: false,
113145
113158
  enableColumnsPerLine: true,
113159
+ // For fetch
113160
+ defaultHeaders: {
113161
+ 'Content-Type': 'application/json'
113162
+ },
113163
+ headers: {},
113146
113164
  /* Prompt/Command Stuff for AI Assistant */
113147
113165
  startAIAssistant: false,
113148
113166
  isContentBox: false,
@@ -115753,16 +115771,21 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
115753
115771
  }
115754
115772
  closeAIAssistant() {
115755
115773
  let modal = document.querySelector('.is-modal.page-command');
115774
+ if (!modal) return;
115756
115775
  modal.classList.remove('active');
115757
115776
  this.dictation.stopDictation();
115758
115777
  localStorage.setItem('_dictation', '0');
115759
115778
  }
115760
115779
  toggleAIAssistant() {
115761
115780
  let modal = document.querySelector('.is-modal.page-command');
115762
- if (modal.classList.contains('active')) {
115763
- this.closeAIAssistant();
115764
- } else {
115781
+ if (!modal) {
115765
115782
  this.openAIAssistant();
115783
+ } else {
115784
+ if (modal.classList.contains('active')) {
115785
+ this.closeAIAssistant();
115786
+ } else {
115787
+ this.openAIAssistant();
115788
+ }
115766
115789
  }
115767
115790
  }
115768
115791
 
@@ -117472,13 +117495,15 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117472
117495
  image: image,
117473
117496
  folder_path: ''
117474
117497
  };
117498
+ let headers = {
117499
+ ...this.headers,
117500
+ ...this.defaultHeaders
117501
+ };
117475
117502
  const response = await fetch(this.upscaleImageUrl, {
117476
117503
  signal: this.signal,
117477
117504
  // Abort
117478
117505
  method: 'POST',
117479
- headers: {
117480
- 'Content-Type': 'application/json'
117481
- },
117506
+ headers,
117482
117507
  body: JSON.stringify(messages)
117483
117508
  });
117484
117509
  const result = await response.json();
@@ -117508,13 +117533,15 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117508
117533
  };
117509
117534
  try {
117510
117535
  let url = this.textToImageUrl;
117536
+ let headers = {
117537
+ ...this.headers,
117538
+ ...this.defaultHeaders
117539
+ };
117511
117540
  const response = await fetch(url, {
117512
117541
  signal: this.signal,
117513
117542
  // Abort
117514
117543
  method: 'POST',
117515
- headers: {
117516
- 'Content-Type': 'application/json'
117517
- },
117544
+ headers,
117518
117545
  body: JSON.stringify(messages)
117519
117546
  });
117520
117547
  const result = await response.json();
@@ -117549,12 +117576,14 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117549
117576
  this.signal = this.controller.signal; // Get a new signal object
117550
117577
  const messages = { prompt, num };
117551
117578
  try {
117552
- const response = await fetch(this.generateImageUrl, {
117579
+ let headers = {
117580
+ ...this.headers,
117581
+ ...this.defaultHeaders
117582
+ };
117583
+ const response = await fetch(this.generateImageUrl, {
117553
117584
  signal: this.signal, // Abort
117554
117585
  method: 'POST',
117555
- headers: {
117556
- 'Content-Type': 'application/json',
117557
- },
117586
+ headers,
117558
117587
  body: JSON.stringify(messages),
117559
117588
  });
117560
117589
 
@@ -117593,13 +117622,15 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117593
117622
  let image = resizedBase64;
117594
117623
  image = image.replace(/^data:image\/(png|jpeg);base64,/, '');
117595
117624
 
117596
- const reqBody = { image: image, filename: filename };
117625
+ let headers = {
117626
+ ...this.headers,
117627
+ ...this.defaultHeaders
117628
+ };
117629
+ const reqBody = { image: image, filename: filename };
117597
117630
  fetch(this.uploadBase64Url, {
117598
117631
  method:'POST',
117599
117632
  body: JSON.stringify(reqBody),
117600
- headers: {
117601
- 'Content-Type': 'application/json',
117602
- }
117633
+ headers
117603
117634
  })
117604
117635
  .then(response=>response.json())
117605
117636
  .then(response=>{
@@ -145068,13 +145099,14 @@ ${currentHtml}
145068
145099
  if (this.builder.sendCommand) {
145069
145100
  data = await this.builder.sendCommand(messages);
145070
145101
  } else {
145102
+ let headers = { ...this.builder.headers,
145103
+ ...this.builder.defaultHeaders
145104
+ };
145071
145105
  const response = await fetch(this.builder.sendCommandUrl, {
145072
145106
  signal: this.signal,
145073
145107
  // Abort
145074
145108
  method: 'POST',
145075
- headers: {
145076
- 'Content-Type': 'application/json'
145077
- },
145109
+ headers,
145078
145110
  body: JSON.stringify(messages)
145079
145111
  });
145080
145112
  data = await response.json();
@@ -145143,11 +145175,12 @@ ${currentHtml}
145143
145175
  if (this.builder.consoleLog) {
145144
145176
  if (!(error + '').includes('Failed to fetch')) {
145145
145177
  // Only if not CORS error
145178
+ let headers = { ...this.builder.headers,
145179
+ ...this.builder.defaultHeaders
145180
+ };
145146
145181
  const response = await fetch(this.builder.sendCommandUrl, {
145147
145182
  method: 'POST',
145148
- headers: {
145149
- 'Content-Type': 'application/json'
145150
- },
145183
+ headers,
145151
145184
  body: JSON.stringify(messages)
145152
145185
  });
145153
145186
  const data = await response.text();
@@ -146679,17 +146712,14 @@ class ContentBox {
146679
146712
  // Option for self-hosted fonts:
146680
146713
  // fontPath: 'assets/cssfonts/', // If set, will be used
146681
146714
  plugins: [// { name: 'preview', showInMainToolbar: true, showInElementToolbar: true },
146715
+ // { name: 'symbols', showInMainToolbar: true, showInElementToolbar: false },
146716
+ // { name: 'animation', showInMainToolbar: true, showInElementToolbar: true },
146682
146717
  {
146683
146718
  name: 'wordcount',
146684
146719
  showInMainToolbar: true,
146685
146720
  showInElementToolbar: true
146686
- }, {
146687
- name: 'symbols',
146688
- showInMainToolbar: true,
146689
- showInElementToolbar: false
146690
- } // { name: 'animation', showInMainToolbar: true, showInElementToolbar: true },
146691
- ],
146692
- disableConfig: false,
146721
+ }],
146722
+ disableConfig: true,
146693
146723
  maxColumns: 6,
146694
146724
  useLightbox: true,
146695
146725
  lightboxArrow: true,
@@ -149214,6 +149244,11 @@ class ContentBox {
149214
149244
  // mode: 'dark',
149215
149245
  // css: 'contentbuilder/themes/dark.css'
149216
149246
  // },
149247
+ // For fetch
149248
+ defaultHeaders: {
149249
+ 'Content-Type': 'application/json'
149250
+ },
149251
+ headers: {},
149217
149252
 
149218
149253
  /* Prompt/Command Stuff */
149219
149254
  consoleLog: false,
@@ -150231,6 +150266,8 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
150231
150266
  canvas: this.settings.canvas,
150232
150267
  docContainer: this.settings.wrapper,
150233
150268
  consoleLog: this.settings.consoleLog,
150269
+ defaultHeaders: this.settings.defaultHeaders,
150270
+ headers: this.settings.headers,
150234
150271
  isContentBox: true,
150235
150272
  speechTranscribeUrl: this.settings.speechTranscribeUrl,
150236
150273
  autoSendDelay: this.settings.autoSendDelay,