@innovastudio/contentbuilder 1.5.41 → 1.5.43

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/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.5.41",
4
+ "version": "1.5.43",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -12658,7 +12658,7 @@ class Grid {
12658
12658
  this.builder.uo.saveForUndo();
12659
12659
  this.builder.hideTools();
12660
12660
  cell.parentElement.insertBefore(cell, cell.previousElementSibling);
12661
- this.builder.opts.onChange();
12661
+ this.builder.opts.onChange(true);
12662
12662
  }
12663
12663
  }
12664
12664
  moveColumnNext() {
@@ -12670,7 +12670,7 @@ class Grid {
12670
12670
  this.builder.uo.saveForUndo();
12671
12671
  this.builder.hideTools();
12672
12672
  cell.parentElement.insertBefore(cellnext, cell);
12673
- this.builder.opts.onChange();
12673
+ this.builder.opts.onChange(true);
12674
12674
  }
12675
12675
  }
12676
12676
  moveColumnUp() {
@@ -12699,7 +12699,7 @@ class Grid {
12699
12699
 
12700
12700
  //Move row up
12701
12701
  row.parentNode.insertBefore(row, row.previousElementSibling);
12702
- this.builder.opts.onChange();
12702
+ this.builder.opts.onChange(true);
12703
12703
  return;
12704
12704
  } else {
12705
12705
  this.builder.uo.saveForUndo();
@@ -12723,7 +12723,7 @@ class Grid {
12723
12723
  setTimeout(() => {
12724
12724
  cell.click(); //refresh active cell/row
12725
12725
  }, 30);
12726
- this.builder.opts.onChange();
12726
+ this.builder.opts.onChange(true);
12727
12727
  }
12728
12728
  } else {
12729
12729
  //move outside container (move to previous container)
@@ -12743,7 +12743,7 @@ class Grid {
12743
12743
  setTimeout(() => {
12744
12744
  cell.click(); //refresh active cell/row
12745
12745
  }, 30);
12746
- this.builder.opts.onChange();
12746
+ this.builder.opts.onChange(true);
12747
12747
  }
12748
12748
 
12749
12749
  //fix layout
@@ -12779,7 +12779,7 @@ class Grid {
12779
12779
 
12780
12780
  //Move row down
12781
12781
  row.parentNode.insertBefore(row.nextElementSibling, row);
12782
- this.builder.opts.onChange();
12782
+ this.builder.opts.onChange(true);
12783
12783
  return;
12784
12784
  } else {
12785
12785
  this.builder.uo.saveForUndo();
@@ -12803,7 +12803,7 @@ class Grid {
12803
12803
  setTimeout(() => {
12804
12804
  cell.click(); //refresh active cell/row
12805
12805
  }, 30);
12806
- this.builder.opts.onChange();
12806
+ this.builder.opts.onChange(true);
12807
12807
  }
12808
12808
  } else {
12809
12809
  //move outside container (move to next container)
@@ -12823,7 +12823,7 @@ class Grid {
12823
12823
  setTimeout(() => {
12824
12824
  cell.click(); //refresh active cell/row
12825
12825
  }, 30);
12826
- this.builder.opts.onChange();
12826
+ this.builder.opts.onChange(true);
12827
12827
  }
12828
12828
 
12829
12829
  //fix layout
@@ -17053,9 +17053,12 @@ const renderSnippetPanel = (builder, snippetOpen) => {
17053
17053
  </div>
17054
17054
  </div>
17055
17055
  `;
17056
- dom.appendHtml(builder.builderStuff, html);
17056
+ let snippetModal = builder.builderStuff.querySelector('.is-modal.snippetwindow');
17057
+ if (!snippetModal) {
17058
+ dom.appendHtml(builder.builderStuff, html);
17059
+ snippetModal = builder.builderStuff.querySelector('.is-modal.snippetwindow');
17060
+ }
17057
17061
  builder.draggable('.snippetwindow .is-draggable');
17058
- const snippetModal = builder.builderStuff.querySelector('.is-modal.snippetwindow');
17059
17062
  const btnClose = snippetModal.querySelector('.is-modal-close');
17060
17063
  btnClose.addEventListener('click', () => {
17061
17064
  snippetModal.classList.remove('active');
@@ -87451,7 +87454,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
87451
87454
 
87452
87455
  // Extend the onChange function
87453
87456
  var oldget = this.opts.onChange;
87454
- this.opts.onChange = () => {
87457
+ this.opts.onChange = hideTools => {
87455
87458
  var ret = oldget.apply(this, arguments);
87456
87459
  if (this.activeCol) {
87457
87460
  // Quick reposition column tool
@@ -87459,14 +87462,16 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
87459
87462
  }
87460
87463
  this.elmTool.repositionElementTool(true);
87461
87464
 
87462
- // if(this.element.image.imageTool) this.element.image.imageTool.style.display='';
87463
- // if(this.element.module.moduleTool) this.element.module.moduleTool.style.display='';
87464
- // if(this.element.hyperlink.linkTool) this.element.hyperlink.linkTool.style.display='';
87465
- // this.colTool.lockIndicator.style.display='';
87465
+ // Hide some tools (not all)
87466
+ if (this.element.image.imageTool) this.element.image.imageTool.style.display = '';
87467
+ if (this.element.module.moduleTool) this.element.module.moduleTool.style.display = '';
87468
+ if (this.element.code.codeTool) this.element.code.codeTool.style.display = '';
87469
+ if (this.element.hyperlink.linkTool) this.element.hyperlink.linkTool.style.display = '';
87470
+ this.colTool.lockIndicator.style.display = '';
87466
87471
 
87467
87472
  // this.hideTools();
87468
87473
  setTimeout(() => {
87469
- this.hideTools();
87474
+ if (hideTools) this.hideTools(); // Hide all tools to prevent incorrect positioning (eg. when layout changes)
87470
87475
  }, 40); // give delay, in case of programmatically click after col move
87471
87476
 
87472
87477
  return ret;
@@ -89716,6 +89721,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
89716
89721
  this.pageoption.print();
89717
89722
  }
89718
89723
  destroy() {
89724
+ const snippetData = document.querySelector('#_snippet_data');
89725
+ if (snippetData) snippetData.remove();
89719
89726
  if (this.eb) this.eb.destroy();
89720
89727
  this.doc.body.classList.remove('data-editor');
89721
89728
  document.removeEventListener('click', this.doDocumentClick, false);
@@ -90748,8 +90755,11 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
90748
90755
  if (this.isScriptAlreadyIncluded(snippetFile)) return;
90749
90756
  const script = document.createElement('script');
90750
90757
  script.src = snippetFile;
90758
+ script.id = '_snippet_data';
90751
90759
  script.async = true;
90752
90760
  script.onload = () => {
90761
+ if (!document.body.contains(this.builderStuff)) return; // in case the instance is destroyed
90762
+
90753
90763
  this.opts.snippetJSON = window.data_basic;
90754
90764
  if (!this.canvas) for (let i = this.opts.snippetJSON.snippets.length - 1; i >= 0; i--) {
90755
90765
  if (this.opts.snippetJSON.snippets[i].mode === 'canvas') {
@@ -92822,6 +92832,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
92822
92832
  if (iframeTool) iframeTool.style.display = '';
92823
92833
  let moduleTool = this.doc.querySelector('.is-module-tool');
92824
92834
  if (moduleTool) moduleTool.style.display = '';
92835
+ let codeTool = this.doc.querySelector('.is-code-tool');
92836
+ if (codeTool) codeTool.style.display = '';
92825
92837
  let lockIndicator = this.doc.querySelector('.is-locked-indicator');
92826
92838
  if (lockIndicator) lockIndicator.style.display = '';
92827
92839
  let linkTool = this.doc.querySelector('#divLinkTool');