@innovastudio/contentbuilder 1.3.74 → 1.3.76

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.3.74",
4
+ "version": "1.3.76",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -809,6 +809,20 @@ button:focus-visible {
809
809
  width: 34px;
810
810
  margin: 3px 0 3px 7px;
811
811
  }
812
+ #_cbhtml[toolbarfull] .is-rte-tool,
813
+ #_cbhtml[toolbarfull] .is-elementrte-tool,
814
+ .is-ui[toolbarfull] .is-rte-tool,
815
+ .is-ui[toolbarfull] .is-elementrte-tool {
816
+ top: 0 !important;
817
+ left: 0 !important;
818
+ width: 100vw;
819
+ align-items: center;
820
+ box-shadow: rgba(0, 0, 0, 0.07) -1px 1px 0px 0px !important;
821
+ }
822
+ #_cbhtml[toolbarfull] .is-rte-pop,
823
+ .is-ui[toolbarfull] .is-rte-pop {
824
+ box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 0px 1px !important;
825
+ }
812
826
  #_cbhtml .is-rte-pop,
813
827
  .is-ui .is-rte-pop {
814
828
  z-index: 10002;
@@ -5332,15 +5332,18 @@ class Util {
5332
5332
  dom.removeClass(elm, 'elm-inspected');
5333
5333
  }); // RTE
5334
5334
 
5335
- let rtetool = builderStuff.querySelector('.is-rte-tool');
5336
- if (rtetool) rtetool.style.display = 'none';
5337
- let elementRtetool = builderStuff.querySelector('.is-elementrte-tool');
5338
- if (elementRtetool) elementRtetool.style.display = 'none'; // Click ok on code view should hide these as well
5335
+ if (this.builder.toolbarDisplay === 'auto') {
5336
+ let rtetool = builderStuff.querySelector('.is-rte-tool');
5337
+ if (rtetool) rtetool.style.display = 'none';
5338
+ let elementRtetool = builderStuff.querySelector('.is-elementrte-tool');
5339
+ if (elementRtetool) elementRtetool.style.display = 'none'; // Click ok on code view should hide these as well
5340
+
5341
+ let rtetoolmore = builderStuff.querySelector('.rte-more-options');
5342
+ if (rtetoolmore) rtetoolmore.style.display = '';
5343
+ let elementRtetoolmore = builderStuff.querySelector('.elementrte-more-options');
5344
+ if (elementRtetoolmore) elementRtetoolmore.style.display = '';
5345
+ } // Element
5339
5346
 
5340
- let rtetoolmore = builderStuff.querySelector('.rte-more-options');
5341
- if (rtetoolmore) rtetoolmore.style.display = '';
5342
- let elementRtetoolmore = builderStuff.querySelector('.elementrte-more-options');
5343
- if (elementRtetoolmore) elementRtetoolmore.style.display = ''; // Element
5344
5347
 
5345
5348
  elms = this.builder.doc.querySelectorAll('.elm-active');
5346
5349
  Array.prototype.forEach.call(elms, elm => {
@@ -21948,14 +21951,14 @@ const renderSnippetPanel = builder => {
21948
21951
 
21949
21952
  builder.sectionDropSetup();
21950
21953
  },
21951
- onMove: evt => {
21954
+ onMove: () => {
21952
21955
  let emptyinfo = builder.doc.querySelector('.row-add-initial'); // if there is empty info, remove it during snippet drag drop
21953
21956
  // if(emptyinfo) emptyinfo.parentNode.removeChild(emptyinfo);
21954
21957
 
21955
- if (emptyinfo) emptyinfo.style.display = 'none';
21956
- if (builder.sortableOnPage) if (evt.related.getBoundingClientRect().top < 0 || evt.related.getBoundingClientRect().top > window.innerHeight) {
21957
- return false;
21958
- }
21958
+ if (emptyinfo) emptyinfo.style.display = 'none'; // if(builder.sortableOnPage) if(evt.related.getBoundingClientRect().top<0 ||
21959
+ // evt.related.getBoundingClientRect().top>window.innerHeight) {
21960
+ // return false;
21961
+ // }
21959
21962
  },
21960
21963
  onStart: () => {
21961
21964
  // Remove .builder-active during dragging (because this class makes rows have border-right/left 120px)
@@ -65391,6 +65394,7 @@ class Preferences {
65391
65394
  <label style="${this.builder.isTouchSupport ? 'display:none;' : 'display:block;'}margin-top:5px;margin-bottom:5px;">
65392
65395
  ${util.out('Toolbar position')}:&nbsp;
65393
65396
  <select class="select-editingtoolbar">
65397
+ <option value="topfull">${util.out('Top (Full Width)')}</option>
65394
65398
  <option value="top">${util.out('Top')}</option>
65395
65399
  <option value="left">${util.out('Left')}</option>
65396
65400
  <option value="right">${util.out('Right')}</option>
@@ -65523,8 +65527,8 @@ class Preferences {
65523
65527
  // if (localStorage.getItem('_editingtoolbardisplay') !== null) {
65524
65528
  // this.builder.opts.toolbarDisplay = localStorage.getItem('_editingtoolbardisplay');
65525
65529
  // }
65526
-
65527
- this.builder.opts.toolbarDisplay = 'auto'; // this.setToolbarDisplay(this.builder.opts.toolbarDisplay);
65530
+ // this.builder.opts.toolbarDisplay = 'auto';
65531
+ // this.setToolbarDisplay(this.builder.opts.toolbarDisplay);
65528
65532
 
65529
65533
  if (localStorage.getItem('_snippetssidebardisplay') !== null) {
65530
65534
  this.builder.opts.snippetsSidebarDisplay = localStorage.getItem('_snippetssidebardisplay');
@@ -65762,7 +65766,14 @@ class Preferences {
65762
65766
  if (this.builder.themes) {
65763
65767
  const n = this.builder.themeIndex;
65764
65768
  if (this.builder.themeIndex) localStorage.setItem('_theme', n);
65765
- }
65769
+ } // clear/hide rte pops
65770
+
65771
+
65772
+ const builderStuff = this.builder.builderStuff;
65773
+ let rtepops = builderStuff.querySelectorAll('.is-rte-pop');
65774
+ Array.prototype.forEach.call(rtepops, rtepop => {
65775
+ rtepop.style.display = '';
65776
+ });
65766
65777
  }
65767
65778
 
65768
65779
  setToolbar(toolbar) {
@@ -65770,9 +65781,19 @@ class Preferences {
65770
65781
  const builderStuff = this.builder.builderStuff;
65771
65782
  const contentStuff = this.builder.contentStuff;
65772
65783
 
65773
- if (toolbar === 'top') {
65784
+ if (toolbar === 'topfull') {
65785
+ builderStuff.setAttribute('toolbarfull', '');
65786
+ builderStuff.removeAttribute('toolbarleft', '');
65787
+ builderStuff.removeAttribute('toolbarright', '');
65788
+
65789
+ if (this.builder.iframe) {
65790
+ contentStuff.removeAttribute('toolbarleft', '');
65791
+ contentStuff.removeAttribute('toolbarright', '');
65792
+ }
65793
+ } else if (toolbar === 'top') {
65774
65794
  builderStuff.removeAttribute('toolbarleft', '');
65775
65795
  builderStuff.removeAttribute('toolbarright', '');
65796
+ builderStuff.removeAttribute('toolbarfull', '');
65776
65797
 
65777
65798
  if (this.builder.iframe) {
65778
65799
  contentStuff.removeAttribute('toolbarleft', '');
@@ -65781,6 +65802,7 @@ class Preferences {
65781
65802
  } else if (toolbar === 'left') {
65782
65803
  builderStuff.setAttribute('toolbarleft', '');
65783
65804
  builderStuff.removeAttribute('toolbarright', '');
65805
+ builderStuff.removeAttribute('toolbarfull', '');
65784
65806
 
65785
65807
  if (this.builder.iframe) {
65786
65808
  contentStuff.setAttribute('toolbarleft', '');
@@ -65789,6 +65811,7 @@ class Preferences {
65789
65811
  } else if (toolbar === 'right') {
65790
65812
  builderStuff.setAttribute('toolbarright', '');
65791
65813
  builderStuff.removeAttribute('toolbarleft', '');
65814
+ builderStuff.removeAttribute('toolbarfull', '');
65792
65815
 
65793
65816
  if (this.builder.iframe) {
65794
65817
  contentStuff.setAttribute('toolbarright', '');
@@ -68946,7 +68969,31 @@ class Rte {
68946
68969
  dom.addClass(this.elementRteMoreOptions, 'deactive');
68947
68970
  }
68948
68971
  }
68949
- });
68972
+ }); // Backward compatible
68973
+
68974
+ if (this.builder.toolbar === 'topfull') {
68975
+ if (window.getComputedStyle(this.rteTool).getPropertyValue('left') !== '0px') {
68976
+ this.builderStuff.insertAdjacentHTML('afterbegin', `
68977
+ <style>
68978
+ [toolbarfull] .is-rte-tool,
68979
+ [toolbarfull] .is-elementrte-tool {
68980
+ top: 0 !important;
68981
+ left: 0 !important;
68982
+ width: 100vw;
68983
+ align-items: center;
68984
+ box-shadow: rgba(0, 0, 0, 0.07) -1px 1px 0px 0px !important;
68985
+ }
68986
+ [toolbarfull] .is-rte-pop {
68987
+ box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 0px 1px !important;
68988
+ }
68989
+ </style>
68990
+ `);
68991
+ }
68992
+ }
68993
+
68994
+ if (this.builder.toolbarDisplay !== 'auto') {
68995
+ this.showDefaultToolbar(); // first time
68996
+ }
68950
68997
  }
68951
68998
 
68952
68999
  zoomStart() {
@@ -69193,10 +69240,12 @@ class Rte {
69193
69240
  let top;
69194
69241
  let left;
69195
69242
  const btnRteMore = this.rteTool.querySelectorAll('button.rte-more');
69243
+ let btnWidth = 0;
69196
69244
  btnRteMore.forEach(btn => {
69197
69245
  if (btn.getBoundingClientRect().top > 0) {
69198
69246
  top = btn.getBoundingClientRect().top;
69199
69247
  left = btn.getBoundingClientRect().left;
69248
+ btnWidth = btn.offsetWidth;
69200
69249
  }
69201
69250
  });
69202
69251
  const pop = this.rteMoreOptions;
@@ -69223,6 +69272,10 @@ class Rte {
69223
69272
  pop.style.left = parseFloat(this.rteTool.style.left) + this.rteTool.offsetWidth - w + adj + 'px'; //(left -(w/2)+23) + 'px';
69224
69273
 
69225
69274
  pop.style.right = 'auto';
69275
+
69276
+ if (this.builderStuff.hasAttribute('toolbarfull')) {
69277
+ pop.style.left = left - w + btnWidth + 'px';
69278
+ }
69226
69279
  }
69227
69280
  } // showElementRteMore() {
69228
69281
  // const btnElementRteMore = this.elementRteTool.querySelector('button.rte-more');
@@ -69298,6 +69351,10 @@ class Rte {
69298
69351
  pop.style.left = parseFloat(this.elementRteTool.style.left) + this.elementRteTool.offsetWidth - w + adj + 'px'; //(left -(w/2)+23) + 'px';
69299
69352
 
69300
69353
  pop.style.right = 'auto';
69354
+
69355
+ if (this.builderStuff.hasAttribute('toolbarfull')) {
69356
+ pop.style.left = left - w + btnElementRteMore.offsetWidth + 'px';
69357
+ }
69301
69358
  }
69302
69359
  }
69303
69360
 
@@ -69445,6 +69502,60 @@ class Rte {
69445
69502
  dom.cleanClassSize(elm, classname); // dom.cleanUnusedSpan(elm); // will remove empty spans that makes selection changes
69446
69503
  }
69447
69504
 
69505
+ hideAlignButtons() {
69506
+ let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69507
+ let separator1;
69508
+ let separator2;
69509
+ Array.prototype.forEach.call(btns, btn => {
69510
+ btn.style.display = 'none';
69511
+
69512
+ if (btn.previousElementSibling) {
69513
+ if (btn.previousElementSibling.classList.contains('rte-separator')) {
69514
+ separator1 = btn.previousElementSibling;
69515
+ }
69516
+ }
69517
+
69518
+ if (btn.nextElementSibling) {
69519
+ if (btn.nextElementSibling.classList.contains('rte-separator')) {
69520
+ separator2 = btn.nextElementSibling;
69521
+ }
69522
+ }
69523
+ });
69524
+
69525
+ if (separator1 && separator2) {
69526
+ separator2.style.display = 'none';
69527
+ }
69528
+
69529
+ btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69530
+
69531
+ Array.prototype.forEach.call(btns, btn => {
69532
+ btn.style.display = 'none';
69533
+ });
69534
+ }
69535
+
69536
+ showAlignButtons() {
69537
+ let separators = this.elementRteTool.querySelectorAll('.rte-separator');
69538
+ Array.prototype.forEach.call(separators, separator => {
69539
+ separator.style.display = '';
69540
+ });
69541
+ let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69542
+ Array.prototype.forEach.call(btns, btn => {
69543
+ btn.style.display = '';
69544
+ });
69545
+ btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69546
+
69547
+ Array.prototype.forEach.call(btns, btn => {
69548
+ btn.style.display = '';
69549
+ });
69550
+ }
69551
+
69552
+ showDefaultToolbar() {
69553
+ this.elementRteTool.style.display = 'flex';
69554
+ this.rteTool.style.display = 'none';
69555
+ this.hideAlignButtons();
69556
+ this.positionToolbar();
69557
+ }
69558
+
69448
69559
  click(col) {
69449
69560
  const dom = this.dom;
69450
69561
  let elm = this.builder.inspectedElement;
@@ -69486,32 +69597,32 @@ class Rte {
69486
69597
  if ((elm.tagName.toLowerCase() === 'img' || dom.hasClass(elm, 'is-social') || dom.hasClass(elm, 'is-rounded-button-medium') || dom.hasClass(elm, 'cell-active')) && !dom.getSelected()) {
69487
69598
  if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
69488
69599
  this.elementRteTool.style.display = 'flex';
69489
- this.rteTool.style.display = 'none';
69490
- let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69491
- Array.prototype.forEach.call(btns, btn => {
69492
- btn.style.display = '';
69493
- });
69494
- btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69495
-
69496
- Array.prototype.forEach.call(btns, btn => {
69497
- btn.style.display = '';
69498
- });
69600
+ this.rteTool.style.display = 'none'; // let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69601
+ // Array.prototype.forEach.call(btns, (btn) => {
69602
+ // btn.style.display = '';
69603
+ // });
69604
+ // btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69605
+ // Array.prototype.forEach.call(btns, (btn) => {
69606
+ // btn.style.display = '';
69607
+ // });
69608
+
69609
+ this.showAlignButtons();
69499
69610
  this.positionToolbar();
69500
69611
  }
69501
69612
  } else if (dom.hasClass(elm, 'spacer') || elm.tagName.toLowerCase() === 'video' || dom.hasClass(elm, 'ovl') || col.getAttribute('data-html')) {
69502
69613
  //|| col===elm
69503
69614
  if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
69504
69615
  this.elementRteTool.style.display = 'flex';
69505
- this.rteTool.style.display = 'none';
69506
- let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69507
- Array.prototype.forEach.call(btns, btn => {
69508
- btn.style.display = 'none';
69509
- });
69510
- btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69511
-
69512
- Array.prototype.forEach.call(btns, btn => {
69513
- btn.style.display = 'none';
69514
- });
69616
+ this.rteTool.style.display = 'none'; // let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69617
+ // Array.prototype.forEach.call(btns, (btn) => {
69618
+ // btn.style.display = 'none';
69619
+ // });
69620
+ // btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69621
+ // Array.prototype.forEach.call(btns, (btn) => {
69622
+ // btn.style.display = 'none';
69623
+ // });
69624
+
69625
+ this.hideAlignButtons();
69515
69626
  this.positionToolbar();
69516
69627
  }
69517
69628
  } else if (dom.hasClass(elm, 'icon')) {
@@ -69534,16 +69645,16 @@ class Rte {
69534
69645
  } else {
69535
69646
  if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
69536
69647
  this.elementRteTool.style.display = 'flex';
69537
- this.rteTool.style.display = 'none';
69538
- let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69539
- Array.prototype.forEach.call(btns, btn => {
69540
- btn.style.display = '';
69541
- });
69542
- btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69648
+ this.rteTool.style.display = 'none'; // let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69649
+ // Array.prototype.forEach.call(btns, (btn) => {
69650
+ // btn.style.display = '';
69651
+ // });
69652
+ // btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69653
+ // Array.prototype.forEach.call(btns, (btn) => {
69654
+ // btn.style.display = '';
69655
+ // });
69543
69656
 
69544
- Array.prototype.forEach.call(btns, btn => {
69545
- btn.style.display = '';
69546
- });
69657
+ this.showAlignButtons();
69547
69658
  this.positionToolbar();
69548
69659
  }
69549
69660
  }
@@ -69551,16 +69662,16 @@ class Rte {
69551
69662
  } else {
69552
69663
  if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
69553
69664
  this.elementRteTool.style.display = 'flex';
69554
- this.rteTool.style.display = 'none';
69555
- let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69556
- Array.prototype.forEach.call(btns, btn => {
69557
- btn.style.display = 'none';
69558
- });
69559
- btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69665
+ this.rteTool.style.display = 'none'; // let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69666
+ // Array.prototype.forEach.call(btns, (btn) => {
69667
+ // btn.style.display = 'none';
69668
+ // });
69669
+ // btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69670
+ // Array.prototype.forEach.call(btns, (btn) => {
69671
+ // btn.style.display = 'none';
69672
+ // });
69560
69673
 
69561
- Array.prototype.forEach.call(btns, btn => {
69562
- btn.style.display = 'none';
69563
- });
69674
+ this.hideAlignButtons();
69564
69675
  this.positionToolbar();
69565
69676
  }
69566
69677
  }
@@ -75591,6 +75702,10 @@ class ContentBuilder {
75591
75702
  // Additional (to prevent lost focus)
75592
75703
  util.clearActiveCell();
75593
75704
  util.clearControls();
75705
+
75706
+ if (this.toolbarDisplay !== 'auto') {
75707
+ this.rte.showDefaultToolbar();
75708
+ }
75594
75709
  }
75595
75710
  }
75596
75711
 
@@ -76063,6 +76178,8 @@ class ContentBuilder {
76063
76178
  if (oldCss) oldCss.parentNode.removeChild(oldCss);
76064
76179
  this.builderStuff.insertAdjacentHTML('afterbegin', newCss);
76065
76180
  }
76181
+
76182
+ this.sectionDropSetup(); // enable drop as section (ContentBox)
76066
76183
  },
76067
76184
  onStart: () => {
76068
76185
  this.uo.saveForUndo(); // Even if cancelled, saveForUndo will make sure not to save if there is no change
@@ -76071,6 +76188,8 @@ class ContentBuilder {
76071
76188
  },
76072
76189
  onEnd: () => {
76073
76190
  this.util.checkEmpty(); // for multiple instances check
76191
+
76192
+ if (this.sortableOnPage) this.sortableOnPage.destroy(); // enable drop as section (ContentBox)
76074
76193
  },
76075
76194
  onAdd: evt => {
76076
76195
  var itemEl = evt.item;