@innovastudio/contentbox 1.6.55 → 1.6.56

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.55",
4
+ "version": "1.6.56",
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.40",
55
+ "@innovastudio/contentbuilder": "^1.5.43",
56
56
  "js-beautify": "^1.14.0"
57
57
  }
58
58
  }
@@ -38947,7 +38947,7 @@ class Grid {
38947
38947
  this.builder.uo.saveForUndo();
38948
38948
  this.builder.hideTools();
38949
38949
  cell.parentElement.insertBefore(cell, cell.previousElementSibling);
38950
- this.builder.opts.onChange();
38950
+ this.builder.opts.onChange(true);
38951
38951
  }
38952
38952
  }
38953
38953
  moveColumnNext() {
@@ -38959,7 +38959,7 @@ class Grid {
38959
38959
  this.builder.uo.saveForUndo();
38960
38960
  this.builder.hideTools();
38961
38961
  cell.parentElement.insertBefore(cellnext, cell);
38962
- this.builder.opts.onChange();
38962
+ this.builder.opts.onChange(true);
38963
38963
  }
38964
38964
  }
38965
38965
  moveColumnUp() {
@@ -38988,7 +38988,7 @@ class Grid {
38988
38988
 
38989
38989
  //Move row up
38990
38990
  row.parentNode.insertBefore(row, row.previousElementSibling);
38991
- this.builder.opts.onChange();
38991
+ this.builder.opts.onChange(true);
38992
38992
  return;
38993
38993
  } else {
38994
38994
  this.builder.uo.saveForUndo();
@@ -39012,7 +39012,7 @@ class Grid {
39012
39012
  setTimeout(() => {
39013
39013
  cell.click(); //refresh active cell/row
39014
39014
  }, 30);
39015
- this.builder.opts.onChange();
39015
+ this.builder.opts.onChange(true);
39016
39016
  }
39017
39017
  } else {
39018
39018
  //move outside container (move to previous container)
@@ -39032,7 +39032,7 @@ class Grid {
39032
39032
  setTimeout(() => {
39033
39033
  cell.click(); //refresh active cell/row
39034
39034
  }, 30);
39035
- this.builder.opts.onChange();
39035
+ this.builder.opts.onChange(true);
39036
39036
  }
39037
39037
 
39038
39038
  //fix layout
@@ -39068,7 +39068,7 @@ class Grid {
39068
39068
 
39069
39069
  //Move row down
39070
39070
  row.parentNode.insertBefore(row.nextElementSibling, row);
39071
- this.builder.opts.onChange();
39071
+ this.builder.opts.onChange(true);
39072
39072
  return;
39073
39073
  } else {
39074
39074
  this.builder.uo.saveForUndo();
@@ -39092,7 +39092,7 @@ class Grid {
39092
39092
  setTimeout(() => {
39093
39093
  cell.click(); //refresh active cell/row
39094
39094
  }, 30);
39095
- this.builder.opts.onChange();
39095
+ this.builder.opts.onChange(true);
39096
39096
  }
39097
39097
  } else {
39098
39098
  //move outside container (move to next container)
@@ -39112,7 +39112,7 @@ class Grid {
39112
39112
  setTimeout(() => {
39113
39113
  cell.click(); //refresh active cell/row
39114
39114
  }, 30);
39115
- this.builder.opts.onChange();
39115
+ this.builder.opts.onChange(true);
39116
39116
  }
39117
39117
 
39118
39118
  //fix layout
@@ -43342,9 +43342,12 @@ const renderSnippetPanel = (builder, snippetOpen) => {
43342
43342
  </div>
43343
43343
  </div>
43344
43344
  `;
43345
- dom.appendHtml(builder.builderStuff, html);
43345
+ let snippetModal = builder.builderStuff.querySelector('.is-modal.snippetwindow');
43346
+ if (!snippetModal) {
43347
+ dom.appendHtml(builder.builderStuff, html);
43348
+ snippetModal = builder.builderStuff.querySelector('.is-modal.snippetwindow');
43349
+ }
43346
43350
  builder.draggable('.snippetwindow .is-draggable');
43347
- const snippetModal = builder.builderStuff.querySelector('.is-modal.snippetwindow');
43348
43351
  const btnClose = snippetModal.querySelector('.is-modal-close');
43349
43352
  btnClose.addEventListener('click', () => {
43350
43353
  snippetModal.classList.remove('active');
@@ -113740,7 +113743,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
113740
113743
 
113741
113744
  // Extend the onChange function
113742
113745
  var oldget = this.opts.onChange;
113743
- this.opts.onChange = () => {
113746
+ this.opts.onChange = hideTools => {
113744
113747
  var ret = oldget.apply(this, arguments);
113745
113748
  if (this.activeCol) {
113746
113749
  // Quick reposition column tool
@@ -113748,14 +113751,16 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
113748
113751
  }
113749
113752
  this.elmTool.repositionElementTool(true);
113750
113753
 
113751
- // if(this.element.image.imageTool) this.element.image.imageTool.style.display='';
113752
- // if(this.element.module.moduleTool) this.element.module.moduleTool.style.display='';
113753
- // if(this.element.hyperlink.linkTool) this.element.hyperlink.linkTool.style.display='';
113754
- // this.colTool.lockIndicator.style.display='';
113754
+ // Hide some tools (not all)
113755
+ if (this.element.image.imageTool) this.element.image.imageTool.style.display = '';
113756
+ if (this.element.module.moduleTool) this.element.module.moduleTool.style.display = '';
113757
+ if (this.element.code.codeTool) this.element.code.codeTool.style.display = '';
113758
+ if (this.element.hyperlink.linkTool) this.element.hyperlink.linkTool.style.display = '';
113759
+ this.colTool.lockIndicator.style.display = '';
113755
113760
 
113756
113761
  // this.hideTools();
113757
113762
  setTimeout(() => {
113758
- this.hideTools();
113763
+ if (hideTools) this.hideTools(); // Hide all tools to prevent incorrect positioning (eg. when layout changes)
113759
113764
  }, 40); // give delay, in case of programmatically click after col move
113760
113765
 
113761
113766
  return ret;
@@ -116005,6 +116010,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
116005
116010
  this.pageoption.print();
116006
116011
  }
116007
116012
  destroy() {
116013
+ const snippetData = document.querySelector('#_snippet_data');
116014
+ if (snippetData) snippetData.remove();
116008
116015
  if (this.eb) this.eb.destroy();
116009
116016
  this.doc.body.classList.remove('data-editor');
116010
116017
  document.removeEventListener('click', this.doDocumentClick, false);
@@ -117037,8 +117044,11 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117037
117044
  if (this.isScriptAlreadyIncluded(snippetFile)) return;
117038
117045
  const script = document.createElement('script');
117039
117046
  script.src = snippetFile;
117047
+ script.id = '_snippet_data';
117040
117048
  script.async = true;
117041
117049
  script.onload = () => {
117050
+ if (!document.body.contains(this.builderStuff)) return; // in case the instance is destroyed
117051
+
117042
117052
  this.opts.snippetJSON = window.data_basic;
117043
117053
  if (!this.canvas) for (let i = this.opts.snippetJSON.snippets.length - 1; i >= 0; i--) {
117044
117054
  if (this.opts.snippetJSON.snippets[i].mode === 'canvas') {
@@ -117180,6 +117190,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117180
117190
  link.href = csslink;
117181
117191
  link.setAttribute('data-cb-color', '');
117182
117192
  link.addEventListener('load', () => {
117193
+ if (!document.body.contains(this.builderStuff)) return; // in case the instance is destroyed
117194
+
117183
117195
  // Remove previous css
117184
117196
  cssLink = document.querySelector('[data-cb-del]');
117185
117197
  if (cssLink) cssLink.parentNode.removeChild(cssLink);
@@ -117251,6 +117263,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117251
117263
  // if(this.opts.onThemeChange) this.opts.onThemeChange();
117252
117264
 
117253
117265
  await this.delay(1000);
117266
+ if (!document.body.contains(this.builderStuff)) return; // in case the instance is destroyed
117267
+
117254
117268
  // setTimeout(()=>{
117255
117269
  util.getUIStyles();
117256
117270
  this.setUIColorRefresh();
@@ -119107,6 +119121,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
119107
119121
  if (iframeTool) iframeTool.style.display = '';
119108
119122
  let moduleTool = this.doc.querySelector('.is-module-tool');
119109
119123
  if (moduleTool) moduleTool.style.display = '';
119124
+ let codeTool = this.doc.querySelector('.is-code-tool');
119125
+ if (codeTool) codeTool.style.display = '';
119110
119126
  let lockIndicator = this.doc.querySelector('.is-locked-indicator');
119111
119127
  if (lockIndicator) lockIndicator.style.display = '';
119112
119128
  let linkTool = this.doc.querySelector('#divLinkTool');