@innovastudio/contentbox 1.6.64 → 1.6.66

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.64",
4
+ "version": "1.6.66",
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.55",
55
+ "@innovastudio/contentbuilder": "^1.5.56",
56
56
  "js-beautify": "^1.14.0"
57
57
  }
58
58
  }
@@ -103544,7 +103544,7 @@ class Dictation {
103544
103544
  const btnOk = this.modalDisclaimer.querySelector('.input-ok');
103545
103545
  btnOk.addEventListener('click', () => {
103546
103546
  this.builder.util.hideModal(this.modalDisclaimer);
103547
- this.openDictation();
103547
+ this.openDictation_();
103548
103548
  });
103549
103549
  let info = `
103550
103550
  <div style="font-weight:500;margin: 25px 0 7px;">${util.out('Dictation')}</div>
@@ -107018,14 +107018,12 @@ ${answer}
107018
107018
  };
107019
107019
  try {
107020
107020
  /*
107021
- let headers = {
107022
- ...this.builder.headers,
107023
- ...this.builder.defaultHeaders
107024
- };
107025
107021
  const response = await fetch(this.builder.sendCommandUrl, {
107026
107022
  signal: this.signal, // Abort
107027
107023
  method: 'POST',
107028
- headers,
107024
+ headers: {
107025
+ 'Content-Type': 'application/json',
107026
+ },
107029
107027
  body: JSON.stringify(messages),
107030
107028
  });
107031
107029
  const data = await response.json();
@@ -107035,15 +107033,13 @@ ${answer}
107035
107033
  if (this.builder.sendCommand) {
107036
107034
  data = await this.builder.sendCommand(messages);
107037
107035
  } else {
107038
- let headers = {
107039
- ...this.builder.headers,
107040
- ...this.builder.defaultHeaders
107041
- };
107042
107036
  const response = await fetch(this.builder.sendCommandUrl, {
107043
107037
  signal: this.signal,
107044
107038
  // Abort
107045
107039
  method: 'POST',
107046
- headers,
107040
+ headers: {
107041
+ 'Content-Type': 'application/json'
107042
+ },
107047
107043
  body: JSON.stringify(messages)
107048
107044
  });
107049
107045
  data = await response.json();
@@ -107107,13 +107103,11 @@ ${answer}
107107
107103
  if (this.builder.consoleLog) {
107108
107104
  if (!(error + '').includes('Failed to fetch')) {
107109
107105
  // Only if not CORS error
107110
- let headers = {
107111
- ...this.builder.headers,
107112
- ...this.builder.defaultHeaders
107113
- };
107114
107106
  const response = await fetch(this.builder.sendCommandUrl, {
107115
107107
  method: 'POST',
107116
- headers,
107108
+ headers: {
107109
+ 'Content-Type': 'application/json'
107110
+ },
107117
107111
  body: JSON.stringify(messages)
107118
107112
  });
107119
107113
  const data = await response.text();
@@ -146515,6 +146509,7 @@ class IframePanel {
146515
146509
 
146516
146510
  const timeoutHandler = async () => {
146517
146511
  await sleep(0.2);
146512
+ if (!document.body.contains(this.editPanel)) return; // in case of destroyed
146518
146513
 
146519
146514
  if (iframe.contentDocument.readyState === 'complete') {
146520
146515
  iframe.contentDocument.body.classList.add('iframe-body'); // add .iframe-body class that is required by box/flex.css
@@ -153958,39 +153953,46 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
153958
153953
  }
153959
153954
 
153960
153955
  destroy() {
153956
+ // let html = this.html();
153961
153957
  if (this.resizeObserver) this.resizeObserver.disconnect();
153962
- this.doc.removeEventListener('click', this.doDocumentClick, false);
153963
- if (this.iframe) document.removeEventListener('click', this.doDocumentClick, false);
153964
- this.doc.removeEventListener('click', this.doDocumentKeydown, false);
153965
- if (this.iframe) document.removeEventListener('click', this.doDocumentKeydown, false);
153966
- window.removeEventListener('scroll', this.doWindowScroll, false);
153967
- this.doc.removeEventListener('scroll', this.doAnimWheel, false);
153968
- this.win.removeEventListener('scroll', this.doAnimScroll, false);
153969
- this.win.removeEventListener('scroll', this.doScrollSync, false);
153970
- let html = this.html(); // this.builderStuff.parentNode.removeChild(this.builderStuff);
153958
+ const elmStyleEditPanel = document.querySelector('#_style_editpanel');
153959
+ if (elmStyleEditPanel) elmStyleEditPanel.remove(elmStyleEditPanel);
153960
+ const editPanel = document.querySelector('#editPanel');
153961
+ if (editPanel) editPanel.remove();
153962
+ const responsiveTool = document.querySelector('.is-responsive-tool');
153963
+ if (responsiveTool) responsiveTool.remove(); // this.builderStuff.parentNode.removeChild(this.builderStuff);
153971
153964
 
153972
153965
  this.builderStuff.innerHTML = '';
153973
- dom.removeClass(document.body, 'sidebar-active');
153966
+ document.body.classList.remove('sidebar-active');
153974
153967
  document.body.removeAttribute('data-skrollrr-off');
153975
153968
  document.body.style.overflowY = ''; // in iframe use, overflowY is set 'hidden'
153976
153969
  // Remove special css
153977
153970
 
153978
- const cbContentStyle = this.doc.querySelector('#_contentbox_css');
153979
- if (cbContentStyle) cbContentStyle.parentNode.removeChild(cbContentStyle);
153980
- const cbStuffStyle = document.querySelector('#_contentboxstuff_css');
153981
- if (cbStuffStyle) cbStuffStyle.parentNode.removeChild(cbStuffStyle); // Render html content
153982
-
153983
- let range = document.createRange();
153984
- const wrapper = this.wrapperEl;
153985
- wrapper.innerHTML = '';
153986
- wrapper.appendChild(range.createContextualFragment(html)); // We use createContextualFragment so that embedded javascript code (code block) will be executed
153971
+ if (this.doc) {
153972
+ const cbContentStyle = this.doc.querySelector('#_contentbox_css');
153973
+ if (cbContentStyle) cbContentStyle.remove(cbContentStyle);
153974
+ }
153987
153975
 
153988
- dom.removeClass(wrapper, 'is-edit');
153989
- this.editor.destroy();
153976
+ const cbStuffStyle = document.querySelector('#_contentboxstuff_css');
153977
+ if (cbStuffStyle) cbStuffStyle.remove(cbStuffStyle); // // Render html content
153978
+ // let range = document.createRange();
153979
+ // const wrapper = this.wrapperEl;
153980
+ // wrapper.innerHTML = '';
153981
+ // wrapper.appendChild(range.createContextualFragment(html)); // We use createContextualFragment so that embedded javascript code (code block) will be executed
153982
+ // wrapper.classList.remove('is-edit')
153983
+
153984
+ if (this.editor) this.editor.destroy();
153990
153985
  const panel = document.querySelector('#_newbox');
153991
153986
  if (panel) panel.parentNode.removeChild(panel);
153992
- document.body.classList.remove('controlpanel'); // Stop Pace
153993
- // Pace.stop();
153987
+ document.body.classList.remove('controlpanel');
153988
+ if (this.doc) this.doc.removeEventListener('click', this.doDocumentClick, false);
153989
+ if (this.iframe) document.removeEventListener('click', this.doDocumentClick, false);
153990
+ if (this.doc) this.doc.removeEventListener('click', this.doDocumentKeydown, false);
153991
+ if (this.iframe) document.removeEventListener('click', this.doDocumentKeydown, false);
153992
+ if (this.doc) this.doc.removeEventListener('scroll', this.doAnimWheel, false);
153993
+ if (this.win) this.win.removeEventListener('scroll', this.doAnimScroll, false);
153994
+ if (this.win) this.win.removeEventListener('scroll', this.doScrollSync, false);
153995
+ window.removeEventListener('scroll', this.doWindowScroll, false);
153994
153996
  }
153995
153997
 
153996
153998
  cleanupUnused() {