@innovastudio/contentbuilder 1.5.36 → 1.5.38

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/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.5.36",
4
+ "version": "1.5.38",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -12656,6 +12656,7 @@ class Grid {
12656
12656
  if (!cell) return;
12657
12657
  if (cell.previousElementSibling) {
12658
12658
  this.builder.uo.saveForUndo();
12659
+ this.builder.hideTools();
12659
12660
  cell.parentElement.insertBefore(cell, cell.previousElementSibling);
12660
12661
  this.builder.opts.onChange();
12661
12662
  }
@@ -12667,6 +12668,7 @@ class Grid {
12667
12668
  const cellnext = util.cellNext(cell);
12668
12669
  if (cellnext) {
12669
12670
  this.builder.uo.saveForUndo();
12671
+ this.builder.hideTools();
12670
12672
  cell.parentElement.insertBefore(cellnext, cell);
12671
12673
  this.builder.opts.onChange();
12672
12674
  }
@@ -12693,6 +12695,7 @@ class Grid {
12693
12695
  //+2 => includes is-row-tool & is-rowaddtool
12694
12696
 
12695
12697
  this.builder.uo.saveForUndo();
12698
+ this.builder.hideTools();
12696
12699
 
12697
12700
  //Move row up
12698
12701
  row.parentNode.insertBefore(row, row.previousElementSibling);
@@ -12700,6 +12703,7 @@ class Grid {
12700
12703
  return;
12701
12704
  } else {
12702
12705
  this.builder.uo.saveForUndo();
12706
+ this.builder.hideTools();
12703
12707
 
12704
12708
  //Add inside prev row
12705
12709
  let tool = row.previousElementSibling.querySelector('.is-row-tool');
@@ -12727,6 +12731,7 @@ class Grid {
12727
12731
  }
12728
12732
  } else {
12729
12733
  this.builder.uo.saveForUndo();
12734
+ this.builder.hideTools();
12730
12735
  var rowElement = row.cloneNode(true);
12731
12736
  rowElement.innerHTML = '';
12732
12737
  rowElement.appendChild(cell);
@@ -12770,6 +12775,7 @@ class Grid {
12770
12775
  //+2 => includes is-row-tool & is-rowadd-tool
12771
12776
 
12772
12777
  this.builder.uo.saveForUndo();
12778
+ this.builder.hideTools();
12773
12779
 
12774
12780
  //Move row down
12775
12781
  row.parentNode.insertBefore(row.nextElementSibling, row);
@@ -12777,6 +12783,7 @@ class Grid {
12777
12783
  return;
12778
12784
  } else {
12779
12785
  this.builder.uo.saveForUndo();
12786
+ this.builder.hideTools();
12780
12787
 
12781
12788
  //Add inside next row
12782
12789
  let tool = row.nextElementSibling.querySelector('.is-row-tool');
@@ -12804,6 +12811,7 @@ class Grid {
12804
12811
  }
12805
12812
  } else {
12806
12813
  this.builder.uo.saveForUndo();
12814
+ this.builder.hideTools();
12807
12815
  var rowElement = row.cloneNode(true);
12808
12816
  rowElement.innerHTML = '';
12809
12817
  rowElement.appendChild(cell);
@@ -17269,8 +17277,10 @@ const renderSnippetPanel = (builder, snippetOpen) => {
17269
17277
  // evt.related.getBoundingClientRect().top>window.innerHeight) {
17270
17278
  // return false;
17271
17279
  // }
17272
- },
17273
17280
 
17281
+ const wrapper = builder.doc.querySelector(builder.page);
17282
+ if (wrapper) wrapper.style.marginLeft = '';
17283
+ },
17274
17284
  onSort: evt => {
17275
17285
  if (!builder.canvas) return;
17276
17286
  let snippetX = evt.originalEvent.clientX;
@@ -17286,6 +17296,12 @@ const renderSnippetPanel = (builder, snippetOpen) => {
17286
17296
  block.style.left = x + '%';
17287
17297
  block.removeAttribute('data-new-dummy');
17288
17298
  }
17299
+
17300
+ // to prevent flicker caused by snippet panel above wrapper (see contentbuilder.js sectionDropSetup)
17301
+ if (builder.page && builder.page === '.is-wrapper') {
17302
+ const wrapper = builder.doc.querySelector(builder.page);
17303
+ if (wrapper) wrapper.style.marginLeft = '';
17304
+ }
17289
17305
  },
17290
17306
  onStart: () => {
17291
17307
  // Remove .builder-active during dragging (because this class makes rows have border-right/left 120px)
@@ -17334,6 +17350,12 @@ const renderSnippetPanel = (builder, snippetOpen) => {
17334
17350
  }
17335
17351
  let dummies = builder.doc.querySelectorAll('.block-dummy');
17336
17352
  dummies.forEach(elm => elm.parentNode.removeChild(elm));
17353
+
17354
+ // to prevent flicker caused by snippet panel above wrapper (see contentbuilder.js sectionDropSetup)
17355
+ if (builder.page && builder.page === '.is-wrapper') {
17356
+ const wrapper = builder.doc.querySelector(builder.page);
17357
+ if (wrapper) wrapper.style.marginLeft = '';
17358
+ }
17337
17359
  }, 10);
17338
17360
  }
17339
17361
  });
@@ -86373,7 +86395,7 @@ class ContentBuilder {
86373
86395
  deleteConfirm: false,
86374
86396
  disableBootstrapIcons: false,
86375
86397
  sectionTemplate: `
86376
- <div class="is-section is-box is-section-100 type-opensans">
86398
+ <div class="is-section is-box is-section-100 type-system-ui">
86377
86399
  <div class="is-overlay"></div>
86378
86400
  <div class="is-boxes">
86379
86401
  <div class="is-box-centered">
@@ -87439,10 +87461,17 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
87439
87461
  this.util.repositionColumnTool();
87440
87462
  }
87441
87463
  this.elmTool.repositionElementTool(true);
87442
- if (this.element.image.imageTool) this.element.image.imageTool.style.display = '';
87443
- if (this.element.module.moduleTool) this.element.module.moduleTool.style.display = '';
87444
- if (this.element.hyperlink.linkTool) this.element.hyperlink.linkTool.style.display = '';
87445
- this.colTool.lockIndicator.style.display = '';
87464
+
87465
+ // if(this.element.image.imageTool) this.element.image.imageTool.style.display='';
87466
+ // if(this.element.module.moduleTool) this.element.module.moduleTool.style.display='';
87467
+ // if(this.element.hyperlink.linkTool) this.element.hyperlink.linkTool.style.display='';
87468
+ // this.colTool.lockIndicator.style.display='';
87469
+
87470
+ // this.hideTools();
87471
+ setTimeout(() => {
87472
+ this.hideTools();
87473
+ }, 40); // give delay, in case of programmatically click after col move
87474
+
87446
87475
  return ret;
87447
87476
  };
87448
87477
 
@@ -92500,6 +92529,11 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
92500
92529
  if (this.page) {
92501
92530
  if (this.page !== '.is-wrapper') return; // only for ContentBox
92502
92531
  const wrapper = this.doc.querySelector(this.page);
92532
+
92533
+ // to prevent flicker caused by snippet panel above wrapper
92534
+ if (!wrapper.querySelector('.is-section')) {
92535
+ wrapper.style.marginLeft = '300px';
92536
+ }
92503
92537
  this.sortableOnPage = new Sortable(wrapper, {
92504
92538
  scroll: true,
92505
92539
  group: 'shared',
@@ -92593,6 +92627,13 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
92593
92627
 
92594
92628
  if (this.opts.emailMode) bSnippet = false;
92595
92629
 
92630
+ // check if is block
92631
+ let isBlock = false;
92632
+ if (html.includes('"is-block')) {
92633
+ isBlock = true;
92634
+ bSnippet = false;
92635
+ }
92636
+
92596
92637
  // Convert snippet into your defined 12 columns grid
92597
92638
  var rowClass = this.opts.row; //row
92598
92639
  var colClass = this.opts.cols; //['col s1', 'col s2', 'col s3', 'col s4', 'col s5', 'col s6', 'col s7', 'col s8', 'col s9', 'col s10', 'col s11', 'col s12']
@@ -92650,6 +92691,14 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
92650
92691
  // </div>
92651
92692
  // `;
92652
92693
  itemEl.outerHTML = this.settings.sectionTemplate.replace('[%CONTENT%]', html);
92694
+ } else if (isBlock) {
92695
+ let canvasTemplate = `
92696
+ <div class="is-section is-box is-section-100 type-system-ui box-canvas autolayout last-box">
92697
+ <div class="is-overlay"></div>
92698
+ [%CONTENT%]
92699
+ </div>
92700
+ `;
92701
+ itemEl.outerHTML = canvasTemplate.replace('[%CONTENT%]', html);
92653
92702
  } else {
92654
92703
  // Snippet is wrapped in row/colum (may contain custom code or has [data-html] attribute)
92655
92704
  // Can only be inserted after current row or last row (not on column or element).
@@ -92735,6 +92784,16 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
92735
92784
  hideElementTools() {
92736
92785
  let elmTool = this.doc.querySelector('.is-element-tool');
92737
92786
  if (elmTool) elmTool.style.display = '';
92787
+ let videoTool = this.doc.querySelector('.is-video-tool');
92788
+ if (videoTool) videoTool.style.display = '';
92789
+ let audioTool = this.doc.querySelector('.is-audio-tool');
92790
+ if (audioTool) audioTool.style.display = '';
92791
+ let iframeTool = this.doc.querySelector('.is-iframe-tool');
92792
+ if (iframeTool) iframeTool.style.display = '';
92793
+ let moduleTool = this.doc.querySelector('.is-module-tool');
92794
+ if (moduleTool) moduleTool.style.display = '';
92795
+ let lockIndicator = this.doc.querySelector('.is-locked-indicator');
92796
+ if (lockIndicator) lockIndicator.style.display = '';
92738
92797
  let linkTool = this.doc.querySelector('#divLinkTool');
92739
92798
  if (linkTool) linkTool.style.display = '';
92740
92799
  let spacerTool = this.builderStuff.querySelector('.is-spacer-tool');
@@ -92748,6 +92807,32 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
92748
92807
  this.inspectedElement = null;
92749
92808
  this.activeElement = null;
92750
92809
  }
92810
+ hideTools() {
92811
+ // used by contentbuilder.js & grid.js
92812
+
92813
+ // let elmTool = this.doc.querySelector('.is-element-tool');
92814
+ // if(elmTool) elmTool.style.display = '';
92815
+
92816
+ let videoTool = this.doc.querySelector('.is-video-tool');
92817
+ if (videoTool) videoTool.style.display = '';
92818
+ let audioTool = this.doc.querySelector('.is-audio-tool');
92819
+ if (audioTool) audioTool.style.display = '';
92820
+ let iframeTool = this.doc.querySelector('.is-iframe-tool');
92821
+ if (iframeTool) iframeTool.style.display = '';
92822
+ let moduleTool = this.doc.querySelector('.is-module-tool');
92823
+ if (moduleTool) moduleTool.style.display = '';
92824
+ let lockIndicator = this.doc.querySelector('.is-locked-indicator');
92825
+ if (lockIndicator) lockIndicator.style.display = '';
92826
+ let linkTool = this.doc.querySelector('#divLinkTool');
92827
+ if (linkTool) linkTool.style.display = '';
92828
+ let spacerTool = this.builderStuff.querySelector('.is-spacer-tool');
92829
+ if (spacerTool) spacerTool.style.display = '';
92830
+ this.element.image.hideImageTool();
92831
+
92832
+ // this.doc.querySelectorAll('.icon-active').forEach(elm => elm.classList.remove('icon-active'));
92833
+ // this.doc.querySelectorAll('.elm-inspected').forEach(elm => elm.classList.remove('elm-inspected'));
92834
+ // this.doc.querySelectorAll('.elm-active').forEach(elm => elm.classList.remove('elm-active'));
92835
+ }
92751
92836
  }
92752
92837
 
92753
92838
  export { ContentBuilder as default };