@innovastudio/contentbuilder 1.3.75 → 1.3.77

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.75",
4
+ "version": "1.3.77",
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;
817
+ left: 0;
818
+ width: 100vw;
819
+ align-items: center;
820
+ box-shadow: rgba(0, 0, 0, 0.07) -1px 1px 0px 0px;
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;
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 => {
@@ -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,48 @@ class Rte {
68946
68969
  dom.addClass(this.elementRteMoreOptions, 'deactive');
68947
68970
  }
68948
68971
  }
68949
- });
68972
+ }); // Backward compatible
68973
+
68974
+ this.builderStuff.insertAdjacentHTML('afterbegin', `
68975
+ <style>
68976
+ #_cbhtml[toolbarfull] .is-rte-tool,
68977
+ #_cbhtml[toolbarfull] .is-elementrte-tool {
68978
+ top: 0;
68979
+ left: 0;
68980
+ width: 100vw;
68981
+ align-items: center;
68982
+ box-shadow: rgba(0, 0, 0, 0.07) -1px 1px 0px 0px;
68983
+ }
68984
+ #_cbhtml[toolbarfull] .is-rte-pop {
68985
+ box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 0px 1px;
68986
+ }
68987
+ </style>
68988
+ `);
68989
+ /*
68990
+ if(this.builder.toolbar === 'topfull') {
68991
+ if(window.getComputedStyle(this.rteTool).getPropertyValue('left') !== '0px') {
68992
+ this.builderStuff.insertAdjacentHTML('afterbegin', `
68993
+ <style>
68994
+ #_cbhtml[toolbarfull] .is-rte-tool,
68995
+ #_cbhtml[toolbarfull] .is-elementrte-tool {
68996
+ top: 0;
68997
+ left: 0;
68998
+ width: 100vw;
68999
+ align-items: center;
69000
+ box-shadow: rgba(0, 0, 0, 0.07) -1px 1px 0px 0px;
69001
+ }
69002
+ #_cbhtml[toolbarfull] .is-rte-pop {
69003
+ box-shadow: rgba(0, 0, 0, 0.05) 0px 1px 0px 1px;
69004
+ }
69005
+ </style>
69006
+ `);
69007
+ }
69008
+ }
69009
+ */
69010
+
69011
+ if (this.builder.toolbarDisplay !== 'auto') {
69012
+ this.showDefaultToolbar(); // first time
69013
+ }
68950
69014
  }
68951
69015
 
68952
69016
  zoomStart() {
@@ -69193,10 +69257,12 @@ class Rte {
69193
69257
  let top;
69194
69258
  let left;
69195
69259
  const btnRteMore = this.rteTool.querySelectorAll('button.rte-more');
69260
+ let btnWidth = 0;
69196
69261
  btnRteMore.forEach(btn => {
69197
69262
  if (btn.getBoundingClientRect().top > 0) {
69198
69263
  top = btn.getBoundingClientRect().top;
69199
69264
  left = btn.getBoundingClientRect().left;
69265
+ btnWidth = btn.offsetWidth;
69200
69266
  }
69201
69267
  });
69202
69268
  const pop = this.rteMoreOptions;
@@ -69223,6 +69289,10 @@ class Rte {
69223
69289
  pop.style.left = parseFloat(this.rteTool.style.left) + this.rteTool.offsetWidth - w + adj + 'px'; //(left -(w/2)+23) + 'px';
69224
69290
 
69225
69291
  pop.style.right = 'auto';
69292
+
69293
+ if (this.builderStuff.hasAttribute('toolbarfull')) {
69294
+ pop.style.left = left - w + btnWidth + 'px';
69295
+ }
69226
69296
  }
69227
69297
  } // showElementRteMore() {
69228
69298
  // const btnElementRteMore = this.elementRteTool.querySelector('button.rte-more');
@@ -69298,6 +69368,10 @@ class Rte {
69298
69368
  pop.style.left = parseFloat(this.elementRteTool.style.left) + this.elementRteTool.offsetWidth - w + adj + 'px'; //(left -(w/2)+23) + 'px';
69299
69369
 
69300
69370
  pop.style.right = 'auto';
69371
+
69372
+ if (this.builderStuff.hasAttribute('toolbarfull')) {
69373
+ pop.style.left = left - w + btnElementRteMore.offsetWidth + 'px';
69374
+ }
69301
69375
  }
69302
69376
  }
69303
69377
 
@@ -69445,6 +69519,60 @@ class Rte {
69445
69519
  dom.cleanClassSize(elm, classname); // dom.cleanUnusedSpan(elm); // will remove empty spans that makes selection changes
69446
69520
  }
69447
69521
 
69522
+ hideAlignButtons() {
69523
+ let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69524
+ let separator1;
69525
+ let separator2;
69526
+ Array.prototype.forEach.call(btns, btn => {
69527
+ btn.style.display = 'none';
69528
+
69529
+ if (btn.previousElementSibling) {
69530
+ if (btn.previousElementSibling.classList.contains('rte-separator')) {
69531
+ separator1 = btn.previousElementSibling;
69532
+ }
69533
+ }
69534
+
69535
+ if (btn.nextElementSibling) {
69536
+ if (btn.nextElementSibling.classList.contains('rte-separator')) {
69537
+ separator2 = btn.nextElementSibling;
69538
+ }
69539
+ }
69540
+ });
69541
+
69542
+ if (separator1 && separator2) {
69543
+ separator2.style.display = 'none';
69544
+ }
69545
+
69546
+ btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69547
+
69548
+ Array.prototype.forEach.call(btns, btn => {
69549
+ btn.style.display = 'none';
69550
+ });
69551
+ }
69552
+
69553
+ showAlignButtons() {
69554
+ let separators = this.elementRteTool.querySelectorAll('.rte-separator');
69555
+ Array.prototype.forEach.call(separators, separator => {
69556
+ separator.style.display = '';
69557
+ });
69558
+ let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69559
+ Array.prototype.forEach.call(btns, btn => {
69560
+ btn.style.display = '';
69561
+ });
69562
+ btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69563
+
69564
+ Array.prototype.forEach.call(btns, btn => {
69565
+ btn.style.display = '';
69566
+ });
69567
+ }
69568
+
69569
+ showDefaultToolbar() {
69570
+ this.elementRteTool.style.display = 'flex';
69571
+ this.rteTool.style.display = 'none';
69572
+ this.hideAlignButtons();
69573
+ this.positionToolbar();
69574
+ }
69575
+
69448
69576
  click(col) {
69449
69577
  const dom = this.dom;
69450
69578
  let elm = this.builder.inspectedElement;
@@ -69486,32 +69614,32 @@ class Rte {
69486
69614
  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
69615
  if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
69488
69616
  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
- });
69617
+ this.rteTool.style.display = 'none'; // let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69618
+ // Array.prototype.forEach.call(btns, (btn) => {
69619
+ // btn.style.display = '';
69620
+ // });
69621
+ // btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69622
+ // Array.prototype.forEach.call(btns, (btn) => {
69623
+ // btn.style.display = '';
69624
+ // });
69625
+
69626
+ this.showAlignButtons();
69499
69627
  this.positionToolbar();
69500
69628
  }
69501
69629
  } else if (dom.hasClass(elm, 'spacer') || elm.tagName.toLowerCase() === 'video' || dom.hasClass(elm, 'ovl') || col.getAttribute('data-html')) {
69502
69630
  //|| col===elm
69503
69631
  if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
69504
69632
  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
- });
69633
+ this.rteTool.style.display = 'none'; // let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69634
+ // Array.prototype.forEach.call(btns, (btn) => {
69635
+ // btn.style.display = 'none';
69636
+ // });
69637
+ // btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69638
+ // Array.prototype.forEach.call(btns, (btn) => {
69639
+ // btn.style.display = 'none';
69640
+ // });
69641
+
69642
+ this.hideAlignButtons();
69515
69643
  this.positionToolbar();
69516
69644
  }
69517
69645
  } else if (dom.hasClass(elm, 'icon')) {
@@ -69534,16 +69662,16 @@ class Rte {
69534
69662
  } else {
69535
69663
  if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
69536
69664
  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
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 = '';
69668
+ // });
69669
+ // btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69670
+ // Array.prototype.forEach.call(btns, (btn) => {
69671
+ // btn.style.display = '';
69672
+ // });
69543
69673
 
69544
- Array.prototype.forEach.call(btns, btn => {
69545
- btn.style.display = '';
69546
- });
69674
+ this.showAlignButtons();
69547
69675
  this.positionToolbar();
69548
69676
  }
69549
69677
  }
@@ -69551,16 +69679,16 @@ class Rte {
69551
69679
  } else {
69552
69680
  if (this.elementRteTool.style.display === 'none' || this.elementRteTool.style.display === '') {
69553
69681
  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
69682
+ this.rteTool.style.display = 'none'; // let btns = this.elementRteTool.querySelectorAll('button[data-align]');
69683
+ // Array.prototype.forEach.call(btns, (btn) => {
69684
+ // btn.style.display = 'none';
69685
+ // });
69686
+ // btns = this.elementRteMoreOptions.querySelectorAll('button[data-align]'); //new
69687
+ // Array.prototype.forEach.call(btns, (btn) => {
69688
+ // btn.style.display = 'none';
69689
+ // });
69560
69690
 
69561
- Array.prototype.forEach.call(btns, btn => {
69562
- btn.style.display = 'none';
69563
- });
69691
+ this.hideAlignButtons();
69564
69692
  this.positionToolbar();
69565
69693
  }
69566
69694
  }
@@ -75591,6 +75719,10 @@ class ContentBuilder {
75591
75719
  // Additional (to prevent lost focus)
75592
75720
  util.clearActiveCell();
75593
75721
  util.clearControls();
75722
+
75723
+ if (this.toolbarDisplay !== 'auto') {
75724
+ this.rte.showDefaultToolbar();
75725
+ }
75594
75726
  }
75595
75727
  }
75596
75728