@innovastudio/contentbox 1.6.54 → 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.54",
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.38",
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');
@@ -43567,8 +43570,11 @@ const renderSnippetPanel = (builder, snippetOpen) => {
43567
43570
  // return false;
43568
43571
  // }
43569
43572
 
43570
- const wrapper = builder.doc.querySelector(builder.page);
43571
- if (wrapper) wrapper.style.marginLeft = '';
43573
+ // to prevent flicker caused by snippet panel above wrapper (see contentbuilder.js sectionDropSetup)
43574
+ if (builder.page && builder.page === '.is-wrapper') {
43575
+ const wrapper = builder.doc.querySelector(builder.page);
43576
+ if (wrapper) wrapper.style.marginLeft = '';
43577
+ }
43572
43578
  },
43573
43579
  onSort: evt => {
43574
43580
  if (!builder.canvas) return;
@@ -43585,12 +43591,6 @@ const renderSnippetPanel = (builder, snippetOpen) => {
43585
43591
  block.style.left = x + '%';
43586
43592
  block.removeAttribute('data-new-dummy');
43587
43593
  }
43588
-
43589
- // to prevent flicker caused by snippet panel above wrapper (see contentbuilder.js sectionDropSetup)
43590
- if (builder.page && builder.page === '.is-wrapper') {
43591
- const wrapper = builder.doc.querySelector(builder.page);
43592
- if (wrapper) wrapper.style.marginLeft = '';
43593
- }
43594
43594
  },
43595
43595
  onStart: () => {
43596
43596
  // Remove .builder-active during dragging (because this class makes rows have border-right/left 120px)
@@ -113743,7 +113743,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
113743
113743
 
113744
113744
  // Extend the onChange function
113745
113745
  var oldget = this.opts.onChange;
113746
- this.opts.onChange = () => {
113746
+ this.opts.onChange = hideTools => {
113747
113747
  var ret = oldget.apply(this, arguments);
113748
113748
  if (this.activeCol) {
113749
113749
  // Quick reposition column tool
@@ -113751,14 +113751,16 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
113751
113751
  }
113752
113752
  this.elmTool.repositionElementTool(true);
113753
113753
 
113754
- // if(this.element.image.imageTool) this.element.image.imageTool.style.display='';
113755
- // if(this.element.module.moduleTool) this.element.module.moduleTool.style.display='';
113756
- // if(this.element.hyperlink.linkTool) this.element.hyperlink.linkTool.style.display='';
113757
- // 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 = '';
113758
113760
 
113759
113761
  // this.hideTools();
113760
113762
  setTimeout(() => {
113761
- this.hideTools();
113763
+ if (hideTools) this.hideTools(); // Hide all tools to prevent incorrect positioning (eg. when layout changes)
113762
113764
  }, 40); // give delay, in case of programmatically click after col move
113763
113765
 
113764
113766
  return ret;
@@ -116008,6 +116010,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
116008
116010
  this.pageoption.print();
116009
116011
  }
116010
116012
  destroy() {
116013
+ const snippetData = document.querySelector('#_snippet_data');
116014
+ if (snippetData) snippetData.remove();
116011
116015
  if (this.eb) this.eb.destroy();
116012
116016
  this.doc.body.classList.remove('data-editor');
116013
116017
  document.removeEventListener('click', this.doDocumentClick, false);
@@ -117040,8 +117044,11 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117040
117044
  if (this.isScriptAlreadyIncluded(snippetFile)) return;
117041
117045
  const script = document.createElement('script');
117042
117046
  script.src = snippetFile;
117047
+ script.id = '_snippet_data';
117043
117048
  script.async = true;
117044
117049
  script.onload = () => {
117050
+ if (!document.body.contains(this.builderStuff)) return; // in case the instance is destroyed
117051
+
117045
117052
  this.opts.snippetJSON = window.data_basic;
117046
117053
  if (!this.canvas) for (let i = this.opts.snippetJSON.snippets.length - 1; i >= 0; i--) {
117047
117054
  if (this.opts.snippetJSON.snippets[i].mode === 'canvas') {
@@ -117183,6 +117190,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117183
117190
  link.href = csslink;
117184
117191
  link.setAttribute('data-cb-color', '');
117185
117192
  link.addEventListener('load', () => {
117193
+ if (!document.body.contains(this.builderStuff)) return; // in case the instance is destroyed
117194
+
117186
117195
  // Remove previous css
117187
117196
  cssLink = document.querySelector('[data-cb-del]');
117188
117197
  if (cssLink) cssLink.parentNode.removeChild(cssLink);
@@ -117254,6 +117263,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
117254
117263
  // if(this.opts.onThemeChange) this.opts.onThemeChange();
117255
117264
 
117256
117265
  await this.delay(1000);
117266
+ if (!document.body.contains(this.builderStuff)) return; // in case the instance is destroyed
117267
+
117257
117268
  // setTimeout(()=>{
117258
117269
  util.getUIStyles();
117259
117270
  this.setUIColorRefresh();
@@ -119110,6 +119121,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
119110
119121
  if (iframeTool) iframeTool.style.display = '';
119111
119122
  let moduleTool = this.doc.querySelector('.is-module-tool');
119112
119123
  if (moduleTool) moduleTool.style.display = '';
119124
+ let codeTool = this.doc.querySelector('.is-code-tool');
119125
+ if (codeTool) codeTool.style.display = '';
119113
119126
  let lockIndicator = this.doc.querySelector('.is-locked-indicator');
119114
119127
  if (lockIndicator) lockIndicator.style.display = '';
119115
119128
  let linkTool = this.doc.querySelector('#divLinkTool');