@innovastudio/contentbox 1.0.24 → 1.0.28

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.
@@ -363,12 +363,23 @@ class SideBar {
363
363
  sideIndex++;
364
364
  });
365
365
  html += '</div>';
366
- html += '' + '<div id="divSidebarSections" class="is-sidebar-content" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div>' + '<iframe id="ifrIdeasPanel" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>' + '<div id="divSidebarSnippets" class="is-sidebar-content scroll-darker"" style="max-width:275px;border-left: transparent 50px solid;box-sizing: border-box;">' + '' + '</div>' + '<div id="divSidebarSource" class="is-sidebar-content" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div>' + '<div style="position:absolute;width:240px;height:35px;right:10px;top:5px;z-index:1;display:flex;">' + '<button title="' + out('Cancel') + '" id="btnViewHtmlCancel" style="height:38px" class="classic-secondary"> ' + out('Cancel') + ' </button>' + '<button title="' + out('Ok') + '" id="btnViewHtmlOk" style="height:38px" class="classic-primary"> ' + out('Ok') + ' </button>' + '</div>' + '<div style="height:100%;box-sizing:border-box;border-top:#f3f3f3 50px solid;position:relative">' + '<textarea id="inpViewHtml" style="width:100%;height:100%;resize: none;"></textarea>' + '<button title="' + out('Enlarge') + '" class="edit-html-larger" style="width:40px;height:40px;position:absolute;right:20px;top:5px;background:#fff;padding: 0;"><svg class="is-icon-flex" style="width:22px;height:22px;fill:rgb(170, 170, 170);"><use xlink:href="#ion-arrow-expand"></use></svg></button>' + '</div>' + '</div>' + '</div>' + '<div id="divSidebarTypography" class="is-sidebar-content" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div class="scroll-darker">' + '<div id="divSelector" style="position:fixed;top:0;right:0;width:100%;z-index:2;padding: 0 0 0 50px;box-sizing: border-box;"></div>' + '<div id="divStyles"></div>' + '</div>' + '</div>' + '<div id="divCustomSidebarArea1" class="is-sidebar-content" style="max-width:500px;">' + '<div style="padding:0 0 0 50px;box-sizing:border-box;">' + '<iframe id="ifrCustomSidebarArea1" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>' + '<div id="divCustomSidebarArea2" class="is-sidebar-content" style="max-width:500px;">' + '<div style="padding:0 0 0 50px;box-sizing:border-box;">' + '<iframe id="ifrCustomSidebarArea2" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>';
366
+ html += '' + '<div id="divSidebarSections" class="is-sidebar-content" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div>' + '<iframe id="ifrIdeasPanel" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>' + '<div id="divSidebarSnippets" class="is-sidebar-content scroll-darker"" style="max-width:275px;border-left: transparent 50px solid;box-sizing: border-box;">' + '' + '</div>' + '<div id="divSidebarSource" class="is-sidebar-content" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div>' + '<div style="position:absolute;width:240px;height:35px;right:10px;top:5px;z-index:1;display:flex;">' + '<button title="' + out('Cancel') + '" id="btnViewHtmlCancel" style="height:38px" class="classic-secondary"> ' + out('Cancel') + ' </button>' + '<button title="' + out('Ok') + '" id="btnViewHtmlOk" style="height:38px" class="classic-primary"> ' + out('Ok') + ' </button>' + '</div>' + '<div style="height:100%;box-sizing:border-box;border-top:#f3f3f3 50px solid;position:relative">' + '<textarea id="inpViewHtml" style="width:100%;height:100%;resize: none;"></textarea>' + '<button title="' + out('Enlarge') + '" class="edit-html-larger" style="width:40px;height:40px;position:absolute;right:20px;top:5px;background:#fff;padding: 0;"><svg class="is-icon-flex" style="width:22px;height:22px;fill:rgb(170, 170, 170);"><use xlink:href="#ion-arrow-expand"></use></svg></button>' + '</div>' + '</div>' + '</div>' + '<div id="divSidebarTypography" class="is-sidebar-content" style="-webkit-transition-duration:0.2s;transition-duration:0.2s;">' + '<div class="scroll-darker">' + '<div style="padding: 15px 0 0 20px">' + '<div class="is-sidebar-title" style="margin-bottom:12px;">' + out('Typography Styles') + '</div>' + '<div>' + out('Apply to') + ':</div>' + '<div style="display:flex;justify-content:space-between;align-items: center;">' + '<div class="typo-target-default" style="display:flex">' + '<label><input type="radio" name="typoTarget" value="page"> <span>' + out('Page') + '</span></label>' + '<label><input type="radio" name="typoTarget" value="section" checked> <span>' + out('Section') + '</span></label>' + '</div>' + '<div class="typo-target-box" style="display: flex;">' + '<span>' + out('Active Box') + '</span>' + '</div>' + '<button title="' + out('Clear') + '" id="btnTypoClear"><svg class="is-icon-flex" style="width:11px;height:11px;"><use xlink:href="#icon-clean"></use></svg></button>' + '</div>' + '</div>' + '<div id="divSelector"></div>' + '<div id="divStyles"></div>' + '</div>' + '</div>' + '<div id="divCustomSidebarArea1" class="is-sidebar-content" style="max-width:500px;">' + '<div style="padding:0 0 0 50px;box-sizing:border-box;">' + '<iframe id="ifrCustomSidebarArea1" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>' + '<div id="divCustomSidebarArea2" class="is-sidebar-content" style="max-width:500px;">' + '<div style="padding:0 0 0 50px;box-sizing:border-box;">' + '<iframe id="ifrCustomSidebarArea2" src="about:blank" style="width:100%;height:100%;box-sizing:border-box;border:none;">' + '</iframe>' + '</div>' + '</div>';
367
367
  } else {
368
368
  html = '<div id="divSections" style="display:none"></div>' + '<div class="is-modal addsection">' + '<div style="max-width: 900px;">' + '<div id="divSectionList" class="is-section-list"></div>' + '</div>' + '</div>';
369
369
  }
370
+ /*
371
+ html += '<div class="is-modal applytypography">' +
372
+ '<div style="max-width: 400px;text-align:center;">' +
373
+ '<p>' + out('This page has one or more sections that have their own typography style.') + '</p>' +
374
+ '<label><input name="rdoApplyTypoStyle" type="radio" value="1">' + out('Replace all sections\' typography style.') + '</label><br>' +
375
+ '<label><input name="rdoApplyTypoStyle" type="radio" value="0">' + out('Keep sections\' specific typography style.') + '</label>' +
376
+ '<p><i>' + out('To apply typography style on a specific section, goto \'Content Style\' tab in Box Settings') + '</i></p>' +
377
+ '<button class="input-ok classic">' + out('Ok') + '</button>' +
378
+ '</div>' +
379
+ '</div>';
380
+ */
381
+
370
382
 
371
- html += '<div class="is-modal applytypography">' + '<div style="max-width: 400px;text-align:center;">' + '<p>' + out('This page has one or more sections that have their own typography style.') + '</p>' + '<label><input name="rdoApplyTypoStyle" type="radio" value="1">' + out('Replace all sections\' typography style.') + '</label><br>' + '<label><input name="rdoApplyTypoStyle" type="radio" value="0">' + out('Keep sections\' specific typography style.') + '</label>' + '<p><i>' + out('To apply typography style on a specific section, goto \'Content Style\' tab in Box Settings') + '</i></p>' + '<button class="input-ok classic">' + out('Ok') + '</button>' + '</div>' + '</div>';
372
383
  dom$I.appendHtml(builderStuff, html);
373
384
 
374
385
  if (this.builder.useSidebar) {
@@ -400,7 +411,8 @@ class SideBar {
400
411
  let panelId = btn.getAttribute('data-content');
401
412
 
402
413
  if (panelId) {
403
- if (panelId === 'divSidebarSections' || panelId === 'divSidebarTypography') {
414
+ if (panelId === 'divSidebarSections') {
415
+ // || panelId==='divSidebarTypography'
404
416
  const overlayHtml = '<div class="is-sidebar-overlay" style="position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(255,255,255,0.000001);z-index: 1000;"></div>';
405
417
  dom$I.appendHtml(builderStuff, overlayHtml);
406
418
  }
@@ -443,6 +455,8 @@ class SideBar {
443
455
 
444
456
  if (cmd == 'typography') {
445
457
  btn.setAttribute('data-applyto', 'page');
458
+ builderStuff.querySelector('.typo-target-default').style.display = 'flex';
459
+ builderStuff.querySelector('.typo-target-box').style.display = 'none';
446
460
  this.viewTypography();
447
461
  }
448
462
  }
@@ -537,63 +551,61 @@ class SideBar {
537
551
  textarea.setAttribute('data-source-ok', '#btnViewHtmlOk');
538
552
  textarea.setAttribute('data-source-cancel', '#btnViewHtmlCancel');
539
553
  this.builder.editor.viewHtmlLarger();
554
+ });
555
+ let btnTypoClear = document.querySelector('#btnTypoClear');
556
+ btnTypoClear.addEventListener('click', () => {
557
+ this.boxTypography('', '', '');
540
558
  }); // Apply Typography on Page
541
559
 
560
+ /*
542
561
  let modalTypography = builderStuff.querySelector('.is-modal.applytypography');
543
562
  const btnOk = modalTypography.querySelector('.input-ok');
544
- btnOk.addEventListener('click', () => {
545
- const contentStylePath = this.builder.settings.contentStylePath;
546
- let val = modalTypography.querySelector('input[name="rdoApplyTypoStyle"]:checked').value;
547
-
548
- if (val === '1') {
549
- // Replace all sections' style
563
+ btnOk.addEventListener('click', ()=>{
564
+ const contentStylePath = this.builder.settings.contentStylePath;
565
+ let val = modalTypography.querySelector('input[name="rdoApplyTypoStyle"]:checked').value;
566
+ if (val === '1') {
567
+ // Replace all sections' style
568
+ let links = document.getElementsByTagName('link');
569
+ for (let i = 0; i < links.length; i++) {
570
+ if (links[i].getAttribute('data-name') === 'contentstyle') {
571
+ let classname = links[i].getAttribute('data-class');
572
+ //check if classname used in content
573
+ if (this.builder.wrapperEl.querySelector('.' + classname)) {
574
+ let elms = this.builder.wrapperEl.querySelectorAll('.' + classname);
575
+ elms.forEach((elm)=>{
576
+ dom.removeClass(elm, classname);
577
+ });
578
+ links[i].setAttribute('data-rel', '_del');
579
+ }
580
+ }
581
+ }
582
+ let dels = document.querySelectorAll('[data-rel="_del"]');
583
+ dels.forEach((item)=>{
584
+ item.parentNode.removeChild(item);
585
+ });
586
+ }
587
+ //Cleanup (remove previous css that has prefix 'basetype-')
550
588
  let links = document.getElementsByTagName('link');
551
-
552
589
  for (let i = 0; i < links.length; i++) {
553
- if (links[i].getAttribute('data-name') === 'contentstyle') {
554
- let classname = links[i].getAttribute('data-class'); //check if classname used in content
555
-
556
- if (this.builder.wrapperEl.querySelector('.' + classname)) {
557
- let elms = this.builder.wrapperEl.querySelectorAll('.' + classname);
558
- elms.forEach(elm => {
559
- dom$I.removeClass(elm, classname);
560
- });
561
- links[i].setAttribute('data-rel', '_del');
590
+ let src = links[i].href.toLowerCase();
591
+ if (src.indexOf('basetype-') != -1) {
592
+ links[i].setAttribute('data-rel', '_del');
562
593
  }
563
- }
564
594
  }
565
-
566
595
  let dels = document.querySelectorAll('[data-rel="_del"]');
567
- dels.forEach(item => {
568
- item.parentNode.removeChild(item);
596
+ dels.forEach((item)=>{
597
+ item.parentNode.removeChild(item);
569
598
  });
570
- } //Cleanup (remove previous css that has prefix 'basetype-')
571
-
572
-
573
- let links = document.getElementsByTagName('link');
574
-
575
- for (let i = 0; i < links.length; i++) {
576
- let src = links[i].href.toLowerCase();
577
-
578
- if (src.indexOf('basetype-') != -1) {
579
- links[i].setAttribute('data-rel', '_del');
599
+ //Add new page css
600
+ if (this.pageCss != '') {
601
+ dom.appendHtml(document.head, '<link href="' + contentStylePath + this.pageCss + '" rel="stylesheet">');
580
602
  }
581
- }
582
-
583
- let dels = document.querySelectorAll('[data-rel="_del"]');
584
- dels.forEach(item => {
585
- item.parentNode.removeChild(item);
586
- }); //Add new page css
587
-
588
- if (this.pageCss != '') {
589
- dom$I.appendHtml(document.head, '<link href="' + contentStylePath + this.pageCss + '" rel="stylesheet">');
590
- } // this.builder.hideModal($modal);
591
-
592
-
593
- this.builder.hideModal(modalTypography); //Trigger Change event
594
-
595
- this.builder.settings.onChange();
603
+ // this.builder.hideModal($modal);
604
+ this.builder.hideModal(modalTypography);
605
+ //Trigger Change event
606
+ this.builder.settings.onChange();
596
607
  });
608
+ */
597
609
  }
598
610
  } //constructor
599
611
 
@@ -728,9 +740,9 @@ class SideBar {
728
740
  html += '<div data-css="' + styles[i].css + '" data-sectioncss="' + styles[i].sectioncss + '" data-classname="' + styles[i].classname + '">' + '<div>[' + (i + 1) + '] ' + styles[i].caption + '</div>' + '<img src="' + contentStylePath + styles[i].img + '" /><span class="is-overlay"></span></div></div>';
729
741
  }
730
742
  }
731
- }
743
+ } // html += '<div data-css="" data-sectioncss="" data-classname=""><img src="' + contentStylePath + '_clear.jpg" /><span class="is-overlay"></span></div></div>';
744
+
732
745
 
733
- html += '<div data-css="" data-sectioncss="" data-classname=""><img src="' + contentStylePath + '_clear.jpg" /><span class="is-overlay"></span></div></div>';
734
746
  let selection = document.querySelector('#divStyles');
735
747
  selection.innerHTML = html;
736
748
  let elms = elementChildren(selection);
@@ -746,9 +758,9 @@ class SideBar {
746
758
 
747
759
  for (var i = 0; i < styles.length; i++) {
748
760
  stylehtml += '<div data-css="' + styles[i].css + '" data-sectioncss="' + styles[i].sectioncss + '" data-classname="' + styles[i].classname + '"><div>[' + (i + 1) + '] ' + styles[i].caption + '</div><img src="' + contentStylePath + styles[i].img + '" /><span class="is-overlay"></span></div></div>';
749
- }
761
+ } // stylehtml += '<div data-css="" data-sectioncss="" data-classname=""><img src="' + contentStylePath + '_clear.jpg" /><span class="is-overlay"></span></div></div>';
762
+
750
763
 
751
- stylehtml += '<div data-css="" data-sectioncss="" data-classname=""><img src="' + contentStylePath + '_clear.jpg" /><span class="is-overlay"></span></div></div>';
752
764
  var selection = document.querySelector('#divStyles');
753
765
  selection.innerHTML = stylehtml;
754
766
  var elms = elementChildren(selection);
@@ -765,21 +777,31 @@ class SideBar {
765
777
  const contentStylePath = this.builder.settings.contentStylePath; //Check apply to what
766
778
 
767
779
  let applyto = builderStuff.querySelector('.is-sidebar > button[data-command="typography"]').getAttribute('data-applyto');
780
+ let mode = document.querySelector('input[name="typoTarget"]:checked').value;
768
781
 
769
- if (applyto === 'box') {
770
- let activeBox = this.builder.activeBox;
771
-
772
- if (activeBox) {
773
- let classList = activeBox.getAttribute('class').split(/\s+/);
782
+ if (applyto !== 'box') {
783
+ if (mode === 'section') {
784
+ let activeSection = this.builder.activeSection;
785
+ let classList = activeSection.getAttribute('class').split(/\s+/);
774
786
  classList.forEach(item => {
775
787
  if (item.indexOf('type-') != -1) {
776
788
  //Remove previous class that has prefix 'type-'
777
- dom$I.removeClass(activeBox, item);
789
+ dom$I.removeClass(activeSection, item);
778
790
  }
791
+ });
792
+ let boxes = activeSection.querySelectorAll('.is-box, .is-box-centered');
793
+ boxes.forEach(box => {
794
+ let classList = box.getAttribute('class').split(/\s+/);
795
+ classList.forEach(item => {
796
+ if (item.indexOf('type-') != -1) {
797
+ //Remove previous class that has prefix 'type-'
798
+ dom$I.removeClass(box, item);
799
+ }
800
+ });
779
801
  }); //Add new class
780
802
 
781
803
  if (className !== '') {
782
- dom$I.addClass(activeBox, className); //Add css
804
+ dom$I.addClass(activeSection, className); //Add css
783
805
 
784
806
  let exist = false;
785
807
  let links = document.getElementsByTagName('link');
@@ -809,20 +831,30 @@ class SideBar {
809
831
  dels.forEach(item => {
810
832
  item.parentNode.removeChild(item);
811
833
  });
812
- }
813
- } else {
814
- let bSectionStyleExists = false;
815
- let links = document.getElementsByTagName('link');
834
+ } else if (mode === 'page') {
835
+ // Replace all sections' style
836
+ let links = document.getElementsByTagName('link');
816
837
 
817
- for (let i = 0; i < links.length; i++) {
818
- if (links[i].getAttribute('data-name') === 'contentstyle') {
819
- bSectionStyleExists = true;
838
+ for (let i = 0; i < links.length; i++) {
839
+ if (links[i].getAttribute('data-name') === 'contentstyle') {
840
+ let classname = links[i].getAttribute('data-class'); //check if classname used in content
841
+
842
+ if (this.builder.wrapperEl.querySelector('.' + classname)) {
843
+ let elms = this.builder.wrapperEl.querySelectorAll('.' + classname);
844
+ elms.forEach(elm => {
845
+ dom$I.removeClass(elm, classname);
846
+ });
847
+ links[i].setAttribute('data-rel', '_del');
848
+ }
849
+ }
820
850
  }
821
- }
822
851
 
823
- if (!bSectionStyleExists) {
824
- //Cleanup (remove previous css that has prefix 'basetype-')
825
- let links = document.getElementsByTagName('link');
852
+ let dels = document.querySelectorAll('[data-rel="_del"]');
853
+ dels.forEach(item => {
854
+ item.parentNode.removeChild(item);
855
+ }); //Cleanup (remove previous css that has prefix 'basetype-')
856
+
857
+ links = document.getElementsByTagName('link');
826
858
 
827
859
  for (let i = 0; i < links.length; i++) {
828
860
  let src = links[i].href.toLowerCase();
@@ -832,7 +864,7 @@ class SideBar {
832
864
  }
833
865
  }
834
866
 
835
- let dels = document.querySelectorAll('[data-rel="_del"]');
867
+ dels = document.querySelectorAll('[data-rel="_del"]');
836
868
  dels.forEach(item => {
837
869
  item.parentNode.removeChild(item);
838
870
  }); //Add new page css
@@ -840,13 +872,95 @@ class SideBar {
840
872
  if (pageCss != '') {
841
873
  dom$I.appendHtml(document.head, '<link href="' + contentStylePath + pageCss + '" rel="stylesheet">');
842
874
  }
843
- } else {
844
- // this.className = className;
845
- // this.contentCss = contentCss;
846
- this.pageCss = pageCss;
847
- let modal = builderStuff.querySelector('.is-modal.applytypography');
848
- this.builder.showModal(modal);
849
- builderStuff.querySelectorAll('input[name="rdoApplyTypoStyle"]')[1].checked = true;
875
+ } else if (mode === 'container') {
876
+ let builderActive = document.querySelector('.builder-active');
877
+ if (!builderActive) return;
878
+ let box = dom$I.parentsHasClass(builderActive, 'is-box');
879
+ let classList = box.getAttribute('class').split(/\s+/);
880
+ classList.forEach(item => {
881
+ if (item.indexOf('type-') != -1) {
882
+ //Remove previous class that has prefix 'type-'
883
+ dom$I.removeClass(box, item);
884
+ }
885
+ }); //Add new class
886
+
887
+ if (className !== '') {
888
+ dom$I.addClass(box, className); //Add css
889
+
890
+ let exist = false;
891
+ let links = document.getElementsByTagName('link');
892
+
893
+ for (let i = 0; i < links.length; i++) {
894
+ let src = links[i].href.toLowerCase();
895
+ if (src.indexOf(contentCss.toLowerCase()) != -1) exist = true;
896
+ }
897
+
898
+ if (!exist) dom$I.appendHtml(document.head, '<link data-name="contentstyle" data-class="' + className + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
899
+ } //Cleanup unused
900
+
901
+
902
+ let links = document.getElementsByTagName('link');
903
+
904
+ for (let i = 0; i < links.length; i++) {
905
+ if (links[i].getAttribute('data-name') === 'contentstyle') {
906
+ let classname = links[i].getAttribute('data-class'); //check if classname used in content
907
+
908
+ if (!this.builder.wrapperEl.querySelector('.' + classname)) {
909
+ links[i].setAttribute('data-rel', '_del');
910
+ }
911
+ }
912
+ }
913
+
914
+ let dels = document.querySelectorAll('[data-rel="_del"]');
915
+ dels.forEach(item => {
916
+ item.parentNode.removeChild(item);
917
+ });
918
+ }
919
+ }
920
+
921
+ if (applyto === 'box') {
922
+ let activeBox = this.builder.activeBox;
923
+
924
+ if (activeBox) {
925
+ let classList = activeBox.getAttribute('class').split(/\s+/);
926
+ classList.forEach(item => {
927
+ if (item.indexOf('type-') != -1) {
928
+ //Remove previous class that has prefix 'type-'
929
+ dom$I.removeClass(activeBox, item);
930
+ }
931
+ }); //Add new class
932
+
933
+ if (className !== '') {
934
+ dom$I.addClass(activeBox, className); //Add css
935
+
936
+ let exist = false;
937
+ let links = document.getElementsByTagName('link');
938
+
939
+ for (let i = 0; i < links.length; i++) {
940
+ let src = links[i].href.toLowerCase();
941
+ if (src.indexOf(contentCss.toLowerCase()) != -1) exist = true;
942
+ }
943
+
944
+ if (!exist) dom$I.appendHtml(document.head, '<link data-name="contentstyle" data-class="' + className + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
945
+ } //Cleanup unused
946
+
947
+
948
+ let links = document.getElementsByTagName('link');
949
+
950
+ for (let i = 0; i < links.length; i++) {
951
+ if (links[i].getAttribute('data-name') === 'contentstyle') {
952
+ let classname = links[i].getAttribute('data-class'); //check if classname used in content
953
+
954
+ if (!this.builder.wrapperEl.querySelector('.' + classname)) {
955
+ links[i].setAttribute('data-rel', '_del');
956
+ }
957
+ }
958
+ }
959
+
960
+ let dels = document.querySelectorAll('[data-rel="_del"]');
961
+ dels.forEach(item => {
962
+ item.parentNode.removeChild(item);
963
+ });
850
964
  }
851
965
  } //Trigger Change event
852
966
 
@@ -1771,7 +1885,10 @@ class EditSection {
1771
1885
  this.builder = builder;
1772
1886
  const builderStuff = this.builder.builderStuff;
1773
1887
  this.builderStuff = builderStuff;
1774
- let html = '<div class="is-modal delsectionconfirm">' + '<div style="max-width: 400px;">' + '<p style="margin-bottom: 25px;text-align:center;">' + out('Are you sure you want to delete this section?') + '</p>' + '<button title="' + out('Delete') + '" class="input-ok classic">' + out('Delete') + '</button>' + '</div>' + '</div>' + '' + '<div class="is-modal editsection">' + '<div class="is-modal-content" style="max-width: 270px;padding:0;">' + '<div class="is-modal-bar is-draggable">' + out('Section Settings') + '</div>' + '<div style="padding:30px 20px 20px;">' + '<div style="display:flex;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Move Section') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Move Up') + '" class="cmd-section-up" style="">&#8593;</button>' + '<button title="' + out('Move Down') + '" class="cmd-section-down" style="border-left:none;">&#8595;</button>' + '<button title="' + out('Move to Top') + '" class="cmd-section-top" style="border-left:none;"><span style="transform:rotate(90deg);position:absolute;top:13px;left:15px;">&#8676;</span></button>' + '<button title="' + out('Move to Bottom') + '" class="cmd-section-bottom" style="border-left:none;"><span style="transform:rotate(90deg);position:absolute;top:13px;left:15px;">&#8677;</span></button>' + '</div>' + '</div>' + '<div style="display:flex;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Height') + ':</div>' + '<div style="display:flex">' + '<button class="cmd-section-height" data-value="0">Auto</button>' + '<button class="cmd-section-height" data-value="20" style="border-left:none;">20%</button>' + '<button class="cmd-section-height" data-value="30" style="border-left:none;">30%</button>' + '<button class="cmd-section-height" data-value="40" style="border-left:none;">40%</button>' + '</div>' + '<div style="display:flex">' + '<button class="cmd-section-height" data-value="50" style="border-top:none;">50%</button>' + '<button class="cmd-section-height" data-value="60" style="border-left:none;border-top:none;">60%</button>' + '<button class="cmd-section-height" data-value="75" style="border-left:none;border-top:none;">75%</button>' + '<button class="cmd-section-height" data-value="100" style="border-left:none;border-top:none;">100%</button>' + '</div>' + '</div>' + '<div style="display:flex;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + '<label for="chkScrollIcon" style="margin:0;"><input id="chkScrollIcon" type="checkbox" /> ' + out('Scroll Icon') + '</label>' + '</div>' + '<div style="display:flex;padding-top:10px;">' + '<button title="' + out('Light') + '" class="cmd-section-scroll" data-value="light" style="min-width:80px;">' + out('Light') + '</button>' + '<button title="' + out('Dark') + '" class="cmd-section-scroll" data-value="dark" style="border-left:none;min-width:80px;">' + out('Dark') + '</button>' + '</div>' + '</div>' + '</div>' + '</div>' + '</div>' + '' + '<div class="is-modal editmodule">' + '<div style="max-width:900px;height:570px;padding:0;box-sizing:border-box;position:relative;">' + '<div class="is-modal-bar is-draggable" style="position: absolute;top: 0;left: 0;width: 100%;z-index:1;">' + out('Module Settings') + '</div>' + '<iframe style="position: absolute;top: 0;left: 0;width:100%;height:100%;border:none;border-bottom:60px solid transparent;border-top:40px solid transparent;margin:0;box-sizing:border-box;" src="about:blank"></iframe>' + '<input id="hidModuleCode" type="hidden" />' + '<input id="hidModuleSettings" type="hidden" />' + '<button class="input-ok classic" style="height:60px;position:absolute;left:0;bottom:0;">' + out('Ok') + '</button>' + '</div>' + '</div>' + '' + '<div class="is-modal editcustomcode">' + '<div style="max-width:900px;height:570px;padding:0;box-sizing:border-box;position:relative;">' + '<div class="is-modal-bar is-draggable" style="position: absolute;top: 0;left: 0;width: 100%;z-index:1;">' + out('Custom Code (Javascript Allowed)') + '</div>' + '<textarea id="txtBoxCustomCode" class="inptxt" style="background: #fff;position: absolute;top: 0;left: 0;width:100%;height:100%;border:none;border-bottom:60px solid transparent;border-top:40px solid transparent;box-sizing:border-box;"></textarea>' + '<input id="hidBoxCustomCode" type="hidden" />' + '<button class="cell-html-larger" style="width:35px;height:35px;position:absolute;right:0;top:0;background:transparent;z-index:2;"><svg class="is-icon-flex" style="width:19px;height:19px;fill:rgb(170, 170, 170);"><use xlink:href="#ion-arrow-expand"></use></svg></button>' + '<button class="input-ok classic" style="height:60px;position:absolute;left:0;bottom:0;">' + out('Ok') + '</button>' + '</div>' + '</div>' + '';
1888
+ let html = '<div class="is-modal delsectionconfirm">' + '<div style="max-width: 400px;">' + '<p style="margin-bottom: 25px;text-align:center;">' + out('Are you sure you want to delete this section?') + '</p>' + '<button title="' + out('Delete') + '" class="input-ok classic">' + out('Delete') + '</button>' + '</div>' + '</div>' + '' + '<div class="is-modal editsection">' + '<div class="is-modal-content" style="max-width:292px;padding:0;">' + '<div class="is-modal-bar is-draggable">' + out('Section Settings') + '</div>' + '<div style="padding:30px 20px 20px;">' + '<div style="display:flex;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Move Section') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Move Up') + '" class="cmd-section-up" style="">&#8593;</button>' + '<button title="' + out('Move Down') + '" class="cmd-section-down" style="border-left:none;">&#8595;</button>' + '<button title="' + out('Move to Top') + '" class="cmd-section-top" style="border-left:none;"><span style="transform:rotate(90deg);position:absolute;top:13px;left:15px;">&#8676;</span></button>' + '<button title="' + out('Move to Bottom') + '" class="cmd-section-bottom" style="border-left:none;"><span style="transform:rotate(90deg);position:absolute;top:13px;left:15px;">&#8677;</span></button>' + '</div>' + '</div>' + '<div style="display:flex;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Height') + ':</div>' + '<div style="display:flex">' +
1889
+ /*
1890
+ '<button title="Auto" class="cmd-section-height" data-value="0">Auto</button>' + */
1891
+ '<button title="20%" class="cmd-section-height" data-value="20" style="border-left:none;">20%</button>' + '<button title="25%" class="cmd-section-height" data-value="25" style="border-left:none;">25%</button>' + '<button title="30%" class="cmd-section-height" data-value="30" style="border-left:none;">30%</button>' + '<button title="40%" class="cmd-section-height" data-value="40" style="border-left:none;">40%</button>' + '<button title="50%" class="cmd-section-height" data-value="50" style="border-left:none;">50%</button>' + '</div>' + '<div style="display:flex">' + '<button title="60%" class="cmd-section-height" data-value="60" style="border-left:none;border-top:none;">60%</button>' + '<button title="70%" class="cmd-section-height" data-value="70" style="border-left:none;border-top:none;">70%</button>' + '<button title="75%" class="cmd-section-height" data-value="75" style="border-left:none;border-top:none;">75%</button>' + '<button title="80%" class="cmd-section-height" data-value="80" style="border-left:none;border-top:none;">80%</button>' + '<button title="100%" class="cmd-section-height" data-value="100" style="border-left:none;border-top:none;">100%</button>' + '</div>' + '</div>' + '<div style="display:flex;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Spacing') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('xs') + '" class="cmd-box-spacing" data-value="default" style="border-left:none;">' + out('xs') + '</button>' + '<button title="' + out('sm') + '" class="cmd-box-spacing" data-value="sm" style="border-left:none;">' + out('sm') + '</button>' + '<button title="' + out('m') + '" class="cmd-box-spacing" data-value="m" style="border-left:none;">' + out('m') + '</button>' + '<button title="' + out('lg') + '" class="cmd-box-spacing" data-value="lg" style="border-left:none;">' + out('lg') + '</button>' + '<button title="' + out('Clear') + '" class="cmd-box-spacing" data-value="none" style="border-left:none;"><svg class="is-icon-flex" style="width:11px;height:11px;"><use xlink:href="#icon-clean"></use></svg></button>' + '</div>' + '</div>' + '<div style="display:none;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + '<label for="chkScrollIcon" style="margin:0;"><input id="chkScrollIcon" type="checkbox" /> ' + out('Scroll Icon') + '</label>' + '</div>' + '<div style="display:flex;padding-top:10px;">' + '<button title="' + out('Light') + '" class="cmd-section-scroll" data-value="light" style="min-width:80px;">' + out('Light') + '</button>' + '<button title="' + out('Dark') + '" class="cmd-section-scroll" data-value="dark" style="border-left:none;min-width:80px;">' + out('Dark') + '</button>' + '</div>' + '</div>' + '<div style="display:flex;flex-direction:column;padding-bottom:3px;">' + '<div style="padding-top:20px;padding-bottom:3px;">' + out('Scroll Button') + ':</div>' + '<div style="display:flex;flex-flow:wrap;">' + '<button class="cmd-scroll-preset" data-command="1" title="' + out('Apply') + '" type="button">1</button>' + '<button class="cmd-scroll-preset" data-command="2" title="' + out('Apply') + '" type="button">2</button>' + '<button class="cmd-scroll-preset" data-command="3" title="' + out('Apply') + '" type="button">3</button>' + '<button class="cmd-scroll-preset" data-command="4" title="' + out('Apply') + '" type="button">4</button>' + '<button class="cmd-scroll-preset" data-command="5" title="' + out('Apply') + '" type="button">5</button>' + '<button class="cmd-scroll-preset" data-command="6" title="' + out('Apply') + '" type="button">6</button>' + '<button class="cmd-scroll-preset" data-command="7" title="' + out('Apply') + '" type="button">7</button>' + '<button class="cmd-scroll-preset" data-command="8" title="' + out('Apply') + '" type="button">8</button>' + '<button class="cmd-scroll-preset" data-command="9" title="' + out('Apply') + '" type="button">9</button>' + '<button class="cmd-scroll-preset" data-command="10" title="' + out('Apply') + '" type="button">10</button>' + '<button class="cmd-scroll-preset" data-command="11" title="' + out('Apply') + '" type="button">11</button>' + '<button class="cmd-scroll-preset" data-command="12" title="' + out('Apply') + '" type="button">12</button>' + '<button class="cmd-scroll-preset" data-command="13" title="' + out('Apply') + '" type="button">13</button>' + '<button class="cmd-scroll-preset" data-command="14" title="' + out('Apply') + '" type="button">14</button>' + '<button class="cmd-scroll-preset" data-command="" title="' + out('Remove') + '" type="button"><svg class="is-icon-flex" style="width:10px;height:10px;"><use xlink:href="#icon-clean"></use></svg></button>' + '</div>' + '</div>' + '</div>' + '</div>' + '</div>' + '' + '<div class="is-modal editmodule">' + '<div style="max-width:900px;height:570px;padding:0;box-sizing:border-box;position:relative;">' + '<div class="is-modal-bar is-draggable" style="position: absolute;top: 0;left: 0;width: 100%;z-index:1;">' + out('Module Settings') + '</div>' + '<iframe style="position: absolute;top: 0;left: 0;width:100%;height:100%;border:none;border-bottom:60px solid transparent;border-top:40px solid transparent;margin:0;box-sizing:border-box;" src="about:blank"></iframe>' + '<input id="hidModuleCode" type="hidden" />' + '<input id="hidModuleSettings" type="hidden" />' + '<button class="input-ok classic" style="height:60px;position:absolute;left:0;bottom:0;">' + out('Ok') + '</button>' + '</div>' + '</div>' + '' + '<div class="is-modal editcustomcode">' + '<div style="max-width:900px;height:570px;padding:0;box-sizing:border-box;position:relative;">' + '<div class="is-modal-bar is-draggable" style="position: absolute;top: 0;left: 0;width: 100%;z-index:1;">' + out('Custom Code (Javascript Allowed)') + '</div>' + '<textarea id="txtBoxCustomCode" class="inptxt" style="background: #fff;position: absolute;top: 0;left: 0;width:100%;height:100%;border:none;border-bottom:60px solid transparent;border-top:40px solid transparent;box-sizing:border-box;"></textarea>' + '<input id="hidBoxCustomCode" type="hidden" />' + '<button class="cell-html-larger" style="width:35px;height:35px;position:absolute;right:0;top:0;background:transparent;z-index:2;"><svg class="is-icon-flex" style="width:19px;height:19px;fill:rgb(170, 170, 170);"><use xlink:href="#ion-arrow-expand"></use></svg></button>' + '<button class="input-ok classic" style="height:60px;position:absolute;left:0;bottom:0;">' + out('Ok') + '</button>' + '</div>' + '</div>' + '';
1775
1892
  dom$H.appendHtml(builderStuff, html);
1776
1893
  let modalEditSection = builderStuff.querySelector('.is-modal.editsection');
1777
1894
  this.modalEditSection = modalEditSection;
@@ -1827,6 +1944,16 @@ class EditSection {
1827
1944
  this.builder.settings.onChange();
1828
1945
  });
1829
1946
  });
1947
+ const btnBoxSpacing = modalEditSection.querySelectorAll('.cmd-box-spacing');
1948
+ btnBoxSpacing.forEach(btn => {
1949
+ btn.addEventListener('click', () => {
1950
+ this.builder.editor.saveForUndo();
1951
+ let val = btn.getAttribute('data-value');
1952
+ this.boxSpacing(val); //Trigger Change event
1953
+
1954
+ this.builder.settings.onChange();
1955
+ });
1956
+ });
1830
1957
  const btnScrollIconStyle = modalEditSection.querySelectorAll('.cmd-section-scroll');
1831
1958
  btnScrollIconStyle.forEach(btn => {
1832
1959
  btn.addEventListener('click', () => {
@@ -1838,6 +1965,16 @@ class EditSection {
1838
1965
  this.builder.settings.onChange();
1839
1966
  });
1840
1967
  });
1968
+ const btnScrollPreset = modalEditSection.querySelectorAll('.cmd-scroll-preset');
1969
+ btnScrollPreset.forEach(btn => {
1970
+ btn.addEventListener('click', () => {
1971
+ this.builder.editor.saveForUndo();
1972
+ let s = btn.getAttribute('data-command');
1973
+ this.sectionScrollPreset(s); //Trigger Change event
1974
+
1975
+ this.builder.settings.onChange();
1976
+ });
1977
+ });
1841
1978
  const chkScrollIcon = modalEditSection.querySelector('#chkScrollIcon');
1842
1979
  chkScrollIcon.addEventListener('click', () => {
1843
1980
  this.builder.editor.saveForUndo();
@@ -1928,11 +2065,14 @@ class EditSection {
1928
2065
  activeSection.style.height = '';
1929
2066
  dom$H.removeClass(activeSection, 'is-section-auto');
1930
2067
  dom$H.removeClass(activeSection, 'is-section-20');
2068
+ dom$H.removeClass(activeSection, 'is-section-25');
1931
2069
  dom$H.removeClass(activeSection, 'is-section-30');
1932
2070
  dom$H.removeClass(activeSection, 'is-section-40');
1933
2071
  dom$H.removeClass(activeSection, 'is-section-50');
1934
2072
  dom$H.removeClass(activeSection, 'is-section-60');
2073
+ dom$H.removeClass(activeSection, 'is-section-70');
1935
2074
  dom$H.removeClass(activeSection, 'is-section-75');
2075
+ dom$H.removeClass(activeSection, 'is-section-80');
1936
2076
  dom$H.removeClass(activeSection, 'is-section-100');
1937
2077
 
1938
2078
  if (n === '0') {
@@ -1946,6 +2086,37 @@ class EditSection {
1946
2086
  this.builder.scrollTo(activeSection);
1947
2087
  }
1948
2088
 
2089
+ boxSpacing(s) {
2090
+ const activeSection = this.builder.activeSection;
2091
+
2092
+ if (s == 'none') {
2093
+ dom$H.removeClass(activeSection, 'box-space');
2094
+ dom$H.removeClass(activeSection, 'box-space-sm');
2095
+ dom$H.removeClass(activeSection, 'box-space-m');
2096
+ dom$H.removeClass(activeSection, 'box-space-lg');
2097
+ } else {
2098
+ dom$H.addClass(activeSection, 'box-space');
2099
+ }
2100
+
2101
+ if (s === 'sm') {
2102
+ dom$H.removeClass(activeSection, 'box-space-m');
2103
+ dom$H.removeClass(activeSection, 'box-space-lg');
2104
+ dom$H.addClass(activeSection, 'box-space-sm');
2105
+ } else if (s == 'm') {
2106
+ dom$H.removeClass(activeSection, 'box-space-sm');
2107
+ dom$H.removeClass(activeSection, 'box-space-lg');
2108
+ dom$H.addClass(activeSection, 'box-space-m');
2109
+ } else if (s == 'lg') {
2110
+ dom$H.removeClass(activeSection, 'box-space-sm');
2111
+ dom$H.removeClass(activeSection, 'box-space-m');
2112
+ dom$H.addClass(activeSection, 'box-space-lg');
2113
+ } else if (s == 'default') {
2114
+ dom$H.removeClass(activeSection, 'box-space-sm');
2115
+ dom$H.removeClass(activeSection, 'box-space-m');
2116
+ dom$H.removeClass(activeSection, 'box-space-lg');
2117
+ }
2118
+ }
2119
+
1949
2120
  sectionUseScroll() {
1950
2121
  const activeSection = this.builder.activeSection;
1951
2122
  const modalEditSection = this.modalEditSection;
@@ -1979,6 +2150,313 @@ class EditSection {
1979
2150
  }
1980
2151
  }
1981
2152
 
2153
+ sectionScrollPreset(s) {
2154
+ const section = this.builder.activeSection;
2155
+ const scroll = section.querySelector('.is-arrow-down');
2156
+ if (scroll) scroll.parentNode.removeChild(scroll);
2157
+
2158
+ if (s === '1') {
2159
+ //light
2160
+ let color = '#fff';
2161
+ let bgcolor = 'rgb(173 173 173 / 26%)';
2162
+ let svgfill = '';
2163
+
2164
+ {
2165
+ svgfill = `fill:${color};`;
2166
+ }
2167
+
2168
+ let html = `<div data-target="svgfill" class="is-arrow-down bounce" data-scroll-preset="10" style="width: 30px;margin-left: -15px;height: 40px;">
2169
+ <a href="#" style="border-radius: 5px;background:${bgcolor};box-shadow:0px 5px 5px 0px rgba(0, 0, 0, 0.03);">
2170
+ <svg style="width:17px;height:17px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2171
+ <g>
2172
+ <path d="M277.375 85v259.704l119.702-119.702L427 256 256 427 85 256l29.924-29.922 119.701 118.626V85h42.75z"></path>
2173
+ </g>
2174
+ </svg>
2175
+ </a>
2176
+ </div>`;
2177
+ section.insertAdjacentHTML('beforeend', html);
2178
+ }
2179
+
2180
+ if (s === '2') {
2181
+ //dark
2182
+ let color = '#000';
2183
+ let bgcolor = 'rgb(221 221 221 / 30%)';
2184
+ let svgfill = '';
2185
+
2186
+ {
2187
+ svgfill = `fill:${color};`;
2188
+ }
2189
+
2190
+ let html = `<div data-target="svgfill" class="is-arrow-down bounce" data-scroll-preset="10" style="width: 30px;margin-left: -15px;height: 40px;">
2191
+ <a href="#" style="border-radius: 5px;background:${bgcolor};box-shadow:0px 5px 5px 0px rgba(0, 0, 0, 0.03);">
2192
+ <svg style="width:17px;height:17px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2193
+ <g>
2194
+ <path d="M277.375 85v259.704l119.702-119.702L427 256 256 427 85 256l29.924-29.922 119.701 118.626V85h42.75z"></path>
2195
+ </g>
2196
+ </svg>
2197
+ </a>
2198
+ </div>`;
2199
+ section.insertAdjacentHTML('beforeend', html);
2200
+ }
2201
+
2202
+ if (s === '3') {
2203
+ //light
2204
+ let color = '#fff';
2205
+ let bgcolor = 'rgba(193, 193, 193, 0.18)';
2206
+ let svgfill = '';
2207
+
2208
+ {
2209
+ svgfill = `fill:${color};`;
2210
+ }
2211
+
2212
+ let html = `<div data-target="svgfill" class="is-arrow-down bounce" data-scroll-preset="5">
2213
+ <a href="#" style="background:${bgcolor};border-radius:500px">
2214
+ <svg style="width:22px;height:22px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2215
+ <g>
2216
+ <path d="M396.6 160l19.4 20.7L256 352 96 180.7l19.3-20.7L256 310.5z"></path>
2217
+ </g>
2218
+ </svg>
2219
+ </a>
2220
+ </div>`;
2221
+ section.insertAdjacentHTML('beforeend', html);
2222
+ }
2223
+
2224
+ if (s === '4') {
2225
+ //dark
2226
+ let color = '#000';
2227
+ let bgcolor = 'rgba(193, 193, 193, 0.18)';
2228
+ let svgfill = '';
2229
+
2230
+ {
2231
+ svgfill = `fill:${color};`;
2232
+ }
2233
+
2234
+ let html = `<div data-target="svgfill" class="is-arrow-down bounce" data-scroll-preset="5">
2235
+ <a href="#" style="background:${bgcolor};border-radius:500px">
2236
+ <svg style="width:22px;height:22px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2237
+ <g>
2238
+ <path d="M396.6 160l19.4 20.7L256 352 96 180.7l19.3-20.7L256 310.5z"></path>
2239
+ </g>
2240
+ </svg>
2241
+ </a>
2242
+ </div>`;
2243
+ section.insertAdjacentHTML('beforeend', html);
2244
+ }
2245
+
2246
+ if (s === '5') {
2247
+ let color = '#fff';
2248
+ let svgfill = '';
2249
+ svgfill = `fill:${color};`;
2250
+ let html = `<div data-target="svgfill" class="is-arrow-down bounce" data-scroll-preset="1">
2251
+ <a href="#" style="background:none;border-radius:unset;">
2252
+ <svg style="width:30px;height:30px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2253
+ <g>
2254
+ <path d="M349.7 322.2c-3.1-3.1-8-3-11.3 0L264 388.6V104c0-4.4-3.6-8-8-8s-8 3.6-8 8v284.6l-74.4-66.3c-3.4-2.9-8.1-3.2-11.2-.1-3.1 3.1-3.3 8.5-.1 11.4 0 0 87 79.2 88 80s2.8 2.4 5.7 2.4 4.9-1.6 5.7-2.4 88-80 88-80c1.5-1.5 2.3-3.6 2.3-5.7s-.8-4.1-2.3-5.7z"></path>
2255
+ </g>
2256
+ </svg>
2257
+ </a>
2258
+ </div>`;
2259
+ section.insertAdjacentHTML('beforeend', html);
2260
+ }
2261
+
2262
+ if (s === '6') {
2263
+ let color = '#000';
2264
+ let svgfill = '';
2265
+ svgfill = `fill:${color};`;
2266
+ let html = `<div data-target="svgfill" class="is-arrow-down bounce" data-scroll-preset="1">
2267
+ <a href="#" style="background:none;border-radius:unset;">
2268
+ <svg style="width:30px;height:30px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2269
+ <g>
2270
+ <path d="M349.7 322.2c-3.1-3.1-8-3-11.3 0L264 388.6V104c0-4.4-3.6-8-8-8s-8 3.6-8 8v284.6l-74.4-66.3c-3.4-2.9-8.1-3.2-11.2-.1-3.1 3.1-3.3 8.5-.1 11.4 0 0 87 79.2 88 80s2.8 2.4 5.7 2.4 4.9-1.6 5.7-2.4 88-80 88-80c1.5-1.5 2.3-3.6 2.3-5.7s-.8-4.1-2.3-5.7z"></path>
2271
+ </g>
2272
+ </svg>
2273
+ </a>
2274
+ </div>`;
2275
+ section.insertAdjacentHTML('beforeend', html);
2276
+ }
2277
+
2278
+ if (s === '7') {
2279
+ let color = '#fff';
2280
+ let border = 'border:#333 2px solid;';
2281
+ let svgfill = '';
2282
+
2283
+ {
2284
+ border = `border:${color} 2px solid;`;
2285
+ svgfill = `fill:${color};`;
2286
+ }
2287
+
2288
+ let html = `<div data-target="border,svgfill" class="is-arrow-down bounce" data-scroll-preset="2" style="width: 30px;margin-left: -15px;height: 40px;">
2289
+ <a href="#" style="${border}border-radius: 5px;background:none;">
2290
+ <svg style="width:17px;height:17px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2291
+ <g>
2292
+ <path d="M277.375 85v259.704l119.702-119.702L427 256 256 427 85 256l29.924-29.922 119.701 118.626V85h42.75z"></path>
2293
+ </g>
2294
+ </svg>
2295
+ </a>
2296
+ </div>`;
2297
+ section.insertAdjacentHTML('beforeend', html);
2298
+ }
2299
+
2300
+ if (s === '8') {
2301
+ let color = '#000';
2302
+ let border = 'border:#333 2px solid;';
2303
+ let svgfill = '';
2304
+
2305
+ {
2306
+ border = `border:${color} 2px solid;`;
2307
+ svgfill = `fill:${color};`;
2308
+ }
2309
+
2310
+ let html = `<div data-target="border,svgfill" class="is-arrow-down bounce" data-scroll-preset="2" style="width: 30px;margin-left: -15px;height: 40px;">
2311
+ <a href="#" style="${border}border-radius: 5px;background:none;">
2312
+ <svg style="width:17px;height:17px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2313
+ <g>
2314
+ <path d="M277.375 85v259.704l119.702-119.702L427 256 256 427 85 256l29.924-29.922 119.701 118.626V85h42.75z"></path>
2315
+ </g>
2316
+ </svg>
2317
+ </a>
2318
+ </div>`;
2319
+ section.insertAdjacentHTML('beforeend', html);
2320
+ }
2321
+
2322
+ if (s === '9') {
2323
+ let color = '#fff';
2324
+ let svgfill = '';
2325
+
2326
+ {
2327
+ svgfill = `fill:${color};`;
2328
+ }
2329
+
2330
+ let html = `<div data-target="svgfill" class="is-arrow-down bounce" data-scroll-preset="3">
2331
+ <a href="#" style="background:none;border-radius:unset;">
2332
+ <svg style="width:30px;height:30px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2333
+ <g>
2334
+ <path d="M396.6 160l19.4 20.7L256 352 96 180.7l19.3-20.7L256 310.5z"></path>
2335
+ </g>
2336
+ </svg>
2337
+ </a>
2338
+ </div>`;
2339
+ section.insertAdjacentHTML('beforeend', html);
2340
+ }
2341
+
2342
+ if (s === '10') {
2343
+ let color = '#000';
2344
+ let svgfill = '';
2345
+
2346
+ {
2347
+ svgfill = `fill:${color};`;
2348
+ }
2349
+
2350
+ let html = `<div data-target="svgfill" class="is-arrow-down bounce" data-scroll-preset="3">
2351
+ <a href="#" style="background:none;border-radius:unset;">
2352
+ <svg style="width:30px;height:30px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2353
+ <g>
2354
+ <path d="M396.6 160l19.4 20.7L256 352 96 180.7l19.3-20.7L256 310.5z"></path>
2355
+ </g>
2356
+ </svg>
2357
+ </a>
2358
+ </div>`;
2359
+ section.insertAdjacentHTML('beforeend', html);
2360
+ }
2361
+
2362
+ if (s === '11') {
2363
+ let color = '#fff';
2364
+ let svgfill = '';
2365
+
2366
+ {
2367
+ svgfill = `fill:${color};`;
2368
+ }
2369
+
2370
+ let html = `<div data-target="svgfill" class="is-arrow-down bounce" data-scroll-preset="4">
2371
+ <a href="#" style="background:none;border-radius:unset;">
2372
+ <svg style="width:60px;height:60px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2373
+ <g>
2374
+ <path d="M396.6 160l19.4 20.7L256 352 96 180.7l19.3-20.7L256 310.5z"></path>
2375
+ </g>
2376
+ </svg>
2377
+ </a>
2378
+ </div>`;
2379
+ section.insertAdjacentHTML('beforeend', html);
2380
+ }
2381
+
2382
+ if (s === '12') {
2383
+ let color = '#000';
2384
+ let svgfill = '';
2385
+
2386
+ {
2387
+ svgfill = `fill:${color};`;
2388
+ }
2389
+
2390
+ let html = `<div data-target="svgfill" class="is-arrow-down bounce" data-scroll-preset="4">
2391
+ <a href="#" style="background:none;border-radius:unset;">
2392
+ <svg style="width:60px;height:60px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2393
+ <g>
2394
+ <path d="M396.6 160l19.4 20.7L256 352 96 180.7l19.3-20.7L256 310.5z"></path>
2395
+ </g>
2396
+ </svg>
2397
+ </a>
2398
+ </div>`;
2399
+ section.insertAdjacentHTML('beforeend', html);
2400
+ }
2401
+
2402
+ if (s === '13') {
2403
+ //light
2404
+ let color = '#fff';
2405
+ let border = 'border:#111 2px solid;';
2406
+ let svgfill = '';
2407
+
2408
+ {
2409
+ border = `border:${color} 2px solid;`;
2410
+ svgfill = `fill:${color};`;
2411
+ }
2412
+
2413
+ let html = `<div data-target="border,svgfill" class="is-arrow-down bounce" data-scroll-preset="7" style="width: 40px;margin-left: -20px;height: 35px;">
2414
+ <a href="#" style="background:none;border-radius:unset;${border};">
2415
+ <svg style="width:25px;height:25px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2416
+ <g>
2417
+ <path d="M396.6 160l19.4 20.7L256 352 96 180.7l19.3-20.7L256 310.5z"></path>
2418
+ </g>
2419
+ </svg>
2420
+ </a>
2421
+ </div>`;
2422
+ section.insertAdjacentHTML('beforeend', html);
2423
+ }
2424
+
2425
+ if (s === '14') {
2426
+ //dark
2427
+ let color = '#000';
2428
+ let border = 'border:#111 2px solid;';
2429
+ let svgfill = '';
2430
+
2431
+ {
2432
+ border = `border:${color} 2px solid;`;
2433
+ svgfill = `fill:${color};`;
2434
+ }
2435
+
2436
+ let html = `<div data-target="border,svgfill" class="is-arrow-down bounce" data-scroll-preset="7" style="width: 40px;margin-left: -20px;height: 35px;">
2437
+ <a href="#" style="background:none;border-radius:unset;${border}">
2438
+ <svg style="width:25px;height:25px;${svgfill}" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
2439
+ <g>
2440
+ <path d="M396.6 160l19.4 20.7L256 352 96 180.7l19.3-20.7L256 310.5z"></path>
2441
+ </g>
2442
+ </svg>
2443
+ </a>
2444
+ </div>`;
2445
+ section.insertAdjacentHTML('beforeend', html);
2446
+ } // let refSection = section.querySelector('.is-section-tool');
2447
+ // refSection.insertAdjacentHTML('beforebegin', html);
2448
+
2449
+
2450
+ const scrollButton = section.querySelector('.is-arrow-down a');
2451
+ if (scrollButton) scrollButton.addEventListener('click', e => {
2452
+ // section.nextElementSibling.scrollIntoView({ behavior: 'smooth' });
2453
+ this.builder.scrollTo(section.nextElementSibling);
2454
+ e.preventDefault();
2455
+ e.stopImmediatePropagation();
2456
+ return false;
2457
+ });
2458
+ }
2459
+
1982
2460
  }
1983
2461
 
1984
2462
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
@@ -7189,7 +7667,7 @@ class EditBox {
7189
7667
  this.builder = builder;
7190
7668
  this.builderStuff = this.builder.builderStuff;
7191
7669
  const builderStuff = this.builderStuff;
7192
- let html = '' + '<div id="divBoxTool">' + '<form id="form-upload-cover" data-tooltip-top data-title="' + out('Cover') + '" target="frame-upload-cover" method="post" action="' + this.builder.coverImageHandler + '" enctype="multipart/form-data" style="position:relative;width:40px;height:40px;display:inline-block;float:left;background: rgb(90, 156, 38);">' + '<div style="width:40px;height:40px;overflow:hidden;">' + '<div style="position:absolute;width:100%;height:100%;"><svg class="is-icon-flex" style="position: absolute;top: 12px;left: 12px;fill:rgb(255,255,255);"><use xlink:href="#ion-image"></use></svg></div>' + '<input type="file" title="' + out('Cover') + '" id="fileCover" name="fileCover" accept="image/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;"/>' + '</div>' + '<input id="hidcustomval" name="hidcustomval" type="hidden" value="" />' + '<iframe id="frame-upload-cover" name="frame-upload-cover" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>' + '</form>' + '<button id="btnEditBox" data-tooltip-top data-title="' + out('Box Settings') + '" title="' + out('Box Settings') + '"><svg class="is-icon-flex"><use xlink:href="#ion-wrench"></use></svg></button>' + '<button id="btnEditModule" data-tooltip-top data-title="' + out('Module Settings') + '" title="' + out('Module Settings') + '"><svg class="is-icon-flex"><use xlink:href="#ion-ios-gear"></use></svg></button>' + '</div>' + '' + '<div class="is-modal editmodule">' + '<div style="max-width:900px;height:570px;padding:0;box-sizing:border-box;position:relative;">' + '<div class="is-modal-bar is-draggable" style="position: absolute;top: 0;left: 0;width: 100%;z-index:1;">' + out('Module Settings') + '</div>' + '<iframe style="position: absolute;top: 0;left: 0;width:100%;height:100%;border:none;border-bottom:60px solid transparent;border-top:40px solid transparent;margin:0;box-sizing:border-box;" src="about:blank"></iframe>' + '<input id="hidModuleCode" type="hidden" />' + '<input id="hidModuleSettings" type="hidden" />' + '<button class="input-ok classic" style="height:60px;position:absolute;left:0;bottom:0;">' + out('Ok') + '</button>' + '</div>' + '</div>' + '' + '<div class="is-modal editcustomcode">' + '<div style="max-width:900px;height:570px;padding:0;box-sizing:border-box;position:relative;">' + '<div class="is-modal-bar is-draggable" style="position: absolute;top: 0;left: 0;width: 100%;z-index:1;">' + out('Custom Code (Javascript Allowed)') + '</div>' + '<textarea id="txtBoxCustomCode" class="inptxt" style="background: #fff;position: absolute;top: 0;left: 0;width:100%;height:100%;border:none;border-bottom:60px solid transparent;border-top:40px solid transparent;box-sizing:border-box;"></textarea>' + '<input id="hidBoxCustomCode" type="hidden" />' + '<button class="cell-html-larger" style="width:35px;height:35px;position:absolute;right:0;top:0;background:transparent;z-index:2;"><svg class="is-icon-flex" style="width:19px;height:19px;fill:rgb(170, 170, 170);"><use xlink:href="#ion-arrow-expand"></use></svg></button>' + '<button class="input-ok classic" style="height:60px;position:absolute;left:0;bottom:0;">' + out('Ok') + '</button>' + '</div>' + '</div>' + '<div class="is-modal editbox">' + '<div class="is-modal-content" style="max-width:380px;min-height:300px;padding:0">' + '<div class="is-modal-bar is-draggable">' + out('Box Settings') + '</div>' + '<div class="is-tabs clearfix" style="padding-top:37px;">' + '<a id="tabBoxGeneral" href="" data-content="divBoxGeneral" class="active">' + out('General') + '</a>' + '<a id="tabBoxContentContainer" href="" data-content="divBoxContentContainer">' + out('Content') + '</a>' + '<a id="tabBoxContentText" href="" data-content="divBoxContentText">' + out('Text') + '</a>' + '<a id="tabBoxImage" href="" data-content="divBoxImage">' + out('Image') + '</a>' + '<a id="tabBoxAnimate" href="" data-content="divBoxAnimate">' + out('Animate') + '</a>' + '<a id="tabBoxClick" href="" data-content="divBoxClick">' + out('On Click') + '</a>' + '</div>' + '<div id="divBoxGeneral" class="is-tab-content" data-group="boxsettings" style="display:flex;padding-top:0">' + '<div id="divBoxSize">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Box Size') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Decrease') + '" class="cmd-box-smaller" style="width:40px;">-</button>' + '<button title="' + out('Increase') + '" class="cmd-box-larger" style="width:40px;border-left:none">+</button>' + '<br style="clear:both">' + '</div>' + '</div>' + '<div id="divContentSize">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Content Size') + ':</div>' + '<div style="display: flex;flex-direction: row;flex-wrap: wrap;">' + '<input class="inp-box-size" type="text" style="width:80px;height:35px;text-align:center;font-size:12px;" />' + '<button class="cmd-box-size" data-value="380" style="width:40px;border-left:none">380</button>' + '<button class="cmd-box-size" data-value="440" style="width:40px;border-left:none">440</button>' + '<button class="cmd-box-size" data-value="500" style="width:40px;border-left:none">500</button>' + '<button class="cmd-box-size" data-value="640" style="width:40px;border-left:none">640</button>' + '<button class="cmd-box-size" data-value="760" style="width:40px;border-left:none">760</button>' + '<button class="cmd-box-size" data-value="800" style="width:40px;border-top:none">800</button>' + '<button class="cmd-box-size" data-value="860" style="width:40px;border-top:none">860</button>' + '<button class="cmd-box-size" data-value="940" style="width:40px;border-top:none">940</button>' + '<button class="cmd-box-size" data-value="1020" style="width:40px;border-top:none;border-left:none">1020</button>' + '<button class="cmd-box-size" data-value="1100" style="width:40px;border-top:none;border-left:none">1100</button>' + '<button class="cmd-box-size" data-value="1200" style="width:40px;border-top:none;border-left:none">1200</button>' + '<button class="cmd-box-size" data-value="1400" style="width:40px;border-top:none;border-left:none">1400</button>' + '<button title="' + out('Decrease') + '" class="cmd-box-size" data-value="-" style="width:40px;border-top:none;border-left:none">-</button>' + '<button title="' + out('Increase') + '"class="cmd-box-size" data-value="+" style="width:40px;border-top:none;border-left:none">+</button>' + '<br style="clear:both">' + '</div>' + '</div>' + '<div id="divBoxBackgroundColor">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Background Color') + ':</div>' + '<div style="display:flex;">' + '<button title="' + out('Background Color') + '" class="input-box-bgcolor is-btn-color" style="margin-right:15px"></button>' + '<button title="' + out('Gradient') + '" class="input-box-gradient classic" data-value="+">' + out('Gradient') + '</button>' + '</div>' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Background Image') + ':</div>' + '<div style="height:auto">' + '<div class="box-bgimage-preview"></div>' + '<div style="display: flex">' + '<button title="' + out('Image') + '" class="input-box-bgimage">' + '<svg class="is-icon-flex"><use xlink:href="#ion-image"></use></svg>' + '<span>' + out('Image') + '</span>' + '</button>' + '<button title="' + out('Remove') + '" class="input-box-bgremove"><svg class="is-icon-flex" style="width:11px;height:11px;"><use xlink:href="#icon-clean"></use></svg></button>' + '<button title="' + out('Adjust') + '" class="input-box-bgimageadjust"><svg class="is-icon-flex"><use xlink:href="#ion-wrench"></use></svg></button>' + '</div>' + '</div>' + '</div>' + '<div id="divBoxPickPhoto" class="is-settings" style="padding-top:20px">' + '<button class="cmd-box-pickphoto" data-value="" style="width:100%"><svg class="is-icon-flex" style=""><use xlink:href="#ion-image"></use></svg></button>' + '</div>' + '<p id="divNoBoxSettings" style="text-align: center;display:none;">' + out('This box has no available settings.') + '</p>' + '</div>' + '<div id="divBoxClick" class="is-tab-content" data-group="boxsettings" style="padding-top:0">' + '<label for="inpBoxLinkSource" style="display:block;padding-top:20px;">' + out('Open') + ':</label>' + '<div class="image-src" style="display:flex">' + '<input id="inpBoxLinkSource" class="input-src" type="text" style="height:38px">' + '<button title="' + out('Select') + '" class="input-select" style="flex:none;width:40px;height:38px;background:transparent;"><svg class="is-icon-flex"><use xlink:href="#ion-more"></use></svg></button>' + '<div class="image-larger5" style="position: relative; flex: 0 0 auto; width: 40px; height: 38px; box-shadow: rgba(0, 0, 0, 0.32) 0px 3px 6px -6px;">' + '<form class="form-upload-larger" target="frameTargetBoxLinkUpload" method="post" action="' + this.builder.largerImageHandler + '" enctype="multipart/form-data" style="position:absolute;top:0;left:0;width:100%;height:100%;">' + '<input id="hidRefId5" name="hidRefId" type="hidden" value="">' + '<svg class="is-icon-flex" style="position: absolute;top: 10px;left: 15px;"><use xlink:href="#ion-image"></use></svg>' + '<input title="' + out('Select') + '" id="fileImage5" name="fileImage" type="file" accept="image/*,video/mp4" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">' + '</form>' + '<iframe id="frameTargetBoxLinkUpload" name="frameTargetBoxLinkUpload" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>' + '</div>' + '</div>' + '<div style="padding-top:20px">' + '<button class="cmd-box-testclick">' + out('Test') + '</button>' + '</div>' + '</div>';
7670
+ let html = '' + '<div id="divBoxTool">' + '<form id="form-upload-cover" data-tooltip-top data-title="' + out('Background Image') + '" target="frame-upload-cover" method="post" action="' + this.builder.coverImageHandler + '" enctype="multipart/form-data" style="position:relative;width:40px;height:40px;display:inline-block;float:left;background: rgb(90, 156, 38);">' + '<div style="width:40px;height:40px;overflow:hidden;">' + '<div style="position:absolute;width:100%;height:100%;"><svg class="is-icon-flex" style="position: absolute;top: 12px;left: 12px;fill:rgb(255,255,255);"><use xlink:href="#ion-image"></use></svg></div>' + '<input type="file" title="' + out('Background Image') + '" id="fileCover" name="fileCover" accept="image/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;"/>' + '</div>' + '<input id="hidcustomval" name="hidcustomval" type="hidden" value="" />' + '<iframe id="frame-upload-cover" name="frame-upload-cover" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>' + '</form>' + '<button id="btnEditBox" data-tooltip-top data-title="' + out('Box Settings') + '" title="' + out('Box Settings') + '"><svg class="is-icon-flex"><use xlink:href="#ion-wrench"></use></svg></button>' + '<button id="btnEditModule" data-tooltip-top data-title="' + out('Module Settings') + '" title="' + out('Module Settings') + '"><svg class="is-icon-flex"><use xlink:href="#ion-ios-gear"></use></svg></button>' + '</div>' + '' + '<div class="is-modal editmodule">' + '<div style="max-width:900px;height:570px;padding:0;box-sizing:border-box;position:relative;">' + '<div class="is-modal-bar is-draggable" style="position: absolute;top: 0;left: 0;width: 100%;z-index:1;">' + out('Module Settings') + '</div>' + '<iframe style="position: absolute;top: 0;left: 0;width:100%;height:100%;border:none;border-bottom:60px solid transparent;border-top:40px solid transparent;margin:0;box-sizing:border-box;" src="about:blank"></iframe>' + '<input id="hidModuleCode" type="hidden" />' + '<input id="hidModuleSettings" type="hidden" />' + '<button class="input-ok classic" style="height:60px;position:absolute;left:0;bottom:0;">' + out('Ok') + '</button>' + '</div>' + '</div>' + '' + '<div class="is-modal editcustomcode">' + '<div style="max-width:900px;height:570px;padding:0;box-sizing:border-box;position:relative;">' + '<div class="is-modal-bar is-draggable" style="position: absolute;top: 0;left: 0;width: 100%;z-index:1;">' + out('Custom Code (Javascript Allowed)') + '</div>' + '<textarea id="txtBoxCustomCode" class="inptxt" style="background: #fff;position: absolute;top: 0;left: 0;width:100%;height:100%;border:none;border-bottom:60px solid transparent;border-top:40px solid transparent;box-sizing:border-box;"></textarea>' + '<input id="hidBoxCustomCode" type="hidden" />' + '<button class="cell-html-larger" style="width:35px;height:35px;position:absolute;right:0;top:0;background:transparent;z-index:2;"><svg class="is-icon-flex" style="width:19px;height:19px;fill:rgb(170, 170, 170);"><use xlink:href="#ion-arrow-expand"></use></svg></button>' + '<button class="input-ok classic" style="height:60px;position:absolute;left:0;bottom:0;">' + out('Ok') + '</button>' + '</div>' + '</div>' + '<div class="is-modal editbox">' + '<div class="is-modal-content" style="max-width:380px;min-height:300px;padding:0">' + '<div class="is-modal-bar is-draggable">' + out('Box Settings') + '</div>' + '<div class="is-tabs clearfix" style="padding-top:37px;">' + '<a id="tabBoxGeneral" href="" data-content="divBoxGeneral" class="active">' + out('General') + '</a>' + '<a id="tabBoxContentContainer" href="" data-content="divBoxContentContainer">' + out('Content') + '</a>' + '<a id="tabBoxContentText" href="" data-content="divBoxContentText">' + out('Text') + '</a>' + '<a id="tabBoxImage" href="" data-content="divBoxImage">' + out('Image') + '</a>' + '<a id="tabBoxAnimate" href="" data-content="divBoxAnimate">' + out('Animate') + '</a>' + '<a id="tabBoxClick" href="" data-content="divBoxClick">' + out('On Click') + '</a>' + '</div>' + '<div id="divBoxGeneral" class="is-tab-content" data-group="boxsettings" style="display:flex;padding-top:0">' + '<div id="divBoxSize">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Box Size') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Decrease') + '" class="cmd-box-smaller" style="width:40px;">-</button>' + '<button title="' + out('Increase') + '" class="cmd-box-larger" style="width:40px;border-left:none">+</button>' + '<br style="clear:both">' + '</div>' + '</div>' + '<div id="divContentSize">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Content Size') + ':</div>' + '<div style="display: flex;flex-direction: row;flex-wrap: wrap;">' + '<input class="inp-box-size" type="text" style="width:80px;height:35px;text-align:center;font-size:12px;" />' + '<button class="cmd-box-size" data-value="380" style="width:40px;border-left:none">380</button>' + '<button class="cmd-box-size" data-value="440" style="width:40px;border-left:none">440</button>' + '<button class="cmd-box-size" data-value="500" style="width:40px;border-left:none">500</button>' + '<button class="cmd-box-size" data-value="640" style="width:40px;border-left:none">640</button>' + '<button class="cmd-box-size" data-value="760" style="width:40px;border-left:none">760</button>' + '<button class="cmd-box-size" data-value="800" style="width:40px;border-top:none">800</button>' + '<button class="cmd-box-size" data-value="860" style="width:40px;border-top:none">860</button>' + '<button class="cmd-box-size" data-value="940" style="width:40px;border-top:none">940</button>' + '<button class="cmd-box-size" data-value="1020" style="width:40px;border-top:none;border-left:none">1020</button>' + '<button class="cmd-box-size" data-value="1100" style="width:40px;border-top:none;border-left:none">1100</button>' + '<button class="cmd-box-size" data-value="1200" style="width:40px;border-top:none;border-left:none">1200</button>' + '<button class="cmd-box-size" data-value="1400" style="width:40px;border-top:none;border-left:none">1400</button>' + '<button title="' + out('Decrease') + '" class="cmd-box-size" data-value="-" style="width:40px;border-top:none;border-left:none">-</button>' + '<button title="' + out('Increase') + '"class="cmd-box-size" data-value="+" style="width:40px;border-top:none;border-left:none">+</button>' + '<br style="clear:both">' + '</div>' + '</div>' + '<div id="divBoxBackgroundColor">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Background Color') + ':</div>' + '<div style="display:flex;">' + '<button title="' + out('Background Color') + '" class="input-box-bgcolor is-btn-color" style="margin-right:15px"></button>' + '<button title="' + out('Gradient') + '" class="input-box-gradient classic" data-value="+">' + out('Gradient') + '</button>' + '</div>' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Background Image') + ':</div>' + '<div style="height:auto">' + '<div class="box-bgimage-preview"></div>' + '<div style="display: flex">' + '<button title="' + out('Image') + '" class="input-box-bgimage">' + '<svg class="is-icon-flex"><use xlink:href="#ion-image"></use></svg>' + '<span>' + out('Image') + '</span>' + '</button>' + '<button title="' + out('Remove') + '" class="input-box-bgremove"><svg class="is-icon-flex" style="width:11px;height:11px;"><use xlink:href="#icon-clean"></use></svg></button>' + '<button title="' + out('Adjust') + '" class="input-box-bgimageadjust"><svg class="is-icon-flex"><use xlink:href="#ion-wrench"></use></svg></button>' + '</div>' + '</div>' + '</div>' + '<div id="divBoxPickPhoto" class="is-settings" style="padding-top:20px">' + '<button class="cmd-box-pickphoto" data-value="" style="width:100%"><svg class="is-icon-flex" style=""><use xlink:href="#ion-image"></use></svg></button>' + '</div>' + '<p id="divNoBoxSettings" style="text-align: center;display:none;">' + out('This box has no available settings.') + '</p>' + '</div>' + '<div id="divBoxClick" class="is-tab-content" data-group="boxsettings" style="padding-top:0">' + '<label for="inpBoxLinkSource" style="display:block;padding-top:20px;">' + out('Open') + ':</label>' + '<div class="image-src" style="display:flex">' + '<input id="inpBoxLinkSource" class="input-src" type="text" style="height:38px">' + '<button title="' + out('Select') + '" class="input-select" style="flex:none;width:40px;height:38px;background:transparent;"><svg class="is-icon-flex"><use xlink:href="#ion-more"></use></svg></button>' + '<div class="image-larger5" style="position: relative; flex: 0 0 auto; width: 40px; height: 38px; box-shadow: rgba(0, 0, 0, 0.32) 0px 3px 6px -6px;">' + '<form class="form-upload-larger" target="frameTargetBoxLinkUpload" method="post" action="' + this.builder.largerImageHandler + '" enctype="multipart/form-data" style="position:absolute;top:0;left:0;width:100%;height:100%;">' + '<input id="hidRefId5" name="hidRefId" type="hidden" value="">' + '<svg class="is-icon-flex" style="position: absolute;top: 10px;left: 15px;"><use xlink:href="#ion-image"></use></svg>' + '<input title="' + out('Select') + '" id="fileImage5" name="fileImage" type="file" accept="image/*,video/mp4" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">' + '</form>' + '<iframe id="frameTargetBoxLinkUpload" name="frameTargetBoxLinkUpload" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>' + '</div>' + '</div>' + '<div style="padding-top:20px">' + '<button class="cmd-box-testclick">' + out('Test') + '</button>' + '</div>' + '</div>';
7193
7671
  html += '<div id="divBoxContentText" class="is-tab-content" data-group="boxsettings" style="padding-top:0">' + '<div style="display:flex;flex-direction: column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Text Style') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Light') + '" class="cmd-box-textcolor" data-value="light">' + out('Light') + '</button>' + '<button title="' + out('Dark') + '" class="cmd-box-textcolor" data-value="dark" style="border-left:none;">' + out('Dark') + '</button>' + '<br style="clear:both">' + '</div>' + '</div>' + '<div style="display:flex;flex-direction: column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Transparency') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Increase') + '" class="cmd-box-textopacity" data-value="+" style="width:40px"> + </button>' + '<button title="' + out('Decrease') + '" class="cmd-box-textopacity" data-value="-" style="width:40px;border-left:none;"> - </button>' + '<button title="' + out('Not Set') + '" class="cmd-box-textopacity" data-value="" style="border-left:none;">' + out('Not Set') + '</button>' + '<br style="clear:both">' + '</div>' + '</div>' + '<div style="display:flex;flex-direction: column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">Align:</div>' + '<div style="display:flex">' + '<button title="' + out('Align Left') + '" class="cmd-box-textalign" data-value="left" style="width:40px"><svg class="is-icon-flex" style="fill:rgba(0, 0, 0, 0.8);width:13px;height:13px;"><use xlink:href="#icon-align-left"></use></svg></button>' + '<button title="' + out('Align Center') + '" class="cmd-box-textalign" data-value="center" style="width:40px;border-left:none;"><svg class="is-icon-flex" style="fill:rgba(0, 0, 0, 0.8);width:13px;height:13px;"><use xlink:href="#icon-align-center"></use></svg></button>' + '<button title="' + out('Align Right') + '" class="cmd-box-textalign" data-value="right" style="width:40px;border-left:none;"><svg class="is-icon-flex" style="fill:rgba(0, 0, 0, 0.8);width:13px;height:13px;"><use xlink:href="#icon-align-right"></use></svg></button>' + '<button title="' + out('Align Full') + '" class="cmd-box-textalign" data-value="justify" style="width:40px;border-left:none;"><svg class="is-icon-flex" style="fill:rgba(0, 0, 0, 0.8);width:13px;height:13px;"><use xlink:href="#icon-align-full"></use></svg></button>' + '<br style="clear:both">' + '</div>' + '</div>' + (this.builder.settings.enableContentStyle ? '<div style="display:flex;flex-direction: column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Typography') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Change Style') + '" class="cmd-box-typography" data-value="+"> ' + out('Change Style') + ' </button>' + '<br style="clear:both">' + '</div>' + '</div>' : '') + '</div>' + '<div id="divBoxContentContainer" class="is-tab-content" data-group="boxsettings" style="padding-top:0">' + '<div style="display:flex;flex-direction: column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Position') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Top Left') + '" class="cmd-box-content-pos" data-value="topleft" style="width:40px;">&#8598;</button>' + '<button title="' + out('Top Center') + '" class="cmd-box-content-pos" data-value="topcenter" style="width:40px;border-left:none;">&#8593;</button>' + '<button title="' + out('Top Right') + '" class="cmd-box-content-pos" data-value="topright" style="width:40px;border-left:none;">&#8599;</button>' + '</div>' + '<div style="display:flex">' + '<button title="' + out('Middle Left') + '" class="cmd-box-content-pos" data-value="middleleft" style="width:40px;border-top:none;">&#8592;</button>' + '<button title="' + out('Middle Center') + '" class="cmd-box-content-pos" data-value="middlecenter" style="width:40px;border-left:none;border-top:none;">&#9737;</button>' + '<button title="' + out('Middle Right') + '" class="cmd-box-content-pos" data-value="middleright" style="width:40px;border-left:none;border-top:none;">&#8594;</button>' + '</div>' + '<div style="display:flex">' + '<button title="' + out('Bottom Left') + '" class="cmd-box-content-pos" data-value="bottomleft" style="width:40px;border-top:none;">&#8601;</button>' + '<button title="' + out('Bottom Center') + '" class="cmd-box-content-pos" data-value="bottomcenter" style="width:40px;border-left:none;border-top:none;">&#8595;</button>' + '<button title="' + out('Bottom Right') + '" class="cmd-box-content-pos" data-value="bottomright" style="width:40px;border-left:none;border-top:none;">&#8600;</button>' + '</div>' + '</div>' + '<div style="display:flex;flex-direction: column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Top/Bottom Adjustment') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Decrease') + '" class="cmd-box-content-edge-y" data-value="-" style="width:40px;">-</button>' + '<button title="' + out('Increase') + '" class="cmd-box-content-edge-y" data-value="+" style="width:40px;border-left:none;">+</button>' + '<button title="' + out('Not Set') + '" class="cmd-box-content-edge-y" data-value="" style="width:40px;border-left:none;min-width:100px;">' + out('Not Set') + '</button>' + '</div>' + '</div>' + '<div style="display:flex;flex-direction: column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Left/Right Adjustment') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Decrease') + '" class="cmd-box-content-edge-x" data-value="-" style="width:40px;">-</button>' + '<button title="' + out('Increase') + '" class="cmd-box-content-edge-x" data-value="+" style="width:40px;border-left:none;">+</button>' + '<button title="' + out('Not Set') + '" class="cmd-box-content-edge-x" data-value="" style="width:40px;border-left:none;min-width:100px;">' + out('Not Set') + '</button>' + '</div>' + '</div>' + '</div>' + '<div id="divBoxImage" class="is-tab-content" data-group="boxsettings" style="padding-top:0">' + (this.builder.settings.onCoverImageSelectClick != null ? '<div style="padding-top:20px;">' + '<button class="cmd-box-selectasset" style="width:120px;">' + out('Select Image') + '</button>' + '</div>' + '<div style="padding-top:20px;">' + '<label for="chkAnimateBg" style="margin:0;"><input id="chkAnimateBg" type="checkbox" /> ' + out('Ken Burns Effect') + '</label>' + '</div>' : '<div style="padding-top:20px;">' + '<label for="chkAnimateBg" style="margin:0;"><input id="chkAnimateBg" type="checkbox" /> ' + out('Ken Burns Effect') + '</label>' + '</div>') + '<div style="padding-top:10px;">' + '<label for="chkParallaxBg" style="margin:0;"><input id="chkParallaxBg" type="checkbox" /> ' + out('Parallax') + '</label>' + '</div>' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Overlay Color') + ':</div>' + '<div style="display:flex;">' + '<button title="' + out('Overlay Color') + '" class="input-box-overlaycolor is-btn-color" style="margin-right:15px"></button>' + '</div>' + '<div style="display:flex;flex-direction: column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Overlay Transparency') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Increase') + '" class="cmd-box-overlayopacity" data-value="+" style="width:40px;">+</button>' + '<button title="' + out('Decrease') + '" class="cmd-box-overlayopacity" data-value="-" style="width:40px;border-left:none;">-</button>' + '<button title="' + out('None') + '" class="cmd-box-overlayopacity" data-value="0" style="border-left:none;min-width:100px;">' + out('None') + '</button>' + '</div>' + '</div>' + '</div>' + '<div id="divBoxAnimate" class="is-tab-content" data-group="boxsettings" style="padding-top:0">' + '<div style="display:flex;flex-direction: column;">' + '<select class="cmd-box-animate">' + '<option value="">' + out('None') + '</option>' + '<option value="is-pulse">pulse</option>' + '<option value="is-bounceIn">bounceIn</option>' + '<option value="is-fadeIn">fadeIn</option>' + '<option value="is-fadeInDown">fadeInDown</option>' + '<option value="is-fadeInLeft">fadeInLeft</option>' + '<option value="is-fadeInRight">fadeInRight</option>' + '<option value="is-fadeInUp">fadeInUp</option>' + '<option value="is-flipInX">flipInX</option>' + '<option value="is-flipInY">flipInY</option>' + '<option value="is-slideInUp">slideInUp</option>' + '<option value="is-slideInDown">slideInDown</option>' + '<option value="is-slideInLeft">slideInLeft</option>' + '<option value="is-slideInRight">slideInRight</option>' + '<option value="is-zoomIn">zoomIn</option>' + '</select>' + '<label for="chkAnimOnce" style="margin:10px 0 0;"><input id="chkAnimOnce" type="checkbox" /> ' + out('Once') + '</label>' + '</div>' + '<div>' + '<label style="padding-top:20px;">' + out('Delay') + ': ' + '<select class="cmd-box-animatedelay" style="margin-top:3px;">' + '<option value="">' + out('None') + '</option>' + '<option value="delay-0ms">0s</option>' + '<option value="delay-100ms">100ms</option>' + '<option value="delay-200ms">200ms</option>' + '<option value="delay-300ms">300ms</option>' + '<option value="delay-400ms">400ms</option>' + '<option value="delay-500ms">500ms</option>' + '<option value="delay-600ms">600ms</option>' + '<option value="delay-700ms">700ms</option>' + '<option value="delay-800ms">800ms</option>' + '<option value="delay-900ms">900ms</option>' + '<option value="delay-1000ms">1000ms</option>' + '<option value="delay-1100ms">1100ms</option>' + '<option value="delay-1200ms">1200ms</option>' + '<option value="delay-1300ms">1300ms</option>' + '<option value="delay-1400ms">1400ms</option>' + '<option value="delay-1500ms">1500ms</option>' + '<option value="delay-1600ms">1600ms</option>' + '<option value="delay-1700ms">1700ms</option>' + '<option value="delay-1800ms">1800ms</option>' + '<option value="delay-1900ms">1900ms</option>' + '<option value="delay-2000ms">2000ms</option>' + '<option value="delay-2100ms">2100ms</option>' + '<option value="delay-2200ms">2200ms</option>' + '<option value="delay-2300ms">2300ms</option>' + '<option value="delay-2400ms">2400ms</option>' + '<option value="delay-2500ms">2500ms</option>' + '<option value="delay-2600ms">2600ms</option>' + '<option value="delay-2700ms">2700ms</option>' + '<option value="delay-2800ms">2800ms</option>' + '<option value="delay-2900ms">2900ms</option>' + '<option value="delay-3000ms">3000ms</option>' + '</select></label>' + '</div>' + '<div style="padding-top:20px">' + '<button class="cmd-box-animate-test" style="width:100%">' + out('Test') + '</button>' + '</div>' + '</div>' + '</div>' + '</div>' + '' + '<div class="is-modal pickphoto">' + '<div style="max-width:1000px;height:570px;padding:0;box-sizing:border-box;position:relative;">' + '<div class="is-modal-bar is-draggable" style="position: absolute;top: 0;left: 0;width: 100%;z-index:1;">' + out('Photos') + '</div>' + '<iframe style="position: absolute;top: 0;left: 0;width:100%;height:100%;border:none;border-top:40px solid transparent;margin:0;box-sizing:border-box;" src="about:blank"></iframe>' + '</div>' + '</div>' + '';
7194
7672
  dom$G.appendHtml(builderStuff, html); // Box Tool
7195
7673
 
@@ -7318,8 +7796,32 @@ class EditBox {
7318
7796
  btnBoxTypo.addEventListener('click', () => {
7319
7797
  this.builder.hideModal(modalEditBox); //Open divSidebarTypography
7320
7798
 
7321
- builderStuff.querySelector('.is-sidebar > button[data-command="typography"]').click();
7799
+ builderStuff.querySelector('.is-sidebar > button[data-command="typography"]').click(); //Overide
7800
+ //--- overlay (this needs overlay to prevent activeBox change) ---
7801
+
7802
+ const overlayHtml = '<div class="is-sidebar-overlay" style="position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(255,255,255,0.000001);z-index: 1000;"></div>';
7803
+ dom$G.appendHtml(builderStuff, overlayHtml);
7804
+ const modalOverlay = builderStuff.querySelector('.is-sidebar-overlay');
7805
+ if (modalOverlay) modalOverlay.addEventListener('click', () => {
7806
+ // Close all opened sidebar
7807
+ const overlay = document.querySelector('.is-sidebar-overlay');
7808
+
7809
+ if (overlay) {
7810
+ overlay.remove();
7811
+ document.body.style.overflowY = '';
7812
+ }
7813
+
7814
+ document.querySelectorAll('.is-sidebar-button.active').forEach(elm => {
7815
+ dom$G.removeClass(elm, 'active');
7816
+ });
7817
+ document.querySelectorAll('.is-sidebar-content.active').forEach(elm => {
7818
+ dom$G.removeClass(elm, 'active');
7819
+ });
7820
+ }); //--- /overlay ---
7821
+
7322
7822
  builderStuff.querySelector('.is-sidebar > button[data-command="typography"]').setAttribute('data-applyto', 'box');
7823
+ builderStuff.querySelector('.typo-target-default').style.display = 'none';
7824
+ builderStuff.querySelector('.typo-target-box').style.display = 'flex';
7323
7825
  });
7324
7826
  });
7325
7827
  const btnBoxSizes = modalEditBox.querySelectorAll('.cmd-box-size');
@@ -7488,6 +7990,9 @@ class EditBox {
7488
7990
  } else if (dom$G.hasClass(container, 'edge-x-5')) {
7489
7991
  dom$G.removeClass(container, 'edge-x-5');
7490
7992
  dom$G.addClass(container, 'edge-x-4');
7993
+ } else if (dom$G.hasClass(container, 'edge-x-6')) {
7994
+ dom$G.removeClass(container, 'edge-x-6');
7995
+ dom$G.addClass(container, 'edge-x-5');
7491
7996
  } else {
7492
7997
  dom$G.addClass(container, 'edge-x-0');
7493
7998
  }
@@ -7510,6 +8015,9 @@ class EditBox {
7510
8015
  dom$G.removeClass(container, 'edge-x-4');
7511
8016
  dom$G.addClass(container, 'edge-x-5');
7512
8017
  } else if (dom$G.hasClass(container, 'edge-x-5')) {
8018
+ dom$G.removeClass(container, 'edge-x-5');
8019
+ dom$G.addClass(container, 'edge-x-6');
8020
+ } else if (dom$G.hasClass(container, 'edge-x-6')) {
7513
8021
  return false;
7514
8022
  } else {
7515
8023
  dom$G.addClass(container, 'edge-x-0');
@@ -7523,6 +8031,7 @@ class EditBox {
7523
8031
  dom$G.removeClass(container, 'edge-x-3');
7524
8032
  dom$G.removeClass(container, 'edge-x-4');
7525
8033
  dom$G.removeClass(container, 'edge-x-5');
8034
+ dom$G.removeClass(container, 'edge-x-6');
7526
8035
  } //Trigger Change event
7527
8036
 
7528
8037
 
@@ -7570,6 +8079,15 @@ class EditBox {
7570
8079
  } else if (dom$G.hasClass(boxCentered, 'edge-y-5')) {
7571
8080
  dom$G.removeClass(boxCentered, 'edge-y-5');
7572
8081
  dom$G.addClass(boxCentered, 'edge-y-4');
8082
+ } else if (dom$G.hasClass(boxCentered, 'edge-y-6')) {
8083
+ dom$G.removeClass(boxCentered, 'edge-y-6');
8084
+ dom$G.addClass(boxCentered, 'edge-y-5');
8085
+ } else if (dom$G.hasClass(boxCentered, 'edge-y-7')) {
8086
+ dom$G.removeClass(boxCentered, 'edge-y-7');
8087
+ dom$G.addClass(boxCentered, 'edge-y-6');
8088
+ } else if (dom$G.hasClass(boxCentered, 'edge-y-8')) {
8089
+ dom$G.removeClass(boxCentered, 'edge-y-8');
8090
+ dom$G.addClass(boxCentered, 'edge-y-7');
7573
8091
  } else {
7574
8092
  dom$G.addClass(boxCentered, 'edge-y-0');
7575
8093
  }
@@ -7607,6 +8125,15 @@ class EditBox {
7607
8125
  dom$G.removeClass(boxCentered, 'edge-y-4');
7608
8126
  dom$G.addClass(boxCentered, 'edge-y-5');
7609
8127
  } else if (dom$G.hasClass(boxCentered, 'edge-y-5')) {
8128
+ dom$G.removeClass(boxCentered, 'edge-y-5');
8129
+ dom$G.addClass(boxCentered, 'edge-y-6');
8130
+ } else if (dom$G.hasClass(boxCentered, 'edge-y-6')) {
8131
+ dom$G.removeClass(boxCentered, 'edge-y-6');
8132
+ dom$G.addClass(boxCentered, 'edge-y-7');
8133
+ } else if (dom$G.hasClass(boxCentered, 'edge-y-7')) {
8134
+ dom$G.removeClass(boxCentered, 'edge-y-7');
8135
+ dom$G.addClass(boxCentered, 'edge-y-8');
8136
+ } else if (dom$G.hasClass(boxCentered, 'edge-y-8')) {
7610
8137
  return false;
7611
8138
  } else {
7612
8139
  dom$G.addClass(boxCentered, 'edge-y-0');
@@ -7625,98 +8152,55 @@ class EditBox {
7625
8152
  dom$G.removeClass(boxCentered, 'edge-y-3');
7626
8153
  dom$G.removeClass(boxCentered, 'edge-y-4');
7627
8154
  dom$G.removeClass(boxCentered, 'edge-y-5');
7628
- } //simplified
7629
-
7630
-
7631
- if (s === '-') {
7632
- if (dom$G.hasClass(activeBox, 'edge-y--5')) {
7633
- return false;
7634
- } else if (dom$G.hasClass(activeBox, 'edge-y--4')) {
7635
- dom$G.removeClass(activeBox, 'edge-y--4');
7636
- dom$G.addClass(activeBox, 'edge-y--5');
7637
- } else if (dom$G.hasClass(activeBox, 'edge-y--3')) {
7638
- dom$G.removeClass(activeBox, 'edge-y--3');
7639
- dom$G.addClass(activeBox, 'edge-y--4');
7640
- } else if (dom$G.hasClass(activeBox, 'edge-y--2')) {
7641
- dom$G.removeClass(activeBox, 'edge-y--2');
7642
- dom$G.addClass(activeBox, 'edge-y--3');
7643
- } else if (dom$G.hasClass(activeBox, 'edge-y--1')) {
7644
- dom$G.removeClass(activeBox, 'edge-y--1');
7645
- dom$G.addClass(activeBox, 'edge-y--2');
7646
- } else if (dom$G.hasClass(activeBox, 'edge-y-0')) {
7647
- dom$G.removeClass(activeBox, 'edge-y-0');
7648
- dom$G.addClass(activeBox, 'edge-y--1');
7649
- } else if (dom$G.hasClass(activeBox, 'edge-y-1')) {
7650
- dom$G.removeClass(activeBox, 'edge-y-1');
7651
- dom$G.addClass(activeBox, 'edge-y-0');
7652
- } else if (dom$G.hasClass(activeBox, 'edge-y-2')) {
7653
- dom$G.removeClass(activeBox, 'edge-y-2');
7654
- dom$G.addClass(activeBox, 'edge-y-1');
7655
- } else if (dom$G.hasClass(activeBox, 'edge-y-3')) {
7656
- dom$G.removeClass(activeBox, 'edge-y-3');
7657
- dom$G.addClass(activeBox, 'edge-y-2');
7658
- } else if (dom$G.hasClass(activeBox, 'edge-y-4')) {
7659
- dom$G.removeClass(activeBox, 'edge-y-4');
7660
- dom$G.addClass(activeBox, 'edge-y-3');
7661
- } else if (dom$G.hasClass(activeBox, 'edge-y-5')) {
7662
- dom$G.removeClass(activeBox, 'edge-y-5');
7663
- dom$G.addClass(activeBox, 'edge-y-4');
7664
- } else {
7665
- dom$G.addClass(activeBox, 'edge-y-0');
7666
- }
7667
- }
7668
-
7669
- if (s == '+') {
7670
- if (dom$G.hasClass(activeBox, 'edge-y--5')) {
7671
- dom$G.removeClass(activeBox, 'edge-y--5');
7672
- dom$G.addClass(activeBox, 'edge-y--4');
7673
- } else if (dom$G.hasClass(activeBox, 'edge-y--4')) {
7674
- dom$G.removeClass(activeBox, 'edge-y--4');
7675
- dom$G.addClass(activeBox, 'edge-y--3');
7676
- } else if (dom$G.hasClass(activeBox, 'edge-y--3')) {
7677
- dom$G.removeClass(activeBox, 'edge-y--3');
7678
- dom$G.addClass(activeBox, 'edge-y--2');
7679
- } else if (dom$G.hasClass(activeBox, 'edge-y--2')) {
7680
- dom$G.removeClass(activeBox, 'edge-y--2');
7681
- dom$G.addClass(activeBox, 'edge-y--1');
7682
- } else if (dom$G.hasClass(activeBox, 'edge-y--1')) {
7683
- dom$G.removeClass(activeBox, 'edge-y--1');
7684
- dom$G.addClass(activeBox, 'edge-y-0');
7685
- } else if (dom$G.hasClass(activeBox, 'edge-y-0')) {
7686
- dom$G.removeClass(activeBox, 'edge-y-0');
7687
- dom$G.addClass(activeBox, 'edge-y-1');
7688
- } else if (dom$G.hasClass(activeBox, 'edge-y-1')) {
7689
- dom$G.removeClass(activeBox, 'edge-y-1');
7690
- dom$G.addClass(activeBox, 'edge-y-2');
7691
- } else if (dom$G.hasClass(activeBox, 'edge-y-2')) {
7692
- dom$G.removeClass(activeBox, 'edge-y-2');
7693
- dom$G.addClass(activeBox, 'edge-y-3');
7694
- } else if (dom$G.hasClass(activeBox, 'edge-y-3')) {
7695
- dom$G.removeClass(activeBox, 'edge-y-3');
7696
- dom$G.addClass(activeBox, 'edge-y-4');
7697
- } else if (dom$G.hasClass(activeBox, 'edge-y-4')) {
7698
- dom$G.removeClass(activeBox, 'edge-y-4');
7699
- dom$G.addClass(activeBox, 'edge-y-5');
7700
- } else if (dom$G.hasClass(activeBox, 'edge-y-5')) {
7701
- return false;
7702
- } else {
7703
- dom$G.addClass(activeBox, 'edge-y-0');
7704
- }
7705
- }
7706
-
7707
- if (s == '') {
7708
- dom$G.removeClass(activeBox, 'edge-y--5');
7709
- dom$G.removeClass(activeBox, 'edge-y--4');
7710
- dom$G.removeClass(activeBox, 'edge-y--3');
7711
- dom$G.removeClass(activeBox, 'edge-y--2');
7712
- dom$G.removeClass(activeBox, 'edge-y--1');
7713
- dom$G.removeClass(activeBox, 'edge-y-0');
7714
- dom$G.removeClass(activeBox, 'edge-y-1');
7715
- dom$G.removeClass(activeBox, 'edge-y-2');
7716
- dom$G.removeClass(activeBox, 'edge-y-3');
7717
- dom$G.removeClass(activeBox, 'edge-y-4');
7718
- dom$G.removeClass(activeBox, 'edge-y-5');
7719
- } //Trigger Change event
8155
+ dom$G.removeClass(boxCentered, 'edge-y-6');
8156
+ dom$G.removeClass(boxCentered, 'edge-y-7');
8157
+ dom$G.removeClass(boxCentered, 'edge-y-8');
8158
+ } // //simplified
8159
+ // if (s === '-') {
8160
+ // if (dom.hasClass(activeBox, 'edge-y--5')) { return false; }
8161
+ // else if (dom.hasClass(activeBox, 'edge-y--4')) { dom.removeClass(activeBox, 'edge-y--4'); dom.addClass(activeBox, 'edge-y--5'); }
8162
+ // else if (dom.hasClass(activeBox, 'edge-y--3')) { dom.removeClass(activeBox, 'edge-y--3'); dom.addClass(activeBox, 'edge-y--4'); }
8163
+ // else if (dom.hasClass(activeBox, 'edge-y--2')) { dom.removeClass(activeBox, 'edge-y--2'); dom.addClass(activeBox, 'edge-y--3'); }
8164
+ // else if (dom.hasClass(activeBox, 'edge-y--1')) { dom.removeClass(activeBox, 'edge-y--1'); dom.addClass(activeBox, 'edge-y--2'); }
8165
+ // else if (dom.hasClass(activeBox, 'edge-y-0')) { dom.removeClass(activeBox, 'edge-y-0'); dom.addClass(activeBox, 'edge-y--1'); }
8166
+ // else if (dom.hasClass(activeBox, 'edge-y-1')) { dom.removeClass(activeBox, 'edge-y-1'); dom.addClass(activeBox, 'edge-y-0'); }
8167
+ // else if (dom.hasClass(activeBox, 'edge-y-2')) { dom.removeClass(activeBox, 'edge-y-2'); dom.addClass(activeBox, 'edge-y-1'); }
8168
+ // else if (dom.hasClass(activeBox, 'edge-y-3')) { dom.removeClass(activeBox, 'edge-y-3'); dom.addClass(activeBox, 'edge-y-2'); }
8169
+ // else if (dom.hasClass(activeBox, 'edge-y-4')) { dom.removeClass(activeBox, 'edge-y-4'); dom.addClass(activeBox, 'edge-y-3'); }
8170
+ // else if (dom.hasClass(activeBox, 'edge-y-5')) { dom.removeClass(activeBox, 'edge-y-5'); dom.addClass(activeBox, 'edge-y-4'); }
8171
+ // else if (dom.hasClass(activeBox, 'edge-y-6')) { dom.removeClass(activeBox, 'edge-y-6'); dom.addClass(activeBox, 'edge-y-5'); }
8172
+ // else { dom.addClass(activeBox, 'edge-y-0'); }
8173
+ // }
8174
+ // if (s == '+') {
8175
+ // if (dom.hasClass(activeBox, 'edge-y--5')) { dom.removeClass(activeBox, 'edge-y--5'); dom.addClass(activeBox, 'edge-y--4'); }
8176
+ // else if (dom.hasClass(activeBox, 'edge-y--4')) { dom.removeClass(activeBox, 'edge-y--4'); dom.addClass(activeBox, 'edge-y--3'); }
8177
+ // else if (dom.hasClass(activeBox, 'edge-y--3')) { dom.removeClass(activeBox, 'edge-y--3'); dom.addClass(activeBox, 'edge-y--2'); }
8178
+ // else if (dom.hasClass(activeBox, 'edge-y--2')) { dom.removeClass(activeBox, 'edge-y--2'); dom.addClass(activeBox, 'edge-y--1'); }
8179
+ // else if (dom.hasClass(activeBox, 'edge-y--1')) { dom.removeClass(activeBox, 'edge-y--1'); dom.addClass(activeBox, 'edge-y-0'); }
8180
+ // else if (dom.hasClass(activeBox, 'edge-y-0')) { dom.removeClass(activeBox, 'edge-y-0'); dom.addClass(activeBox, 'edge-y-1'); }
8181
+ // else if (dom.hasClass(activeBox, 'edge-y-1')) { dom.removeClass(activeBox, 'edge-y-1'); dom.addClass(activeBox, 'edge-y-2'); }
8182
+ // else if (dom.hasClass(activeBox, 'edge-y-2')) { dom.removeClass(activeBox, 'edge-y-2'); dom.addClass(activeBox, 'edge-y-3'); }
8183
+ // else if (dom.hasClass(activeBox, 'edge-y-3')) { dom.removeClass(activeBox, 'edge-y-3'); dom.addClass(activeBox, 'edge-y-4'); }
8184
+ // else if (dom.hasClass(activeBox, 'edge-y-4')) { dom.removeClass(activeBox, 'edge-y-4'); dom.addClass(activeBox, 'edge-y-5'); }
8185
+ // else if (dom.hasClass(activeBox, 'edge-y-5')) { dom.removeClass(activeBox, 'edge-y-5'); dom.addClass(activeBox, 'edge-y-6'); }
8186
+ // else if (dom.hasClass(activeBox, 'edge-y-6')) { return false; }
8187
+ // else { dom.addClass(activeBox, 'edge-y-0'); }
8188
+ // }
8189
+ // if (s == '') {
8190
+ // dom.removeClass(activeBox, 'edge-y--5');
8191
+ // dom.removeClass(activeBox, 'edge-y--4');
8192
+ // dom.removeClass(activeBox, 'edge-y--3');
8193
+ // dom.removeClass(activeBox, 'edge-y--2');
8194
+ // dom.removeClass(activeBox, 'edge-y--1');
8195
+ // dom.removeClass(activeBox, 'edge-y-0');
8196
+ // dom.removeClass(activeBox, 'edge-y-1');
8197
+ // dom.removeClass(activeBox, 'edge-y-2');
8198
+ // dom.removeClass(activeBox, 'edge-y-3');
8199
+ // dom.removeClass(activeBox, 'edge-y-4');
8200
+ // dom.removeClass(activeBox, 'edge-y-5');
8201
+ // dom.removeClass(boxCentered, 'edge-y-6');
8202
+ // }
8203
+ //Trigger Change event
7720
8204
 
7721
8205
 
7722
8206
  this.builder.settings.onChange();
@@ -7923,12 +8407,13 @@ class EditBox {
7923
8407
  this.builder.editor.saveForUndo(true); // checkLater = true
7924
8408
 
7925
8409
  const activeBox = this.builder.activeBox;
7926
- let bgcolor = window.getComputedStyle(activeBox, null).getPropertyValue('background-color');
7927
- if (bgcolor === 'rgba(0, 0, 0, 0)') bgcolor = ''; // let bgcolor = activeBox.style.backgroundColor;
7928
-
8410
+ let bgcolor = btnBoxBgColor.style.backgroundColor;
8411
+ let overlay = activeBox.querySelector('.is-overlay');
7929
8412
  colorpicker.open(s => {
7930
- activeBox.style.backgroundColor = s;
7931
- activeBox.style.backgroundImage = ''; //remove gradient
8413
+ // activeBox.style.backgroundColor = s;
8414
+ // activeBox.style.backgroundImage = '';//remove gradient
8415
+ overlay.style.backgroundColor = s;
8416
+ overlay.style.backgroundImage = ''; //remove gradient
7932
8417
 
7933
8418
  btnBoxBgColor.style.backgroundColor = s; // preview
7934
8419
  }, bgcolor);
@@ -7939,8 +8424,9 @@ class EditBox {
7939
8424
  const activeBox = this.builder.activeBox;
7940
8425
  this.builder.editor.saveForUndo(true); // checkLater = true
7941
8426
 
8427
+ let overlay = activeBox.querySelector('.is-overlay');
7942
8428
  let gradientPicker = this.builder.editor.gradientpicker();
7943
- gradientPicker.open(activeBox);
8429
+ gradientPicker.open(overlay);
7944
8430
  }); // Box Overlay Color
7945
8431
 
7946
8432
  const btnBoxOverlayColor = modalEditBox.querySelector('.input-box-overlaycolor');
@@ -7983,6 +8469,8 @@ class EditBox {
7983
8469
  overlayColor.style.backgroundColor = s;
7984
8470
  }
7985
8471
 
8472
+ btnBoxOverlayColor.style.backgroundColor = s; // preview
8473
+
7986
8474
  return false;
7987
8475
  }, color); //Note: if color empty, colorpicker will stay with its previous color
7988
8476
  }); // Click to Open Media Select Dialog
@@ -8223,12 +8711,8 @@ class EditBox {
8223
8711
  modalEditBox.querySelector('#chkAnimateBg').checked = false;
8224
8712
  }
8225
8713
 
8226
- if (overlayBg.getAttribute('style')) {
8227
- if (overlayBg.getAttribute('style').indexOf('scale(1.05)') !== -1) {
8228
- modalEditBox.querySelector('#chkParallaxBg').checked = true;
8229
- } else {
8230
- modalEditBox.querySelector('#chkParallaxBg').checked = false;
8231
- }
8714
+ if (overlayBg.getAttribute('data-top-bottom') || overlayBg.getAttribute('data-bottom-top')) {
8715
+ modalEditBox.querySelector('#chkParallaxBg').checked = true;
8232
8716
  } else {
8233
8717
  modalEditBox.querySelector('#chkParallaxBg').checked = false;
8234
8718
  }
@@ -8306,12 +8790,7 @@ class EditBox {
8306
8790
  if (dom$G.hasClass(activeBox, 'delay-2700ms')) selAnimateDelay.value = 'delay-2700ms';
8307
8791
  if (dom$G.hasClass(activeBox, 'delay-2800ms')) selAnimateDelay.value = 'delay-2800ms';
8308
8792
  if (dom$G.hasClass(activeBox, 'delay-2900ms')) selAnimateDelay.value = 'delay-2900ms';
8309
- if (dom$G.hasClass(activeBox, 'delay-3000ms')) selAnimateDelay.value = 'delay-3000ms'; //Background color
8310
-
8311
- let bgcolor = window.getComputedStyle(activeBox, null).getPropertyValue('background-color');
8312
- if (bgcolor === 'rgba(0, 0, 0, 0)') bgcolor = '';
8313
- let btnBoxBgColor = modalEditBox.querySelector('.input-box-bgcolor');
8314
- if (bgcolor) btnBoxBgColor.style.backgroundColor = bgcolor;else btnBoxBgColor.style.backgroundColor = 'transparent'; //Background image
8793
+ if (dom$G.hasClass(activeBox, 'delay-3000ms')) selAnimateDelay.value = 'delay-3000ms'; //Background image
8315
8794
  //Hide image tab
8316
8795
 
8317
8796
  modalEditBox.querySelector('#tabBoxImage').style.display = 'none';
@@ -8356,6 +8835,43 @@ class EditBox {
8356
8835
  modalEditBox.querySelector('#divNoBoxSettings').style.display = 'block'; //Show info: This box has no available settings
8357
8836
  } else {
8358
8837
  modalEditBox.querySelector('#divNoBoxSettings').style.display = 'none';
8838
+ } // FIX OLD VERSION
8839
+
8840
+
8841
+ let overlay = activeBox.querySelector('.is-overlay');
8842
+
8843
+ if (overlay) ; else {
8844
+ activeBox.insertAdjacentHTML('afterbegin', '<div class="is-overlay"></div>');
8845
+ overlay = activeBox.querySelector('.is-overlay');
8846
+ } // Gradient Color
8847
+
8848
+
8849
+ const s = activeBox.style.backgroundImage;
8850
+ if (s) if (s.indexOf('linear-gradient') !== -1) {
8851
+ // Fix
8852
+ overlay.style.backgroundImage = s;
8853
+ activeBox.style.backgroundImage = '';
8854
+ } // Background color
8855
+
8856
+ let btnBoxBgColor = modalEditBox.querySelector('.input-box-bgcolor');
8857
+ let bgcolor = activeBox.style.backgroundColor;
8858
+
8859
+ if (bgcolor) {
8860
+ // Fix
8861
+ overlay.style.backgroundColor = bgcolor;
8862
+ activeBox.style.backgroundColor = '';
8863
+ btnBoxBgColor.style.backgroundColor = bgcolor; //preview
8864
+ } else {
8865
+ bgcolor = overlay.style.backgroundColor;
8866
+
8867
+ if (bgcolor) {
8868
+ btnBoxBgColor.style.backgroundColor = bgcolor; //preview
8869
+ } else {
8870
+ //backward
8871
+ bgcolor = window.getComputedStyle(activeBox, null).getPropertyValue('background-color');
8872
+ if (bgcolor === 'rgba(0, 0, 0, 0)') bgcolor = '';
8873
+ btnBoxBgColor.style.backgroundColor = bgcolor; //preview
8874
+ }
8359
8875
  }
8360
8876
  } //edit
8361
8877
 
@@ -8775,8 +9291,8 @@ class EditBox {
8775
9291
  if (!overlayBg) return;
8776
9292
 
8777
9293
  if (this.modalEditBox.querySelector('#chkParallaxBg').checked) {
8778
- overlayBg.setAttribute('data-bottom-top', 'transform:translateY(-120px) scale(1.05)');
8779
- overlayBg.setAttribute('data-top-bottom', 'transform:translateY(120px) scale(1.05)');
9294
+ overlayBg.setAttribute('data-bottom-top', 'transform:translateY(-120px) scale(1);');
9295
+ overlayBg.setAttribute('data-top-bottom', 'transform:translateY(50px) scale(1.4)');
8780
9296
  this.builder.settings.onRender();
8781
9297
  } else {
8782
9298
  dom$G.removeClass(overlayBg, 'skrollable');
@@ -8887,7 +9403,7 @@ class EditBox {
8887
9403
  // }
8888
9404
 
8889
9405
 
8890
- overlayBg.style.backgroundImage = 'url(' + url + ')';
9406
+ overlayBg.style.backgroundImage = 'url(\'' + url + '\')';
8891
9407
  overlayBg.style.backgroundPosition = 50 + '%' + ' ' + 60 + '%'; //default
8892
9408
 
8893
9409
  preview.innerHTML = `<img src="${url}">`;
@@ -8908,11 +9424,11 @@ class EditBox {
8908
9424
 
8909
9425
  if (overlayContent) {
8910
9426
  if (overlayContent.innerHTML === '') overlayContent.parentNode.removeChild(overlayContent);
8911
- }
8912
-
8913
- if (overlay.childElementCount === 0) overlay.parentNode.removeChild(overlay); // overlayBg.style.backgroundImage = '';
9427
+ } // if(overlay.childElementCount===0) overlay.parentNode.removeChild(overlay); // new version always need overlay
9428
+ // overlayBg.style.backgroundImage = '';
8914
9429
  // overlayBg.style.backgroundPosition = '';
8915
9430
 
9431
+
8916
9432
  preview.innerHTML = ''; //clear overlay color
8917
9433
 
8918
9434
  const btnBoxOverlayColor = modalEditBox.querySelector('.input-box-overlaycolor');
@@ -9494,7 +10010,8 @@ class Util {
9494
10010
  dom.moveAfter(cellElement, cell);
9495
10011
  }
9496
10012
 
9497
- this.builder.applyBehavior();
10013
+ let builderActive = document.querySelector('.builder-active');
10014
+ if (builderActive) this.builder.applyBehaviorOn(builderActive);
9498
10015
  this.fixLayout(row);
9499
10016
  cellElement.click(); //change active block to the newly created
9500
10017
  }
@@ -9543,7 +10060,8 @@ class Util {
9543
10060
 
9544
10061
  row.parentNode.insertBefore(rowElement, row);
9545
10062
  dom.moveAfter(rowElement, row);
9546
- this.builder.applyBehavior();
10063
+ let builderActive = document.querySelector('.builder-active');
10064
+ if (builderActive) this.builder.applyBehaviorOn(builderActive);
9547
10065
  cellElement.click(); //change active block to the newly created
9548
10066
  }
9549
10067
 
@@ -9557,7 +10075,8 @@ class Util {
9557
10075
  // }
9558
10076
 
9559
10077
  element.insertAdjacentHTML('afterend', html);
9560
- this.builder.applyBehavior();
10078
+ let builderActive = document.querySelector('.builder-active');
10079
+ if (builderActive) this.builder.applyBehaviorOn(builderActive);
9561
10080
  let newelement = element.nextElementSibling;
9562
10081
 
9563
10082
  if (newelement.tagName.toLowerCase() === 'img') {
@@ -9565,7 +10084,7 @@ class Util {
9565
10084
  clearTimeout(timeoutId);
9566
10085
  timeoutId = setTimeout(() => {
9567
10086
  if (newelement.complete) {
9568
- newelement.click(); //console.log(2);
10087
+ newelement.click();
9569
10088
  }
9570
10089
  }, 200);
9571
10090
  } else {
@@ -9656,7 +10175,8 @@ class Util {
9656
10175
 
9657
10176
  row.parentNode.insertBefore(rowElement, row);
9658
10177
  dom.moveAfter(rowElement, row);
9659
- this.builder.applyBehavior();
10178
+ let builderActive = document.querySelector('.builder-active');
10179
+ if (builderActive) this.builder.applyBehaviorOn(builderActive);
9660
10180
  cellElement.click(); //change active block to the newly created
9661
10181
  // Change to row selection
9662
10182
 
@@ -9734,10 +10254,16 @@ class Util {
9734
10254
  cell.parentNode.insertBefore(cell, cell.previousElementSibling);
9735
10255
  }
9736
10256
 
9737
- this.builder.applyBehavior();
9738
- this.fixLayout(row);
9739
- cellElement.click(); //change active block to the newly created
9740
- // Call onChange
10257
+ let builderActive = document.querySelector('.builder-active');
10258
+ if (builderActive) this.builder.applyBehaviorOn(builderActive);
10259
+ this.fixLayout(row); // cellElement.click(); //change active block to the newly created
10260
+
10261
+ if (mode === 'cell' || mode === 'cell-right') {
10262
+ cell.nextElementSibling.click();
10263
+ } else {
10264
+ cell.previousElementSibling.click();
10265
+ } // Call onChange
10266
+
9741
10267
 
9742
10268
  this.builder.opts.onChange();
9743
10269
  return;
@@ -9781,10 +10307,11 @@ class Util {
9781
10307
  // row.scrollIntoView({ behavior: 'smooth', block: 'center' });
9782
10308
  // }, 600);
9783
10309
 
9784
- rowElement = row.nextElementSibling; // a must. Must be before applyBehavior() to prevent element delete during fixLayout
9785
-
9786
- this.builder.applyBehavior(); // checkEmpty & onRender called here
10310
+ rowElement = row.nextElementSibling; // a must. Must be before applyBehavior to prevent element delete during fixLayout
10311
+ // checkEmpty & onRender called here
9787
10312
 
10313
+ let builderActive = document.querySelector('.builder-active');
10314
+ if (builderActive) this.builder.applyBehaviorOn(builderActive);
9788
10315
  cellElement = rowElement.childNodes[0];
9789
10316
  cellElement.click(); //change active block to the newly created
9790
10317
  // Change to row selection
@@ -10130,71 +10657,80 @@ class Util {
10130
10657
  }
10131
10658
 
10132
10659
  checkEmpty() {
10133
- const dom = this.dom; // Get all builder areas
10134
-
10660
+ // Get all builder areas
10135
10661
  const builders = document.querySelectorAll(this.builder.opts.container);
10136
10662
  Array.prototype.forEach.call(builders, builder => {
10137
- const rows = dom.elementChildren(builder);
10138
- let empty = true;
10139
- rows.forEach(row => {
10140
- if (dom.hasClass(row, 'row-add-initial')) return;
10141
- if (dom.hasClass(row, 'dummy-space')) return;
10142
- empty = false;
10143
- });
10663
+ this.checkEmptyOn(builder);
10664
+ });
10665
+ }
10144
10666
 
10145
- if (empty) {
10146
- let emptyinfo = builder.querySelector('.row-add-initial');
10667
+ checkEmptyOn(builder) {
10668
+ const dom = this.dom;
10669
+ const rows = dom.elementChildren(builder);
10670
+ let empty = true;
10671
+ rows.forEach(row => {
10672
+ if (dom.hasClass(row, 'row-add-initial')) return;
10673
+ if (dom.hasClass(row, 'dummy-space')) return;
10674
+ empty = false;
10675
+ });
10147
10676
 
10148
- if (!emptyinfo) {
10149
- builder.innerHTML = `<button type="button" class="row-add-initial">${this.out('Empty')}<br><span>${this.out('+ Click to add content')}</span></div>`;
10150
- emptyinfo = builder.querySelector('.row-add-initial');
10151
- }
10677
+ if (empty) {
10678
+ let emptyinfo = builder.querySelector('.row-add-initial');
10152
10679
 
10153
- emptyinfo.addEventListener('click', () => {
10154
- this.clearActiveCell();
10155
- dom.addClass(emptyinfo, 'row-active'); // Needed for addContent(). Directly apply class in Util is fine.
10680
+ if (!emptyinfo) {
10681
+ builder.innerHTML = `<button type="button" class="row-add-initial">${this.out('Empty')}<br><span>${this.out('+ Click to add content')}</span></div>`;
10682
+ emptyinfo = builder.querySelector('.row-add-initial');
10683
+ }
10156
10684
 
10157
- const builderStuff = this.builder.builderStuff;
10158
- let quickadd = builderStuff.querySelector('.quickadd'); // see quickadd.js. Directly select by class in Util is fine.
10685
+ emptyinfo.addEventListener('click', () => {
10686
+ this.clearActiveCell();
10687
+ const builders = document.querySelectorAll(this.builder.opts.container);
10688
+ Array.prototype.forEach.call(builders, item => {
10689
+ dom.removeClass(item, 'builder-active');
10690
+ });
10691
+ dom.addClass(builder, 'builder-active');
10692
+ dom.addClass(emptyinfo, 'row-active'); // Needed for addContent(). Directly apply class in Util is fine.
10159
10693
 
10160
- let tabs = quickadd.querySelector('.is-pop-tabs');
10161
- tabs.style.display = 'none';
10162
- const viewportHeight = window.innerHeight;
10163
- let top = emptyinfo.getBoundingClientRect().top;
10164
- const left = emptyinfo.getBoundingClientRect().left + emptyinfo.offsetWidth * this.builder.opts.zoom / 2 - 11;
10165
- quickadd.style.display = 'flex';
10166
- const w = quickadd.offsetWidth; //to get value, element must not hidden (display:none). So set display:flex before this.
10167
-
10168
- const h = quickadd.offsetHeight;
10169
-
10170
- if (viewportHeight - top > h) {
10171
- top = top + emptyinfo.offsetHeight * this.builder.opts.zoom - 19;
10172
- quickadd.style.top = top + window.pageYOffset + 27 + 'px';
10173
- quickadd.style.left = left - w / 2 + 7 + 'px';
10174
- dom.removeClass(quickadd, 'arrow-bottom');
10175
- dom.removeClass(quickadd, 'arrow-right');
10176
- dom.removeClass(quickadd, 'arrow-left');
10177
- dom.removeClass(quickadd, 'center');
10178
- dom.addClass(quickadd, 'arrow-top');
10179
- dom.addClass(quickadd, 'center');
10180
- } else {
10181
- quickadd.style.top = top + window.pageYOffset - h - 8 + 'px';
10182
- quickadd.style.left = left - w / 2 + 7 + 'px';
10183
- dom.removeClass(quickadd, 'arrow-top');
10184
- dom.removeClass(quickadd, 'arrow-right');
10185
- dom.removeClass(quickadd, 'arrow-left');
10186
- dom.removeClass(quickadd, 'center');
10187
- dom.addClass(quickadd, 'arrow-bottom');
10188
- dom.addClass(quickadd, 'center');
10189
- }
10694
+ const builderStuff = this.builder.builderStuff;
10695
+ let quickadd = builderStuff.querySelector('.quickadd'); // see quickadd.js. Directly select by class in Util is fine.
10190
10696
 
10191
- quickadd.setAttribute('data-mode', 'row');
10192
- });
10193
- } else {
10194
- let emptyinfo = builder.querySelector('.row-add-initial');
10195
- if (emptyinfo) emptyinfo.parentNode.removeChild(emptyinfo);
10196
- }
10197
- });
10697
+ let tabs = quickadd.querySelector('.is-pop-tabs');
10698
+ tabs.style.display = 'none';
10699
+ const viewportHeight = window.innerHeight;
10700
+ let top = emptyinfo.getBoundingClientRect().top;
10701
+ const left = emptyinfo.getBoundingClientRect().left + emptyinfo.offsetWidth * this.builder.opts.zoom / 2 - 11;
10702
+ quickadd.style.display = 'flex';
10703
+ const w = quickadd.offsetWidth; //to get value, element must not hidden (display:none). So set display:flex before this.
10704
+
10705
+ const h = quickadd.offsetHeight;
10706
+
10707
+ if (viewportHeight - top > h) {
10708
+ top = top + emptyinfo.offsetHeight * this.builder.opts.zoom - 19;
10709
+ quickadd.style.top = top + window.pageYOffset + 27 + 'px';
10710
+ quickadd.style.left = left - w / 2 + 7 + 'px';
10711
+ dom.removeClass(quickadd, 'arrow-bottom');
10712
+ dom.removeClass(quickadd, 'arrow-right');
10713
+ dom.removeClass(quickadd, 'arrow-left');
10714
+ dom.removeClass(quickadd, 'center');
10715
+ dom.addClass(quickadd, 'arrow-top');
10716
+ dom.addClass(quickadd, 'center');
10717
+ } else {
10718
+ quickadd.style.top = top + window.pageYOffset - h - 8 + 'px';
10719
+ quickadd.style.left = left - w / 2 + 7 + 'px';
10720
+ dom.removeClass(quickadd, 'arrow-top');
10721
+ dom.removeClass(quickadd, 'arrow-right');
10722
+ dom.removeClass(quickadd, 'arrow-left');
10723
+ dom.removeClass(quickadd, 'center');
10724
+ dom.addClass(quickadd, 'arrow-bottom');
10725
+ dom.addClass(quickadd, 'center');
10726
+ }
10727
+
10728
+ quickadd.setAttribute('data-mode', 'row');
10729
+ });
10730
+ } else {
10731
+ let emptyinfo = builder.querySelector('.row-add-initial');
10732
+ if (emptyinfo) emptyinfo.parentNode.removeChild(emptyinfo);
10733
+ }
10198
10734
  }
10199
10735
 
10200
10736
  clearPreferences() {
@@ -10476,8 +11012,7 @@ class Util {
10476
11012
 
10477
11013
  this.builder.styleButtonClassicBackground = window.getComputedStyle(btnClassic, null).getPropertyValue('background-color');
10478
11014
  this.builder.styleButtonClassicColor = window.getComputedStyle(btnClassic, null).getPropertyValue('color');
10479
- this.builder.styleButtonClassicBackgroundHover = this.getUIStyleValue(btnClassic, 'hover', 'background-color'); // console.log(this.builder.styleButtonClassicBackgroundHover);
10480
-
11015
+ this.builder.styleButtonClassicBackgroundHover = this.getUIStyleValue(btnClassic, 'hover', 'background-color');
10481
11016
  this.builder.styleDark = false;
10482
11017
  this.builder.styleColored = false;
10483
11018
  this.builder.styleColoredDark = false;
@@ -11586,7 +12121,6 @@ class Dom {
11586
12121
  }
11587
12122
  } // https://plainjs.com/javascript/attributes/adding-removing-and-testing-for-classes-9/
11588
12123
  // addClass(element, classname) {
11589
- // console.log(element.classList)
11590
12124
  // if (element.classList) element.classList.add(classname);
11591
12125
  // else if (!this.hasClass(element, classname)) element.className += ' ' + classname;
11592
12126
  // }
@@ -11603,7 +12137,6 @@ class Dom {
11603
12137
  let s = element.getAttribute('class');
11604
12138
  return new RegExp('\\b' + classname + '\\b').test(s);
11605
12139
  } catch (e) {// Do Nothing
11606
- // console.log(element);
11607
12140
  } //return element.classList ? element.classList.contains(classname) : new RegExp('\\b'+ classname+'\\b').test(element.className);
11608
12141
 
11609
12142
  }
@@ -11635,7 +12168,6 @@ class Dom {
11635
12168
  // if(classname==='is-side') console.log(element.nodeName); // NOTE: click on svg can still returns undefined in IE11
11636
12169
  if (!element.tagName) return false;
11637
12170
  if (element.tagName === 'BODY' || element.tagName === 'HTML') return false; // if(!element.classList) {
11638
- // console.log('no classList');
11639
12171
  // return false;
11640
12172
  // }
11641
12173
 
@@ -11685,7 +12217,6 @@ class Dom {
11685
12217
  return true;
11686
12218
  }
11687
12219
  } catch (e) {// Do Nothing
11688
- // console.log(element);
11689
12220
  // return false;
11690
12221
  }
11691
12222
 
@@ -11717,7 +12248,6 @@ class Dom {
11717
12248
  return element;
11718
12249
  }
11719
12250
  } catch (e) {// Do Nothing
11720
- // console.log(element);
11721
12251
  // return false;
11722
12252
  }
11723
12253
 
@@ -11844,7 +12374,7 @@ class Dom {
11844
12374
  textSelection() {
11845
12375
  try {
11846
12376
  var elm;
11847
- var curr = window.getSelection().getRangeAt(0).commonAncestorContainer; //console.log(curr.nodeType)
12377
+ var curr = window.getSelection().getRangeAt(0).commonAncestorContainer;
11848
12378
 
11849
12379
  if (curr.nodeType === 3) {
11850
12380
  // text node
@@ -17135,9 +17665,9 @@ let hash$1 = {};
17135
17665
  class HtmlUtil {
17136
17666
  constructor(builder) {
17137
17667
  this.builder = builder;
17138
- const util = new Util(builder);
17139
- const builderstuff = util.builderStuff();
17140
- let viewhtml = builderstuff.querySelector('.viewhtml');
17668
+ const util = this.builder.util;
17669
+ const builderStuff = this.builder.builderStuff;
17670
+ let viewhtml = builderStuff.querySelector('.viewhtml');
17141
17671
 
17142
17672
  if (!viewhtml) {
17143
17673
  /*
@@ -17183,10 +17713,10 @@ class HtmlUtil {
17183
17713
  </div>
17184
17714
 
17185
17715
  `;
17186
- dom$E.appendHtml(builderstuff, html);
17187
- viewhtml = builderstuff.querySelector('.viewhtml');
17188
- let viewhtmlformatted = builderstuff.querySelector('.viewhtmlformatted');
17189
- let viewhtmlnormal = builderstuff.querySelector('.viewhtmlnormal');
17716
+ dom$E.appendHtml(builderStuff, html);
17717
+ viewhtml = builderStuff.querySelector('.viewhtml');
17718
+ let viewhtmlformatted = builderStuff.querySelector('.viewhtmlformatted');
17719
+ let viewhtmlnormal = builderStuff.querySelector('.viewhtmlnormal');
17190
17720
  let elm = viewhtml.querySelector('.input-html-larger');
17191
17721
  dom$E.addEventListener(elm, 'click', () => {
17192
17722
  let textarea = viewhtml.querySelector('textarea'); // Used by html dialog (syntaxhighlighting)
@@ -17222,9 +17752,9 @@ class HtmlUtil {
17222
17752
  }
17223
17753
 
17224
17754
  viewHtmlNormal() {
17225
- const util = new Util(this.builder);
17226
- const builderstuff = util.builderStuff();
17227
- const viewhtmlnormal = builderstuff.querySelector('.viewhtmlnormal');
17755
+ const util = this.builder.util;
17756
+ const builderStuff = this.builder.builderStuff;
17757
+ const viewhtmlnormal = builderStuff.querySelector('.viewhtmlnormal');
17228
17758
  let iframe = viewhtmlnormal.querySelector('iframe');
17229
17759
  iframe.outerHTML = '<iframe id="ifrHtml" style="width:100%;height:100%;border: none;" src="about:blank"></iframe>'; //clear
17230
17760
 
@@ -17237,9 +17767,9 @@ class HtmlUtil {
17237
17767
  }
17238
17768
 
17239
17769
  viewHtmlLarger() {
17240
- const util = new Util(this.builder);
17241
- const builderstuff = util.builderStuff();
17242
- const viewhtmllarger = builderstuff.querySelector('.viewhtmllarger');
17770
+ const util = this.builder.util;
17771
+ const builderStuff = this.builder.builderStuff;
17772
+ const viewhtmllarger = builderStuff.querySelector('.viewhtmllarger');
17243
17773
  let iframe = viewhtmllarger.querySelector('iframe');
17244
17774
  iframe.outerHTML = '<iframe id="ifrHtml" style="width:100%;height:100%;border: none;" src="about:blank"></iframe>'; //clear
17245
17775
 
@@ -17251,14 +17781,14 @@ class HtmlUtil {
17251
17781
  }
17252
17782
 
17253
17783
  view(mode, area) {
17254
- const util = new Util(this.builder);
17255
- const builderstuff = util.builderStuff();
17784
+ const util = this.builder.util;
17785
+ const builderStuff = this.builder.builderStuff;
17256
17786
  let viewhtml;
17257
17787
 
17258
17788
  if (this.builder.opts.htmlSyntaxHighlighting) {
17259
- viewhtml = builderstuff.querySelector('.viewhtmlformatted');
17789
+ viewhtml = builderStuff.querySelector('.viewhtmlformatted');
17260
17790
  } else {
17261
- viewhtml = builderstuff.querySelector('.viewhtml');
17791
+ viewhtml = builderStuff.querySelector('.viewhtml');
17262
17792
  }
17263
17793
 
17264
17794
  viewhtml.querySelector('.is-modal-footer').innerHTML = `<button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
@@ -17284,7 +17814,7 @@ class HtmlUtil {
17284
17814
 
17285
17815
  dom$E.removeClass(row, 'row-outline'); //Hide Column tool
17286
17816
 
17287
- let columnTool = builderstuff.querySelector('.is-column-tool');
17817
+ let columnTool = builderStuff.querySelector('.is-column-tool');
17288
17818
  dom$E.removeClass(columnTool, 'active');
17289
17819
  }
17290
17820
 
@@ -17332,7 +17862,8 @@ class HtmlUtil {
17332
17862
  if (mode === 'cell') {
17333
17863
  const cell = util.cellSelected();
17334
17864
  cell.innerHTML = html;
17335
- this.builder.applyBehavior(); //Trigger Change event
17865
+ let builderActive = document.querySelector('.builder-active');
17866
+ if (builderActive) this.builder.applyBehaviorOn(builderActive); //Trigger Change event
17336
17867
 
17337
17868
  this.builder.opts.onChange(); //Trigger Render event
17338
17869
 
@@ -17343,7 +17874,8 @@ class HtmlUtil {
17343
17874
  const cell = util.cellSelected();
17344
17875
  const row = cell.parentNode;
17345
17876
  row.innerHTML = html;
17346
- this.builder.applyBehavior(); //Trigger Change event
17877
+ let builderActive = document.querySelector('.builder-active');
17878
+ if (builderActive) this.builder.applyBehaviorOn(builderActive); //Trigger Change event
17347
17879
 
17348
17880
  this.builder.opts.onChange(); //Trigger Render event
17349
17881
 
@@ -17358,7 +17890,8 @@ class HtmlUtil {
17358
17890
  var range = document.createRange();
17359
17891
  range.setStart(area, 0);
17360
17892
  area.appendChild(range.createContextualFragment(html));
17361
- this.builder.applyBehavior(); //Trigger Change event
17893
+ let builderActive = document.querySelector('.builder-active');
17894
+ if (builderActive) this.builder.applyBehaviorOn(builderActive); //Trigger Change event
17362
17895
 
17363
17896
  this.builder.opts.onChange(); //Trigger Render event
17364
17897
 
@@ -17397,9 +17930,9 @@ class HtmlUtil {
17397
17930
  } //Hide popup
17398
17931
 
17399
17932
 
17400
- let columnMore = builderstuff.querySelector('.is-pop.columnmore');
17933
+ let columnMore = builderStuff.querySelector('.is-pop.columnmore');
17401
17934
  columnMore.style.display = '';
17402
- let rowMore = builderstuff.querySelector('.is-pop.rowmore');
17935
+ let rowMore = builderStuff.querySelector('.is-pop.rowmore');
17403
17936
  rowMore.style.display = '';
17404
17937
  }
17405
17938
 
@@ -17427,17 +17960,17 @@ class HtmlUtil {
17427
17960
  });
17428
17961
  }
17429
17962
 
17430
- const util = new Util(this.builder); //Prepare temporary helpers: #tmp_content & #tmp_buildercontent
17963
+ const util = this.builder.util;
17964
+ const builderStuff = this.builder.builderStuff; //Prepare temporary helpers: #tmp_content & #tmp_buildercontent
17431
17965
 
17432
- const builderstuff = util.builderStuff();
17433
- let elm = builderstuff.querySelector('#tmp_content');
17434
- if (elm) builderstuff.removeChild(elm);
17435
- elm = builderstuff.querySelector('#tmp_buildercontent');
17436
- if (elm) builderstuff.removeChild(elm);
17966
+ let elm = builderStuff.querySelector('#tmp_content');
17967
+ if (elm) builderStuff.removeChild(elm);
17968
+ elm = builderStuff.querySelector('#tmp_buildercontent');
17969
+ if (elm) builderStuff.removeChild(elm);
17437
17970
  let html = `<div id="tmp_content" style="position:absolute;top:0;left:0;width:1px;height:1px;overflow:hidden;visibility:hidden;"></div>
17438
17971
  <div id="tmp_buildercontent" style="position:absolute;top:0;left:0;width:1px;height:1px;overflow:hidden;visibility:hidden;"></div>`;
17439
- dom$E.appendHtml(builderstuff, html);
17440
- let tmp = builderstuff.querySelector('#tmp_content');
17972
+ dom$E.appendHtml(builderStuff, html);
17973
+ let tmp = builderStuff.querySelector('#tmp_content');
17441
17974
  tmp.innerHTML = content.innerHTML; //Find subblocks (previously is-builder) in custom code blocks and save them to data-html-1, data-html-2, and so on.
17442
17975
 
17443
17976
  let blocks = tmp.querySelectorAll('[data-html]');
@@ -17478,7 +18011,7 @@ class HtmlUtil {
17478
18011
  _builder.removeAttribute('between-blocks-center'); // old
17479
18012
  _builder.removeAttribute('hideelementhighlight');
17480
18013
  let builderhtml = _builder.innerHTML;
17481
- let tmpbuilder = builderstuff.querySelector('#tmp_buildercontent');
18014
+ let tmpbuilder = builderStuff.querySelector('#tmp_buildercontent');
17482
18015
  tmpbuilder.innerHTML = builderhtml;
17483
18016
  let elms = tmp.querySelectorAll('.sortable-chosen');
17484
18017
  dom.removeClasses(elms, 'sortable-chosen');
@@ -17762,10 +18295,10 @@ class HtmlUtil {
17762
18295
  html = html.replace(/<font/g, '<span').replace(/<\/font/g, '</span');
17763
18296
  }
17764
18297
 
17765
- elm = builderstuff.querySelector('#tmp_content');
17766
- if (elm) builderstuff.removeChild(elm);
17767
- elm = builderstuff.querySelector('#tmp_buildercontent');
17768
- if (elm) builderstuff.removeChild(elm); // return html;
18298
+ elm = builderStuff.querySelector('#tmp_content');
18299
+ if (elm) builderStuff.removeChild(elm);
18300
+ elm = builderStuff.querySelector('#tmp_buildercontent');
18301
+ if (elm) builderStuff.removeChild(elm); // return html;
17769
18302
 
17770
18303
  let beautify = JsBeautify.html;
17771
18304
  return beautify(html);
@@ -18541,7 +19074,8 @@ const prepareSvgIcons = () => {
18541
19074
  class Snippets {
18542
19075
  constructor(builder) {
18543
19076
  this.builder = builder;
18544
- this.util = new Util(this.builder);
19077
+ const util = this.builder.util;
19078
+ this.util = util;
18545
19079
  }
18546
19080
 
18547
19081
  getSnippetsHtml() {
@@ -19438,8 +19972,8 @@ class Snippets {
19438
19972
  const dom$B = new Dom();
19439
19973
 
19440
19974
  const renderQuickAdd = builder => {
19441
- const util = new Util(builder);
19442
- const builderStuff = util.builderStuff();
19975
+ const util = builder.util;
19976
+ const builderStuff = builder.builderStuff;
19443
19977
  let quickadd = builderStuff.querySelector('.quickadd');
19444
19978
 
19445
19979
  if (!quickadd) {
@@ -19824,9 +20358,10 @@ class Grid {
19824
20358
  row.previousElementSibling.appendChild(cell); //add
19825
20359
 
19826
20360
  row.parentNode.removeChild(row); //remove current (empty) row (including its overlay)
20361
+ //re-add tool
19827
20362
 
19828
- builder.applyBehavior(); //re-add tool
19829
-
20363
+ let builderActive = document.querySelector('.builder-active');
20364
+ builder.applyBehaviorOn(builderActive);
19830
20365
  columnTool.position(cell);
19831
20366
  cell.click(); //refresh active cell/row
19832
20367
 
@@ -19841,9 +20376,10 @@ class Grid {
19841
20376
  var rowElement = row.cloneNode(true);
19842
20377
  rowElement.innerHTML = '';
19843
20378
  rowElement.appendChild(cell);
19844
- row.parentNode.insertBefore(rowElement, row);
19845
- builder.applyBehavior(); //re-add tool
20379
+ row.parentNode.insertBefore(rowElement, row); //re-add tool
19846
20380
 
20381
+ let builderActive = document.querySelector('.builder-active');
20382
+ builder.applyBehaviorOn(builderActive);
19847
20383
  columnTool.position(cell);
19848
20384
  cell.click(); //refresh active cell/row
19849
20385
 
@@ -19899,9 +20435,10 @@ class Grid {
19899
20435
  row.nextElementSibling.appendChild(cell); //add
19900
20436
 
19901
20437
  row.parentNode.removeChild(row); //remove current (empty) row (including its overlay)
20438
+ //re-add tool
19902
20439
 
19903
- builder.applyBehavior(); //re-add tool
19904
-
20440
+ let builderActive = document.querySelector('.builder-active');
20441
+ builder.applyBehaviorOn(builderActive);
19905
20442
  columnTool.position(cell);
19906
20443
  cell.click(); //refresh active cell/row
19907
20444
 
@@ -19916,9 +20453,10 @@ class Grid {
19916
20453
  var rowElement = row.cloneNode(true);
19917
20454
  rowElement.innerHTML = '';
19918
20455
  rowElement.appendChild(cell);
19919
- dom$A.moveAfter(rowElement, row);
19920
- builder.applyBehavior(); //re-add tool
20456
+ dom$A.moveAfter(rowElement, row); //re-add tool
19921
20457
 
20458
+ let builderActive = document.querySelector('.builder-active');
20459
+ builder.applyBehaviorOn(builderActive);
19922
20460
  columnTool.position(cell);
19923
20461
  cell.click(); //refresh active cell/row
19924
20462
 
@@ -19962,8 +20500,10 @@ class Grid {
19962
20500
  }
19963
20501
 
19964
20502
  row.insertBefore(cellElement, cell);
19965
- util.fixLayout(row, builder);
19966
- builder.applyBehavior();
20503
+ util.fixLayout(row, builder); //re-add tool
20504
+
20505
+ let builderActive = document.querySelector('.builder-active');
20506
+ builder.applyBehaviorOn(builderActive);
19967
20507
  columnTool.position(cell);
19968
20508
  cell.click(); //refresh active cell/row
19969
20509
 
@@ -20467,8 +21007,10 @@ class Grid {
20467
21007
  cols = dom$A.elementChildren(row);
20468
21008
  cols.forEach(col => {
20469
21009
  dom$A.removeClass(col, 'cell-active');
20470
- });
20471
- builder.applyBehavior();
21010
+ }); //re-add tool
21011
+
21012
+ let builderActive = document.querySelector('.builder-active');
21013
+ builder.applyBehaviorOn(builderActive);
20472
21014
  this.rowTool.position(rowElement);
20473
21015
  this.builder.opts.onChange();
20474
21016
  } // Utilities
@@ -20497,10 +21039,9 @@ class RowTool$1 {
20497
21039
  }
20498
21040
 
20499
21041
  position(row) {
20500
- const util = new Util(this.builder);
20501
- const builderstuff = util.builderStuff();
21042
+ const builderStuff = this.builder.builderStuff;
20502
21043
  let rowTool = row.querySelector('.is-row-tool');
20503
- let rowMore = builderstuff.querySelector('.rowmore');
21044
+ let rowMore = builderStuff.querySelector('.rowmore');
20504
21045
  dom$A.addClass(rowMore, 'transition1');
20505
21046
  const elm = rowTool.querySelector('.row-more');
20506
21047
  const top = elm.getBoundingClientRect().top + window.pageYOffset;
@@ -20537,10 +21078,9 @@ class ColumnTool$1 {
20537
21078
  }
20538
21079
 
20539
21080
  position(col) {
20540
- const util = new Util(this.builder);
20541
- const builderstuff = util.builderStuff();
20542
- this.columnTool = builderstuff.querySelector('.is-column-tool');
20543
- this.columnMore = builderstuff.querySelector('.columnmore');
21081
+ const builderStuff = this.builder.builderStuff;
21082
+ this.columnTool = builderStuff.querySelector('.is-column-tool');
21083
+ this.columnMore = builderStuff.querySelector('.columnmore');
20544
21084
  dom$A.addClass(this.columnMore, 'transition1');
20545
21085
  setTimeout(() => {
20546
21086
  this.columnTool.style.top = col.getBoundingClientRect().top - 29 + window.pageYOffset + 'px';
@@ -20556,17 +21096,15 @@ class ColumnTool$1 {
20556
21096
  }
20557
21097
 
20558
21098
  hide() {
20559
- const util = new Util(this.builder);
20560
- const builderstuff = util.builderStuff();
20561
- this.columnTool = builderstuff.querySelector('.is-column-tool'); // this.columnMore = builderstuff.querySelector('.columnmore');
21099
+ const builderStuff = this.builder.builderStuff;
21100
+ this.columnTool = builderStuff.querySelector('.is-column-tool'); // this.columnMore = builderStuff.querySelector('.columnmore');
20562
21101
 
20563
21102
  dom$A.removeClass(this.columnTool, 'active');
20564
21103
  }
20565
21104
 
20566
21105
  show() {
20567
- const util = new Util(this.builder);
20568
- const builderstuff = util.builderStuff();
20569
- this.columnTool = builderstuff.querySelector('.is-column-tool'); // this.columnMore = builderstuff.querySelector('.columnmore');
21106
+ const builderStuff = this.builder.builderStuff;
21107
+ this.columnTool = builderStuff.querySelector('.is-column-tool'); // this.columnMore = builderStuff.querySelector('.columnmore');
20570
21108
 
20571
21109
  dom$A.addClass(this.columnTool, 'active');
20572
21110
  }
@@ -20689,7 +21227,8 @@ class Draggable$1 {
20689
21227
  const dom$z = new Dom();
20690
21228
 
20691
21229
  const renderGridEditor = builder => {
20692
- const util = new Util(builder);
21230
+ const util = builder.util;
21231
+ const builderStuff = builder.builderStuff;
20693
21232
  const grid = new Grid(builder);
20694
21233
  const htmlutil = new HtmlUtil(builder);
20695
21234
  let rowhtmlbutton = '';
@@ -20736,8 +21275,7 @@ const renderGridEditor = builder => {
20736
21275
  </div>`; //LATER:
20737
21276
  //<button title="${util.out('Element Tool')}" class="cell-elmtool"><svg class="is-icon-flex" style="width:12px;height:12px;"><use xlink:href="#ion-ios-gear"></use></svg></button>
20738
21277
 
20739
- const builderstuff = util.builderStuff();
20740
- dom$z.appendHtml(builderstuff, html);
21278
+ dom$z.appendHtml(builderStuff, html);
20741
21279
  new Draggable$1({
20742
21280
  selector: '.is-draggable'
20743
21281
  });
@@ -24012,8 +24550,8 @@ Sortable.mount(Remove, Revert);
24012
24550
  const dom$x = new Dom();
24013
24551
 
24014
24552
  const renderSnippetPanel = builder => {
24015
- const util = new Util(builder);
24016
- const builderStuff = util.builderStuff();
24553
+ const util = builder.util;
24554
+ const builderStuff = builder.builderStuff;
24017
24555
  let hideHandle = '';
24018
24556
  let sidePanel = builder.opts.sidePanel;
24019
24557
 
@@ -47341,9 +47879,9 @@ const dom$w = new Dom();
47341
47879
  class Image {
47342
47880
  constructor(builder) {
47343
47881
  this.builder = builder;
47344
- const util = new Util(builder);
47882
+ const util = this.builder.util;
47883
+ const builderStuff = this.builder.builderStuff;
47345
47884
  this.util = util;
47346
- const builderStuff = util.builderStuff();
47347
47885
  let imageTool = builderStuff.querySelector('#divImageTool');
47348
47886
  let imageResizer;
47349
47887
 
@@ -49536,8 +50074,8 @@ const dom$v = new Dom();
49536
50074
  class Hyperlink {
49537
50075
  constructor(builder) {
49538
50076
  this.builder = builder;
49539
- const util = new Util(builder);
49540
- const builderStuff = util.builderStuff();
50077
+ const util = this.builder.util;
50078
+ const builderStuff = this.builder.builderStuff;
49541
50079
  this.builderStuff = builderStuff;
49542
50080
  let linkTool = builderStuff.querySelector('#divLinkTool');
49543
50081
 
@@ -50090,9 +50628,9 @@ const dom$u = new Dom();
50090
50628
  class Spacer {
50091
50629
  constructor(builder) {
50092
50630
  this.builder = builder;
50093
- const util = new Util(builder);
50631
+ const util = this.builder.util;
50632
+ const builderStuff = this.builder.builderStuff;
50094
50633
  this.util = util;
50095
- const builderStuff = util.builderStuff();
50096
50634
  this.builderStuff = builderStuff;
50097
50635
  let spacerTool = builderStuff.querySelector('.is-spacer-tool');
50098
50636
 
@@ -50256,9 +50794,9 @@ const dom$t = new Dom();
50256
50794
  class Module {
50257
50795
  constructor(builder) {
50258
50796
  this.builder = builder;
50259
- const util = new Util(builder);
50797
+ const util = this.builder.util;
50798
+ const builderStuff = this.builder.builderStuff;
50260
50799
  this.util = util;
50261
- const builderStuff = util.builderStuff();
50262
50800
  this.builderStuff = builderStuff;
50263
50801
  let moduleTool = builderStuff.querySelector('.is-module-tool');
50264
50802
  let moduleModal;
@@ -50445,7 +50983,8 @@ class Module {
50445
50983
 
50446
50984
  i++;
50447
50985
  });
50448
- this.builder.applyBehavior(); //Trigger Change event
50986
+ let builderActive = document.querySelector('.builder-active');
50987
+ if (builderActive) this.builder.applyBehaviorOn(builderActive); //Trigger Change event
50449
50988
 
50450
50989
  this.builder.opts.onChange(); //Trigger Render event
50451
50990
 
@@ -50501,12 +51040,12 @@ const dom$s = new Dom();
50501
51040
  class Code {
50502
51041
  constructor(builder) {
50503
51042
  this.builder = builder;
50504
- const util = new Util(builder);
51043
+ const util = this.builder.util;
51044
+ const builderStuff = this.builder.builderStuff;
50505
51045
  this.util = util;
51046
+ this.builderStuff = builderStuff;
50506
51047
  const htmlUtil = new HtmlUtil(builder);
50507
51048
  this.htmlUtil = htmlUtil;
50508
- const builderStuff = util.builderStuff();
50509
- this.builderStuff = builderStuff;
50510
51049
  let codeTool = builderStuff.querySelector('.is-code-tool');
50511
51050
 
50512
51051
  if (!codeTool) {
@@ -50627,7 +51166,8 @@ class Code {
50627
51166
  var range = document.createRange();
50628
51167
  range.setStart(codeblock, 0);
50629
51168
  codeblock.appendChild(range.createContextualFragment(html));
50630
- this.builder.applyBehavior(); //Trigger Change event
51169
+ let builderActive = document.querySelector('.builder-active');
51170
+ if (builderActive) this.builder.applyBehaviorOn(builderActive); //Trigger Change event
50631
51171
 
50632
51172
  this.builder.opts.onChange(); //Trigger Render event
50633
51173
 
@@ -50702,9 +51242,9 @@ const dom$r = new Dom();
50702
51242
  class Iframe {
50703
51243
  constructor(builder) {
50704
51244
  this.builder = builder;
50705
- const util = new Util(builder);
51245
+ const util = this.builder.util;
51246
+ const builderStuff = this.builder.builderStuff;
50706
51247
  this.util = util;
50707
- const builderStuff = util.builderStuff();
50708
51248
  this.builderStuff = builderStuff;
50709
51249
  let iframeTool = builderStuff.querySelector('.is-iframe-tool');
50710
51250
  let iframeModal;
@@ -50792,7 +51332,8 @@ class Iframe {
50792
51332
  }
50793
51333
 
50794
51334
  this.builder.activeIframe = iframeParent.querySelector('iframe');
50795
- this.builder.applyBehavior(); //Trigger Change event
51335
+ let builderActive = document.querySelector('.builder-active');
51336
+ if (builderActive) this.builder.applyBehaviorOn(builderActive); //Trigger Change event
50796
51337
 
50797
51338
  this.builder.opts.onChange();
50798
51339
  }
@@ -50844,9 +51385,9 @@ const dom$q = new Dom();
50844
51385
  class Table {
50845
51386
  constructor(builder) {
50846
51387
  this.builder = builder;
50847
- const util = new Util(builder);
51388
+ const util = this.builder.util;
51389
+ const builderStuff = this.builder.builderStuff;
50848
51390
  this.util = util;
50849
- const builderStuff = util.builderStuff();
50850
51391
  this.builderStuff = builderStuff;
50851
51392
  let tableTool = builderStuff.querySelector('.is-table-tool');
50852
51393
  let tableModal;
@@ -51359,9 +51900,9 @@ const dom$p = new Dom();
51359
51900
  class Video {
51360
51901
  constructor(builder) {
51361
51902
  this.builder = builder;
51362
- const util = new Util(builder);
51363
- this.util = util;
51903
+ const util = this.builder.util;
51364
51904
  const builderStuff = this.builder.builderStuff;
51905
+ this.util = util;
51365
51906
  this.builderStuff = builderStuff;
51366
51907
  let videoTool = builderStuff.querySelector('.is-video-tool');
51367
51908
 
@@ -51578,8 +52119,10 @@ const dom$o = new Dom();
51578
52119
  class Element$1 {
51579
52120
  constructor(builder) {
51580
52121
  this.builder = builder;
51581
- const util = new Util(builder);
52122
+ const util = this.builder.util;
52123
+ const builderStuff = this.builder.builderStuff;
51582
52124
  this.util = util;
52125
+ this.builderStuff = builderStuff;
51583
52126
  this.hyperlink = new Hyperlink(builder);
51584
52127
  this.image = new Image(builder);
51585
52128
  this.spacer = new Spacer(builder);
@@ -51588,8 +52131,6 @@ class Element$1 {
51588
52131
  this.iframe = new Iframe(builder);
51589
52132
  this.table = new Table(builder);
51590
52133
  this.video = new Video(builder);
51591
- const builderStuff = util.builderStuff();
51592
- this.builderStuff = builderStuff;
51593
52134
  window.addEventListener('keydown', e => {
51594
52135
  if (e.keyCode === 46) {
51595
52136
  //delete
@@ -51852,11 +52393,11 @@ const dom$n = new Dom();
51852
52393
  class RowTool {
51853
52394
  constructor(builder) {
51854
52395
  this.builder = builder;
52396
+ const util = this.builder.util;
52397
+ const builderStuff = this.builder.builderStuff;
51855
52398
  this.grid = new Grid(builder);
51856
- const util = new Util(this.builder);
51857
52399
  const htmlutil = new HtmlUtil(builder);
51858
- const builderstuff = util.builderStuff();
51859
- let rowMore = builderstuff.querySelector('.rowmore');
52400
+ let rowMore = builderStuff.querySelector('.rowmore');
51860
52401
  let htmlbutton = '';
51861
52402
  if (builder.opts.rowHtmlEditor) htmlbutton = `<button type="button" title="${util.out('HTML')}" class="row-html">
51862
52403
  <span><svg class="is-icon-flex" style="margin-right:-3px;width:12px;height:12px;"><use xlink:href="#ion-ios-arrow-left"></use></svg><svg class="is-icon-flex" style="margin-left:-2px;width:12px;height:12px;"><use xlink:href="#ion-ios-arrow-right"></use></svg></span>${util.out('HTML')}
@@ -51871,8 +52412,8 @@ class RowTool {
51871
52412
  ${htmlbutton}
51872
52413
  </div>
51873
52414
  </div>`;
51874
- dom$n.appendHtml(builderstuff, html);
51875
- rowMore = builderstuff.querySelector('.rowmore');
52415
+ dom$n.appendHtml(builderStuff, html);
52416
+ rowMore = builderStuff.querySelector('.rowmore');
51876
52417
  let elm = rowMore.querySelector('.row-up');
51877
52418
  if (elm) dom$n.addEventListener(elm, 'click', () => {
51878
52419
  this.grid.moveRowUp();
@@ -51917,8 +52458,8 @@ class RowTool {
51917
52458
  }
51918
52459
 
51919
52460
  render(row) {
51920
- const util = new Util(this.builder);
51921
- const builderstuff = util.builderStuff();
52461
+ const util = this.builder.util;
52462
+ const builderStuff = this.builder.builderStuff;
51922
52463
  let rowMore = this.rowMore;
51923
52464
  let rowtool = row.querySelector('.is-row-tool');
51924
52465
 
@@ -51939,7 +52480,7 @@ class RowTool {
51939
52480
  });
51940
52481
  let elm = rowtool.querySelector('.row-grideditor');
51941
52482
  if (elm) dom$n.addEventListener(elm, 'click', () => {
51942
- const grideditor = builderstuff.querySelector('.grideditor');
52483
+ const grideditor = builderStuff.querySelector('.grideditor');
51943
52484
 
51944
52485
  if (dom$n.hasClass(grideditor, 'active')) {
51945
52486
  dom$n.removeClass(grideditor, 'active');
@@ -51987,7 +52528,7 @@ class RowTool {
51987
52528
 
51988
52529
  dom$n.removeClass(row, 'row-outline'); //Hide Column tool
51989
52530
 
51990
- let columnTool = builderstuff.querySelector('.is-column-tool');
52531
+ let columnTool = builderStuff.querySelector('.is-column-tool');
51991
52532
  dom$n.removeClass(columnTool, 'active');
51992
52533
  const elm = rowtool.querySelector('.row-more');
51993
52534
  const top = elm.getBoundingClientRect().top + window.pageYOffset;
@@ -52041,7 +52582,7 @@ class RowAddTool {
52041
52582
  }
52042
52583
 
52043
52584
  render(row) {
52044
- const util = new Util(this.builder);
52585
+ const util = this.builder.util;
52045
52586
  const quickadd = renderQuickAdd(this.builder);
52046
52587
  let rowaddtool = row.querySelector('.is-rowadd-tool');
52047
52588
 
@@ -53756,9 +54297,9 @@ class ColumnTool {
53756
54297
  constructor(builder) {
53757
54298
  this.builder = builder;
53758
54299
  this.grid = new Grid(builder);
53759
- const util = new Util(builder);
54300
+ const util = this.builder.util;
54301
+ const builderStuff = this.builder.builderStuff;
53760
54302
  this.util = util;
53761
- const builderStuff = util.builderStuff();
53762
54303
  let columnTool = builderStuff.querySelector('.is-column-tool');
53763
54304
  let columnMore;
53764
54305
  let htmlbutton = '';
@@ -55187,9 +55728,9 @@ const dom$k = new Dom();
55187
55728
  class ELementStyleEditor {
55188
55729
  constructor(builder) {
55189
55730
  this.builder = builder;
55190
- const util = new Util(builder);
55731
+ const util = this.builder.util;
55732
+ const builderStuff = this.builder.builderStuff;
55191
55733
  this.util = util;
55192
- const builderStuff = util.builderStuff();
55193
55734
  this.builderStuff = builderStuff;
55194
55735
  let modalStyles = builderStuff.querySelector('.editstyles');
55195
55736
 
@@ -55307,9 +55848,9 @@ const dom$j = new Dom();
55307
55848
  class ElementBoxStyles {
55308
55849
  constructor(builder) {
55309
55850
  this.builder = builder;
55310
- const util = new Util(builder);
55851
+ const util = this.builder.util;
55852
+ const builderStuff = this.builder.builderStuff;
55311
55853
  this.util = util;
55312
- const builderStuff = util.builderStuff();
55313
55854
  this.builderStuff = builderStuff;
55314
55855
  const elementStyleEditor = new ELementStyleEditor(builder);
55315
55856
  let panelStuff = builderStuff.querySelector('#divElementBox');
@@ -55825,9 +56366,9 @@ const dom$i = new Dom();
55825
56366
  class ElementSpacingStyles {
55826
56367
  constructor(builder) {
55827
56368
  this.builder = builder;
55828
- const util = new Util(builder);
56369
+ const util = this.builder.util;
56370
+ const builderStuff = this.builder.builderStuff;
55829
56371
  this.util = util;
55830
- const builderStuff = util.builderStuff();
55831
56372
  this.builderStuff = builderStuff;
55832
56373
  const elementStyleEditor = new ELementStyleEditor(builder);
55833
56374
  let panelStuff = builderStuff.querySelector('#divElementSpacing');
@@ -56478,9 +57019,9 @@ const dom$h = new Dom();
56478
57019
  class ElementBorderStyles {
56479
57020
  constructor(builder) {
56480
57021
  this.builder = builder;
56481
- const util = new Util(builder);
57022
+ const util = this.builder.util;
57023
+ const builderStuff = this.builder.builderStuff;
56482
57024
  this.util = util;
56483
- const builderStuff = util.builderStuff();
56484
57025
  this.builderStuff = builderStuff;
56485
57026
  const elementStyleEditor = new ELementStyleEditor(builder);
56486
57027
  let panelStuff = builderStuff.querySelector('#divElementBorder');
@@ -57200,9 +57741,9 @@ const dom$g = new Dom();
57200
57741
  class ElementTextStyles {
57201
57742
  constructor(builder) {
57202
57743
  this.builder = builder;
57203
- const util = new Util(builder);
57744
+ const util = this.builder.util;
57745
+ const builderStuff = this.builder.builderStuff;
57204
57746
  this.util = util;
57205
- const builderStuff = util.builderStuff();
57206
57747
  this.builderStuff = builderStuff;
57207
57748
  const elementStyleEditor = new ELementStyleEditor(builder);
57208
57749
  let panelStuff = builderStuff.querySelector('#divElementText');
@@ -57721,9 +58262,9 @@ const dom$f = new Dom();
57721
58262
  class ElementCornerStyles {
57722
58263
  constructor(builder) {
57723
58264
  this.builder = builder;
57724
- const util = new Util(builder);
58265
+ const util = this.builder.util;
58266
+ const builderStuff = this.builder.builderStuff;
57725
58267
  this.util = util;
57726
- const builderStuff = util.builderStuff();
57727
58268
  this.builderStuff = builderStuff;
57728
58269
  const elementStyleEditor = new ELementStyleEditor(builder);
57729
58270
  let panelStuff = builderStuff.querySelector('#divElementCorner');
@@ -57916,9 +58457,9 @@ const dom$e = new Dom();
57916
58457
  class ElementShadowStyles {
57917
58458
  constructor(builder) {
57918
58459
  this.builder = builder;
57919
- const util = new Util(builder);
58460
+ const util = this.builder.util;
58461
+ const builderStuff = this.builder.builderStuff;
57920
58462
  this.util = util;
57921
- const builderStuff = util.builderStuff();
57922
58463
  this.builderStuff = builderStuff;
57923
58464
  const elementStyleEditor = new ELementStyleEditor(builder);
57924
58465
  let panelStuff = builderStuff.querySelector('#divElementShadow');
@@ -58179,9 +58720,9 @@ const dom$d = new Dom();
58179
58720
  class ElementDisplayStyles {
58180
58721
  constructor(builder) {
58181
58722
  this.builder = builder;
58182
- const util = new Util(builder);
58723
+ const util = this.builder.util;
58724
+ const builderStuff = this.builder.builderStuff;
58183
58725
  this.util = util;
58184
- const builderStuff = util.builderStuff();
58185
58726
  this.builderStuff = builderStuff;
58186
58727
  const elementStyleEditor = new ELementStyleEditor(builder);
58187
58728
  let panelStuff = builderStuff.querySelector('#divElementDisplay');
@@ -58370,9 +58911,9 @@ const dom$c = new Dom();
58370
58911
  class ElementPositionStyles {
58371
58912
  constructor(builder) {
58372
58913
  this.builder = builder;
58373
- const util = new Util(builder);
58914
+ const util = this.builder.util;
58915
+ const builderStuff = this.builder.builderStuff;
58374
58916
  this.util = util;
58375
- const builderStuff = util.builderStuff();
58376
58917
  this.builderStuff = builderStuff;
58377
58918
  const elementStyleEditor = new ELementStyleEditor(builder);
58378
58919
  let panelStuff = builderStuff.querySelector('#divElementPosition');
@@ -58709,9 +59250,9 @@ const dom$b = new Dom();
58709
59250
  class ElementEffectStyles {
58710
59251
  constructor(builder) {
58711
59252
  this.builder = builder;
58712
- const util = new Util(builder);
59253
+ const util = this.builder.util;
59254
+ const builderStuff = this.builder.builderStuff;
58713
59255
  this.util = util;
58714
- const builderStuff = util.builderStuff();
58715
59256
  this.builderStuff = builderStuff;
58716
59257
  const elementStyleEditor = new ELementStyleEditor(builder);
58717
59258
  let panelStuff = builderStuff.querySelector('#divElementEffect');
@@ -59264,9 +59805,9 @@ const dom$a = new Dom();
59264
59805
  class ElementAttributeStyles {
59265
59806
  constructor(builder) {
59266
59807
  this.builder = builder;
59267
- const util = new Util(builder);
59808
+ const util = this.builder.util;
59809
+ const builderStuff = this.builder.builderStuff;
59268
59810
  this.util = util;
59269
- const builderStuff = util.builderStuff();
59270
59811
  this.builderStuff = builderStuff;
59271
59812
  let panelStuff = builderStuff.querySelector('#divElementAttribute');
59272
59813
  this.panelStuff = panelStuff;
@@ -59408,9 +59949,9 @@ const dom$9 = new Dom();
59408
59949
  class ElementAnimationStyles {
59409
59950
  constructor(builder) {
59410
59951
  this.builder = builder;
59411
- const util = new Util(builder);
59952
+ const util = this.builder.util;
59953
+ const builderStuff = this.builder.builderStuff;
59412
59954
  this.util = util;
59413
- const builderStuff = util.builderStuff();
59414
59955
  this.builderStuff = builderStuff;
59415
59956
  let panelStuff = builderStuff.querySelector('#divElementAnimation');
59416
59957
  this.panelStuff = panelStuff;
@@ -59659,9 +60200,9 @@ let arrElms = [];
59659
60200
  class ElementPanel {
59660
60201
  constructor(builder) {
59661
60202
  this.builder = builder;
59662
- const util = new Util(builder);
60203
+ const util = this.builder.util;
60204
+ const builderStuff = this.builder.builderStuff;
59663
60205
  this.util = util;
59664
- const builderStuff = util.builderStuff();
59665
60206
  this.builderStuff = builderStuff;
59666
60207
  let panel = builderStuff.querySelector('.elementstyles');
59667
60208
 
@@ -59888,13 +60429,14 @@ const dom$7 = new Dom();
59888
60429
  class ElementTool {
59889
60430
  constructor(builder) {
59890
60431
  this.builder = builder;
59891
- const util = new Util(builder);
60432
+ const util = this.builder.util;
60433
+ const builderStuff = this.builder.builderStuff;
59892
60434
  this.util = util;
60435
+ this.builderStuff = builderStuff;
59893
60436
  const elementPanel = new ElementPanel(builder);
59894
60437
  this.elementPanel = elementPanel;
59895
- const builderstuff = util.builderStuff();
59896
- let elementTool = builderstuff.querySelector('.is-element-tool');
59897
- let elementMore = builderstuff.querySelector('.elmmore');
60438
+ let elementTool = builderStuff.querySelector('.is-element-tool');
60439
+ let elementMore = builderStuff.querySelector('.elmmore');
59898
60440
 
59899
60441
  if (!elementTool) {
59900
60442
  let html = `<div class="is-tool is-element-tool">
@@ -59914,9 +60456,9 @@ class ElementTool {
59914
60456
  </div>
59915
60457
  </div>
59916
60458
  `;
59917
- dom$7.appendHtml(builderstuff, html);
59918
- elementTool = builderstuff.querySelector('.is-element-tool');
59919
- elementMore = builderstuff.querySelector('.elmmore'); // Prepare for tooltip
60459
+ dom$7.appendHtml(builderStuff, html);
60460
+ elementTool = builderStuff.querySelector('.is-element-tool');
60461
+ elementMore = builderStuff.querySelector('.elmmore'); // Prepare for tooltip
59920
60462
 
59921
60463
  let elms = elementTool.querySelectorAll('[title]');
59922
60464
  Array.prototype.forEach.call(elms, elm => {
@@ -60002,14 +60544,14 @@ class ElementTool {
60002
60544
 
60003
60545
  if (cell.childElementCount === 0 && row.childElementCount === 3) {
60004
60546
  row.parentNode.removeChild(row);
60005
- let columnTool = builderstuff.querySelector('.is-column-tool'); // quick access
60547
+ let columnTool = builderStuff.querySelector('.is-column-tool'); // quick access
60006
60548
 
60007
60549
  dom$7.removeClass(columnTool, 'active');
60008
60550
  util.checkEmpty();
60009
60551
  } else if (cell.childElementCount === 0) {
60010
60552
  row.removeChild(cell);
60011
60553
  util.fixLayout(row, builder);
60012
- let columnTool = builderstuff.querySelector('.is-column-tool'); // // quick access
60554
+ let columnTool = builderStuff.querySelector('.is-column-tool'); // // quick access
60013
60555
 
60014
60556
  dom$7.removeClass(columnTool, 'active');
60015
60557
  }
@@ -60135,7 +60677,8 @@ class ElementTool {
60135
60677
  setTimeout(() => {
60136
60678
  newelm.click();
60137
60679
  this.position(newelm);
60138
- this.builder.applyBehavior(); //Trigger Change event
60680
+ let builderActive = document.querySelector('.builder-active');
60681
+ if (builderActive) this.builder.applyBehaviorOn(builderActive); //Trigger Change event
60139
60682
 
60140
60683
  this.builder.opts.onChange();
60141
60684
  }, 100); //Timeout needed by Safari
@@ -60414,8 +60957,8 @@ const dom$6 = new Dom();
60414
60957
  class Preferences {
60415
60958
  constructor(builder) {
60416
60959
  this.builder = builder;
60417
- const util = new Util(builder);
60418
- const builderstuff = util.builderStuff();
60960
+ const util = this.builder.util;
60961
+ const builderStuff = this.builder.builderStuff;
60419
60962
  let htmlThemes = '';
60420
60963
 
60421
60964
  if (this.builder.themes) {
@@ -60435,7 +60978,7 @@ class Preferences {
60435
60978
  htmlThemes += '</div>';
60436
60979
  }
60437
60980
 
60438
- let config = builderstuff.querySelector('.viewconfig');
60981
+ let config = builderStuff.querySelector('.viewconfig');
60439
60982
 
60440
60983
  if (!config) {
60441
60984
  let html = `<div class="is-modal viewconfig">
@@ -60561,8 +61104,8 @@ class Preferences {
60561
61104
  </div>
60562
61105
  </div>
60563
61106
  </div>`;
60564
- dom$6.appendHtml(builderstuff, html);
60565
- config = builderstuff.querySelector('.viewconfig');
61107
+ dom$6.appendHtml(builderStuff, html);
61108
+ config = builderStuff.querySelector('.viewconfig');
60566
61109
 
60567
61110
  if (!(builder.opts.snippetList === '#divSnippetList' && builder.opts.snippetJSON.snippets.length > 0)) {
60568
61111
  config.querySelector('.option-opensnippets').style.display = 'none';
@@ -60727,9 +61270,9 @@ class Preferences {
60727
61270
  this.setColumnTool(true);
60728
61271
  this.setBuilderMode('');
60729
61272
  this.setEmailMode();
60730
- builderstuff.querySelector('#divHideCellTool').style.display = 'none';
60731
- builderstuff.querySelector('#divOutlineMode').style.display = 'none';
60732
- builderstuff.querySelector('#divBuilderMode').style.display = 'none';
61273
+ builderStuff.querySelector('#divHideCellTool').style.display = 'none';
61274
+ builderStuff.querySelector('#divOutlineMode').style.display = 'none';
61275
+ builderStuff.querySelector('#divBuilderMode').style.display = 'none';
60733
61276
  }
60734
61277
  }
60735
61278
 
@@ -60912,23 +61455,23 @@ class Preferences {
60912
61455
  }
60913
61456
 
60914
61457
  setToolbar(toolbar) {
60915
- let builderstuff = document.querySelector('#_cbhtml');
61458
+ const builderStuff = this.builder.builderStuff;
60916
61459
 
60917
61460
  if (toolbar === 'top') {
60918
- builderstuff.removeAttribute('toolbarleft', '');
60919
- builderstuff.removeAttribute('toolbarright', '');
61461
+ builderStuff.removeAttribute('toolbarleft', '');
61462
+ builderStuff.removeAttribute('toolbarright', '');
60920
61463
  } else if (toolbar === 'left') {
60921
- builderstuff.setAttribute('toolbarleft', '');
60922
- builderstuff.removeAttribute('toolbarright', '');
61464
+ builderStuff.setAttribute('toolbarleft', '');
61465
+ builderStuff.removeAttribute('toolbarright', '');
60923
61466
  } else if (toolbar === 'right') {
60924
- builderstuff.setAttribute('toolbarright', '');
60925
- builderstuff.removeAttribute('toolbarleft', '');
61467
+ builderStuff.setAttribute('toolbarright', '');
61468
+ builderStuff.removeAttribute('toolbarleft', '');
60926
61469
  } // this.positionToolbar();
60927
61470
 
60928
61471
 
60929
- const rteTool = builderstuff.querySelector('.is-rte-tool');
60930
- const rteMoreOptions = builderstuff.querySelector('.rte-more-options');
60931
- const elementRteMoreOptions = builderstuff.querySelector('.elementrte-more-options');
61472
+ const rteTool = builderStuff.querySelector('.is-rte-tool');
61473
+ const rteMoreOptions = builderStuff.querySelector('.rte-more-options');
61474
+ const elementRteMoreOptions = builderStuff.querySelector('.elementrte-more-options');
60932
61475
  if (rteTool) this.builder.rte.positionToolbar();
60933
61476
 
60934
61477
  if (rteMoreOptions) {
@@ -60940,14 +61483,14 @@ class Preferences {
60940
61483
  }
60941
61484
 
60942
61485
  setEmailMode() {
60943
- let builderstuff = document.querySelector('#_cbhtml');
60944
- builderstuff.setAttribute('emailmode', '');
61486
+ const builderStuff = this.builder.builderStuff;
61487
+ builderStuff.setAttribute('emailmode', '');
60945
61488
  }
60946
61489
  /*
60947
61490
  positionToolbar() { // direct
60948
- let builderstuff = document.querySelector('#_cbhtml');
60949
- const rteTool = builderstuff.querySelector('.is-rte-tool');
60950
- const rteMoreOptions = builderstuff.querySelector('.rte-more-options');
61491
+ let builderStuff = document.querySelector('#_cbhtml');
61492
+ const rteTool = builderStuff.querySelector('.is-rte-tool');
61493
+ const rteMoreOptions = builderStuff.querySelector('.rte-more-options');
60951
61494
  if(rteTool){ // check in case rte stuff hasn't rendered yet
60952
61495
  const viewportWidth = window.innerWidth;
60953
61496
  const viewportHeight = window.innerHeight;
@@ -60978,19 +61521,19 @@ class Preferences {
60978
61521
  }
60979
61522
  }
60980
61523
  setToolbarDisplay(toolbardisplay) {
60981
- let builderstuff = document.querySelector('#_cbhtml');
61524
+ let builderStuff = document.querySelector('#_cbhtml');
60982
61525
  if(toolbardisplay==='auto'){
60983
- builderstuff.removeAttribute('toolbarstay','');
61526
+ builderStuff.removeAttribute('toolbarstay','');
60984
61527
  // direct
60985
- const rteTool = builderstuff.querySelector('.is-rte-tool');
61528
+ const rteTool = builderStuff.querySelector('.is-rte-tool');
60986
61529
  if(rteTool) { // check in case rte stuff hasn't rendered yet
60987
61530
  rteTool.style.display = '';
60988
61531
  }
60989
61532
  } else {
60990
- builderstuff.setAttribute('toolbarstay','');
61533
+ builderStuff.setAttribute('toolbarstay','');
60991
61534
  // direct
60992
61535
  const viewportWidth = window.innerWidth;
60993
- const rteTool = builderstuff.querySelector('.is-rte-tool');
61536
+ const rteTool = builderStuff.querySelector('.is-rte-tool');
60994
61537
  if(rteTool) { // check in case rte stuff hasn't rendered yet
60995
61538
  let w = rteTool.offsetWidth;
60996
61539
  let left = (viewportWidth/2) - (w/2);
@@ -61002,12 +61545,12 @@ class Preferences {
61002
61545
 
61003
61546
 
61004
61547
  setElementTool(hideelementtool) {
61005
- let builderstuff = document.querySelector('#_cbhtml');
61548
+ const builderStuff = this.builder.builderStuff;
61006
61549
 
61007
61550
  if (hideelementtool) {
61008
- builderstuff.setAttribute('hideelementtool', '');
61551
+ builderStuff.setAttribute('hideelementtool', '');
61009
61552
  } else {
61010
- builderstuff.removeAttribute('hideelementtool', '');
61553
+ builderStuff.removeAttribute('hideelementtool', '');
61011
61554
  }
61012
61555
  }
61013
61556
 
@@ -61034,12 +61577,12 @@ class Preferences {
61034
61577
  }
61035
61578
 
61036
61579
  setColumnTool(hidecolumntool) {
61037
- let builderstuff = document.querySelector('#_cbhtml');
61580
+ const builderStuff = this.builder.builderStuff;
61038
61581
 
61039
61582
  if (hidecolumntool) {
61040
- builderstuff.setAttribute('hidecolumntool', '');
61583
+ builderStuff.setAttribute('hidecolumntool', '');
61041
61584
  } else {
61042
- builderstuff.removeAttribute('hidecolumntool', '');
61585
+ builderStuff.removeAttribute('hidecolumntool', '');
61043
61586
  }
61044
61587
  }
61045
61588
 
@@ -61055,15 +61598,15 @@ class Preferences {
61055
61598
  }
61056
61599
 
61057
61600
  setToolStyle(toolStyle) {
61058
- let builderstuff = document.querySelector('#_cbhtml');
61601
+ const builderStuff = this.builder.builderStuff;
61059
61602
  const builders = document.querySelectorAll(this.builder.opts.container);
61060
61603
  Array.prototype.forEach.call(builders, builder => {
61061
61604
  if (toolStyle === 'gray') {
61062
61605
  builder.setAttribute('gray', '');
61063
- builderstuff.setAttribute('gray', '');
61606
+ builderStuff.setAttribute('gray', '');
61064
61607
  } else {
61065
61608
  builder.removeAttribute('gray');
61066
- builderstuff.removeAttribute('gray', '');
61609
+ builderStuff.removeAttribute('gray', '');
61067
61610
  }
61068
61611
  });
61069
61612
  }
@@ -61102,24 +61645,24 @@ class Preferences {
61102
61645
  }
61103
61646
 
61104
61647
  setBuilderMode(builderMode) {
61105
- let builderstuff = document.querySelector('#_cbhtml');
61648
+ const builderStuff = this.builder.builderStuff;
61106
61649
  const builders = document.querySelectorAll(this.builder.opts.container);
61107
61650
  Array.prototype.forEach.call(builders, builder => {
61108
61651
  if (builderMode === '') {
61109
61652
  builder.removeAttribute('minimal');
61110
61653
  builder.removeAttribute('clean');
61111
- builderstuff.removeAttribute('minimal');
61112
- builderstuff.removeAttribute('clean');
61654
+ builderStuff.removeAttribute('minimal');
61655
+ builderStuff.removeAttribute('clean');
61113
61656
  } else if (builderMode === 'minimal') {
61114
61657
  builder.setAttribute('minimal', '');
61115
61658
  builder.removeAttribute('clean');
61116
- builderstuff.setAttribute('minimal', '');
61117
- builderstuff.removeAttribute('clean');
61659
+ builderStuff.setAttribute('minimal', '');
61660
+ builderStuff.removeAttribute('clean');
61118
61661
  } else if (builderMode === 'clean') {
61119
61662
  builder.setAttribute('clean', '');
61120
61663
  builder.removeAttribute('minimal');
61121
- builderstuff.setAttribute('clean', '');
61122
- builderstuff.removeAttribute('minimal');
61664
+ builderStuff.setAttribute('clean', '');
61665
+ builderStuff.removeAttribute('minimal');
61123
61666
  }
61124
61667
  });
61125
61668
  }
@@ -61197,20 +61740,14 @@ class Preferences {
61197
61740
 
61198
61741
  }
61199
61742
 
61200
- /*
61201
- LATER:
61202
- - Get/show current font size, line height & letter spacing
61203
- - Click toggle button shows gray highlight
61204
- - Image di luar domain gak bisa di-edit (kasih warning)
61205
- */
61206
61743
  const dom$5 = new Dom();
61207
61744
 
61208
61745
  class Rte {
61209
61746
  constructor(builder) {
61210
61747
  this.builder = builder;
61211
- const util = new Util(builder);
61748
+ const util = this.builder.util;
61749
+ const builderStuff = this.builder.builderStuff;
61212
61750
  this.util = util;
61213
- const builderStuff = util.builderStuff();
61214
61751
  this.builderStuff = builderStuff;
61215
61752
  this.elementStyleEditor = new ELementStyleEditor(builder);
61216
61753
  this.hyperlink = new Hyperlink(builder);
@@ -62071,7 +62608,8 @@ class Rte {
62071
62608
  let fileToInsert = modalInsertImage.querySelector('#imgInsertImagePreview').getAttribute('data-filename');
62072
62609
  util.pasteHtmlAtCaret('<img data-filename="' + fileToInsert + '" src="' + val + '" alt="" />', false);
62073
62610
  util.hideModal(modalInsertImage);
62074
- this.builder.applyBehavior(); //save selection
62611
+ let builderActive = document.querySelector('.builder-active');
62612
+ if (builderActive) this.builder.applyBehaviorOn(builderActive); //save selection
62075
62613
 
62076
62614
  util.saveSelection(); //Trigger Change event
62077
62615
 
@@ -62270,8 +62808,9 @@ class Rte {
62270
62808
  let scale = val / 100;
62271
62809
  this.builder.opts.zoom = scale;
62272
62810
  localStorage.setItem('_zoom', scale); // Save
62811
+ // setZoomOnArea
62273
62812
 
62274
- this.builder.setZoom(); // hide tools
62813
+ this.builder.setZoomOnArea(); // hide tools
62275
62814
 
62276
62815
  let tools = this.builderStuff.querySelectorAll('.is-tool');
62277
62816
  Array.prototype.forEach.call(tools, tool => {
@@ -62297,7 +62836,18 @@ class Rte {
62297
62836
 
62298
62837
  this.rteZoomSlider.onchange = () => {
62299
62838
  setTimeout(() => {
62300
- // show & reposition
62839
+ // setZoomOnControl
62840
+ if (this.builder.opts.page !== '') {
62841
+ const wrapper = document.querySelector(this.builder.opts.page);
62842
+ this.builder.setZoomOnControl(wrapper);
62843
+ } else {
62844
+ const builders = document.querySelectorAll(this.builder.opts.container);
62845
+ builders.forEach(builder => {
62846
+ this.builder.setZoomOnControl(builder);
62847
+ });
62848
+ } // show & reposition
62849
+
62850
+
62301
62851
  this.builder.elmTool.repositionElementTool();
62302
62852
  let col = this.builder.activeCol;
62303
62853
  let tool = this.builderStuff.querySelector('.is-column-tool');
@@ -62448,8 +62998,10 @@ class Rte {
62448
62998
  dom$5.selectElementContents(elm);
62449
62999
  document.execCommand('italic', false, null);
62450
63000
  } else {
62451
- if (elm.style.fontStyle === 'italic') {
62452
- elm.style.fontStyle = '';
63001
+ let fontStyle = window.getComputedStyle(elm).getPropertyValue('font-style');
63002
+
63003
+ if (fontStyle === 'italic') {
63004
+ elm.style.fontStyle = 'normal';
62453
63005
  } else {
62454
63006
  elm.style.fontStyle = 'italic';
62455
63007
  }
@@ -62506,10 +63058,18 @@ class Rte {
62506
63058
  }
62507
63059
 
62508
63060
  if (command === 'uppercase') {
62509
- if (elm.style.textTransform === 'uppercase') {
62510
- elm.style.textTransform = '';
62511
- } else {
63061
+ let textTransform = window.getComputedStyle(elm).getPropertyValue('text-transform');
63062
+
63063
+ if (textTransform === 'uppercase') {
63064
+ elm.style.textTransform = 'lowercase';
63065
+ } else if (textTransform === 'lowercase') {
63066
+ elm.style.textTransform = 'capitalize';
63067
+ } else if (textTransform === 'capitalize') {
63068
+ elm.style.textTransform = 'none';
63069
+ } else if (textTransform === 'none') {
62512
63070
  elm.style.textTransform = 'uppercase';
63071
+ } else {
63072
+ elm.style.textTransform = 'none';
62513
63073
  }
62514
63074
  }
62515
63075
 
@@ -63044,23 +63604,51 @@ class Rte {
63044
63604
  } // var text = dom.getSelected();
63045
63605
 
63046
63606
 
63047
- this.builder.uo.saveForUndo();
63048
- let currentLineHeight = Number(window.getComputedStyle(elm).getPropertyValue('line-height').match(/\d+/)[0]);
63607
+ this.builder.uo.saveForUndo(); // let currentLineHeight = Number(window.getComputedStyle(elm).getPropertyValue('line-height').match(/\d+/)[0]);
63608
+
63609
+ let isInPx = false;
63610
+ let currentLineHeight = elm.style.lineHeight;
63611
+
63612
+ if (currentLineHeight) {
63613
+ if (currentLineHeight.indexOf('px') === -1) {
63614
+ currentLineHeight = parseFloat(currentLineHeight);
63615
+ } else {
63616
+ isInPx = true;
63617
+ }
63618
+ } else {
63619
+ isInPx = true;
63620
+ }
63621
+
63622
+ if (isInPx) {
63623
+ let fontSize = Number(window.getComputedStyle(elm).getPropertyValue('font-size').match(/\d+/)[0]);
63624
+ currentLineHeight = Number(window.getComputedStyle(elm).getPropertyValue('line-height').match(/\d+/)[0]);
63625
+
63626
+ if (fontSize > currentLineHeight) {
63627
+ currentLineHeight = fontSize / currentLineHeight;
63628
+ } else if (fontSize < currentLineHeight) {
63629
+ currentLineHeight = currentLineHeight / fontSize;
63630
+ } else {
63631
+ currentLineHeight = 1;
63632
+ }
63633
+ }
63634
+
63049
63635
  let lineheight;
63050
63636
 
63051
63637
  if (num === '+') {
63052
- lineheight = currentLineHeight + 1 + 'px';
63638
+ lineheight = currentLineHeight + 0.2;
63053
63639
  } else if (num === '-') {
63054
- lineheight = currentLineHeight - 1 + 'px';
63640
+ lineheight = currentLineHeight - 0.2;
63055
63641
  } else if (num === '') {
63056
63642
  lineheight = '';
63057
63643
  } else {
63058
63644
  lineheight = num;
63059
63645
  }
63646
+
63647
+ if (lineheight < 0.2) lineheight = 0.2; // prevent very small number
63648
+
63060
63649
  /** mod by Jack */
63061
63650
  //elm.style.lineHeight = lineheight;
63062
63651
 
63063
-
63064
63652
  dom$5.doFunction(elm, function (theEl) {
63065
63653
  theEl.style.lineHeight = lineheight;
63066
63654
  }, true); //save selection
@@ -65450,8 +66038,10 @@ const dom$3 = new Dom();
65450
66038
 
65451
66039
  class Tooltip {
65452
66040
  constructor(builder) {
65453
- const util = new Util(builder);
65454
- const builderStuff = util.builderStuff();
66041
+ this.builder = builder;
66042
+ const util = this.builder.util;
66043
+ const builderStuff = this.builder.builderStuff;
66044
+ this.util = util;
65455
66045
  this.builderStuff = builderStuff;
65456
66046
  let tooltip = builderStuff.querySelector('.is-tooltip');
65457
66047
 
@@ -65576,17 +66166,18 @@ const dom$2 = new Dom();
65576
66166
  class Lightbox {
65577
66167
  constructor(builder) {
65578
66168
  this.builder = builder;
65579
- const util = new Util(builder);
65580
- let builderStuff = document.querySelector('#_cbhtml'); // All editing controls will be placed within <div id="_cbhtml">...</div>
65581
-
65582
- if (!builderStuff) {
65583
- builderStuff = dom$2.createElement('div');
65584
- builderStuff.id = '_cbhtml';
65585
- builderStuff.className = 'is-ui';
65586
- dom$2.appendChild(document.body, builderStuff);
65587
- }
66169
+ const util = this.builder.util;
66170
+ const builderStuff = this.builder.builderStuff;
66171
+ this.util = util;
66172
+ this.builderStuff = builderStuff; // let builderStuff = document.querySelector('#_cbhtml'); // All editing controls will be placed within <div id="_cbhtml">...</div>
66173
+ // if(!builderStuff) {
66174
+ // builderStuff = dom.createElement('div');
66175
+ // builderStuff.id = '_cbhtml';
66176
+ // builderStuff.className = 'is-ui';
66177
+ // dom.appendChild(document.body, builderStuff);
66178
+ // }
66179
+ // this.builderStuff = builderStuff;
65588
66180
 
65589
- this.builderStuff = builderStuff;
65590
66181
  let html = `
65591
66182
  <div class="is-lightbox lightbox-externalvideo">
65592
66183
  <button class="cmd-lightbox-close" title="${util.out('Close')}" type="button" style="flex:none;position:absolute;top:0;right:0;background:none;z-index:1;">
@@ -66106,6 +66697,7 @@ class ContentBuilder {
66106
66697
  zoom: 1,
66107
66698
  useLightbox: false,
66108
66699
  imageRenameOnEdit: true,
66700
+ disableAutoEmbedVideo: false,
66109
66701
 
66110
66702
  /*
66111
66703
  onZoomStart: () => {
@@ -66277,10 +66869,6 @@ class ContentBuilder {
66277
66869
  const util = new Util(this); // General utilities
66278
66870
 
66279
66871
  this.util = util;
66280
- /** added by Jack */
66281
-
66282
- this.cbDom = new Dom(); // ---
66283
-
66284
66872
  this.isTouchSupport = util.isTouchSupport();
66285
66873
  this.isIE = util.detectIE();
66286
66874
 
@@ -66291,6 +66879,7 @@ class ContentBuilder {
66291
66879
  this.uoTm = null;
66292
66880
  this.uo = new UndoRedo(this);
66293
66881
  this.dom = dom$F;
66882
+ this.cbDom = dom$F;
66294
66883
  this.autoclean = false;
66295
66884
  this.filesAdded = '';
66296
66885
 
@@ -66313,9 +66902,19 @@ class ContentBuilder {
66313
66902
  this.preferences = new Preferences(this); // this will also call setUIColor() and getUIStyles() for theme
66314
66903
 
66315
66904
  renderGridEditor(this); // Render Grid Editor
66905
+ // Check if preview
66906
+ // Get all builder areas
66316
66907
 
66317
- if (this.opts.snippetJSON.snippets.length > 0) {
66318
- renderSnippetPanel(this); // Render Snippet Panel
66908
+ this.preview = false;
66909
+ const builders = document.querySelectorAll(this.opts.container);
66910
+ Array.prototype.forEach.call(builders, builder => {
66911
+ if (dom$F.hasClass(builder, 'preview')) this.preview = true;
66912
+ });
66913
+
66914
+ if (!this.preview) {
66915
+ if (this.opts.snippetJSON.snippets.length > 0) {
66916
+ renderSnippetPanel(this); // Render Snippet Panel
66917
+ }
66319
66918
  }
66320
66919
 
66321
66920
  this.colTool = new ColumnTool(this); // Render Column Tool
@@ -66346,26 +66945,28 @@ class ContentBuilder {
66346
66945
  this.rte = new Rte(this);
66347
66946
  this.tooltip = new Tooltip(this);
66348
66947
  this.lightbox = new Lightbox(this);
66349
- this.applyBehavior(); // Apply editing behavior on content (builder areas)
66948
+ if (!this.preview) this.applyBehavior(); // Apply editing behavior on content (builder areas)
66350
66949
  // Load plugins
66351
66950
 
66352
- if (this.opts.plugins.length > 0) {
66353
- // Option to load plugins without config.js => just use plugins param (and specify the pluginPath).
66354
- this.loadPlugins();
66355
- } else {
66356
- if (typeof this.opts.scriptPath === 'undefined' && this.opts.pluginPath === '') ; else {
66357
- // Backward compatibility
66358
- if (!this.opts.disableConfig) {
66359
- let scriptUrl = this.opts.scriptPath + 'config.js';
66360
- if (this.opts.pluginPath !== '') scriptUrl = this.opts.pluginPath + 'config.js'; // overide plugin location if pluginPath is specified
66361
-
66362
- this.loadScript(scriptUrl).then(() => {
66363
- if (this.opts.plugins.length > 0) {
66364
- this.loadPlugins();
66365
- }
66366
- }, () => {
66367
- console.log('Fail to load config');
66368
- });
66951
+ if (!this.preview) {
66952
+ if (this.opts.plugins.length > 0) {
66953
+ // Option to load plugins without config.js => just use plugins param (and specify the pluginPath).
66954
+ this.loadPlugins();
66955
+ } else {
66956
+ if (typeof this.opts.scriptPath === 'undefined' && this.opts.pluginPath === '') ; else {
66957
+ // Backward compatibility
66958
+ if (!this.opts.disableConfig) {
66959
+ let scriptUrl = this.opts.scriptPath + 'config.js';
66960
+ if (this.opts.pluginPath !== '') scriptUrl = this.opts.pluginPath + 'config.js'; // overide plugin location if pluginPath is specified
66961
+
66962
+ this.loadScript(scriptUrl).then(() => {
66963
+ if (this.opts.plugins.length > 0) {
66964
+ this.loadPlugins();
66965
+ }
66966
+ }, () => {
66967
+ console.log('Fail to load config');
66968
+ });
66969
+ }
66369
66970
  }
66370
66971
  }
66371
66972
  } // Tooltip (move to after plugins loaded)
@@ -66537,9 +67138,11 @@ class ContentBuilder {
66537
67138
  }
66538
67139
 
66539
67140
  setZoom() {
67141
+ // Complete (On Area + On Control)
66540
67142
  if (this.opts.page !== '') {
66541
67143
  const wrapper = document.querySelector(this.opts.page);
66542
67144
  wrapper.style.transform = `scale(${this.opts.zoom})`;
67145
+ this.setZoomOnControl(wrapper);
66543
67146
  } else {
66544
67147
  const builders = document.querySelectorAll(this.opts.container);
66545
67148
  builders.forEach(builder => {
@@ -66558,18 +67161,10 @@ class ContentBuilder {
66558
67161
  builder.style.transition = '';
66559
67162
  }, 300);
66560
67163
  }
67164
+
67165
+ this.setZoomOnControl(builder);
66561
67166
  });
66562
67167
  }
66563
-
66564
- const rowtools = document.querySelectorAll('.is-row-tool');
66565
- rowtools.forEach(rowtool => {
66566
- rowtool.style.transform = `scale(${1 / this.opts.zoom})`;
66567
- rowtool.style.transformOrigin = 'top';
66568
- });
66569
- const rowaddtools = document.querySelectorAll('.is-rowadd-tool button');
66570
- rowaddtools.forEach(rowaddtool => {
66571
- rowaddtool.style.transform = `scale(${1 / this.opts.zoom})`; // rowtool.style.transformOrigin = 'top';
66572
- });
66573
67168
  /*
66574
67169
  if(this.opts.zoom<1) {
66575
67170
  let ss = document.styleSheets;
@@ -66584,296 +67179,342 @@ class ContentBuilder {
66584
67179
  }
66585
67180
  }
66586
67181
  */
67182
+
67183
+ }
67184
+
67185
+ setZoomOnControl(area) {
67186
+ const rowtools = area.querySelectorAll('.is-row-tool');
67187
+ rowtools.forEach(rowtool => {
67188
+ rowtool.style.transform = `scale(${1 / this.opts.zoom})`;
67189
+ rowtool.style.transformOrigin = 'top';
67190
+ });
67191
+ const rowaddtools = area.querySelectorAll('.is-rowadd-tool button');
67192
+ rowaddtools.forEach(rowaddtool => {
67193
+ rowaddtool.style.transform = `scale(${1 / this.opts.zoom})`; // rowtool.style.transformOrigin = 'top';
67194
+ });
67195
+ }
67196
+
67197
+ setZoomOnArea() {
67198
+ if (this.opts.page !== '') {
67199
+ const wrapper = document.querySelector(this.opts.page);
67200
+ wrapper.style.transform = `scale(${this.opts.zoom})`;
67201
+ } else {
67202
+ const builders = document.querySelectorAll(this.opts.container);
67203
+ builders.forEach(builder => {
67204
+ let fade = false; // to prevent initial load animation
67205
+
67206
+ if (!builder.style.transform) fade = true;
67207
+
67208
+ if (fade) {
67209
+ builder.style.transition = 'none';
67210
+ }
67211
+
67212
+ builder.style.transform = `scale(${this.opts.zoom})`;
67213
+
67214
+ if (fade) {
67215
+ setTimeout(() => {
67216
+ builder.style.transition = '';
67217
+ }, 300);
67218
+ }
67219
+ });
67220
+ }
66587
67221
  }
66588
67222
 
66589
67223
  applyBehavior() {
66590
- const util = this.util; // Get all builder areas
67224
+ // Zoom (required by the next process, eg. setZoomOnControl)
67225
+ if (localStorage.getItem('_zoom') !== null) {
67226
+ this.opts.zoom = localStorage.getItem('_zoom'); // Get from saved localStorage
67227
+ }
67228
+
67229
+ this.rte.rteZoomSlider.value = this.opts.zoom * 100; // Set slider value
67230
+ // Get all builder areas
66591
67231
 
66592
67232
  const builders = document.querySelectorAll(this.opts.container);
66593
67233
  Array.prototype.forEach.call(builders, builder => {
66594
- //Make absolute
66595
- if (this.opts.absolutePath) {
66596
- let links = builder.querySelectorAll('a');
66597
- Array.prototype.forEach.call(links, link => {
66598
- let href = link.href;
66599
- link.setAttribute('href', href);
66600
- });
66601
- let imgs = builder.querySelectorAll('img');
66602
- Array.prototype.forEach.call(imgs, img => {
66603
- let src = img.src;
66604
- img.setAttribute('src', src);
66605
- });
66606
- } // Add .is-builder class on each builder area (container)
67234
+ this.applyBehaviorOn(builder); // includes setZoomOnControl
67235
+ }); // Call onRender to indicate content is ready for editing (applyBehavior has been applied)
66607
67236
 
67237
+ this.opts.onRender();
67238
+ this.setZoomOnArea(); // Set zoom
67239
+ } // applyBehavior
66608
67240
 
66609
- dom$F.addClass(builder, 'is-builder'); // Additional setting needed for dynamically added .is-builder. Without this, current toolStyle won't be applied to newly created section (eg. in ContentBox))
66610
- // if (localStorage.getItem('_toolstyle') !== null) {
66611
- // let toolStyle = localStorage.getItem('_toolstyle');
66612
- // this.preferences.setToolStyle(toolStyle);
66613
- // }
66614
- // if (localStorage.getItem('_outlinestyle') !== null) {
66615
- // let outlineStyle = localStorage.getItem('_outlinestyle');
66616
- // this.preferences.setOutlineStyle(outlineStyle);
66617
- // }
66618
67241
 
66619
- this.preferences.initBuilder(builder); // Apply behavior on each row
67242
+ applyBehaviorOn(builder) {
67243
+ const util = this.util; //Make absolute
66620
67244
 
66621
- const rows = dom$F.elementChildren(builder);
66622
- rows.forEach(row => {
66623
- if (dom$F.hasClass(row, 'row-add-initial')) return; // Hack. If a row has margin left/right specified, don't need to set hidden border (that is used to make smooth sortable)
67245
+ if (this.opts.absolutePath) {
67246
+ let links = builder.querySelectorAll('a');
67247
+ Array.prototype.forEach.call(links, link => {
67248
+ let href = link.href;
67249
+ link.setAttribute('href', href);
67250
+ });
67251
+ let imgs = builder.querySelectorAll('img');
67252
+ Array.prototype.forEach.call(imgs, img => {
67253
+ let src = img.src;
67254
+ img.setAttribute('src', src);
67255
+ });
67256
+ } // Add .is-builder class on each builder area (container)
66624
67257
 
66625
- if (row.style.marginLeft || row.style.marginRight) {
66626
- row.style.border = 'none';
66627
- } // On each row, add 2 tools: Row tool (div.is-row-tool) & Row Add tool (div.is-rowadd-tool)
66628
- // Render Row tool
66629
67258
 
67259
+ dom$F.addClass(builder, 'is-builder'); // Additional setting needed for dynamically added .is-builder. Without this, current toolStyle won't be applied to newly created section (eg. in ContentBox))
67260
+ // if (localStorage.getItem('_toolstyle') !== null) {
67261
+ // let toolStyle = localStorage.getItem('_toolstyle');
67262
+ // this.preferences.setToolStyle(toolStyle);
67263
+ // }
67264
+ // if (localStorage.getItem('_outlinestyle') !== null) {
67265
+ // let outlineStyle = localStorage.getItem('_outlinestyle');
67266
+ // this.preferences.setOutlineStyle(outlineStyle);
67267
+ // }
66630
67268
 
66631
- this.rowtool = new RowTool(this);
66632
- this.rowtool.render(row); // Render Row Add tool
67269
+ this.preferences.initBuilder(builder); // Apply behavior on each row
66633
67270
 
66634
- const rowaddtool = new RowAddTool(this);
66635
- rowaddtool.render(row); // Apply behavior on each column
67271
+ const rows = dom$F.elementChildren(builder);
67272
+ rows.forEach(row => {
67273
+ if (dom$F.hasClass(row, 'row-add-initial')) return; // Hack. If a row has margin left/right specified, don't need to set hidden border (that is used to make smooth sortable)
66636
67274
 
66637
- const cols = dom$F.elementChildren(row);
66638
- cols.forEach(col => {
66639
- if (dom$F.hasClass(col, 'is-row-tool') || dom$F.hasClass(col, 'is-rowadd-tool')) return; // Return if not a column
66640
- // For backward compatibility, replace:
66641
- // - data-mode="readonly" with data-noedit
66642
- // - data-mode="readonly-protected" with data-protected
67275
+ if (row.style.marginLeft || row.style.marginRight) {
67276
+ row.style.border = 'none';
67277
+ } // On each row, add 2 tools: Row tool (div.is-row-tool) & Row Add tool (div.is-rowadd-tool)
67278
+ // Render Row tool
66643
67279
 
66644
- if (col.getAttribute('data-mode') === 'readonly') {
66645
- col.setAttribute('data-noedit', '');
66646
- col.removeAttribute('data-mode');
66647
- }
66648
67280
 
66649
- if (col.getAttribute('data-mode') === 'readonly-protected') {
66650
- col.setAttribute('data-protected', '');
66651
- col.removeAttribute('data-mode');
66652
- } // Set ContentEditable
67281
+ this.rowtool = new RowTool(this);
67282
+ this.rowtool.render(row); // Render Row Add tool
66653
67283
 
67284
+ const rowaddtool = new RowAddTool(this);
67285
+ rowaddtool.render(row); // Apply behavior on each column
66654
67286
 
66655
- let noedit = false;
67287
+ const cols = dom$F.elementChildren(row);
67288
+ cols.forEach(col => {
67289
+ if (dom$F.hasClass(col, 'is-row-tool') || dom$F.hasClass(col, 'is-rowadd-tool')) return; // Return if not a column
67290
+ // For backward compatibility, replace:
67291
+ // - data-mode="readonly" with data-noedit
67292
+ // - data-mode="readonly-protected" with data-protected
66656
67293
 
66657
- if (col.hasAttribute('data-noedit')) {
66658
- // Column is not (text) editable.
66659
- noedit = true;
66660
- }
67294
+ if (col.getAttribute('data-mode') === 'readonly') {
67295
+ col.setAttribute('data-noedit', '');
67296
+ col.removeAttribute('data-mode');
67297
+ }
66661
67298
 
66662
- let _protected = false;
67299
+ if (col.getAttribute('data-mode') === 'readonly-protected') {
67300
+ col.setAttribute('data-protected', '');
67301
+ col.removeAttribute('data-mode');
67302
+ } // Set ContentEditable
66663
67303
 
66664
- if (col.hasAttribute('data-protected')) {
66665
- // Column is not (text) editable and also: cannot be deleted, moved or duplicated.
66666
- _protected = true;
66667
- }
66668
67304
 
66669
- let customcode = false;
67305
+ let noedit = false;
66670
67306
 
66671
- if (col.hasAttribute('data-html')) {
66672
- // Column contains custom code.
66673
- customcode = true;
66674
- } // let custommodule = false;
66675
- // if (col.hasAttribute('data-module')) { // Column contains custom module.
66676
- // custommodule = true;
66677
- // }
67307
+ if (col.hasAttribute('data-noedit')) {
67308
+ // Column is not (text) editable.
67309
+ noedit = true;
67310
+ }
66678
67311
 
67312
+ let _protected = false;
66679
67313
 
66680
- if (!customcode && !noedit && !_protected) {
66681
- // Check if column contains editable text
66682
- let elms = col.querySelectorAll('p,h1,h2,h3,h4,h5,h6,table,ul,ol,pre,blockquote,code,figcaption,label,legend,button,a');
67314
+ if (col.hasAttribute('data-protected')) {
67315
+ // Column is not (text) editable and also: cannot be deleted, moved or duplicated.
67316
+ _protected = true;
67317
+ }
66683
67318
 
66684
- if (elms.length > 0) {
66685
- col.contentEditable = true; // Column is (text) editable
66686
- }
66687
- } // Apply behavior on several elements for editing purpose
67319
+ let customcode = false;
66688
67320
 
67321
+ if (col.hasAttribute('data-html')) {
67322
+ // Column contains custom code.
67323
+ customcode = true;
67324
+ } // let custommodule = false;
67325
+ // if (col.hasAttribute('data-module')) { // Column contains custom module.
67326
+ // custommodule = true;
67327
+ // }
66689
67328
 
66690
- this.element.applyBehavior(col); // Add events on column
66691
67329
 
66692
- if (!col.getAttribute('data-click')) {
66693
- // ON CLICK
66694
- // Use bind() => https://www.w3schools.com/react/react_events.asp
66695
- col.addEventListener('click', this.handleCellClick.bind(this, col)); // ON KEYPRESS
67330
+ if (!customcode && !noedit && !_protected) {
67331
+ // Check if column contains editable text
67332
+ let elms = col.querySelectorAll('p,h1,h2,h3,h4,h5,h6,table,ul,ol,pre,blockquote,code,figcaption,label,legend,button,a');
66696
67333
 
66697
- col.addEventListener('keydown', this.handleCellKeypress.bind(this)); // ON KEYDOWN
67334
+ if (elms.length > 0) {
67335
+ col.contentEditable = true; // Column is (text) editable
67336
+ }
67337
+ } // Apply behavior on several elements for editing purpose
66698
67338
 
66699
- col.addEventListener('keydown', this.handleCellKeydown.bind(this, col)); // ON KEYUP
66700
67339
 
66701
- col.addEventListener('keyup', this.handleCellKeyup.bind(this, col)); // ON PASTE
67340
+ this.element.applyBehavior(col); // Add events on column
66702
67341
 
66703
- col.addEventListener('paste', this.handleCellPaste.bind(this));
66704
- col.setAttribute('data-click', true);
66705
- }
66706
- });
66707
- }); // Sortable on each builder (container)
67342
+ if (!col.getAttribute('data-click')) {
67343
+ // ON CLICK
67344
+ // Use bind() => https://www.w3schools.com/react/react_events.asp
67345
+ col.addEventListener('click', this.handleCellClick.bind(this, col)); // ON KEYPRESS
66708
67346
 
66709
- if (!builder.getAttribute('data-sort') && !builder.hasAttribute('nogrid')) {
66710
- // Check first if sortable has been added.
67347
+ col.addEventListener('keydown', this.handleCellKeypress.bind(this)); // ON KEYDOWN
66711
67348
 
66712
- /*
66713
- let userAgentString = navigator.userAgent;
66714
- let safariAgent = userAgentString.indexOf('Safari') > -1;
66715
- let chromeAgent = userAgentString.indexOf('Chrome') > -1;
66716
- if ((chromeAgent) && (safariAgent)) safariAgent = false;
66717
- */
66718
- // let safariAgent = false;
66719
- let sortableObject = new Sortable(builder, {
66720
- // forceFallback: safariAgent,
66721
- // forceFallback: true,
66722
- scroll: true,
66723
- // invertSwap: true, /* https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#swap-threshold */
66724
- group: 'shared',
66725
- direction: 'dummy',
66726
- animation: 300,
66727
- handle: '.row-handle',
66728
- // swapThreshold: 0.1, // this cause drag drop snippet sometimes difficult
66729
- // invertedSwapThreshold: 0.1,
66730
- sort: true,
66731
- onStart: () => {
66732
- this.uo.saveForUndo(); // Even if cancelled, saveForUndo will make sure not to save if there is no change
66733
-
66734
- this.colTool.hideColumnTool();
66735
- this.elmTool.hide();
66736
- },
66737
- onEnd: () => {
66738
- if (!this.opts.emailMode) {
66739
- if (dom$F.hasClass(this.activeCol.parentNode, 'row-outline')) {
66740
- //if not row selection, but col selection
66741
- //if(this.activeCol.parentNode.classList.contains('row-outline')) { //if not row selection, but col selection
66742
- this.colTool.refreshColumnTool(this.activeCol);
66743
- this.colTool.showColumnTool(this.activeCol);
66744
- }
67349
+ col.addEventListener('keydown', this.handleCellKeydown.bind(this, col)); // ON KEYUP
67350
+
67351
+ col.addEventListener('keyup', this.handleCellKeyup.bind(this, col)); // ON PASTE
67352
+
67353
+ col.addEventListener('paste', this.handleCellPaste.bind(this));
67354
+ col.setAttribute('data-click', true);
67355
+ }
67356
+ });
67357
+ }); // Sortable on each builder (container)
67358
+
67359
+ if (!builder.getAttribute('data-sort') && !builder.hasAttribute('nogrid')) {
67360
+ // Check first if sortable has been added.
67361
+
67362
+ /*
67363
+ let userAgentString = navigator.userAgent;
67364
+ let safariAgent = userAgentString.indexOf('Safari') > -1;
67365
+ let chromeAgent = userAgentString.indexOf('Chrome') > -1;
67366
+ if ((chromeAgent) && (safariAgent)) safariAgent = false;
67367
+ */
67368
+ // let safariAgent = false;
67369
+ let sortableObject = new Sortable(builder, {
67370
+ // forceFallback: safariAgent,
67371
+ // forceFallback: true,
67372
+ scroll: true,
67373
+ // invertSwap: true, /* https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#swap-threshold */
67374
+ group: 'shared',
67375
+ direction: 'dummy',
67376
+ animation: 300,
67377
+ handle: '.row-handle',
67378
+ // swapThreshold: 0.1, // this cause drag drop snippet sometimes difficult
67379
+ // invertedSwapThreshold: 0.1,
67380
+ sort: true,
67381
+ onStart: () => {
67382
+ this.uo.saveForUndo(); // Even if cancelled, saveForUndo will make sure not to save if there is no change
67383
+
67384
+ this.colTool.hideColumnTool();
67385
+ this.elmTool.hide();
67386
+ },
67387
+ onEnd: () => {
67388
+ if (!this.opts.emailMode) {
67389
+ if (dom$F.hasClass(this.activeCol.parentNode, 'row-outline')) {
67390
+ //if not row selection, but col selection
67391
+ //if(this.activeCol.parentNode.classList.contains('row-outline')) { //if not row selection, but col selection
67392
+ this.colTool.refreshColumnTool(this.activeCol);
67393
+ this.colTool.showColumnTool(this.activeCol);
66745
67394
  }
66746
- },
66747
- onAdd: evt => {
66748
- var itemEl = evt.item;
67395
+ }
67396
+ },
67397
+ onAdd: evt => {
67398
+ var itemEl = evt.item;
66749
67399
 
66750
- if (itemEl.getAttribute('data-id')) {
66751
- // If has data-id attribute, the dropped item is from snippet panel (snippetpanel.js)
66752
- let snippetid = itemEl.getAttribute('data-id'); // snippetJSON is snippet's JSON (from assets/minimalist-blocks/content.js) that store all snippets' html
67400
+ if (itemEl.getAttribute('data-id')) {
67401
+ // If has data-id attribute, the dropped item is from snippet panel (snippetpanel.js)
67402
+ let snippetid = itemEl.getAttribute('data-id'); // snippetJSON is snippet's JSON (from assets/minimalist-blocks/content.js) that store all snippets' html
66753
67403
 
66754
- const result = this.opts.snippetJSON.snippets.filter(item => {
66755
- if (item.id + '' === snippetid) return item;else return false;
66756
- });
66757
- var html = result[0].html;
66758
- var noedit = result[0].noedit;
66759
- var bSnippet;
67404
+ const result = this.opts.snippetJSON.snippets.filter(item => {
67405
+ if (item.id + '' === snippetid) return item;else return false;
67406
+ });
67407
+ var html = result[0].html;
67408
+ var noedit = result[0].noedit;
67409
+ var bSnippet;
66760
67410
 
66761
- if (html.indexOf('row clearfix') === -1) {
66762
- bSnippet = true; // Just snippet (without row/column grid)
66763
- } else {
66764
- bSnippet = false; // Snippet is wrapped in row/colum
66765
- }
67411
+ if (html.indexOf('row clearfix') === -1) {
67412
+ bSnippet = true; // Just snippet (without row/column grid)
67413
+ } else {
67414
+ bSnippet = false; // Snippet is wrapped in row/colum
67415
+ }
66766
67416
 
66767
- if (this.opts.emailMode) bSnippet = false; // Convert snippet into your defined 12 columns grid
67417
+ if (this.opts.emailMode) bSnippet = false; // Convert snippet into your defined 12 columns grid
66768
67418
 
66769
- var rowClass = this.opts.row; //row
67419
+ var rowClass = this.opts.row; //row
66770
67420
 
66771
- 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']
67421
+ 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']
66772
67422
 
66773
- if (rowClass !== '' && colClass.length === 12) {
66774
- html = html.replace(new RegExp('row clearfix', 'g'), rowClass);
66775
- html = html.replace(new RegExp('column full', 'g'), colClass[11]);
66776
- html = html.replace(new RegExp('column half', 'g'), colClass[5]);
66777
- html = html.replace(new RegExp('column third', 'g'), colClass[3]);
66778
- html = html.replace(new RegExp('column fourth', 'g'), colClass[2]);
66779
- html = html.replace(new RegExp('column fifth', 'g'), colClass[1]);
66780
- html = html.replace(new RegExp('column sixth', 'g'), colClass[1]);
66781
- html = html.replace(new RegExp('column two-third', 'g'), colClass[7]);
66782
- html = html.replace(new RegExp('column two-fourth', 'g'), colClass[8]);
66783
- html = html.replace(new RegExp('column two-fifth', 'g'), colClass[9]);
66784
- html = html.replace(new RegExp('column two-sixth', 'g'), colClass[9]);
66785
- }
67423
+ if (rowClass !== '' && colClass.length === 12) {
67424
+ html = html.replace(new RegExp('row clearfix', 'g'), rowClass);
67425
+ html = html.replace(new RegExp('column full', 'g'), colClass[11]);
67426
+ html = html.replace(new RegExp('column half', 'g'), colClass[5]);
67427
+ html = html.replace(new RegExp('column third', 'g'), colClass[3]);
67428
+ html = html.replace(new RegExp('column fourth', 'g'), colClass[2]);
67429
+ html = html.replace(new RegExp('column fifth', 'g'), colClass[1]);
67430
+ html = html.replace(new RegExp('column sixth', 'g'), colClass[1]);
67431
+ html = html.replace(new RegExp('column two-third', 'g'), colClass[7]);
67432
+ html = html.replace(new RegExp('column two-fourth', 'g'), colClass[8]);
67433
+ html = html.replace(new RegExp('column two-fifth', 'g'), colClass[9]);
67434
+ html = html.replace(new RegExp('column two-sixth', 'g'), colClass[9]);
67435
+ }
66786
67436
 
66787
- html = html.replace(/{id}/g, util.makeId()); // Replace {id} with auto generated id (for custom code snippet)
67437
+ html = html.replace(/{id}/g, util.makeId()); // Replace {id} with auto generated id (for custom code snippet)
66788
67438
 
66789
- if (this.opts.onAdd) {
66790
- html = this.opts.onAdd(html);
66791
- }
67439
+ if (this.opts.onAdd) {
67440
+ html = this.opts.onAdd(html);
67441
+ }
66792
67442
 
66793
- if (this.opts.snippetPathReplace.length > 0) {
66794
- // try {
66795
- if (this.opts.snippetPathReplace[0] !== '') {
66796
- var regex = new RegExp(this.opts.snippetPathReplace[0], 'g');
66797
- html = html.replace(regex, this.opts.snippetPathReplace[1]);
66798
- var string1 = this.opts.snippetPathReplace[0].replace(/\//g, '%2F');
66799
- var string2 = this.opts.snippetPathReplace[1].replace(/\//g, '%2F');
66800
- var regex2 = new RegExp(string1, 'g');
66801
- html = html.replace(regex2, string2);
66802
- } // } catch (e) { 1; }
67443
+ if (this.opts.snippetPathReplace.length > 0) {
67444
+ // try {
67445
+ if (this.opts.snippetPathReplace[0] !== '') {
67446
+ var regex = new RegExp(this.opts.snippetPathReplace[0], 'g');
67447
+ html = html.replace(regex, this.opts.snippetPathReplace[1]);
67448
+ var string1 = this.opts.snippetPathReplace[0].replace(/\//g, '%2F');
67449
+ var string2 = this.opts.snippetPathReplace[1].replace(/\//g, '%2F');
67450
+ var regex2 = new RegExp(string1, 'g');
67451
+ html = html.replace(regex2, string2);
67452
+ } // } catch (e) { 1; }
66803
67453
 
66804
- }
67454
+ }
66805
67455
 
66806
- if (bSnippet) {
66807
- // Just snippet (without row/column grid), ex. buttons, line, social, video, map.
66808
- // Can be inserted after current row, column (cell), element, or last row.
66809
- html = `<div class="${this.opts.row}"><div class="${this.opts.cols[this.opts.cols.length - 1]}"${noedit ? ' data-noedit' : ''}>${html}</div></div>`; // Clean snippet from sortable related code
67456
+ if (bSnippet) {
67457
+ // Just snippet (without row/column grid), ex. buttons, line, social, video, map.
67458
+ // Can be inserted after current row, column (cell), element, or last row.
67459
+ html = `<div class="${this.opts.row}"><div class="${this.opts.cols[this.opts.cols.length - 1]}"${noedit ? ' data-noedit' : ''}>${html}</div></div>`; // Clean snippet from sortable related code
66810
67460
 
66811
- itemEl.removeAttribute('draggable');
66812
- dom$F.removeClass(itemEl, 'snippet-item');
66813
- itemEl.outerHTML = html;
66814
- } else {
66815
- // Snippet is wrapped in row/colum (may contain custom code or has [data-html] attribute)
66816
- // Can only be inserted after current row or last row (not on column or element).
66817
- let snippet = dom$F.createElement('div');
66818
- snippet.innerHTML = html;
66819
- let blocks = snippet.querySelectorAll('[data-html]');
66820
- Array.prototype.forEach.call(blocks, block => {
66821
- // Render custom code block
66822
- html = decodeURIComponent(block.getAttribute('data-html'));
66823
- html = html.replace(/{id}/g, util.makeId());
66824
-
66825
- for (var i = 1; i <= 20; i++) {
66826
- html = html.replace('[%HTML' + i + '%]', block.getAttribute('data-html-' + i) === undefined ? '' : decodeURIComponent(block.getAttribute('data-html-' + i))); //render editable area
66827
- }
67461
+ itemEl.removeAttribute('draggable');
67462
+ dom$F.removeClass(itemEl, 'snippet-item');
67463
+ itemEl.outerHTML = html;
67464
+ } else {
67465
+ // Snippet is wrapped in row/colum (may contain custom code or has [data-html] attribute)
67466
+ // Can only be inserted after current row or last row (not on column or element).
67467
+ let snippet = dom$F.createElement('div');
67468
+ snippet.innerHTML = html;
67469
+ let blocks = snippet.querySelectorAll('[data-html]');
67470
+ Array.prototype.forEach.call(blocks, block => {
67471
+ // Render custom code block
67472
+ html = decodeURIComponent(block.getAttribute('data-html'));
67473
+ html = html.replace(/{id}/g, util.makeId());
67474
+
67475
+ for (var i = 1; i <= 20; i++) {
67476
+ html = html.replace('[%HTML' + i + '%]', block.getAttribute('data-html-' + i) === undefined ? '' : decodeURIComponent(block.getAttribute('data-html-' + i))); //render editable area
67477
+ }
66828
67478
 
66829
- block.innerHTML = html;
66830
- });
66831
- html = snippet.innerHTML; // Clean snippet from sortable related code
67479
+ block.innerHTML = html;
67480
+ });
67481
+ html = snippet.innerHTML; // Clean snippet from sortable related code
66832
67482
 
66833
- itemEl.removeAttribute('draggable');
66834
- dom$F.removeClass(itemEl, 'snippet-item');
66835
- itemEl.innerHTML = ''; // Use createContextualFragment() to make embedded script executable
66836
- // https://ghinda.net/article/script-tags/
67483
+ itemEl.removeAttribute('draggable');
67484
+ dom$F.removeClass(itemEl, 'snippet-item');
67485
+ itemEl.innerHTML = ''; // Use createContextualFragment() to make embedded script executable
67486
+ // https://ghinda.net/article/script-tags/
66837
67487
 
66838
- var range = document.createRange();
66839
- range.setStart(itemEl, 0);
66840
- itemEl.appendChild(range.createContextualFragment(html));
66841
- itemEl.outerHTML = itemEl.innerHTML;
66842
- } // After snippet has been added, re-apply behavior on builder areas
67488
+ var range = document.createRange();
67489
+ range.setStart(itemEl, 0);
67490
+ itemEl.appendChild(range.createContextualFragment(html));
67491
+ itemEl.outerHTML = itemEl.innerHTML;
67492
+ } // After snippet has been added, re-apply behavior on builder areas
66843
67493
 
66844
67494
 
66845
- this.applyBehavior(); // Call onChange
67495
+ this.applyBehaviorOn(builder); // Call onChange
66846
67496
 
66847
- this.opts.onChange(); // Hide element tool
67497
+ this.opts.onChange(); // Hide element tool
66848
67498
 
66849
- this.elmTool.hide();
66850
- }
67499
+ this.elmTool.hide();
66851
67500
  }
66852
- });
66853
- this.sortableObjects.push(sortableObject);
66854
- builder.setAttribute('data-sort', true);
66855
- } // /Sortable
67501
+ }
67502
+ });
67503
+ this.sortableObjects.push(sortableObject);
67504
+ builder.setAttribute('data-sort', true);
67505
+ } // /Sortable
67506
+ // Additional contentEditable for subblock
66856
67507
 
66857
- }); // Additional contentEditable for subblock
66858
67508
 
66859
- const subblocks = document.querySelectorAll('.is-subblock');
67509
+ const subblocks = builder.querySelectorAll('.is-subblock');
66860
67510
  Array.prototype.forEach.call(subblocks, subblock => {
66861
67511
  subblock.contentEditable = true;
66862
67512
  }); // Check if there is empty builder area (still has no content)
66863
67513
 
66864
- util.checkEmpty(); // Call onRender to indicate content is ready for editing (applyBehavior has been applied)
66865
-
66866
- this.opts.onRender(); // Zoom
66867
-
66868
- if (localStorage.getItem('_zoom') !== null) {
66869
- this.opts.zoom = localStorage.getItem('_zoom'); // Get from saved localStorage
66870
- }
66871
-
66872
- this.rte.rteZoomSlider.value = this.opts.zoom * 100; // Set slider value
66873
-
66874
- this.setZoom(); // Set zoom
66875
- } // applyBehavior
67514
+ this.util.checkEmptyOn(builder); // Zoom
66876
67515
 
67516
+ this.setZoomOnControl(builder);
67517
+ }
66877
67518
 
66878
67519
  html(area) {
66879
67520
  const util = this.util;
@@ -67675,6 +68316,7 @@ class ContentBuilder {
67675
68316
  }
67676
68317
 
67677
68318
  loadSnippets(snippetFile) {
68319
+ if (this.preview) return;
67678
68320
  let snippetPanel = document.querySelector(this.opts.snippetList);
67679
68321
  if (snippetPanel) return; // do not render if already rendered (just protection)
67680
68322
 
@@ -68384,26 +69026,29 @@ class ContentBuilder {
68384
69026
  let contentword = document.querySelector('#idContentWord'); //Check video embed
68385
69027
 
68386
69028
  var bPasteObject = false;
68387
- var src = contentword.innerText; //var youRegex = /^http[s]?:\/\/(((www.youtube.com\/watch\?(feature=player_detailpage&)?)v=)|(youtu.be\/))([^#\&\?]*)/;
69029
+ var src = contentword.innerText;
68388
69030
 
68389
- var youRegex = /^http[s]?:\/\/(((www.youtube.com\/watch\?(feature=player_detailpage&)?)v=)|(youtu.be\/))([^#&?]*)/;
68390
- var vimeoRegex = /^.*(vimeo\.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/)|(video\/))?([0-9]+)\/?/;
68391
- var youRegexMatches = youRegex.exec(src);
68392
- var vimeoRegexMatches = vimeoRegex.exec(src);
69031
+ if (!this.opts.disableAutoEmbedVideo) {
69032
+ //var youRegex = /^http[s]?:\/\/(((www.youtube.com\/watch\?(feature=player_detailpage&)?)v=)|(youtu.be\/))([^#\&\?]*)/;
69033
+ var youRegex = /^http[s]?:\/\/(((www.youtube.com\/watch\?(feature=player_detailpage&)?)v=)|(youtu.be\/))([^#&?]*)/;
69034
+ var vimeoRegex = /^.*(vimeo\.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/)|(video\/))?([0-9]+)\/?/;
69035
+ var youRegexMatches = youRegex.exec(src);
69036
+ var vimeoRegexMatches = vimeoRegex.exec(src);
68393
69037
 
68394
- if (youRegexMatches !== null || vimeoRegexMatches !== null) {
68395
- if (youRegexMatches !== null && youRegexMatches.length >= 7) {
68396
- var youMatch = youRegexMatches[6];
68397
- src = 'https://www.youtube.com/embed/' + youMatch + '?rel=0';
68398
- }
69038
+ if (youRegexMatches !== null || vimeoRegexMatches !== null) {
69039
+ if (youRegexMatches !== null && youRegexMatches.length >= 7) {
69040
+ var youMatch = youRegexMatches[6];
69041
+ src = 'https://www.youtube.com/embed/' + youMatch + '?rel=0';
69042
+ }
68399
69043
 
68400
- if (vimeoRegexMatches !== null && vimeoRegexMatches.length >= 7) {
68401
- var vimeoMatch = vimeoRegexMatches[6];
68402
- src = 'https://player.vimeo.com/video/' + vimeoMatch;
68403
- }
69044
+ if (vimeoRegexMatches !== null && vimeoRegexMatches.length >= 7) {
69045
+ var vimeoMatch = vimeoRegexMatches[6];
69046
+ src = 'https://player.vimeo.com/video/' + vimeoMatch;
69047
+ }
68404
69048
 
68405
- sPastedText = '<div class="embed-responsive embed-responsive-16by9"><iframe width="560" height="315" src="' + src + '" frameborder="0" allowfullscreen=""></iframe></div>';
68406
- bPasteObject = true;
69049
+ sPastedText = '<div class="embed-responsive embed-responsive-16by9"><iframe width="560" height="315" src="' + src + '" frameborder="0" allowfullscreen=""></iframe></div>';
69050
+ bPasteObject = true;
69051
+ }
68407
69052
  }
68408
69053
 
68409
69054
  if (!bPasteObject) {
@@ -68525,7 +69170,8 @@ class ContentBuilder {
68525
69170
 
68526
69171
  oSel.removeAllRanges();
68527
69172
  oSel.addRange(range);
68528
- this.applyBehavior(); //Trigger Change event
69173
+ let builderActive = document.querySelector('.builder-active');
69174
+ if (builderActive) this.applyBehaviorOn(builderActive); //Trigger Change event
68529
69175
 
68530
69176
  this.opts.onChange(); //Trigger Render event
68531
69177
 
@@ -71217,11 +71863,14 @@ class ContentBox {
71217
71863
  this.editsection = new EditSection(this);
71218
71864
  this.editbox = new EditBox(this);
71219
71865
  setTimeout(() => {
71220
- this.pageSetup(); // this.wrapperEl.style.opacity = 1;
71866
+ if (!this.pageSetupDone) {
71867
+ this.pageSetup();
71868
+ } // this.wrapperEl.style.opacity = 1;
71221
71869
  // Remove the page-overlay
71222
71870
  // setTimeout(()=>{
71223
71871
  // pageOverlay.parentNode.removeChild(pageOverlay);
71224
71872
  // }, 10);
71873
+
71225
71874
  }, 300); //give delay for the transition (0.3ms) to finish (see box.css on .is-wrapper)
71226
71875
 
71227
71876
  Pace.start();
@@ -71340,13 +71989,11 @@ class ContentBox {
71340
71989
  if (newArea.indexOf('is-static') == -1 && hasStatic) {
71341
71990
  // If page has a footer (a static section), then insert the new section before it.
71342
71991
  dom.appendHtml(lastSection, newArea, 'beforebegin');
71343
- newSection = lastSection.previousSibling;
71344
-
71345
- if (newSection.previousSibling) {
71346
- if (!dom.hasClass(newSection.previousSibling, 'is-bg-grey')) {
71347
- dom.addClass(newSection, 'is-bg-grey');
71348
- }
71349
- }
71992
+ newSection = lastSection.previousSibling; // if(newSection.previousSibling) {
71993
+ // if(!dom.hasClass(newSection.previousSibling, 'is-bg-grey')) {
71994
+ // dom.addClass(newSection, 'is-bg-grey');
71995
+ // }
71996
+ // }
71350
71997
  } else {
71351
71998
  const sectionElms = this.wrapperEl.querySelectorAll('.is-section');
71352
71999
 
@@ -71358,50 +72005,72 @@ class ContentBox {
71358
72005
  dom.appendHtml(this.wrapperEl, newArea, 'afterbegin');
71359
72006
  }
71360
72007
 
71361
- newSection = dom.getLastElement(this.wrapperEl, '.is-section');
72008
+ newSection = dom.getLastElement(this.wrapperEl, '.is-section'); // if(newSection.previousSibling) {
72009
+ // if(!dom.hasClass(newSection.previousSibling, 'is-bg-grey')) {
72010
+ // dom.addClass(newSection, 'is-bg-grey');
72011
+ // }
72012
+ // }
72013
+ }
71362
72014
 
71363
- if (newSection.previousSibling) {
71364
- if (!dom.hasClass(newSection.previousSibling, 'is-bg-grey')) {
71365
- dom.addClass(newSection, 'is-bg-grey');
71366
- }
71367
- }
71368
- } // Code Blocks Handling
72015
+ let arrSections = [];
72016
+ arrSections.push(newSection); // Check up to 3 sections (in case a template has up to 3 sections)
71369
72017
 
72018
+ let prevSection = newSection.previousElementSibling;
71370
72019
 
71371
- let codeBlocks = newSection.querySelectorAll('.is-overlay-content[data-module]');
71372
- codeBlocks.forEach(element => {
71373
- let html = decodeURIComponent(element.getAttribute('data-html')); // Original code is stored in data-html attribute
72020
+ if (prevSection) {
72021
+ let ok = prevSection.querySelector('.is-section-tool');
71374
72022
 
71375
- html = html.replace(/{id}/g, dom.uniqueId()); //Fill the block with original code
72023
+ if (!ok) {
72024
+ arrSections.push(prevSection);
72025
+ }
71376
72026
 
71377
- dom.html(element, html);
71378
- }); // Fix old structure (backward compatible)
72027
+ prevSection = prevSection.previousElementSibling;
71379
72028
 
71380
- let overlays = newSection.querySelectorAll('.is-overlay');
71381
- overlays.forEach(overlay => {
71382
- let overlayContent = overlay.querySelector('.is-overlay-content');
72029
+ if (prevSection) {
72030
+ ok = prevSection.querySelector('.is-section-tool');
71383
72031
 
71384
- if (overlayContent) {
71385
- if (overlayContent.innerHTML === '') {
71386
- if (overlay.childElementCount === 1) {
71387
- overlay.parentNode.removeChild(overlay);
71388
- }
72032
+ if (!ok) {
72033
+ arrSections.push(prevSection);
71389
72034
  }
71390
72035
  }
71391
- });
71392
- this.editor.applyBehavior(); // Section Setup
72036
+ }
71393
72037
 
71394
- this.sectionSetup(newSection); // Box Setup (previously: applyBoxBehavior)
72038
+ arrSections.forEach(section => {
72039
+ // Code Blocks Handling
72040
+ let codeBlocks = section.querySelectorAll('.is-overlay-content[data-module]');
72041
+ codeBlocks.forEach(element => {
72042
+ let html = decodeURIComponent(element.getAttribute('data-html')); // Original code is stored in data-html attribute
71395
72043
 
71396
- if (dom.hasClass(newSection, 'is-box')) {
71397
- this.boxSetup(newSection);
71398
- } else {
71399
- const boxes = newSection.querySelectorAll('.is-box');
71400
- boxes.forEach(box => {
71401
- this.boxSetup(box);
71402
- });
71403
- } //Trigger Change event
72044
+ html = html.replace(/{id}/g, dom.uniqueId()); //Fill the block with original code
72045
+
72046
+ dom.html(element, html);
72047
+ }); // Fix old structure (backward compatible)
72048
+
72049
+ let overlays = section.querySelectorAll('.is-overlay');
72050
+ overlays.forEach(overlay => {
72051
+ let overlayContent = overlay.querySelector('.is-overlay-content');
72052
+
72053
+ if (overlayContent) {
72054
+ if (overlayContent.innerHTML === '') {
72055
+ if (overlay.childElementCount === 1) {
72056
+ overlay.parentNode.removeChild(overlay);
72057
+ }
72058
+ }
72059
+ }
72060
+ }); // Section Setup
72061
+
72062
+ this.sectionSetup(section); // Box Setup (previously: applyBoxBehavior)
71404
72063
 
72064
+ if (dom.hasClass(section, 'is-box')) {
72065
+ this.boxSetup(section);
72066
+ } else {
72067
+ const boxes = section.querySelectorAll('.is-box');
72068
+ boxes.forEach(box => {
72069
+ this.boxSetup(box);
72070
+ });
72071
+ }
72072
+ });
72073
+ this.editor.applyBehavior(); //Trigger Change event
71405
72074
 
71406
72075
  this.onChange();
71407
72076
  dom.removeElement(document.querySelector('.is-sidebar-overlay'));
@@ -71443,9 +72112,7 @@ class ContentBox {
71443
72112
  btns.forEach(btn => {
71444
72113
  btn.style.color = this.editor.styleModalColor;
71445
72114
  });
71446
- const sectionIframe = document.querySelector('#ifrIdeasPanel'); // let doc = sectionIframe.contentWindow.document;
71447
- // console.log(doc);
71448
-
72115
+ const sectionIframe = document.querySelector('#ifrIdeasPanel');
71449
72116
  if (sectionIframe.contentWindow.applyParentStyles) sectionIframe.contentWindow.applyParentStyles();
71450
72117
  }
71451
72118
 
@@ -71550,12 +72217,12 @@ class ContentBox {
71550
72217
  const btnNew = builderStuff.querySelector('#' + btnId);
71551
72218
  btnNew.addEventListener('click', () => {
71552
72219
  if (btn.src) {
71553
- if (!dom.hasClass(btn, 'active')) {
72220
+ if (!dom.hasClass(btnNew, 'active')) {
71554
72221
  dom.removeClass(builderStuff.querySelector('.is-sidebar > div'), 'active');
71555
72222
  dom.removeClass(builderStuff.querySelector('.is-sidebar-content'), 'active');
71556
72223
  document.body.style.overflowY = '';
71557
- dom.addClass(btn, 'active');
71558
- var id = btn.getAttribute('data-content');
72224
+ dom.addClass(btnNew, 'active');
72225
+ var id = btnNew.getAttribute('data-content');
71559
72226
  dom.addClass(builderStuff.querySelector('#' + id), 'active');
71560
72227
  var iframe = builderStuff.querySelector('#' + id + ' iframe');
71561
72228
 
@@ -71652,6 +72319,12 @@ class ContentBox {
71652
72319
  }
71653
72320
 
71654
72321
  loadHtml(html) {
72322
+ const wrapper = this.wrapperEl;
72323
+
72324
+ if (!wrapper.style.opacity) {
72325
+ wrapper.style.opacity = '0';
72326
+ }
72327
+
71655
72328
  if (!this.editor) {
71656
72329
  // Wait for the ContentBuilder init complete
71657
72330
  setTimeout(() => {
@@ -71662,11 +72335,11 @@ class ContentBox {
71662
72335
 
71663
72336
 
71664
72337
  let range = document.createRange();
71665
- const wrapper = this.wrapperEl;
71666
72338
  wrapper.innerHTML = '';
71667
72339
  wrapper.appendChild(range.createContextualFragment(html)); // We use createContextualFragment so that embedded javascript code (code block) will be executed
71668
72340
 
71669
72341
  this.pageSetup();
72342
+ this.pageSetupDone = true; //prevent duplicate for traditional pageSetup on init
71670
72343
  }
71671
72344
 
71672
72345
  boxImage(url) {