@innovastudio/contentbuilder 1.4.118 → 1.4.120

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.
@@ -106,8 +106,8 @@ class Util {
106
106
  callback(true);
107
107
  });
108
108
  }
109
- confirm(message, callback, yesno, yestext) {
110
- if (!this.builder.deleteConfirm) {
109
+ confirm(message, callback, yesno, yestext, forceOpen) {
110
+ if (!this.builder.deleteConfirm && !forceOpen) {
111
111
  callback(true);
112
112
  return;
113
113
  }
@@ -468,6 +468,9 @@ class Util {
468
468
  modal.style.display = '';
469
469
  }
470
470
  refreshModuleLayout(col) {
471
+ let savedHeight;
472
+ if (col.style.height) savedHeight = col.style.height;else col.style.height = `${col.offsetHeight}px`;
473
+ col.style.opacity = 0;
471
474
  let html = decodeURIComponent(col.getAttribute('data-html'));
472
475
  html = html.replace(/{id}/g, this.builder.util.makeId());
473
476
  col.innerHTML = '';
@@ -483,6 +486,14 @@ class Util {
483
486
  }
484
487
  i++;
485
488
  });
489
+ setTimeout(() => {
490
+ if (savedHeight) {
491
+ col.style.height = savedHeight;
492
+ } else {
493
+ col.style.height = '';
494
+ }
495
+ col.style.opacity = '';
496
+ }, 100);
486
497
  }
487
498
  removeColClasses(cell) {
488
499
  cell.classList.remove('full');
@@ -1189,8 +1200,12 @@ class Util {
1189
1200
  pop.style.transition = '';
1190
1201
  }, 200);
1191
1202
  });
1192
- this.builder.moveable.updateRect();
1193
- document.querySelector('.moveable-control-box').style.display = 'none';
1203
+ const movControlBox = document.querySelector('.moveable-control-box');
1204
+ const imageResizer = document.querySelector('#divImageResizer');
1205
+ if (movControlBox && !imageResizer.getAttribute('data-resizing')) {
1206
+ // this.builder.moveable.updateRect();
1207
+ movControlBox.style.display = 'none';
1208
+ }
1194
1209
  }
1195
1210
  hideControls() {
1196
1211
  const dom = this.dom;
@@ -1225,15 +1240,14 @@ class Util {
1225
1240
  Array.prototype.forEach.call(elms, elm => {
1226
1241
  dom.removeClass(elm, 'elm-active');
1227
1242
  });
1228
- let elmTool = builderStuff.querySelector('.is-element-tool');
1243
+ let elmTool = this.builder.doc.querySelector('.is-element-tool');
1229
1244
  elmTool.style.display = '';
1230
- let linkTool = builderStuff.querySelector('#divLinkTool');
1245
+ let linkTool = this.builder.doc.querySelector('#divLinkTool');
1231
1246
  linkTool.style.display = '';
1247
+ this.builder.activeIcon = null;
1248
+ this.builder.inspectedElement = null;
1249
+ this.builder.activeElement = null;
1232
1250
  if (all) {
1233
- this.builder.activeIcon = null;
1234
- this.builder.inspectedElement = null;
1235
- this.builder.activeElement = null;
1236
-
1237
1251
  // RTE
1238
1252
  let rtetool = builderStuff.querySelector('.is-rte-tool');
1239
1253
  if (rtetool) rtetool.style.display = 'none';
@@ -1554,6 +1568,7 @@ class Util {
1554
1568
  rows.forEach(row => {
1555
1569
  if (dom.hasClass(row, 'row-add-initial')) return;
1556
1570
  if (dom.hasClass(row, 'dummy-space')) return;
1571
+ if (row.tagName.toLowerCase() === 'link') return;
1557
1572
  empty = false;
1558
1573
  });
1559
1574
  if (empty) {
@@ -10400,7 +10415,8 @@ class HtmlUtil {
10400
10415
  language: 'html',
10401
10416
  theme: this.builder.styleDark || this.builder.styleColoredDark ? 'vs-dark' : ''
10402
10417
  });
10403
- this.builder.codeEditorExternal.onKeyUp(() => {
10418
+ this.builder.codeEditorExternal.onDidChangeModelContent(() => {
10419
+ // this.builder.codeEditorExternal.onKeyUp(()=>{
10404
10420
  const source = document.querySelector('textarea[data-source-active]');
10405
10421
  source.value = this.builder.codeEditorExternal.getModel().getValue();
10406
10422
  });
@@ -10425,6 +10441,18 @@ class HtmlUtil {
10425
10441
  } else {
10426
10442
  viewhtml = builderStuff.querySelector('.viewhtml');
10427
10443
  }
10444
+ let modelContent = viewhtml.querySelector('.is-modal-content');
10445
+ let codeEditor = viewhtml.querySelector('.input-code-editor');
10446
+ codeEditor.style.opacity = 0.01;
10447
+ if (mode === 'full') {
10448
+ modelContent.style.width = this.builder.codeEditorWidth;
10449
+ modelContent.style.maxWidth = this.builder.codeEditorMaxWidth;
10450
+ codeEditor.style.height = this.builder.codeEditorHeight;
10451
+ } else {
10452
+ modelContent.style.width = this.builder.blockCodeEditorWidth;
10453
+ modelContent.style.maxWidth = this.builder.blockCodeEditorMaxWidth;
10454
+ codeEditor.style.height = this.builder.blockCodeEditorHeight;
10455
+ }
10428
10456
  util.showModal(viewhtml, true, () => {
10429
10457
  if (btn) {
10430
10458
  btn.removeAttribute('data-focus');
@@ -10432,8 +10460,6 @@ class HtmlUtil {
10432
10460
  }
10433
10461
  });
10434
10462
  if (btn) btn.setAttribute('data-focus', true);
10435
- let codeEditor = viewhtml.querySelector('.input-code-editor');
10436
- codeEditor.style.opacity = 0.01;
10437
10463
  this._view(mode, area);
10438
10464
  }
10439
10465
  _view(mode, area) {
@@ -10468,7 +10494,8 @@ class HtmlUtil {
10468
10494
  theme: this.builder.styleDark || this.builder.styleColoredDark ? 'vs-dark' : ''
10469
10495
  });
10470
10496
  let textarea = viewhtml.querySelector('textarea');
10471
- this.builder.codeEditor.onKeyUp(() => {
10497
+ this.builder.codeEditor.onDidChangeModelContent(() => {
10498
+ // this.builder.codeEditor.onKeyUp(()=>{
10472
10499
  textarea.value = this.builder.codeEditor.getModel().getValue();
10473
10500
  });
10474
10501
  });
@@ -10566,16 +10593,6 @@ class HtmlUtil {
10566
10593
  this.builder.codeEditorArea = area;
10567
10594
  let codeEditor = viewhtml.querySelector('.input-code-editor');
10568
10595
  codeEditor.style.opacity = '';
10569
- let modelContent = viewhtml.querySelector('.is-modal-content');
10570
- if (mode === 'full') {
10571
- modelContent.style.width = this.builder.codeEditorWidth;
10572
- modelContent.style.maxWidth = this.builder.codeEditorMaxWidth;
10573
- codeEditor.style.height = this.builder.codeEditorHeight;
10574
- } else {
10575
- modelContent.style.width = this.builder.blockCodeEditorWidth;
10576
- modelContent.style.maxWidth = this.builder.blockCodeEditorMaxWidth;
10577
- codeEditor.style.height = this.builder.blockCodeEditorHeight;
10578
- }
10579
10596
  }
10580
10597
  fromViewToActual(html) {
10581
10598
  for (var key in hash$1) {
@@ -11074,6 +11091,8 @@ class HtmlUtil {
11074
11091
  if (!disableStaticSection) {
11075
11092
  html = html_content + html_footer + html_others;
11076
11093
  }
11094
+ html = tmp.innerHTML.trim();
11095
+ html = html.replace(/<font/g, '<span').replace(/<\/font/g, '</span');
11077
11096
  } else {
11078
11097
  let emptystyles = tmp.querySelectorAll('[style=""]');
11079
11098
  Array.prototype.forEach.call(emptystyles, emptystyle => {
@@ -11771,6 +11790,29 @@ const prepareSvgIcons = builder => {
11771
11790
  <path d="M18 4a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-5l-5 3v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12z"></path>
11772
11791
  </symbol>
11773
11792
 
11793
+ <symbol id="icon-undo" viewBox="0 0 24 24" stroke-width="1.4" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
11794
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
11795
+ <path d="M9 14l-4 -4l4 -4"></path>
11796
+ <path d="M5 10h11a4 4 0 1 1 0 8h-1"></path>
11797
+ </symbol>
11798
+ <symbol id="icon-redo" viewBox="0 0 24 24" stroke-width="1.4" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
11799
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
11800
+ <path d="M15 14l4 -4l-4 -4"></path>
11801
+ <path d="M19 10h-11a4 4 0 1 0 0 8h1"></path>
11802
+ </symbol>
11803
+ <symbol id="icon-save" viewBox="0 0 24 24" stroke-width="1.4" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
11804
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
11805
+ <path d="M6 4h10l4 4v10a2 2 0 0 1 -2 2h-12a2 2 0 0 1 -2 -2v-12a2 2 0 0 1 2 -2"></path>
11806
+ <path d="M12 14m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path>
11807
+ <path d="M14 4l0 4l-6 0l0 -4"></path>
11808
+ </symbol>
11809
+ <symbol id="icon-back" viewBox="0 0 24 24" stroke-width="1.4" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
11810
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
11811
+ <path d="M9 14l-4 -4l4 -4"></path>
11812
+ <path d="M5 10h11a4 4 0 1 1 0 8h-1"></path>
11813
+ </symbol>
11814
+
11815
+
11774
11816
  </defs>
11775
11817
  </svg>`;
11776
11818
  builder.dom.appendHtml(builder.builderStuff, html);
@@ -12243,6 +12285,21 @@ class Snippets {
12243
12285
  width: 100% !important;
12244
12286
  }
12245
12287
  }
12288
+
12289
+
12290
+ * {
12291
+ scrollbar-width: thin;
12292
+ scrollbar-color: rgba(0, 0, 0, 0.2) auto;
12293
+ }
12294
+ *::-webkit-scrollbar {
12295
+ width: 12px;
12296
+ }
12297
+ *::-webkit-scrollbar-track {
12298
+ background: rgba(200, 200, 200, 0.2);
12299
+ }
12300
+ *::-webkit-scrollbar-thumb {
12301
+ background-color:rgba(0, 0, 0, 0.2);
12302
+ }
12246
12303
  </style>
12247
12304
  </head>
12248
12305
 
@@ -12997,31 +13054,13 @@ const renderQuickAdd = builder => {
12997
13054
  </div>
12998
13055
 
12999
13056
  <div class="is-modal snippets" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
13000
- <div class="is-modal-content" style="max-width:1250px;height:90%;padding:0;">
13057
+ <div class="is-modal-content" style="max-width:1500px;width:80vw;height:80vh;padding:0;">
13001
13058
  <iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
13002
13059
  </div>
13003
13060
  </div>
13004
13061
  `;
13005
13062
  dom.appendHtml(builderStuff, html);
13006
13063
  quickadd = builderStuff.querySelector('.quickadd');
13007
- document.addEventListener('click', e => {
13008
- e = e || window.event;
13009
- var target = e.target || e.srcElement;
13010
- if (quickadd.style.display === 'flex') {
13011
- let a = dom.parentsHasClass(target, 'quickadd');
13012
- let b = dom.parentsHasClass(target, 'row-add');
13013
- let c = dom.parentsHasClass(target, 'is-rowadd-tool');
13014
- let d = dom.parentsHasClass(target, 'cell-add');
13015
- let f = dom.parentsHasClass(target, 'elm-add');
13016
- let g = dom.parentsHasClass(target, 'row-add-initial');
13017
- if (a || b || c || d || f || g) {
13018
- return;
13019
- } else {
13020
- // quickadd.style.display = '';
13021
- util.hidePop(quickadd);
13022
- }
13023
- }
13024
- });
13025
13064
  let tabs = quickadd.querySelectorAll('.is-pop-tab-item');
13026
13065
  Array.prototype.forEach.call(tabs, tab => {
13027
13066
  dom.addEventListener(tab, 'click', e => {
@@ -14520,30 +14559,9 @@ const renderGridEditor = builder => {
14520
14559
  selector: '.is-draggable'
14521
14560
  });
14522
14561
  const grideditor = document.querySelector('.grideditor');
14523
- document.addEventListener('click', e => {
14524
- e = e || window.event;
14525
- var target = e.target || e.srcElement;
14526
- if (dom.hasClass(grideditor, 'active')) {
14527
- let a = dom.parentsHasClass(target, 'is-builder');
14528
- let b = dom.parentsHasClass(target, 'grideditor');
14529
- let c = dom.parentsHasClass(target, 'is-modal');
14530
- let d = dom.parentsHasClass(target, 'is-pop');
14531
- let f = dom.parentsHasClass(target, 'rte-grideditor') || dom.hasClass(target, 'rte-grideditor');
14532
- if (a || b || c || d || f) {
14533
- grideditor.style.display = '';
14534
- return;
14535
- } else {
14536
- grideditor.style.display = 'none';
14537
- }
14538
- }
14539
- }, false);
14540
14562
  let elm = grideditor.querySelector('.is-modal-close');
14541
14563
  dom.addEventListener(elm, 'click', () => {
14542
- dom.removeClass(grideditor, 'active');
14543
- const builders = builder.doc.querySelectorAll(builder.opts.container);
14544
- Array.prototype.forEach.call(builders, builder => {
14545
- builder.removeAttribute('grideditor');
14546
- });
14564
+ builder._rowTool.hideGridEditor();
14547
14565
  });
14548
14566
  const btnGridOutline = grideditor.querySelector('.grid-outline');
14549
14567
  dom.addEventListener(btnGridOutline, 'click', () => {
@@ -14586,6 +14604,35 @@ const renderGridEditor = builder => {
14586
14604
  } else {
14587
14605
  quickadd.setAttribute('data-mode', 'cell-right');
14588
14606
  }
14607
+
14608
+ //handleQuickAddClickOut
14609
+ const handleQuickAddClickOut = e => {
14610
+ // console.log('handleQuickAddClickOut');
14611
+ let elm = e.target;
14612
+ if (!elm) return;
14613
+ if (!elm.closest('.quickadd') && !elm.closest('.row-add') && !elm.closest('.is-rowadd-tool') && !elm.closest('.cell-add') && !elm.closest('.elm-add') && !elm.closest('.row-add-initial')) {
14614
+ // click outside
14615
+
14616
+ // hide
14617
+ const quickadd = builderStuff.querySelector('.quickadd');
14618
+ util.hidePop(quickadd);
14619
+ // console.log('HIDE');
14620
+
14621
+ // clear events
14622
+ document.removeEventListener('click', handleQuickAddClickOut);
14623
+ if (builder.iframeDocument) {
14624
+ builder.doc.removeEventListener('click', handleQuickAddClickOut);
14625
+ }
14626
+ builder.handleQuickAddClickOut_ = false;
14627
+ }
14628
+ };
14629
+ if (!builder.handleQuickAddClickOut_) {
14630
+ document.addEventListener('click', handleQuickAddClickOut);
14631
+ if (builder.iframeDocument) {
14632
+ builder.doc.addEventListener('click', handleQuickAddClickOut);
14633
+ }
14634
+ builder.handleQuickAddClickOut_ = true;
14635
+ }
14589
14636
  });
14590
14637
  elm = grideditor.querySelector('.cell-prev');
14591
14638
  dom.addEventListener(elm, 'click', () => {
@@ -14649,9 +14696,9 @@ const renderGridEditor = builder => {
14649
14696
 
14650
14697
  util.restoreSelection();
14651
14698
 
14652
- // if(this.builder.activeElement) {
14653
- // dom.addClass(this.builder.activeElement, 'elm-active');
14654
- // this.builder.elmTool.repositionElementTool();
14699
+ // if(builder.activeElement) {
14700
+ // dom.addClass(builder.activeElement, 'elm-active');
14701
+ // builder.elmTool.repositionElementTool();
14655
14702
  // }
14656
14703
 
14657
14704
  btnCellSettings.removeAttribute('data-focus');
@@ -17835,7 +17882,7 @@ class Select {
17835
17882
  }
17836
17883
  }
17837
17884
 
17838
- const renderSnippetPanel = builder => {
17885
+ const renderSnippetPanel = (builder, snippetOpen) => {
17839
17886
  const util = builder.util;
17840
17887
  const builderStuff = builder.builderStuff;
17841
17888
  const dom = builder.dom;
@@ -18099,7 +18146,7 @@ const renderSnippetPanel = builder => {
18099
18146
  util.clearControls();
18100
18147
  });
18101
18148
  const viewportWidth = window.innerWidth;
18102
- if (builder.opts.snippetOpen && viewportWidth >= 960) {
18149
+ if ((builder.opts.snippetOpen || snippetOpen) && viewportWidth >= 960) {
18103
18150
  snippetPanel.style.cssText = 'transition: all ease 0.8s;';
18104
18151
  setTimeout(function () {
18105
18152
  toggleSnippets(builder);
@@ -45411,7 +45458,7 @@ class Image$1 {
45411
45458
  ${this.builder.opts.selectIcon}
45412
45459
  </button>
45413
45460
 
45414
- <div class="image-larger1" style="position:relative;flex:none;box-shadow: 0px 3px 6px -6px rgba(0, 0, 0, 0.32);">
45461
+ <div class="image-larger1 is-btn classic" style="position:relative;flex:none;box-shadow: 0px 3px 6px -6px rgba(0, 0, 0, 0.32);">
45415
45462
  <form class="form-upload-larger" target="frameTargetImageUpload" method="post" action="${this.builder.opts.largerImageHandler}" enctype="multipart/form-data" style="border-radius:1px;position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;">
45416
45463
  <input id="hidRefId1" name="hidRefId" type="hidden" value="" />
45417
45464
  <svg class="is-icon-flex" style="width:18px;height:18px;"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
@@ -45434,7 +45481,7 @@ class Image$1 {
45434
45481
 
45435
45482
  <button title="${util.out(this.builder.opts.otherSelectCaption)}" class="input-select-other" style="display:none;width:50px">${this.builder.opts.otherSelectIcon}</button>
45436
45483
 
45437
- <div class="image-larger2" style="position:relative;flex:none;box-shadow: 0px 3px 6px -6px rgba(0, 0, 0, 0.32);">
45484
+ <div class="image-larger2 is-btn classic" style="position:relative;flex:none;box-shadow: 0px 3px 6px -6px rgba(0, 0, 0, 0.32);">
45438
45485
  <form class="form-upload-larger" target="frameTargetImageUpload" method="post" action="${this.builder.opts.fileHandler ? this.builder.opts.fileHandler : this.builder.opts.largerImageHandler}" enctype="multipart/form-data" style="border-radius:1px;position:absolute;top:0;left:0;width:100%;height:100%;display:flex;justify-content:center;align-items:center;">
45439
45486
  <input id="hidRefId2" name="hidRefId" type="hidden" value="" />
45440
45487
  <svg class="is-icon-flex"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
@@ -45471,7 +45518,7 @@ class Image$1 {
45471
45518
 
45472
45519
  <div id="divImageResizerOverlay" class="is-tool">
45473
45520
  </div>
45474
- <div id="divImageResizer" data-x=0 data-y=0 class="is-tool moveable resizable">
45521
+ <div id="divImageResizer" class="keep-selection" style="position:absolute;">
45475
45522
  </div>
45476
45523
  `;
45477
45524
  dom.appendHtml(builderStuff, html);
@@ -45529,24 +45576,26 @@ class Image$1 {
45529
45576
  activeImage = activeImage.parentNode;
45530
45577
  bCircular = true;
45531
45578
  }
45579
+ let zoom = this.builder.opts.zoom;
45580
+ let win = this.builder.win;
45532
45581
  if (!bCircular) {
45533
- activeImage.style.width = `${width / this.builder.opts.zoom}px`;
45582
+ activeImage.style.width = `${width / zoom}px`;
45534
45583
  activeImage.style.height = 'auto';
45535
45584
  } else {
45536
- let pl = parseFloat(window.getComputedStyle(activeImage.parentNode).getPropertyValue('padding-left'));
45537
- let pr = parseFloat(window.getComputedStyle(activeImage.parentNode).getPropertyValue('padding-right'));
45538
- let maxWidth = activeImage.parentNode.offsetWidth * this.builder.opts.zoom - pl - pr;
45585
+ let pl = parseFloat(win.getComputedStyle(activeImage.parentNode).getPropertyValue('padding-left'));
45586
+ let pr = parseFloat(win.getComputedStyle(activeImage.parentNode).getPropertyValue('padding-right'));
45587
+ let maxWidth = activeImage.parentNode.offsetWidth * zoom - pl - pr;
45539
45588
  if (width >= maxWidth) width = maxWidth;
45540
45589
  if (height >= width) {
45541
- activeImage.style.width = `${width / this.builder.opts.zoom}px`;
45542
- activeImage.style.height = `${width / this.builder.opts.zoom}px`;
45543
- activeImage.querySelector('img').style.width = `${width / this.builder.opts.zoom}px`;
45544
- activeImage.querySelector('img').style.height = `${width / this.builder.opts.zoom}px`;
45590
+ activeImage.style.width = `${width / zoom}px`;
45591
+ activeImage.style.height = `${width / zoom}px`;
45592
+ activeImage.querySelector('img').style.width = `${width / zoom}px`;
45593
+ activeImage.querySelector('img').style.height = `${width / zoom}px`;
45545
45594
  } else {
45546
- activeImage.style.width = `${width / this.builder.opts.zoom}px`;
45547
- activeImage.style.height = `${height / this.builder.opts.zoom}px`;
45548
- activeImage.querySelector('img').style.width = `${width / this.builder.opts.zoom}px`;
45549
- activeImage.querySelector('img').style.height = `${height / this.builder.opts.zoom}px`;
45595
+ activeImage.style.width = `${width / zoom}px`;
45596
+ activeImage.style.height = `${height / zoom}px`;
45597
+ activeImage.querySelector('img').style.width = `${width / zoom}px`;
45598
+ activeImage.querySelector('img').style.height = `${height / zoom}px`;
45550
45599
  }
45551
45600
  }
45552
45601
 
@@ -45564,8 +45613,8 @@ class Image$1 {
45564
45613
  }
45565
45614
  */
45566
45615
  newPos = this.builder.util.getElementPosition(activeImage);
45567
- let top = newPos.top;
45568
- let left = newPos.left;
45616
+ let top = newPos.top + window.pageYOffset;
45617
+ let left = newPos.left + window.pageXOffset;
45569
45618
  target.style.top = top + 'px';
45570
45619
  target.style.left = left + 'px';
45571
45620
  target.style.width = activeImage.offsetWidth + 'px';
@@ -45579,9 +45628,11 @@ class Image$1 {
45579
45628
  } else {
45580
45629
  window.getSelection().removeAllRanges();
45581
45630
  }
45631
+ imageResizer.setAttribute('data-resizing', '1'); // important: see util.hidePops()
45582
45632
  }).on('resizeEnd', ({
45583
45633
  target
45584
45634
  }) => {
45635
+ imageResizer.removeAttribute('data-resizing');
45585
45636
  imageResizerOverlay.style.display = '';
45586
45637
  let activeImage = this.builder.activeImage;
45587
45638
  let bCircular = false;
@@ -45608,6 +45659,7 @@ class Image$1 {
45608
45659
  var elementWidth = activeImage.parentNode.offsetWidth - paddingX - borderX;
45609
45660
  //var elementHeight = activeImage.parentNode.offsetHeight - paddingY - borderY;
45610
45661
 
45662
+ let win = this.builder.win;
45611
45663
  let currentWidth;
45612
45664
  if (!bCircular) {
45613
45665
  const parentWidth = elementWidth; //activeImage.parentNode.offsetWidth;
@@ -45615,7 +45667,7 @@ class Image$1 {
45615
45667
  const percentage = currentWidth / parentWidth * 100;
45616
45668
  activeImage.style.width = percentage + '%';
45617
45669
  } else {
45618
- const _screenwidth = window.innerWidth;
45670
+ const _screenwidth = win.innerWidth;
45619
45671
  currentWidth = activeImage.offsetWidth;
45620
45672
  const percentage = currentWidth / _screenwidth * 100;
45621
45673
  activeImage.style.width = percentage + 'vw';
@@ -45931,22 +45983,32 @@ class Image$1 {
45931
45983
  this.builder.openImageSelect(src => {
45932
45984
  this.builder.uo.saveForUndo();
45933
45985
  let img = this.builder.activeImage;
45986
+ // img.setAttribute('src', src);
45987
+ img.addEventListener('load', () => {
45988
+ // this.builder.editor.element.image.repositionImageTool();
45989
+ if (this.builder.activeModule) {
45990
+ this.refreshIfIsModule(this.builder.activeModule);
45991
+ this.builder.activeModule.click();
45992
+ } else {
45993
+ this.repositionImageTool();
45994
+ this.builder.elmTool.repositionElementTool();
45995
+ }
45996
+ });
45934
45997
  img.setAttribute('src', src);
45935
- setTimeout(() => {
45936
- img.click();
45937
- let divImageResizer = document.querySelector('#divImageResizer');
45938
- if (divImageResizer) divImageResizer.click();
45939
- setTimeout(() => {
45940
- img.click();
45941
- let divImageResizer = document.querySelector('#divImageResizer');
45942
- if (divImageResizer) divImageResizer.click();
45943
- }, 600);
45944
- }, 10);
45945
45998
 
45946
- //Trigger Change event
45947
- this.builder.opts.onChange();
45999
+ // setTimeout(()=>{
46000
+ // img.click();
46001
+ // let divImageResizer = document.querySelector('#divImageResizer');
46002
+ // if(divImageResizer) divImageResizer.click();
45948
46003
 
45949
- //Trigger Render event
46004
+ // setTimeout(()=>{
46005
+ // img.click();
46006
+ // let divImageResizer = document.querySelector('#divImageResizer');
46007
+ // if(divImageResizer) divImageResizer.click();
46008
+ // },600);
46009
+ // },10);
46010
+
46011
+ this.builder.opts.onChange();
45950
46012
  this.builder.opts.onRender();
45951
46013
  }, currentSrc);
45952
46014
  });
@@ -46534,18 +46596,36 @@ class Image$1 {
46534
46596
  }
46535
46597
  imageTool.style.top = top + 'px';
46536
46598
  imageTool.style.left = toolLeft + 'px';
46537
- let imageResizer = this.imageResizer;
46538
- imageResizer.style.top = top + 'px';
46539
- imageResizer.style.left = left + 'px';
46540
- imageResizer.style.width = elm.offsetWidth * this.builder.opts.zoom + 'px';
46541
- imageResizer.style.height = elm.offsetHeight * this.builder.opts.zoom + 'px';
46542
- if (!this.builder.hideImageResizer) imageResizer.style.display = 'block';
46543
- this.repositionHandler(elm.offsetWidth, elm.offsetHeight);
46599
+ if (!this.builder.activeImage.hasAttribute('data-noresize')) {
46600
+ let imageResizer = this.imageResizer;
46601
+ imageResizer.style.top = top + 'px';
46602
+ imageResizer.style.left = left + 'px';
46603
+ imageResizer.style.width = elm.offsetWidth * this.builder.opts.zoom + 'px';
46604
+ imageResizer.style.height = elm.offsetHeight * this.builder.opts.zoom + 'px';
46605
+ if (!this.builder.hideImageResizer) imageResizer.style.display = 'block';
46606
+ this.repositionHandler(elm.offsetWidth, elm.offsetHeight);
46544
46607
 
46545
- // moveable
46546
- if (this.builder.moveable) this.builder.moveable.updateRect();
46547
- const movControlBox = document.querySelector('.moveable-control-box');
46548
- if (movControlBox && !this.builder.hideImageResizer) movControlBox.style.display = 'block';
46608
+ // moveable
46609
+ if (this.builder.moveable) this.builder.moveable.updateRect();
46610
+ const movControlBox = document.querySelector('.moveable-control-box');
46611
+ if (movControlBox && !this.builder.hideImageResizer) movControlBox.style.display = 'block';
46612
+ }
46613
+ }
46614
+ }
46615
+ hideImageTool() {
46616
+ let imageTool = this.imageTool;
46617
+ imageTool.style.display = '';
46618
+ let imageResizer = this.imageResizer;
46619
+ imageResizer.style.display = 'none';
46620
+
46621
+ // moveable
46622
+ imageResizer.style.top = '-10px';
46623
+ imageResizer.style.left = '-10px';
46624
+ imageResizer.style.width = '1px';
46625
+ imageResizer.style.height = '1px';
46626
+ if (this.builder.moveable) {
46627
+ this.builder.moveable.updateRect();
46628
+ document.querySelector('.moveable-control-box').style.display = 'none';
46549
46629
  }
46550
46630
  }
46551
46631
  click(e) {
@@ -46642,108 +46722,31 @@ class Image$1 {
46642
46722
  if (this.builder.moveable) this.builder.moveable.updateRect();
46643
46723
  const movControlBox = document.querySelector('.moveable-control-box');
46644
46724
  if (movControlBox && !this.builder.hideImageResizer) movControlBox.style.display = 'block';
46645
-
46646
- /*
46647
- if(elm.getAttribute('data-mov')!=='1'){
46648
- let obj = new Moveable(document.body, {
46649
- target: elm,
46650
- resizable: true,
46651
- throttleResize: 0,
46652
- keepRatio: true,
46653
- }).on('resizeStart', () => {
46654
- const builderStuff = this.builder.builderStuff;
46655
- // hide image tool
46656
- this.imageTool.style.display = '';
46657
- // hide element tool
46658
- let elementTool = builderStuff.querySelector('.is-element-tool');
46659
- elementTool.style.display = '';
46660
- // Hide column tool
46661
- let columnTool = builderStuff.querySelector('.is-column-tool');
46662
- dom.removeClass(columnTool, 'active');
46663
- }).on('resize', ({ target, width, height }) => {
46664
- // target.style.width = `${width}px`;
46665
- // target.style.height = `${height}px`;
46666
- // get active image
46667
- let activeImage = target;
46668
- let bCircular = false;
46669
- if(dom.hasClass(activeImage, 'img-circular')) {
46670
- bCircular = true;
46671
- }
46672
- let pl = parseFloat(window.getComputedStyle(activeImage.parentNode).getPropertyValue('padding-left'));
46673
- let pr = parseFloat(window.getComputedStyle(activeImage.parentNode).getPropertyValue('padding-right'));
46674
- let maxWidth = activeImage.parentNode.offsetWidth - pl - pr;
46675
- if(width>maxWidth) return;
46676
- if(!bCircular) {
46677
- // activeImage.style.width = `${width/this.builder.opts.zoom}px`;
46678
- // activeImage.style.height = 'auto';
46679
- activeImage.style.width = `${width}px`;
46680
- activeImage.style.height = `${height}px`;
46681
- } else {
46682
- if(height>=width) {
46683
- activeImage.style.width = `${width}px`;
46684
- activeImage.style.height =`${width}px`;
46685
- activeImage.querySelector('img').style.width = `${width}px`;
46686
- activeImage.querySelector('img').style.height = `${width}px`;
46687
- } else {
46688
- activeImage.style.width = `${width}px`;
46689
- activeImage.style.height =`${height}px`;
46690
- activeImage.querySelector('img').style.width = `${width}px`;
46691
- activeImage.querySelector('img').style.height = `${height}px`;
46692
- }
46693
- }
46694
-
46695
- // https://stackoverflow.com/questions/29908261/prevent-text-selection-on-mouse-drag
46696
- // prevent text selection
46697
- if (document.selection) {
46698
- document.selection.empty();
46699
- } else {
46700
- window.getSelection().removeAllRanges();
46701
- }
46702
-
46703
- }).on('resizeEnd', ({ target }) => {
46704
- const builderStuff = this.builder.builderStuff;
46705
- let activeImage = target;
46706
- let bCircular = false;
46707
- if(dom.hasClass(activeImage, 'img-circular')) {
46708
- bCircular = true;
46709
- }
46710
- // https://stackoverflow.com/questions/25197184/get-the-height-of-an-element-minus-padding-margin-border-widths
46711
- var cs = getComputedStyle(activeImage.parentNode);
46712
- var paddingX = parseFloat(cs.paddingLeft) + parseFloat(cs.paddingRight);
46713
- //var paddingY = parseFloat(cs.paddingTop) + parseFloat(cs.paddingBottom);
46714
- var borderX = parseFloat(cs.borderLeftWidth) + parseFloat(cs.borderRightWidth);
46715
- //var borderY = parseFloat(cs.borderTopWidth) + parseFloat(cs.borderBottomWidth);
46716
- // Element width and height minus padding and border
46717
- var elementWidth = activeImage.parentNode.offsetWidth - paddingX - borderX;
46718
- //var elementHeight = activeImage.parentNode.offsetHeight - paddingY - borderY;
46719
- if(!bCircular) {
46720
- var parentWidth = elementWidth; //activeImage.parentNode.offsetWidth;
46721
- var currentWidth = activeImage.offsetWidth;
46722
- // var currentHeight = activeImage.offsetHeight;
46723
- var percentage = (currentWidth / parentWidth) * 100;
46724
- activeImage.style.width = percentage + '%';
46725
- activeImage.style.height = 'auto';
46726
- // activeImage.style.height = ((percentage*currentHeight)/currentWidth) + '%';//new
46727
- }
46728
- if(this.builder.opts.emailMode) {
46729
- //activeImage.setAttribute('width', percentage + '%');
46730
- activeImage.setAttribute('width', currentWidth);
46731
- }
46732
- target.setAttribute('data-resized', 1);
46733
- setTimeout(()=>{
46734
- target.setAttribute('data-resized', 0);
46735
- },300);
46736
- //Trigger Change event
46737
- this.builder.opts.onChange();
46738
- // Show column tool
46739
- let columnTool = builderStuff.querySelector('.is-column-tool');
46740
- dom.addClass(columnTool, 'active');
46741
-
46742
- });
46743
- elm.setAttribute('data-mov','1');
46744
- this.builder.imgs.push(obj);
46745
- }
46746
- */
46725
+ const handleImageToolClickOut = e => {
46726
+ // console.log('handleImageToolClickOut');
46727
+ let elm = e.target;
46728
+ if (!elm) return;
46729
+ if (!elm.closest('#divImageResizer') && !elm.closest('#divImageTool') && !elm.closest('.is-modal') && !elm.closest('.keep-selection') && !elm.closest('.sl-wrapper') && !elm.closest('.sl-overlay') && !elm.closest('.sl-close') && !elm.closest('img')) {
46730
+ // click outside
46731
+
46732
+ // hide
46733
+ this.hideImageTool();
46734
+ // console.log('HIDE');
46735
+
46736
+ document.removeEventListener('click', handleImageToolClickOut);
46737
+ if (this.builder.iframeDocument) {
46738
+ this.builder.doc.removeEventListener('click', handleImageToolClickOut);
46739
+ }
46740
+ this.builder.handleImageToolClickOut_ = false;
46741
+ }
46742
+ };
46743
+ if (!this.builder.handleImageToolClickOut_) {
46744
+ document.addEventListener('click', handleImageToolClickOut);
46745
+ if (this.builder.iframeDocument) {
46746
+ this.builder.doc.addEventListener('click', handleImageToolClickOut);
46747
+ }
46748
+ this.builder.handleImageToolClickOut_ = true;
46749
+ }
46747
46750
  } else {
46748
46751
  let imageResizer = this.imageResizer;
46749
46752
  imageResizer.style.display = 'none';
@@ -46763,18 +46766,7 @@ class Image$1 {
46763
46766
  prog = true;
46764
46767
  }
46765
46768
  if (prog) {
46766
- imageTool.style.display = '';
46767
- let imageResizer = this.imageResizer;
46768
- imageResizer.style.display = 'none';
46769
-
46770
- // moveable
46771
- imageResizer.style.top = '-10px';
46772
- imageResizer.style.left = '-10px';
46773
- imageResizer.style.width = '1px';
46774
- imageResizer.style.height = '1px';
46775
- if (this.builder.moveable) this.builder.moveable.updateRect();
46776
- const movControlBox = document.querySelector('.moveable-control-box');
46777
- if (movControlBox) movControlBox.style.display = 'none';
46769
+ this.hideImageTool();
46778
46770
  }
46779
46771
 
46780
46772
  // NOTE:
@@ -46788,36 +46780,11 @@ class Image$1 {
46788
46780
  // },100);
46789
46781
  // }
46790
46782
  } else {
46791
- let imageTool = this.imageTool;
46792
- imageTool.style.display = '';
46793
46783
  this.builder.activeImage = null;
46794
- let imageResizer = this.imageResizer;
46795
- imageResizer.style.display = 'none';
46796
-
46797
- // moveable
46798
- imageResizer.style.top = '-10px';
46799
- imageResizer.style.left = '-10px';
46800
- imageResizer.style.width = '1px';
46801
- imageResizer.style.height = '1px';
46802
- if (this.builder.moveable) this.builder.moveable.updateRect();
46803
- const movControlBox = document.querySelector('.moveable-control-box');
46804
- if (movControlBox) movControlBox.style.display = 'none';
46784
+ this.hideImageTool();
46805
46785
  }
46806
46786
  } else {
46807
- let imageTool = this.imageTool;
46808
- imageTool.style.display = '';
46809
46787
  this.builder.activeImage = null;
46810
- let imageResizer = this.imageResizer;
46811
- imageResizer.style.display = 'none';
46812
-
46813
- // moveable
46814
- imageResizer.style.top = '-10px';
46815
- imageResizer.style.left = '-10px';
46816
- imageResizer.style.width = '1px';
46817
- imageResizer.style.height = '1px';
46818
- if (this.builder.moveable) this.builder.moveable.updateRect();
46819
- const movControlBox = document.querySelector('.moveable-control-box');
46820
- if (movControlBox) movControlBox.style.display = 'none';
46821
46788
  }
46822
46789
  }
46823
46790
 
@@ -48725,7 +48692,7 @@ class Hyperlink {
48725
48692
  <button title="${util.out(this.builder.opts.otherSelectCaption)}" class="input-select-other" style="display:none;width:50px">
48726
48693
  ${this.builder.opts.otherSelectIcon}
48727
48694
  </button>
48728
- <div class="div-anyfile-upload" style="position: relative; flex: 0 0 auto; width: 43px; height: 43px; box-shadow: rgba(0, 0, 0, 0.32) 0px 3px 6px -6px;">
48695
+ <div class="div-anyfile-upload is-btn classic" style="position: relative; flex: 0 0 auto; width: 50px; height: 43px; box-shadow: rgba(0, 0, 0, 0.32) 0px 3px 6px -6px;">
48729
48696
  <form class="form-upload-larger" target="frameTargetAnyfileUpload" method="post" action="${this.builder.opts.fileHandler}" enctype="multipart/form-data" style="overflow:hidden;position:absolute;top:0;left:0;width:100%;height:100%;border-radius:1px;display:flex;align-items: center;justify-content: center;">
48730
48697
  <input class="input-anyfile-customval" name="hidRefId" type="hidden" value="${this.builder.customval}" />
48731
48698
  <svg class="is-icon-flex"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
@@ -48882,15 +48849,17 @@ class Hyperlink {
48882
48849
  }
48883
48850
  link.setAttribute('title', title);
48884
48851
  } else {
48885
- link.outerHTML = link.innerHTML;
48852
+ // link.outerHTML = link.innerHTML;
48886
48853
  this.hideTool();
48887
48854
  if (this.builder.activeIcon) {
48888
48855
  this.builder.activeIcon.setAttribute('dummy-sel', '');
48889
48856
  link.outerHTML = this.builder.activeIcon.outerHTML;
48890
- let icon = document.querySelector('[dummy-sel]');
48857
+ let icon = this.builder.doc.querySelector('[dummy-sel]');
48891
48858
  icon.removeAttribute('dummy-sel');
48892
48859
  this.builder.activeIcon = icon;
48893
48860
  this.builder.activeIcon.click();
48861
+ } else {
48862
+ link.outerHTML = link.innerHTML;
48894
48863
  }
48895
48864
  }
48896
48865
 
@@ -49127,8 +49096,6 @@ class Hyperlink {
49127
49096
 
49128
49097
  this.showTool(link);
49129
49098
  e.preventDefault();
49130
- } else {
49131
- this.hideTool();
49132
49099
  }
49133
49100
  }
49134
49101
  showTool(link) {
@@ -49170,6 +49137,33 @@ class Hyperlink {
49170
49137
  const h = linkTool.offsetHeight;
49171
49138
  linkTool.style.top = top - h - 3 + 'px';
49172
49139
  linkTool.style.left = left + link.offsetWidth * this.builder.opts.zoom - w + 'px';
49140
+ const handleLinkButtonClick = e => {
49141
+ // console.log('handleLinkButtonClick');
49142
+ let elm = e.target;
49143
+ if (!elm) return;
49144
+ if (!elm.closest('#divLinkTool') && !elm.closest('.is-modal') && !elm.closest('.keep-selection') && !elm.closest('a')) {
49145
+ // click outside
49146
+
49147
+ // hide
49148
+ this.hideTool();
49149
+ // console.log('HIDE');
49150
+
49151
+ // Hide Button Editor Modal
49152
+ this.builder.element.hyperlink.buttonEditor.hide();
49153
+ document.removeEventListener('click', handleLinkButtonClick);
49154
+ if (this.builder.iframeDocument) {
49155
+ this.builder.doc.removeEventListener('click', handleLinkButtonClick);
49156
+ }
49157
+ this.builder.handleLinkButtonClick_ = false;
49158
+ }
49159
+ };
49160
+ if (!this.builder.handleLinkButtonClick_) {
49161
+ document.addEventListener('click', handleLinkButtonClick);
49162
+ if (this.builder.iframeDocument) {
49163
+ this.builder.doc.addEventListener('click', handleLinkButtonClick);
49164
+ }
49165
+ this.builder.handleLinkButtonClick_ = true;
49166
+ }
49173
49167
  }
49174
49168
  hideTool() {
49175
49169
  this.linkTool.style.display = '';
@@ -49522,9 +49516,34 @@ class Button {
49522
49516
  if (btn && !customcode && !noedit && !_protected) {
49523
49517
  this.builder.activeButton = btn;
49524
49518
  this.showTool(btn);
49519
+ const handleButtonClick = e => {
49520
+ // console.log('handleButtonClick');
49521
+ let elm = e.target;
49522
+ if (!elm) return;
49523
+ if (!elm.closest('#divButtonTool') && !elm.closest('.is-modal') && !elm.closest('.keep-selection') && !elm.closest('button')) {
49524
+ // click outside
49525
+
49526
+ // hide
49527
+ this.hideTool();
49528
+ // console.log('HIDE');
49529
+
49530
+ // Hide Button Editor Modal
49531
+ this.builder.element.hyperlink.buttonEditor.hide();
49532
+ document.removeEventListener('click', handleButtonClick);
49533
+ if (this.builder.iframeDocument) {
49534
+ this.builder.doc.removeEventListener('click', handleButtonClick);
49535
+ }
49536
+ this.builder.handleButtonClick_ = false;
49537
+ }
49538
+ };
49539
+ if (!this.builder.handleButtonClick_) {
49540
+ document.addEventListener('click', handleButtonClick);
49541
+ if (this.builder.iframeDocument) {
49542
+ this.builder.doc.addEventListener('click', handleButtonClick);
49543
+ }
49544
+ this.builder.handleButtonClick_ = true;
49545
+ }
49525
49546
  e.preventDefault();
49526
- } else {
49527
- this.hideTool();
49528
49547
  }
49529
49548
  }
49530
49549
  editButton() {
@@ -49731,7 +49750,8 @@ class Module {
49731
49750
  if (!moduleTool) {
49732
49751
  let html = `
49733
49752
  <div class="is-tool is-module-tool">
49734
- <button title="${util.out('Settings')}" data-title="${util.out('Settings')}" style="width:40px;height:40px;"><svg class="is-icon-flex"><use xlink:href="#ion-ios-gear"></use></svg></button>
49753
+ <button class="btn-module-refresh" title="${util.out('Refresh')}" data-title="${util.out('Refresh')}" style="width:40px;height:40px;"><svg class="is-icon-flex"><use xlink:href="#icon-reload"></use></svg></button>
49754
+ <button class="btn-module-settings" title="${util.out('Settings')}" data-title="${util.out('Settings')}" style="width:40px;height:40px;"><svg class="is-icon-flex"><use xlink:href="#ion-ios-gear"></use></svg></button>
49735
49755
  </div>
49736
49756
 
49737
49757
  <input id="hidContentModuleCode" type="hidden" />
@@ -49759,11 +49779,15 @@ class Module {
49759
49779
  }
49760
49780
  moduleModal = builderStuff.querySelector('.is-modal.custommodule');
49761
49781
  this.moduleModal = moduleModal;
49762
- let btn = moduleTool.querySelector('button');
49763
- dom.addEventListener(btn, 'click', async () => {
49764
- // old: 10100
49765
-
49766
- this.edit(btn);
49782
+ const btnModuleSettings = moduleTool.querySelector('.btn-module-settings');
49783
+ btnModuleSettings.addEventListener('click', async () => {
49784
+ this.edit(btnModuleSettings);
49785
+ });
49786
+ const btnModuleRefresh = moduleTool.querySelector('.btn-module-refresh');
49787
+ btnModuleRefresh.addEventListener('click', async () => {
49788
+ let module = this.builder.activeModule;
49789
+ module.click();
49790
+ this.util.refreshModuleLayout(module);
49767
49791
  });
49768
49792
  let btnOk = moduleModal.querySelector('.input-ok');
49769
49793
  dom.addEventListener(btnOk, 'click', () => {
@@ -49811,16 +49835,16 @@ class Module {
49811
49835
  });
49812
49836
  let builderActive = this.builder.doc.querySelector('.builder-active');
49813
49837
  if (builderActive) this.builder.applyBehaviorOn(builderActive);
49814
-
49815
- //Trigger Change event
49816
49838
  this.builder.opts.onChange();
49817
-
49818
- //Trigger Render event
49819
49839
  this.builder.opts.onRender();
49820
- this.util.hideControls();
49821
- this.util.repositionColumnTool(true);
49822
- if (this.builder.onRefreshTool) this.builder.onRefreshTool();
49823
- module.click();
49840
+
49841
+ // this.util.hideControls();
49842
+
49843
+ // this.util.repositionColumnTool(true);
49844
+ // if(this.builder.onRefreshTool) this.builder.onRefreshTool();
49845
+
49846
+ // module.click();
49847
+
49824
49848
  this.builder.hideModal(moduleModal);
49825
49849
  });
49826
49850
  let btnCancel = moduleModal.querySelector('.input-cancel');
@@ -49837,7 +49861,10 @@ class Module {
49837
49861
  const dom = this.dom;
49838
49862
 
49839
49863
  //-------- Set a flag to indicate active module -----------
49840
- dom.removeAttributes(document.querySelectorAll('[data-module-active]'), 'data-module-active');
49864
+ dom.removeAttributes(this.builder.doc.querySelectorAll('[data-module-active]'), 'data-module-active');
49865
+ // this.builder.doc.querySelectorAll('[data-module-active]').forEach(element => {
49866
+ // element.removeAttribute('data-module-active');
49867
+ // });
49841
49868
  module.setAttribute('data-module-active', '1');
49842
49869
  //-------- /Set a flag to indicate active module -----------
49843
49870
 
@@ -49953,26 +49980,27 @@ class Module {
49953
49980
  index++;
49954
49981
  });
49955
49982
  */
49983
+ if (module.getAttribute('data-panel') === 'side' && this.builder.controlPanel) ; else {
49984
+ this.util.showModal(moduleModal, true, () => {
49985
+ if (btn) {
49986
+ btn.removeAttribute('data-focus');
49987
+ btn.focus();
49988
+ }
49989
+ });
49990
+ if (btn) btn.setAttribute('data-focus', true);
49956
49991
 
49957
- this.util.showModal(moduleModal, true, () => {
49958
- if (btn) {
49959
- btn.removeAttribute('data-focus');
49960
- btn.focus();
49961
- }
49962
- });
49963
- if (btn) btn.setAttribute('data-focus', true);
49964
-
49965
- // var d = new Date();
49966
- // moduleModal.querySelector('iframe').src = this.builder.opts.modulePath + modulename + '.html?' + d.getTime(); //always refreshed
49992
+ // var d = new Date();
49993
+ // moduleModal.querySelector('iframe').src = this.builder.opts.modulePath + modulename + '.html?' + d.getTime(); //always refreshed
49967
49994
 
49968
- const iframe = moduleModal.querySelector('iframe');
49969
- let result = await fetch(this.builder.opts.modulePath + modulename + '.html');
49970
- result = await result.text();
49971
- result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
49972
- let doc = iframe.contentWindow.document;
49973
- doc.open();
49974
- doc.write(result);
49975
- doc.close();
49995
+ let iframe = moduleModal.querySelector('iframe');
49996
+ let result = await fetch(this.builder.opts.modulePath + modulename + '.html');
49997
+ result = await result.text();
49998
+ result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
49999
+ let doc = iframe.contentWindow.document;
50000
+ doc.open();
50001
+ doc.write(result);
50002
+ doc.close();
50003
+ }
49976
50004
  }
49977
50005
  click(col) {
49978
50006
  let custommodule = false;
@@ -49982,25 +50010,38 @@ class Module {
49982
50010
  }
49983
50011
  if (custommodule) {
49984
50012
  this.builder.activeModule = col;
49985
- let elm = col;
49986
50013
  this.moduleTool.style.display = 'flex';
49987
- let _toolwidth = this.moduleTool.offsetWidth; //to get value, element must not hidden (display:none). So set display:flex before this.
49988
-
49989
- let w = elm.offsetWidth * this.builder.opts.zoom;
49990
- let top = elm.getBoundingClientRect().top + this.builder.win.pageYOffset;
49991
- let left = elm.getBoundingClientRect().left - 2;
49992
- left = left + (w - _toolwidth);
49993
-
49994
- //Adjust left in case an element is outside the screen
49995
- const _screenwidth = window.innerWidth;
49996
- if (_toolwidth + left > _screenwidth) left = elm.getBoundingClientRect().left;
49997
- this.moduleTool.style.top = top + 'px';
49998
- this.moduleTool.style.left = left + 'px';
50014
+ const btn = this.moduleTool.querySelector('.btn-module-settings');
50015
+ if (col.getAttribute('data-panel') === 'side' && this.builder.controlPanel) {
50016
+ btn.style.display = 'none';
50017
+ } else {
50018
+ btn.style.display = '';
50019
+ }
50020
+ this.repositionModuleTool();
49999
50021
  } else {
50000
50022
  this.builder.activeModule = null;
50001
50023
  this.moduleTool.style.display = '';
50002
50024
  }
50003
50025
  }
50026
+ repositionModuleTool() {
50027
+ if (!this.builder.activeModule) return;
50028
+ if (this.moduleTool.style.display !== 'flex') return;
50029
+ let elm = this.builder.activeModule;
50030
+
50031
+ // this.moduleTool.style.display = 'flex';
50032
+ let _toolwidth = this.moduleTool.offsetWidth; //to get value, element must not hidden (display:none). So set display:flex before this.
50033
+
50034
+ let w = elm.offsetWidth * this.builder.opts.zoom;
50035
+ let top = elm.getBoundingClientRect().top + this.builder.win.pageYOffset;
50036
+ let left = elm.getBoundingClientRect().left - 2;
50037
+ left = left + (w - _toolwidth);
50038
+
50039
+ //Adjust left in case an element is outside the screen
50040
+ const _screenwidth = window.innerWidth;
50041
+ if (_toolwidth + left > _screenwidth) left = elm.getBoundingClientRect().left;
50042
+ this.moduleTool.style.top = top + 'px';
50043
+ this.moduleTool.style.left = left + 'px';
50044
+ }
50004
50045
  }
50005
50046
 
50006
50047
  class Code {
@@ -50433,21 +50474,6 @@ class Table {
50433
50474
  tableTool = contentStuff.querySelector('.is-table-tool');
50434
50475
  }
50435
50476
  tableModal = builderStuff.querySelector('.is-modal.edittable');
50436
- let btn = tableTool.querySelector('button');
50437
- dom.addEventListener(btn, 'click', () => {
50438
- // old 10317
50439
- if (dom.hasClass(tableModal, 'active')) {
50440
- // dom.removeClass(tableModal, 'active');
50441
- util.hideModal(tableModal);
50442
- } else {
50443
- dom.addClass(tableModal, 'active');
50444
- util.showModal(tableModal);
50445
- }
50446
- });
50447
- let btnClose = tableModal.querySelector('.is-modal-close');
50448
- dom.addEventListener(btnClose, 'click', () => {
50449
- dom.removeClass(tableModal, 'active');
50450
- });
50451
50477
  const btnBgColor = tableModal.querySelector('.input-table-bgcolor');
50452
50478
  btnBgColor.addEventListener('click', e => {
50453
50479
  this.builder.uo.saveForUndo();
@@ -50609,7 +50635,7 @@ class Table {
50609
50635
 
50610
50636
  //Table Layout
50611
50637
 
50612
- btn = tableModal.querySelector('[data-table-cmd="rowabove"]');
50638
+ let btn = tableModal.querySelector('[data-table-cmd="rowabove"]');
50613
50639
  btn.addEventListener('click', () => {
50614
50640
  if (!this.builder.activeTd) return;
50615
50641
 
@@ -50746,47 +50772,99 @@ class Table {
50746
50772
  //Trigger Change event
50747
50773
  this.builder.opts.onChange();
50748
50774
  });
50775
+ btn = tableTool.querySelector('button');
50776
+ dom.addEventListener(btn, 'click', () => {
50777
+ // old 10317
50778
+
50779
+ if (tableModal.classList.contains('active')) {
50780
+ this.hideTableEditor();
50781
+ } else {
50782
+ this.showTableEditor();
50783
+ }
50784
+ });
50785
+ let btnClose = tableModal.querySelector('.is-modal-close');
50786
+ dom.addEventListener(btnClose, 'click', () => {
50787
+ dom.removeClass(tableModal, 'active');
50788
+ });
50749
50789
  }
50750
50790
  this.tableTool = tableTool;
50751
50791
  this.tableModal = tableModal;
50752
50792
  }
50753
- click(e) {
50754
- const dom = this.dom;
50755
- if (dom.parentsHasElement(e.target, 'table')) {
50756
- // only edit table.default
50757
-
50758
- let element = e.target;
50759
- let td;
50760
- let table;
50761
- if (element.tagName.toLowerCase() === 'td') {
50762
- td = element;
50763
- } else {
50764
- while (element.tagName.toLowerCase() !== 'td') {
50765
- element = element.parentNode;
50793
+ showTableEditor() {
50794
+ const tableModal = this.tableModal;
50795
+ this.util.showModal(tableModal);
50796
+ this.realtime();
50797
+ const handleTableClick = e => {
50798
+ // console.log('handleTableClick');
50799
+ let elm = e.target;
50800
+ if (!elm) return;
50801
+ if (!elm.closest('.is-table-tool') && !elm.closest('.is-sidebar') && !elm.closest('.is-modal') && !elm.closest('.keep-selection') && !elm.closest('table')) {
50802
+ // click outside
50803
+
50804
+ // hide
50805
+ this.hideTableEditor();
50806
+ // console.log('HIDE');
50807
+
50808
+ document.removeEventListener('click', handleTableClick);
50809
+ if (this.builder.iframeDocument) {
50810
+ this.builder.doc.removeEventListener('click', handleTableClick);
50766
50811
  }
50767
- td = element;
50812
+ this.builder.handleTableClick_ = false;
50768
50813
  }
50769
- while (element.tagName.toLowerCase() !== 'table') {
50770
- element = element.parentNode;
50814
+ if (elm.closest('table')) {
50815
+ this.realtime();
50816
+ }
50817
+ };
50818
+ if (!this.builder.handleTableClick_) {
50819
+ document.addEventListener('click', handleTableClick);
50820
+ if (this.builder.iframeDocument) {
50821
+ this.builder.doc.addEventListener('click', handleTableClick);
50771
50822
  }
50772
- table = element;
50823
+ this.builder.handleTableClick_ = true;
50824
+ }
50825
+ }
50826
+ hideTableEditor() {
50827
+ const tableModal = this.tableModal;
50828
+ this.util.hideModal(tableModal);
50829
+ }
50830
+ realtime() {
50831
+ const tableModal = this.tableModal;
50832
+ if (tableModal.classList.contains('active') && this.builder.activeTable) {
50833
+ let activeTd = this.builder.activeTd;
50834
+ tableModal.querySelector('.input-table-bgcolor').style.backgroundColor = activeTd.style.backgroundColor;
50835
+ tableModal.querySelector('.input-table-textcolor').style.backgroundColor = activeTd.style.color;
50836
+ tableModal.querySelector('.input-table-bordercolor').style.backgroundColor = activeTd.style.borderColor;
50837
+ tableModal.querySelector('#selCellBorderWidth').value = parseInt(activeTd.style.borderWidth);
50838
+ } else {
50839
+ tableModal.querySelector('.input-table-bgcolor').style.backgroundColor = '';
50840
+ tableModal.querySelector('.input-table-textcolor').style.backgroundColor = '';
50841
+ tableModal.querySelector('.input-table-bordercolor').style.backgroundColor = '';
50842
+ tableModal.querySelector('#selCellBorderWidth').value = 0;
50843
+ }
50844
+ }
50845
+ click(e) {
50846
+ let elm = e.target;
50847
+ if (!elm) return;
50848
+ const dom = this.dom;
50849
+ const table = elm.closest('table');
50850
+ if (table) {
50851
+ let td = elm.closest('td');
50773
50852
  if (dom.hasClass(table, 'default')) {
50774
50853
  // only edit table.default
50775
50854
 
50776
50855
  this.builder.activeTd = td;
50777
50856
  this.builder.activeTable = table;
50778
- let elm = table;
50779
50857
  this.tableTool.style.display = 'flex';
50780
50858
  let _toolwidth = this.tableTool.offsetWidth; //to get value, element must not hidden (display:none). So set display:flex before this.
50781
50859
 
50782
- let w = elm.offsetWidth * this.builder.opts.zoom;
50783
- let top = elm.getBoundingClientRect().top + this.builder.win.pageYOffset;
50784
- let left = elm.getBoundingClientRect().left - 2;
50860
+ let w = table.offsetWidth * this.builder.opts.zoom;
50861
+ let top = table.getBoundingClientRect().top + this.builder.win.pageYOffset;
50862
+ let left = table.getBoundingClientRect().left - 2;
50785
50863
  left = left + (w - _toolwidth);
50786
50864
 
50787
50865
  //Adjust left in case an element is outside the screen
50788
50866
  const _screenwidth = window.innerWidth;
50789
- if (_toolwidth + left > _screenwidth) left = elm.getBoundingClientRect().left;
50867
+ if (_toolwidth + left > _screenwidth) left = table.getBoundingClientRect().left;
50790
50868
  this.tableTool.style.top = top + 'px';
50791
50869
  this.tableTool.style.left = left + 'px';
50792
50870
  } else {
@@ -50799,18 +50877,6 @@ class Table {
50799
50877
  this.builder.activeTable = null;
50800
50878
  this.tableTool.style.display = '';
50801
50879
  }
50802
- if (dom.hasClass(this.tableModal, 'active') && this.builder.activeTable) {
50803
- let activeTd = this.builder.activeTd;
50804
- this.tableModal.querySelector('.input-table-bgcolor').style.backgroundColor = activeTd.style.backgroundColor;
50805
- this.tableModal.querySelector('.input-table-textcolor').style.backgroundColor = activeTd.style.color;
50806
- this.tableModal.querySelector('.input-table-bordercolor').style.backgroundColor = activeTd.style.borderColor;
50807
- this.tableModal.querySelector('#selCellBorderWidth').value = parseInt(activeTd.style.borderWidth);
50808
- } else {
50809
- this.tableModal.querySelector('.input-table-bgcolor').style.backgroundColor = '';
50810
- this.tableModal.querySelector('.input-table-textcolor').style.backgroundColor = '';
50811
- this.tableModal.querySelector('.input-table-bordercolor').style.backgroundColor = '';
50812
- this.tableModal.querySelector('#selCellBorderWidth').value = 0;
50813
- }
50814
50880
  }
50815
50881
  }
50816
50882
 
@@ -50857,7 +50923,7 @@ class Video {
50857
50923
  <button title="${util.out('Select')}" class="input-select" style="flex:none;">
50858
50924
  ${this.builder.opts.selectIcon}
50859
50925
  </button>
50860
- <div class="video-larger1 input-upload" style="position:relative;flex:none;box-shadow: 0px 3px 6px -6px rgba(0, 0, 0, 0.32);">
50926
+ <div class="video-larger1 input-upload is-btn classic" style="position:relative;flex:none;box-shadow: 0px 3px 6px -6px rgba(0, 0, 0, 0.32);">
50861
50927
  <form class="form-upload-larger" target="frameTargetVideoUpload" method="post" action="${this.builder.opts.videoHandler}" enctype="multipart/form-data" style="position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%;">
50862
50928
  <input id="hidRefId5" name="hidRefId" type="hidden" value="" />
50863
50929
  <svg class="is-icon-flex" style="width:18px;height:18px;"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
@@ -51097,7 +51163,7 @@ class Audio {
51097
51163
  <button title="${util.out('Select')}" class="input-select" style="flex:none;">
51098
51164
  ${this.builder.opts.selectIcon}
51099
51165
  </button>
51100
- <div class="audio-file-upload input-upload" style="position:relative;flex:none;box-shadow: 0px 3px 6px -6px rgba(0, 0, 0, 0.32);">
51166
+ <div class="audio-file-upload input-upload is-btn classic" style="position:relative;flex:none;box-shadow: 0px 3px 6px -6px rgba(0, 0, 0, 0.32);">
51101
51167
  <form class="form-upload-larger" target="frameTargetAudioUpload" method="post" action="${this.builder.opts.audioHandler}" enctype="multipart/form-data" style="position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%;">
51102
51168
  <input id="hidRefAudio" name="hidRefId" type="hidden" value="" />
51103
51169
  <svg class="is-icon-flex" style="width:18px;height:18px;"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
@@ -51248,66 +51314,7 @@ class Audio {
51248
51314
  }
51249
51315
  }
51250
51316
 
51251
- // Currently not used
51252
-
51253
- class Svg {
51254
- constructor(builder) {
51255
- this.builder = builder;
51256
- const util = this.builder.util;
51257
- const builderStuff = this.builder.builderStuff;
51258
- this.util = util;
51259
- this.builderStuff = builderStuff;
51260
- const dom = this.builder.dom;
51261
- this.dom = dom;
51262
- let svgTool = builderStuff.querySelector('#divSvgTool');
51263
- if (!svgTool) {
51264
- let html = `
51265
- <div id="divSvgTool" class="is-tool">
51266
-
51267
- </div>
51268
- `;
51269
- dom.appendHtml(builderStuff, html);
51270
- svgTool = builderStuff.querySelector('#divSvgTool');
51271
- }
51272
- this.svgTool = svgTool;
51273
- }
51274
- click() {//e
51275
- // Do Nothing
51276
- /*
51277
- const elm = e.target;
51278
- if(elm.tagName.toLowerCase() === 'svg' || elm.tagName.toLowerCase() === 'path') {
51279
- this.builder.activeSvg = elm.closest('svg');
51280
- // prevent text selection
51281
- if (document.selection) {
51282
- document.selection.empty();
51283
- } else {
51284
- window.getSelection().removeAllRanges();
51285
- }
51286
-
51287
- this.showTool(this.builder.activeSvg);
51288
- } else {
51289
- this.hideTool();
51290
- }
51291
- */
51292
- }
51293
- /*
51294
- showTool(elm) {
51295
- const top = elm.getBoundingClientRect().top + window.pageYOffset;
51296
- const left = elm.getBoundingClientRect().left;
51297
- this.svgTool.style.display = 'flex';
51298
-
51299
- const w = this.svgTool.offsetWidth; //to get value, element must not hidden (display:none). So set display:flex before this.
51300
- const h = this.svgTool.offsetHeight;
51301
- var bBox = elm.getBBox();
51302
- this.svgTool.style.top = (top - h + window.pageYOffset - 3) + 'px';
51303
- this.svgTool.style.left = (left + (bBox.width * this.builder.opts.zoom) - bBox.width) + 'px';
51304
- }
51305
- hideTool() {
51306
- this.svgTool.style.display = '';
51307
- }
51308
- */
51309
- }
51310
-
51317
+ // import Svg from './elementsvg.js';
51311
51318
  // import Moveable from 'moveable';
51312
51319
 
51313
51320
  class Element$1 {
@@ -51329,8 +51336,9 @@ class Element$1 {
51329
51336
  this.table = new Table(builder);
51330
51337
  this.video = new Video(builder);
51331
51338
  this.audio = new Audio(builder);
51332
- this.svg = new Svg(builder);
51339
+ // this.svg = new Svg(builder);
51333
51340
  }
51341
+
51334
51342
  applyBehavior(col) {
51335
51343
  const dom = this.dom;
51336
51344
  let customcode = false;
@@ -51468,13 +51476,11 @@ class Element$1 {
51468
51476
  //previously this is commented: && !noedit && !_protected
51469
51477
 
51470
51478
  // Icon
51471
- const icons = document.querySelectorAll('.icon-active');
51472
- Array.prototype.forEach.call(icons, icon => {
51473
- dom.removeClass(icon, 'icon-active');
51474
- });
51479
+ const icons = this.builder.doc.querySelectorAll('.icon-active');
51480
+ icons.forEach(icon => icon.classList.remove('icon-active'));
51475
51481
  this.builder.activeIcon = null;
51476
51482
  if (elm.tagName.toLowerCase() === 'i' && elm.innerHTML === '') {
51477
- dom.addClass(elm, 'icon-active');
51483
+ elm.classList.add('icon-active');
51478
51484
  dom.selectElementContents(elm);
51479
51485
  this.builder.activeIcon = elm;
51480
51486
 
@@ -51515,7 +51521,7 @@ class Element$1 {
51515
51521
  this.spacer.click(e);
51516
51522
 
51517
51523
  // svg
51518
- this.svg.click(e);
51524
+ // this.svg.click(e);
51519
51525
  } else {
51520
51526
  this.util.hideControls();
51521
51527
 
@@ -51536,49 +51542,6 @@ class Element$1 {
51536
51542
 
51537
51543
  //Module
51538
51544
  this.module.click(col, e);
51539
-
51540
- /*
51541
- // let elms = document.querySelectorAll('[data-resizable]');
51542
- // elms.forEach((elm)=>{
51543
- // if(elm.getAttribute('data-resizable')==='1') {
51544
- // elm.destroy();
51545
- // elm.setAttribute('data-resizable', '');
51546
- // }
51547
- // });
51548
- // let rotate = 0;
51549
- let elmResizable;
51550
- if(elm.hasAttribute('data-resizable')) {
51551
- elmResizable = elm;
51552
- } else {
51553
- elmResizable = dom.getParentByAttribute(elm,'data-resizable');
51554
- }
51555
- if(elmResizable) {
51556
- if(elmResizable.getAttribute('data-resizable')!=='1') {
51557
- new Moveable(document.body, {
51558
- target: elmResizable, //document.querySelector('.resizable'),
51559
- resizable: true,
51560
- // draggable: true,
51561
- // warpable: true,
51562
- // rotatable: true,
51563
- throttleResize: 0,
51564
- keepRatio: true,
51565
- }).on('resize', ({ target, width, height }) => {
51566
- target.style.width = `${width}px`;
51567
- target.style.height = `${height}px`;
51568
- });
51569
-
51570
-
51571
- // .on('rotate', ({ target, delta }) => {
51572
- // rotate += delta;
51573
- // target.style.transform = 'rotate(' + rotate + 'deg)';
51574
- // }).on('drag', ({ target, left, top }) => {
51575
- // target.style.left = left + 'px';
51576
- // target.style.top = top + 'px';
51577
- // });
51578
- elmResizable.setAttribute('data-resizable', '1');
51579
- }
51580
- }
51581
- */
51582
51545
  }
51583
51546
  }
51584
51547
 
@@ -53270,6 +53233,7 @@ class RowTool {
53270
53233
  const util = this.builder.util;
53271
53234
  this.util = util;
53272
53235
  const builderStuff = this.builder.builderStuff;
53236
+ this.builderStuff = builderStuff;
53273
53237
  const dom = this.builder.dom;
53274
53238
  this.dom = dom;
53275
53239
  this.grid = new Grid(builder);
@@ -53451,6 +53415,11 @@ class RowTool {
53451
53415
  // Open Row Settings
53452
53416
  let elm = rowMore.querySelector('.row-settings');
53453
53417
  if (elm) dom.addEventListener(elm, 'click', () => {
53418
+ if (this.builder.controlPanel) {
53419
+ this.builder.controlpanel.select('row', true);
53420
+ util.hidePop(this.rowMore);
53421
+ return;
53422
+ }
53454
53423
  const row = this.rowOverlay();
53455
53424
  if (!row) return;
53456
53425
  this.readRowStyles(row);
@@ -54126,6 +54095,35 @@ class RowTool {
54126
54095
  } else {
54127
54096
  quickadd.setAttribute('data-mode', 'cell-right');
54128
54097
  }
54098
+
54099
+ //handleQuickAddClickOut
54100
+ const handleQuickAddClickOut = e => {
54101
+ // console.log('handleQuickAddClickOut');
54102
+ let elm = e.target;
54103
+ if (!elm) return;
54104
+ if (!elm.closest('.quickadd') && !elm.closest('.row-add') && !elm.closest('.is-rowadd-tool') && !elm.closest('.cell-add') && !elm.closest('.elm-add') && !elm.closest('.row-add-initial')) {
54105
+ // click outside
54106
+
54107
+ // hide
54108
+ const quickadd = builderStuff.querySelector('.quickadd');
54109
+ util.hidePop(quickadd);
54110
+ // console.log('HIDE');
54111
+
54112
+ // clear events
54113
+ document.removeEventListener('click', handleQuickAddClickOut);
54114
+ if (this.builder.iframeDocument) {
54115
+ this.builder.doc.removeEventListener('click', handleQuickAddClickOut);
54116
+ }
54117
+ this.builder.handleQuickAddClickOut_ = false;
54118
+ }
54119
+ };
54120
+ if (!this.builder.handleQuickAddClickOut_) {
54121
+ document.addEventListener('click', handleQuickAddClickOut);
54122
+ if (this.builder.iframeDocument) {
54123
+ this.builder.doc.addEventListener('click', handleQuickAddClickOut);
54124
+ }
54125
+ this.builder.handleQuickAddClickOut_ = true;
54126
+ }
54129
54127
  });
54130
54128
  const btnCellMore = coltool.querySelector('.cell-more');
54131
54129
  if (btnCellMore) dom.addEventListener(btnCellMore, 'click', () => {
@@ -54170,8 +54168,126 @@ class RowTool {
54170
54168
  dom.removeClass(btnCellLocking, 'on');
54171
54169
  // btnCellLocking.innerHTML = '<svg class="is-icon-flex"><use xlink:href="#icon-lock-off"></use></svg>';
54172
54170
  }
54173
- });
54174
54171
 
54172
+ // columnMore
54173
+
54174
+ const btnIncrease = columnMore.querySelector('.cell-increase');
54175
+ const btnDecrease = columnMore.querySelector('.cell-decrease');
54176
+ const btnPrev = columnMore.querySelector('.cell-prev');
54177
+ const btnNext = columnMore.querySelector('.cell-next');
54178
+ const btnUp = columnMore.querySelector('.cell-up');
54179
+ const btnDown = columnMore.querySelector('.cell-down');
54180
+ const btnDuplicate = columnMore.querySelector('.cell-duplicate');
54181
+ const btnLock = columnMore.querySelector('.cell-locking');
54182
+ const separator = columnMore.querySelector('.is-separator');
54183
+ let nogrid = cell.closest('[nogrid]'); //dom.parentsHasAttribute(col, 'nogrid');
54184
+ if (nogrid) {
54185
+ btnPrev.style.display = 'none';
54186
+ btnNext.style.display = 'none';
54187
+ btnUp.style.display = 'none';
54188
+ btnDown.style.display = 'none';
54189
+ if (btnIncrease) btnIncrease.style.display = 'none';
54190
+ if (btnDecrease) btnDecrease.style.display = 'none';
54191
+ btnDuplicate.style.display = 'none';
54192
+ btnPrev.setAttribute('disabled', 'disabled');
54193
+ btnNext.setAttribute('disabled', 'disabled');
54194
+ btnUp.setAttribute('disabled', 'disabled');
54195
+ btnDown.setAttribute('disabled', 'disabled');
54196
+ btnIncrease.setAttribute('disabled', 'disabled');
54197
+ btnDecrease.setAttribute('disabled', 'disabled');
54198
+ btnDuplicate.setAttribute('disabled', 'disabled');
54199
+ let btnColHtml = columnMore.querySelector('.cell-html');
54200
+ if (btnColHtml) btnColHtml.style.display = '';
54201
+ if (cell.getAttribute('data-html')) {
54202
+ columnMore.querySelector('.cell-html').style.display = 'none';
54203
+ this.columnTool.querySelector('.cell-more').style.display = 'none';
54204
+ columnMore.querySelector('.cell-html').setAttribute('disabled', 'disabled');
54205
+ this.columnTool.querySelector('.cell-more').setAttribute('disabled', 'disabled');
54206
+ }
54207
+ } else {
54208
+ btnPrev.style.display = '';
54209
+ btnNext.style.display = '';
54210
+ btnUp.style.display = '';
54211
+ btnDown.style.display = '';
54212
+ if (btnIncrease) btnIncrease.style.display = '';
54213
+ if (btnDecrease) btnDecrease.style.display = '';
54214
+ btnDuplicate.style.display = '';
54215
+ btnPrev.removeAttribute('disabled');
54216
+ btnNext.removeAttribute('disabled');
54217
+ btnUp.removeAttribute('disabled');
54218
+ btnDown.removeAttribute('disabled');
54219
+ if (btnIncrease) btnIncrease.removeAttribute('disabled');
54220
+ if (btnDecrease) btnDecrease.removeAttribute('disabled');
54221
+ btnDuplicate.removeAttribute('disabled');
54222
+ let btnColHtml = columnMore.querySelector('.cell-html');
54223
+ if (btnColHtml) {
54224
+ btnColHtml.style.display = '';
54225
+ btnColHtml.removeAttribute('disabled');
54226
+ }
54227
+ let row = cell.parentNode;
54228
+ let num = 3; //is-row-tool, is-col-tool & is-rowadd-tool
54229
+ if (row.querySelector('.is-row-overlay')) {
54230
+ num = 4; //is-row-tool, is-col-tool, is-rowadd-tool & is-row-overlay
54231
+ }
54232
+
54233
+ if (row.childElementCount - num === 1) {
54234
+ //-num => minus is-row-tool, is-col-tool, is-rowadd-tool & is-row-overlay
54235
+ btnPrev.style.display = 'none';
54236
+ btnNext.style.display = 'none';
54237
+ if (btnIncrease) btnIncrease.style.display = 'none';
54238
+ if (btnDecrease) btnDecrease.style.display = 'none';
54239
+ btnPrev.setAttribute('disabled', 'disabled');
54240
+ btnNext.setAttribute('disabled', 'disabled');
54241
+ if (btnIncrease) btnIncrease.setAttribute('disabled', 'disabled');
54242
+ if (btnDecrease) btnDecrease.setAttribute('disabled', 'disabled');
54243
+ } else {
54244
+ btnPrev.style.display = '';
54245
+ btnNext.style.display = '';
54246
+ if (btnIncrease) btnIncrease.style.display = '';
54247
+ if (btnDecrease) btnDecrease.style.display = '';
54248
+ btnPrev.removeAttribute('disabled');
54249
+ btnNext.removeAttribute('disabled');
54250
+ if (btnIncrease) btnIncrease.removeAttribute('disabled');
54251
+ if (btnDecrease) btnDecrease.removeAttribute('disabled');
54252
+ }
54253
+
54254
+ // let btnColHtml = columnMore.querySelector('.cell-html');
54255
+ let btnColDuplicate = btnDuplicate;
54256
+ if (cell.getAttribute('data-html')) {
54257
+ if (btnColHtml) {
54258
+ btnColHtml.style.display = 'none';
54259
+ btnColHtml.setAttribute('disabled', 'disabled');
54260
+ }
54261
+ if (btnColDuplicate) {
54262
+ btnColDuplicate.style.display = 'none';
54263
+ btnColDuplicate.setAttribute('disabled', 'disabled');
54264
+ }
54265
+ } else {
54266
+ if (btnColHtml) {
54267
+ btnColHtml.style.display = '';
54268
+ btnColHtml.removeAttribute('disabled');
54269
+ }
54270
+ if (btnColDuplicate) {
54271
+ btnColDuplicate.style.display = '';
54272
+ btnColDuplicate.removeAttribute('disabled');
54273
+ }
54274
+ }
54275
+ }
54276
+ if (cell.classList.contains('column-lock')) {
54277
+ btnPrev.style.display = 'none';
54278
+ btnNext.style.display = 'none';
54279
+ btnUp.style.display = 'none';
54280
+ btnDown.style.display = 'none';
54281
+ btnIncrease.style.display = 'none';
54282
+ btnDecrease.style.display = 'none';
54283
+ btnDuplicate.style.display = 'none';
54284
+ separator.style.display = 'none';
54285
+ btnLock.style.display = 'none';
54286
+ } else {
54287
+ separator.style.display = '';
54288
+ btnLock.style.display = '';
54289
+ }
54290
+ });
54175
54291
  const btnCellRemove = coltool.querySelector('.cell-remove');
54176
54292
  if (btnCellRemove) dom.addEventListener(btnCellRemove, 'click', () => {
54177
54293
  const grid = new Grid(this.builder);
@@ -54181,47 +54297,7 @@ class RowTool {
54181
54297
  });
54182
54298
  let btnGridEditor = rowtool.querySelector('.row-grideditor');
54183
54299
  if (btnGridEditor) dom.addEventListener(btnGridEditor, 'click', () => {
54184
- const grideditor = builderStuff.querySelector('.grideditor');
54185
- if (dom.hasClass(grideditor, 'active')) {
54186
- dom.removeClass(grideditor, 'active');
54187
- const builders = document.querySelectorAll(this.builder.opts.container);
54188
- Array.prototype.forEach.call(builders, builder => {
54189
- builder.removeAttribute('grideditor');
54190
- });
54191
- } else {
54192
- // dom.addClass(grideditor, 'active');
54193
- this.util.showModal(grideditor, false, () => {
54194
- btnGridEditor.removeAttribute('data-focus');
54195
- btnGridEditor.focus();
54196
- });
54197
- btnGridEditor.setAttribute('data-focus', true);
54198
- const builders = document.querySelectorAll(this.builder.opts.container);
54199
- Array.prototype.forEach.call(builders, builder => {
54200
- builder.setAttribute('grideditor', '');
54201
- });
54202
-
54203
- // Grid Editor Status
54204
- // On/off outline button
54205
- const btnGridOutline = grideditor.querySelector('.grid-outline');
54206
- const container = this.builder.doc.querySelector(this.builder.opts.container); // get one
54207
- if (container.hasAttribute('gridoutline')) {
54208
- dom.addClass(btnGridOutline, 'on');
54209
- } else {
54210
- dom.removeClass(btnGridOutline, 'on');
54211
- }
54212
- // On/off lock button
54213
- const btnCellLocking = grideditor.querySelector('.cell-locking');
54214
- let cell = util.cellSelected();
54215
- if (cell) {
54216
- if (cell.hasAttribute('data-noedit')) {
54217
- dom.addClass(btnCellLocking, 'on');
54218
- } else {
54219
- dom.removeClass(btnCellLocking, 'on');
54220
- }
54221
- } else {
54222
- dom.removeClass(btnCellLocking, 'on');
54223
- }
54224
- }
54300
+ this.showGridEditor();
54225
54301
  });
54226
54302
  const btnMore = rowtool.querySelector('.row-more');
54227
54303
  if (btnMore) dom.addEventListener(btnMore, 'click', () => {
@@ -54310,6 +54386,92 @@ class RowTool {
54310
54386
  });
54311
54387
  }
54312
54388
  }
54389
+ hideGridEditor() {
54390
+ const grideditor = this.builderStuff.querySelector('.grideditor');
54391
+ grideditor.classList.remove('active');
54392
+ const builders = this.builder.doc.querySelectorAll(this.builder.opts.container);
54393
+ builders.forEach(builder => {
54394
+ builder.removeAttribute('grideditor');
54395
+ });
54396
+ }
54397
+ showGridEditor() {
54398
+ const grideditor = this.builderStuff.querySelector('.grideditor');
54399
+ const handleGridToolClickOut = e => {
54400
+ // console.log('handleGridToolClickOut');
54401
+ let elm = e.target;
54402
+ if (!elm) return;
54403
+ if (!elm.closest('.rte-grideditor') && !elm.closest('.grideditor') && !elm.closest('.is-modal') && !elm.closest('.keep-selection') && !elm.closest('.is-sidebar') && !elm.closest('.is-rte-tool') && !elm.closest('.is-rte-pop') && !elm.closest('.is-elementrte-tool') && !elm.closest('.is-builder') && !elm.closest('.is-pop')) {
54404
+ // click outside
54405
+
54406
+ // hide
54407
+ this.hideGridEditor();
54408
+ // console.log('HIDE');
54409
+
54410
+ // clear events
54411
+ document.removeEventListener('click', handleGridToolClickOut);
54412
+ if (this.builder.iframeDocument) {
54413
+ this.builder.doc.removeEventListener('click', handleGridToolClickOut);
54414
+ }
54415
+ this.builder.handleGridToolClickOut_ = false;
54416
+ }
54417
+ };
54418
+ if (grideditor.classList.contains('active')) {
54419
+ // hide
54420
+ this.hideGridEditor();
54421
+
54422
+ // clear events
54423
+ document.removeEventListener('click', handleGridToolClickOut);
54424
+ if (this.builder.iframeDocument) {
54425
+ this.builder.doc.removeEventListener('click', handleGridToolClickOut);
54426
+ }
54427
+ this.builder.handleGridToolClickOut_ = false;
54428
+ return;
54429
+ }
54430
+
54431
+ // this.util.showModal(grideditor, false, ()=>{
54432
+ // btnGridEditor.removeAttribute('data-focus');
54433
+ // btnGridEditor.focus();
54434
+ // });
54435
+ // btnGridEditor.setAttribute('data-focus', true);
54436
+
54437
+ this.util.showModal(grideditor);
54438
+ const builders = this.builder.doc.querySelectorAll(this.builder.opts.container);
54439
+ builders.forEach(builder => {
54440
+ builder.setAttribute('grideditor', '');
54441
+ });
54442
+
54443
+ /*
54444
+ // Grid Editor Status
54445
+ // On/off outline button
54446
+ const btnGridOutline = grideditor.querySelector('.grid-outline');
54447
+ const container = this.builder.doc.querySelector(this.builder.opts.container); // get one
54448
+ if(container.hasAttribute('gridoutline')) {
54449
+ dom.addClass(btnGridOutline, 'on');
54450
+ } else {
54451
+ dom.removeClass(btnGridOutline, 'on');
54452
+ }
54453
+ // On/off lock button
54454
+ const btnCellLocking = grideditor.querySelector('.cell-locking');
54455
+ let cell = util.cellSelected();
54456
+ if(cell) {
54457
+ if(cell.hasAttribute('data-noedit')) {
54458
+ dom.addClass(btnCellLocking, 'on');
54459
+ } else {
54460
+ dom.removeClass(btnCellLocking, 'on');
54461
+ }
54462
+ } else {
54463
+ dom.removeClass(btnCellLocking, 'on');
54464
+ }
54465
+ */
54466
+
54467
+ if (!this.builder.handleGridToolClickOut_) {
54468
+ document.addEventListener('click', handleGridToolClickOut);
54469
+ if (this.builder.iframeDocument) {
54470
+ this.builder.doc.addEventListener('click', handleGridToolClickOut);
54471
+ }
54472
+ this.builder.handleGridToolClickOut_ = true;
54473
+ }
54474
+ }
54313
54475
  readRowStyles(row) {
54314
54476
  this.util.clearActiveElement();
54315
54477
 
@@ -54410,6 +54572,7 @@ class RowAddTool {
54410
54572
  render(row) {
54411
54573
  const dom = this.dom;
54412
54574
  const util = this.builder.util;
54575
+ const builderStuff = this.builder.builderStuff;
54413
54576
  const quickadd = renderQuickAdd(this.builder);
54414
54577
  let rowaddtool = row.querySelector('.is-rowadd-tool');
54415
54578
  if (!rowaddtool) {
@@ -54476,7 +54639,35 @@ class RowAddTool {
54476
54639
  dom.addClass(quickadd, 'center');
54477
54640
  }
54478
54641
  quickadd.setAttribute('data-mode', 'row');
54479
- return false;
54642
+
54643
+ //handleQuickAddClickOut
54644
+ const handleQuickAddClickOut = e => {
54645
+ // console.log('handleQuickAddClickOut');
54646
+ let elm = e.target;
54647
+ if (!elm) return;
54648
+ if (!elm.closest('.quickadd') && !elm.closest('.row-add') && !elm.closest('.is-rowadd-tool') && !elm.closest('.cell-add') && !elm.closest('.elm-add') && !elm.closest('.row-add-initial')) {
54649
+ // click outside
54650
+
54651
+ // hide
54652
+ const quickadd = builderStuff.querySelector('.quickadd');
54653
+ util.hidePop(quickadd);
54654
+ // console.log('HIDE');
54655
+
54656
+ // clear events
54657
+ document.removeEventListener('click', handleQuickAddClickOut);
54658
+ if (this.builder.iframeDocument) {
54659
+ this.builder.doc.removeEventListener('click', handleQuickAddClickOut);
54660
+ }
54661
+ this.builder.handleQuickAddClickOut_ = false;
54662
+ }
54663
+ };
54664
+ if (!this.builder.handleQuickAddClickOut_) {
54665
+ document.addEventListener('click', handleQuickAddClickOut);
54666
+ if (this.builder.iframeDocument) {
54667
+ this.builder.doc.addEventListener('click', handleQuickAddClickOut);
54668
+ }
54669
+ this.builder.handleQuickAddClickOut_ = true;
54670
+ }
54480
54671
  });
54481
54672
  }
54482
54673
  }
@@ -54739,7 +54930,7 @@ class ColumnTool {
54739
54930
  ${this.builder.opts.otherSelectIcon}
54740
54931
  </button>
54741
54932
 
54742
- <div class="image-larger4" style="position: relative; flex: 0 0 auto; width: 40px; height: 38px; box-shadow: rgba(0, 0, 0, 0.32) 0px 3px 6px -6px;">
54933
+ <div class="image-larger4 is-btn classic" style="position: relative; flex: 0 0 auto; width: 40px; height: 38px; box-shadow: rgba(0, 0, 0, 0.32) 0px 3px 6px -6px;">
54743
54934
  <form class="form-upload-larger" target="frameTargetLinkUpload" method="post" action="${this.builder.opts.largerImageHandler}" enctype="multipart/form-data" style="position:absolute;top:0;left:0;width:100%;height:100%;border-radius:1px;display:flex;align-items: center;justify-content: center;">
54744
54935
  <input id="hidRefId4" name="hidRefId" type="hidden" value="">
54745
54936
  <svg class="is-icon-flex" style="width:18px;height:18px;"><use xlink:href="#ion-ios-cloud-upload-outline"></use></svg>
@@ -55115,6 +55306,11 @@ class ColumnTool {
55115
55306
  // Open Column Settings
55116
55307
  elm = columnMore.querySelector('.cell-settings');
55117
55308
  if (elm) dom.addEventListener(elm, 'click', () => {
55309
+ if (this.builder.controlPanel) {
55310
+ this.builder.controlpanel.select('column', true);
55311
+ util.hidePop(this.columnMore);
55312
+ return;
55313
+ }
55118
55314
  let cell = util.cellSelected();
55119
55315
  if (!cell) return;
55120
55316
  this.readCellStyles(cell);
@@ -55514,6 +55710,8 @@ class ColumnTool {
55514
55710
  cell.removeAttribute('data-scale');
55515
55711
  };
55516
55712
  inpImageHorSlider.onchange = () => {
55713
+ if (this.builder.win.adjustBgPos) this.builder.win.adjustBgPos(); // adjustBgPos() from box/flex.js
55714
+
55517
55715
  //Trigger Change event
55518
55716
  this.builder.opts.onChange();
55519
55717
  };
@@ -55593,6 +55791,8 @@ class ColumnTool {
55593
55791
  cell.removeAttribute('data-scale');
55594
55792
  };
55595
55793
  inpImageVertSlider.onchange = () => {
55794
+ if (this.builder.win.adjustBgPos) this.builder.win.adjustBgPos(); // adjustBgPos() from box/flex.js
55795
+
55596
55796
  //Trigger Change event
55597
55797
  this.builder.opts.onChange();
55598
55798
  };
@@ -57135,144 +57335,28 @@ class ColumnTool {
57135
57335
  }
57136
57336
  }
57137
57337
  click(col) {
57138
- const dom = this.dom;
57139
-
57140
- //---- New Col Tool ----
57141
57338
  this.columnTool = col.parentNode.querySelector('.is-col-tool');
57142
57339
  this.columnTool.style.left = col.offsetLeft + 'px';
57143
57340
  this.columnTool.style.top = col.offsetTop + 'px';
57144
- //---- /New Col Tool ----
57145
-
57146
- const btnIncrease = this.columnMore.querySelector('.cell-increase');
57147
- const btnDecrease = this.columnMore.querySelector('.cell-decrease');
57148
- let nogrid = dom.parentsHasAttribute(col, 'nogrid');
57341
+ const btnAdd = this.columnTool.querySelector('.cell-add');
57342
+ const btnRemove = this.columnTool.querySelector('.cell-remove');
57343
+ const btnMore = this.columnTool.querySelector('.cell-more');
57344
+ let nogrid = col.closest('[nogrid]');
57149
57345
  if (nogrid) {
57150
- this.columnMore.querySelector('.cell-prev').style.display = 'none';
57151
- this.columnMore.querySelector('.cell-next').style.display = 'none';
57152
- this.columnMore.querySelector('.cell-up').style.display = 'none';
57153
- this.columnMore.querySelector('.cell-down').style.display = 'none';
57154
- if (btnIncrease) btnIncrease.style.display = 'none';
57155
- if (btnDecrease) btnDecrease.style.display = 'none';
57156
- this.columnMore.querySelector('.cell-duplicate').style.display = 'none';
57157
- this.columnMore.querySelector('.cell-prev').setAttribute('disabled', 'disabled');
57158
- this.columnMore.querySelector('.cell-next').setAttribute('disabled', 'disabled');
57159
- this.columnMore.querySelector('.cell-up').setAttribute('disabled', 'disabled');
57160
- this.columnMore.querySelector('.cell-down').setAttribute('disabled', 'disabled');
57161
- btnIncrease.setAttribute('disabled', 'disabled');
57162
- btnDecrease.setAttribute('disabled', 'disabled');
57163
- this.columnMore.querySelector('.cell-duplicate').setAttribute('disabled', 'disabled');
57164
- let btnColHtml = this.columnMore.querySelector('.cell-html');
57165
- if (btnColHtml) btnColHtml.style.display = '';
57166
- this.columnTool.querySelector('.cell-add').style.display = 'none';
57167
- this.columnTool.querySelector('.cell-remove').style.display = 'none';
57168
- this.columnTool.querySelector('.cell-add').setAttribute('disabled', 'disabled');
57169
- this.columnTool.querySelector('.cell-remove').setAttribute('disabled', 'disabled');
57346
+ btnAdd.style.display = 'none';
57347
+ btnRemove.style.display = 'none';
57348
+ btnAdd.setAttribute('disabled', 'disabled');
57349
+ btnRemove.setAttribute('disabled', 'disabled');
57170
57350
  if (col.getAttribute('data-html')) {
57171
- this.columnMore.querySelector('.cell-html').style.display = 'none';
57172
- this.columnTool.querySelector('.cell-more').style.display = 'none';
57173
- this.columnMore.querySelector('.cell-html').setAttribute('disabled', 'disabled');
57174
- this.columnTool.querySelector('.cell-more').setAttribute('disabled', 'disabled');
57351
+ btnMore.style.display = 'none';
57352
+ btnMore.setAttribute('disabled', 'disabled');
57175
57353
  }
57176
57354
  } else {
57177
- this.columnMore.querySelector('.cell-prev').style.display = '';
57178
- this.columnMore.querySelector('.cell-next').style.display = '';
57179
- this.columnMore.querySelector('.cell-up').style.display = '';
57180
- this.columnMore.querySelector('.cell-down').style.display = '';
57181
- if (btnIncrease) btnIncrease.style.display = '';
57182
- if (btnDecrease) btnDecrease.style.display = '';
57183
- this.columnMore.querySelector('.cell-duplicate').style.display = '';
57184
- this.columnMore.querySelector('.cell-prev').removeAttribute('disabled');
57185
- this.columnMore.querySelector('.cell-next').removeAttribute('disabled');
57186
- this.columnMore.querySelector('.cell-up').removeAttribute('disabled');
57187
- this.columnMore.querySelector('.cell-down').removeAttribute('disabled');
57188
- if (btnIncrease) btnIncrease.removeAttribute('disabled');
57189
- if (btnDecrease) btnDecrease.removeAttribute('disabled');
57190
- this.columnMore.querySelector('.cell-duplicate').removeAttribute('disabled');
57191
- let btnColHtml = this.columnMore.querySelector('.cell-html');
57192
- if (btnColHtml) {
57193
- btnColHtml.style.display = '';
57194
- btnColHtml.removeAttribute('disabled');
57195
- }
57196
- this.columnTool.querySelector('.cell-add').style.display = '';
57197
- this.columnTool.querySelector('.cell-remove').style.display = '';
57198
- this.columnTool.querySelector('.cell-add').removeAttribute('disabled');
57199
- this.columnTool.querySelector('.cell-remove').removeAttribute('disabled');
57200
- let row = col.parentNode;
57201
- let num = 3; //is-row-tool, is-col-tool & is-rowadd-tool
57202
- if (row.querySelector('.is-row-overlay')) {
57203
- num = 4; //is-row-tool, is-col-tool, is-rowadd-tool & is-row-overlay
57204
- }
57205
-
57206
- if (row.childElementCount - num === 1) {
57207
- //-num => minus is-row-tool, is-col-tool, is-rowadd-tool & is-row-overlay
57208
- this.columnMore.querySelector('.cell-prev').style.display = 'none';
57209
- this.columnMore.querySelector('.cell-next').style.display = 'none';
57210
- if (btnIncrease) btnIncrease.style.display = 'none';
57211
- if (btnDecrease) btnDecrease.style.display = 'none';
57212
- this.columnMore.querySelector('.cell-prev').setAttribute('disabled', 'disabled');
57213
- this.columnMore.querySelector('.cell-next').setAttribute('disabled', 'disabled');
57214
- if (btnIncrease) btnIncrease.setAttribute('disabled', 'disabled');
57215
- if (btnDecrease) btnDecrease.setAttribute('disabled', 'disabled');
57216
- } else {
57217
- this.columnMore.querySelector('.cell-prev').style.display = '';
57218
- this.columnMore.querySelector('.cell-next').style.display = '';
57219
- if (btnIncrease) btnIncrease.style.display = '';
57220
- if (btnDecrease) btnDecrease.style.display = '';
57221
- this.columnMore.querySelector('.cell-prev').removeAttribute('disabled');
57222
- this.columnMore.querySelector('.cell-next').removeAttribute('disabled');
57223
- if (btnIncrease) btnIncrease.removeAttribute('disabled');
57224
- if (btnDecrease) btnDecrease.removeAttribute('disabled');
57225
- }
57226
-
57227
- // let btnColHtml = this.columnMore.querySelector('.cell-html');
57228
- let btnColDuplicate = this.columnMore.querySelector('.cell-duplicate');
57229
- if (col.getAttribute('data-html')) {
57230
- if (btnColHtml) {
57231
- btnColHtml.style.display = 'none';
57232
- btnColHtml.setAttribute('disabled', 'disabled');
57233
- }
57234
- if (btnColDuplicate) {
57235
- btnColDuplicate.style.display = 'none';
57236
- btnColDuplicate.setAttribute('disabled', 'disabled');
57237
- }
57238
- } else {
57239
- if (btnColHtml) {
57240
- btnColHtml.style.display = '';
57241
- btnColHtml.removeAttribute('disabled');
57242
- }
57243
- if (btnColDuplicate) {
57244
- btnColDuplicate.style.display = '';
57245
- btnColDuplicate.removeAttribute('disabled');
57246
- }
57247
- }
57248
-
57249
- //data-protected
57250
- /*
57251
- if(row.hasAttribute('data-protected')){
57252
- row.querySelector('.is-row-tool').style.display = 'none';
57253
- this.columnTool.style.display = 'none'; // if row protected, then all column protected
57254
- } else {
57255
- if(row.querySelectorAll('[data-protected]').length>0){
57256
- row.querySelector('.is-row-tool').style.display = 'none';
57257
- } else {
57258
- row.querySelector('.is-row-tool').style.display = '';
57259
- }
57260
- this.columnTool.style.display = '';
57261
- //check columnTool buttons if need to show or hide
57262
- let _protected = dom.parentsHasAttribute(col, 'data-protected');
57263
- if(_protected){
57264
- this.columnTool.querySelector('.cell-add').style.display = 'none';
57265
- this.columnTool.querySelector('.cell-remove').style.display = 'none';
57266
- this.columnTool.querySelector('.cell-more').style.display = 'none';
57267
- } else {
57268
- this.columnTool.querySelector('.cell-add').style.display = '';
57269
- this.columnTool.querySelector('.cell-remove').style.display = '';
57270
- this.columnTool.querySelector('.cell-more').style.display = '';
57271
- }
57272
- }
57273
- */
57355
+ btnAdd.style.display = '';
57356
+ btnRemove.style.display = '';
57357
+ btnAdd.removeAttribute('disabled');
57358
+ btnRemove.removeAttribute('disabled');
57274
57359
  }
57275
-
57276
57360
  let row = col.parentNode;
57277
57361
 
57278
57362
  //data-protected
@@ -57285,42 +57369,22 @@ class ColumnTool {
57285
57369
  rowaddtool.style.display = 'none';
57286
57370
  }
57287
57371
  } else {
57288
- // if(row.querySelectorAll('[data-protected]').length>0){
57289
- // row.querySelector('.is-row-tool').style.display = 'none';
57290
- // } else {
57291
- // row.querySelector('.is-row-tool').style.display = '';
57292
- // }
57293
-
57294
57372
  this.columnTool.style.display = '';
57295
57373
  //check columnTool buttons if need to show or hide
57296
- let _protected = dom.parentsHasAttribute(col, 'data-protected');
57374
+ let _protected = col.closest('[data-protected]');
57297
57375
  if (_protected) {
57298
- this.columnTool.querySelector('.cell-add').style.display = 'none';
57299
- this.columnTool.querySelector('.cell-remove').style.display = 'none';
57300
- this.columnTool.querySelector('.cell-more').style.display = 'none';
57376
+ btnAdd.style.display = 'none';
57377
+ btnRemove.style.display = 'none';
57378
+ btnMore.style.display = 'none';
57301
57379
  } else {
57302
- this.columnTool.querySelector('.cell-add').style.display = '';
57303
- this.columnTool.querySelector('.cell-remove').style.display = '';
57304
- this.columnTool.querySelector('.cell-more').style.display = '';
57380
+ btnAdd.style.display = '';
57381
+ btnRemove.style.display = '';
57382
+ btnMore.style.display = '';
57305
57383
  }
57306
57384
  }
57307
-
57308
- // Column Lock will hide Add & Remove column
57309
57385
  if (col.classList.contains('column-lock')) {
57310
- this.columnTool.querySelector('.cell-add').style.display = 'none';
57311
- this.columnTool.querySelector('.cell-remove').style.display = 'none';
57312
- this.columnMore.querySelector('.cell-prev').style.display = 'none';
57313
- this.columnMore.querySelector('.cell-next').style.display = 'none';
57314
- this.columnMore.querySelector('.cell-up').style.display = 'none';
57315
- this.columnMore.querySelector('.cell-down').style.display = 'none';
57316
- this.columnMore.querySelector('.cell-increase').style.display = 'none';
57317
- this.columnMore.querySelector('.cell-decrease').style.display = 'none';
57318
- this.columnMore.querySelector('.cell-duplicate').style.display = 'none';
57319
- this.columnMore.querySelector('.is-separator').style.display = 'none';
57320
- this.columnMore.querySelector('.cell-locking').style.display = 'none';
57321
- } else {
57322
- this.columnMore.querySelector('.is-separator').style.display = '';
57323
- this.columnMore.querySelector('.cell-locking').style.display = '';
57386
+ btnAdd.style.display = 'none';
57387
+ btnRemove.style.display = 'none';
57324
57388
  }
57325
57389
  }
57326
57390
  }
@@ -62246,8 +62310,10 @@ class ElementTool {
62246
62310
  this.builderStuff = builderStuff;
62247
62311
  const dom = this.builder.dom;
62248
62312
  this.dom = dom;
62249
- const elementPanel = new ElementPanel(builder);
62250
- this.elementPanel = elementPanel;
62313
+ if (!this.builder.controlPanel) {
62314
+ const elementPanel = new ElementPanel(builder);
62315
+ this.elementPanel = elementPanel;
62316
+ }
62251
62317
  let elementTool = builderStuff.querySelector('.is-element-tool');
62252
62318
  let elementMore = builderStuff.querySelector('.elmmore');
62253
62319
  if (!elementTool) {
@@ -62333,7 +62399,35 @@ class ElementTool {
62333
62399
  dom.addClass(quickadd, 'center');
62334
62400
  }
62335
62401
  quickadd.setAttribute('data-mode', 'elm');
62336
- return false;
62402
+
62403
+ //handleQuickAddClickOut
62404
+ const handleQuickAddClickOut = e => {
62405
+ // console.log('handleQuickAddClickOut');
62406
+ let elm = e.target;
62407
+ if (!elm) return;
62408
+ if (!elm.closest('.quickadd') && !elm.closest('.row-add') && !elm.closest('.is-rowadd-tool') && !elm.closest('.cell-add') && !elm.closest('.elm-add') && !elm.closest('.row-add-initial')) {
62409
+ // click outside
62410
+
62411
+ // hide
62412
+ const quickadd = builderStuff.querySelector('.quickadd');
62413
+ util.hidePop(quickadd);
62414
+ // console.log('HIDE');
62415
+
62416
+ // clear events
62417
+ document.removeEventListener('click', handleQuickAddClickOut);
62418
+ if (this.builder.iframeDocument) {
62419
+ this.builder.doc.removeEventListener('click', handleQuickAddClickOut);
62420
+ }
62421
+ this.builder.handleQuickAddClickOut_ = false;
62422
+ }
62423
+ };
62424
+ if (!this.builder.handleQuickAddClickOut_) {
62425
+ document.addEventListener('click', handleQuickAddClickOut);
62426
+ if (this.builder.iframeDocument) {
62427
+ this.builder.doc.addEventListener('click', handleQuickAddClickOut);
62428
+ }
62429
+ this.builder.handleQuickAddClickOut_ = true;
62430
+ }
62337
62431
  });
62338
62432
  const elmRemove = elementTool.querySelector('.elm-remove');
62339
62433
  dom.addEventListener(elmRemove, 'click', () => {
@@ -62558,15 +62652,21 @@ class ElementTool {
62558
62652
 
62559
62653
  const elmSettings = elementTool.querySelector('.elm-settings');
62560
62654
  if (elmSettings) dom.addEventListener(elmSettings, 'click', () => {
62561
- // elementMore.style.display = '';
62562
62655
  util.hidePop(elementMore);
62563
- this.elementPanel.showPanel();
62656
+ if (this.builder.controlPanel) {
62657
+ this.builder.controlpanel.objDialogElement.open();
62658
+ } else {
62659
+ this.elementPanel.showPanel();
62660
+ }
62564
62661
  });
62565
62662
  const elmSettings2 = elementMore.querySelector('.elm-settings');
62566
62663
  if (elmSettings2) dom.addEventListener(elmSettings2, 'click', () => {
62567
- // elementMore.style.display = '';
62568
62664
  util.hidePop(elementMore);
62569
- this.elementPanel.showPanel();
62665
+ if (this.builder.controlPanel) {
62666
+ this.builder.controlpanel.objDialogElement.open();
62667
+ } else {
62668
+ this.elementPanel.showPanel();
62669
+ }
62570
62670
  });
62571
62671
 
62572
62672
  // document.addEventListener('mousedown', (e) => {
@@ -62757,7 +62857,9 @@ class ElementTool {
62757
62857
  // console.log(this.builder.inspectedElement);
62758
62858
  // console.log(this.builder.activeElement);
62759
62859
 
62760
- this.elementPanel.click(e);
62860
+ if (!this.builder.controlPanel) {
62861
+ this.elementPanel.click(e);
62862
+ }
62761
62863
  }
62762
62864
  refresh() {
62763
62865
  if (this.builder.activeElement) {
@@ -62821,6 +62923,7 @@ class ElementTool {
62821
62923
  pos() {
62822
62924
  let elementTool = this.elementTool;
62823
62925
  let elm = this.builder.activeElement;
62926
+ if (!elm) return;
62824
62927
  if (elm.closest('.is-dock')) return;
62825
62928
  let top, left;
62826
62929
  if (!this.builder.iframe) {
@@ -65147,7 +65250,7 @@ class Rte {
65147
65250
  let scale = val / 100;
65148
65251
  this.builder.onZoomEnd(scale);
65149
65252
  }
65150
- }, 300);
65253
+ }, 350);
65151
65254
  };
65152
65255
 
65153
65256
  // Zoom Modal
@@ -66264,7 +66367,7 @@ class Rte {
66264
66367
  // -----------------------------
66265
66368
 
66266
66369
  // Click anywhere will hide Column tool
66267
- this.builder.doc.addEventListener('click', this.builder.doRteClick = e => {
66370
+ if (!this.builder.controlPanel) this.builder.doc.addEventListener('click', this.builder.doRteClick = e => {
66268
66371
  e = e || window.event;
66269
66372
  var target = e.target || e.srcElement;
66270
66373
  if (!this.builderStuff) return; // in case the builder is destroyed
@@ -66344,7 +66447,7 @@ class Rte {
66344
66447
  if (this.builder.toolbarDisplay !== 'auto') {
66345
66448
  this.showDefaultToolbar(); // first time
66346
66449
  }
66347
- }
66450
+ } //contructor
66348
66451
 
66349
66452
  zoomStart() {
66350
66453
  if (this.builder.onZoomStart) {
@@ -67208,6 +67311,7 @@ class Rte {
67208
67311
  });
67209
67312
  }
67210
67313
  showDefaultToolbar() {
67314
+ if (this.builder.controlPanel) return;
67211
67315
  this.elementRteTool.style.display = 'flex';
67212
67316
  this.rteTool.style.display = 'none';
67213
67317
  this.hideAlignButtons();
@@ -70295,7 +70399,8 @@ class Tabs {
70295
70399
  const content = document.querySelector('#' + id);
70296
70400
  content.style.display = 'flex';
70297
70401
  dom$1.addClass(content, 'active');
70298
- document.querySelector('.is-tabs-more').style.display = 'none';
70402
+ const tabMore = document.querySelector('.is-tabs-more');
70403
+ if (tabMore) tabMore.style.display = 'none';
70299
70404
 
70300
70405
  // Close all dropdown
70301
70406
  closeAllDropdowns();
@@ -70929,7 +71034,7 @@ class Resize {
70929
71034
  let moduleWidth = item.offsetWidth / row.offsetWidth * 100;
70930
71035
  item.style.width = moduleWidth + '%';
70931
71036
  item.style.flex = 'none';
70932
- this.builder.util.refreshModuleLayout(item);
71037
+ if (!item.hasAttribute('data-norefresh')) this.builder.util.refreshModuleLayout(item);
70933
71038
  }
70934
71039
  });
70935
71040
  }
@@ -70997,7 +71102,8 @@ class ContentStuff {
70997
71102
  <button title="${util.out('Settings')}" data-title="${util.out('Settings')}" style="width:40px;height:40px;background:none;"><svg class="is-icon-flex"><use xlink:href="#ion-ios-gear"></use></svg></button>
70998
71103
  </div>
70999
71104
  <div class="is-tool is-module-tool">
71000
- <button title="${util.out('Settings')}" data-title="${util.out('Settings')}" style="width:40px;height:40px;"><svg class="is-icon-flex"><use xlink:href="#ion-ios-gear"></use></svg></button>
71105
+ <button class="btn-module-refresh" title="${util.out('Refresh')}" data-title="${util.out('Refresh')}" style="width:40px;height:40px;"><svg class="is-icon-flex"><use xlink:href="#icon-reload"></use></svg></button>
71106
+ <button class="btn-module-settings" title="${util.out('Settings')}" data-title="${util.out('Settings')}" style="width:40px;height:40px;"><svg class="is-icon-flex"><use xlink:href="#ion-ios-gear"></use></svg></button>
71001
71107
  </div>
71002
71108
  <div id="divSpacerTool" class="is-tool is-spacer-tool">
71003
71109
  <button title="${util.out('Decrease')}" data-value="-"><svg class="is-icon-flex"><use xlink:href="#ion-ios-minus-empty"></use></svg></button>
@@ -71137,6 +71243,11 @@ class ContentStuff {
71137
71243
  <path d="M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"></path>
71138
71244
  <path d="M20.2 20.2l1.8 1.8"></path>
71139
71245
  </symbol>
71246
+ <symbol id="icon-reload" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
71247
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
71248
+ <path d="M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1.002 7.935 1.007 9.425 4.747"></path>
71249
+ <path d="M20 4v5h-5"></path>
71250
+ </symbol>
71140
71251
  </defs>
71141
71252
  </svg>
71142
71253
 
@@ -71870,14 +71981,6 @@ class ContentStuff {
71870
71981
  right: auto;
71871
71982
  left: -40px;
71872
71983
  }
71873
- .is-builder.builder-active > div:not(.row-active) {
71874
- border-right: 120px rgba(0, 0, 0, 0) solid;
71875
- margin-right: -120px;
71876
- }
71877
- .is-builder[leftrowtool].builder-active > div:not(.row-active) {
71878
- border-left: 120px rgba(0, 0, 0, 0) solid;
71879
- margin-left: -120px;
71880
- }
71881
71984
  .is-builder[rowoutline] .row-outline {
71882
71985
  outline: none;
71883
71986
  }
@@ -71950,21 +72053,6 @@ class ContentStuff {
71950
72053
  }
71951
72054
 
71952
72055
 
71953
-
71954
-
71955
-
71956
- .is-builder.builder-active > div:not(.row-active) {
71957
- border-right: 120px rgba(0,0,0,0) solid;
71958
- margin-right: -120px;
71959
- }
71960
- .is-builder[leftrowtool].builder-active > div:not(.row-active) {
71961
- border-left: 120px rgba(0,0,0,0) solid;
71962
- margin-left: -120px;
71963
- }
71964
-
71965
-
71966
-
71967
-
71968
72056
  /* Prevent css framework overide (Materialize) */
71969
72057
  .is-ui [type="checkbox"]:not(:checked), .is-ui [type="checkbox"]:checked {
71970
72058
  position: unset !important;
@@ -72014,6 +72102,20 @@ class ContentStuff {
72014
72102
  }
72015
72103
 
72016
72104
 
72105
+ * {
72106
+ scrollbar-width: thin;
72107
+ scrollbar-color: rgba(0, 0, 0, 0.2) auto;
72108
+ }
72109
+ *::-webkit-scrollbar {
72110
+ width: 12px;
72111
+ }
72112
+ *::-webkit-scrollbar-track {
72113
+ background: rgba(200, 200, 200, 0.2);
72114
+ }
72115
+ *::-webkit-scrollbar-thumb {
72116
+ background-color:rgba(0, 0, 0, 0.2);
72117
+ }
72118
+
72017
72119
  ${this.builder.simpleEditingBreakpoint ? `
72018
72120
 
72019
72121
  @media all and (max-width: ${this.builder.simpleEditingBreakpoint}) {
@@ -74004,7 +74106,7 @@ class Dictation {
74004
74106
  </div>
74005
74107
  </div>
74006
74108
  <textarea class="inp-command"></textarea>
74007
- <div style="display:flex;padding-left:3px;">
74109
+ <div style="display:flex;">
74008
74110
  <button title="${util.out('Settings')}" class="cmd-command-config classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
74009
74111
  <svg class="is-icon-flex" style="width:15px;height:15px;flex:none;"><use xlink:href="#icon-settings"></use></svg>
74010
74112
  </button>
@@ -74014,7 +74116,7 @@ class Dictation {
74014
74116
  <button title="${util.out('Command Examples')}" class="cmd-command-list classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
74015
74117
  <svg class="is-icon-flex" style="width: 18px; height: 18px;"><use xlink:href="#icon-message-search"></use></svg>
74016
74118
  </button>
74017
- <button title="${util.out('Clear')}" class="cmd-clear-command classic-secondary" style="margin-right:6px;width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
74119
+ <button title="${util.out('Clear')}" class="cmd-clear-command classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
74018
74120
  <svg class="is-icon-flex" style="width: 18px; height: 18px;"><use xlink:href="#icon-eraser"></use></svg>
74019
74121
  </button>
74020
74122
 
@@ -75008,34 +75110,7 @@ class Similarity {
75008
75110
  }
75009
75111
  }
75010
75112
 
75011
- // Experimental
75012
- // import {out} from './out.js';
75013
- class ControlPanel {
75014
- constructor(builder) {
75015
- this.builder = builder;
75016
- this.builderStuff = this.builder.builderStuff;
75017
- /*
75018
- let controlPanel = builderStuff.querySelector('.is-controlpanel');
75019
- if(!controlPanel) {
75020
- let html = `
75021
- <style>
75022
-
75023
- </style>
75024
- <div class="is-controlpanel">
75025
- </div>
75026
- `;
75027
- // const doc = this.builder.doc;
75028
- // document.body.classList.add('controlpanel');
75029
- builderStuff.insertAdjacentHTML('beforeend', html);
75030
- controlPanel = builderStuff.querySelector('.is-controlpanel');
75031
- } else {
75032
- // Means ContentBox
75033
- }
75034
- this.controlPanel = controlPanel;
75035
- // Add ContentBuilder controls
75036
- */
75037
- }
75038
- }
75113
+ // import ControlPanel from './controlpanel.js';
75039
75114
 
75040
75115
  class ContentBuilder {
75041
75116
  constructor(opts = {}) {
@@ -76096,11 +76171,31 @@ class ContentBuilder {
76096
76171
  this.dom.appendChild(document.body, builderStuff);
76097
76172
  }
76098
76173
  this.builderStuff = builderStuff;
76099
- this.controlpanel = new ControlPanel(this);
76100
76174
  prepareSvgIcons(this); // Prepare icons (embed svg definitions for icons)
76101
76175
 
76102
- this.preferences = new Preferences(this); // this will also call setUIColor() and getUIStyles() for theme
76103
-
76176
+ if (!this.controlPanel) this.preferences = new Preferences(this); // this will also call setUIColor() and getUIStyles() for theme
76177
+ else {
76178
+ if (localStorage.getItem('_theme') != null) {
76179
+ const n = localStorage.getItem('_theme');
76180
+ this.themeIndex = n;
76181
+ if (this.themes) {
76182
+ if (this.themes.length > 0) {
76183
+ const item = this.themes[n];
76184
+ if (item) {
76185
+ this.setUIColor(item[1], item[2]);
76186
+ this.renderIframeLater = true;
76187
+ }
76188
+ }
76189
+ }
76190
+ } else {
76191
+ this.setUIColor('', '');
76192
+ this.renderIframeLater = true;
76193
+ }
76194
+ if (!this.renderIframeLater) {
76195
+ // means setUIColor() not called, so we need to call getUIStyles() manually
76196
+ util.getUIStyles();
76197
+ }
76198
+ }
76104
76199
  renderGridEditor(this); // Render Grid Editor
76105
76200
 
76106
76201
  // Check if preview
@@ -76221,55 +76316,36 @@ class ContentBuilder {
76221
76316
  });
76222
76317
  }
76223
76318
 
76319
+ // if(!this.isContentBox && this.controlPanel) {
76320
+ // this.controlpanel = new ControlPanel(this);
76321
+ // }
76322
+
76224
76323
  // Add document Click event
76225
76324
  document.addEventListener('click', this.doDocumentClick = e => {
76226
- e = e || window.event;
76227
- let target = e.target || e.srcElement;
76325
+ let target = e.target;
76228
76326
  if (!target) return;
76229
76327
  let rowClicked;
76230
- if (target.parentNode) rowClicked = this.dom.hasClass(target.parentNode, 'is-builder');
76231
- let containerClicked = this.dom.hasClass(target, 'is-builder');
76232
- let a = false,
76233
- b = false,
76234
- c = false,
76235
- d = false,
76236
- f = false,
76237
- g = false,
76238
- h = false,
76239
- i = false,
76240
- j = false,
76241
- k = false;
76242
- let m = false,
76243
- n = false,
76244
- o = false,
76245
- p = false;
76328
+ if (target.parentNode && target.parentNode.classList) rowClicked = target.parentNode.classList.contains('is-builder');
76329
+ let containerClicked = target.classList.contains('is-builder');
76330
+ let a = target.closest('.is-builder');
76331
+ let p = target.closest('.is-subblock');
76332
+ let b = target.closest('.is-modal') || target.closest('.keep-selection');
76333
+ let c = target.closest('.is-side') || target.closest('.is-sidebar');
76334
+ let d = target.closest('.is-pop');
76335
+ let f = target.closest('.is-tool');
76336
+ let g = target.closest('.is-rte-tool') || target.closest('.is-elementrte-tool');
76337
+ let h = target.closest('.is-rte-pop');
76338
+ let i = target.closest('.row-add-initial');
76339
+ let j = target.closest('.sl-wrapper') || target.closest('.sl-overlay') || target.closest('.sl-close');
76340
+ let k = target.closest('.is-selectbox') || target.closest('.is-selectbox-options');
76246
76341
  let isSpecialElement = false;
76247
- let element = target;
76248
- while (element) {
76249
- if (!element.tagName) break;
76250
- if (element.tagName === 'BODY' || element.tagName === 'HTML') break;
76251
- if (this.dom.hasClass(element, 'is-builder')) a = true;
76252
- if (this.dom.hasClass(element, 'is-subblock')) p = true;
76253
- if (this.dom.hasClass(element, 'is-modal') || this.dom.hasClass(element, 'keep-selection')) b = true;
76254
- if (this.dom.hasClass(element, 'is-side') || this.dom.hasClass(element, 'is-sidebar')) c = true;
76255
- if (this.dom.hasClass(element, 'is-pop')) d = true;
76256
- if (this.dom.hasClass(element, 'is-tool')) f = true;
76257
- if (this.dom.hasClass(element, 'is-rte-tool') || this.dom.hasClass(element, 'is-elementrte-tool')) g = true;
76258
- if (this.dom.hasClass(element, 'is-rte-pop')) h = true;
76259
- if (this.dom.hasClass(element, 'row-add-initial')) i = true;
76260
- if (this.dom.hasClass(element, 'sl-wrapper') || this.dom.hasClass(element, 'sl-overlay') || this.dom.hasClass(element, 'sl-close')) j = true;
76261
- if (this.dom.hasClass(element, 'is-selectbox') || this.dom.hasClass(element, 'is-selectbox-options')) k = true; // dropdown
76262
-
76263
- if (this.opts.specialElementClasses) {
76264
- for (let i = 0; i < this.opts.specialElementClasses.length; i++) {
76265
- if (this.dom.hasClass(element, this.opts.specialElementClasses[i])) isSpecialElement = true;
76266
- }
76342
+ if (this.opts.specialElementClasses) {
76343
+ for (let i = 0; i < this.opts.specialElementClasses.length; i++) {
76344
+ isSpecialElement = target.closest('.' + this.opts.specialElementClasses[i]);
76267
76345
  }
76268
- if (element.id === 'divImageTool') m = true;
76269
- if (element.id === 'divImageResizer') n = true;
76270
- if (this.preserveSelection) o = true;
76271
- element = element.parentNode;
76272
76346
  }
76347
+ let o;
76348
+ if (this.preserveSelection) o = true;
76273
76349
 
76274
76350
  // dropdown
76275
76351
  if (!k) {
@@ -76278,45 +76354,40 @@ class ContentBuilder {
76278
76354
  dropdown.style.display = 'none';
76279
76355
  });
76280
76356
  }
76281
-
76282
- // let a = this.dom.parentsHasClass(target, 'is-builder'); // builder area
76283
- // let b = this.dom.parentsHasClass(target, 'is-modal'); // modal
76284
- // let c = this.dom.parentsHasClass(target, 'is-side'); // side panel
76285
- // let d = this.dom.parentsHasClass(target, 'is-pop'); // pop
76286
- // let f = this.dom.parentsHasClass(target, 'is-tool'); // tool
76287
- // let g = this.dom.parentsHasClass(target, 'is-rte-tool');
76288
- // let h = this.dom.parentsHasClass(target, 'is-rte-pop');
76289
- // let i = this.dom.parentsHasClass(target, 'row-add-initial');
76290
- // let j = this.dom.hasClass(target, 'sl-overlay') ||
76291
- // this.dom.parentsHasClass(target, 'sl-overlay') ||
76292
- // this.dom.hasClass(target, 'sl-close') ||
76293
- // this.dom.parentsHasClass(target, 'sl-close');
76357
+ const clrPicker = document.querySelector('.clr-picker.clr-open');
76358
+ // if(clrPicker) return;
76294
76359
 
76295
76360
  // Image Resizer
76361
+ let n = target.closest('#divImageResizer');
76362
+ if (n) return;
76363
+
76364
+ /*
76365
+ let m = target.closest('#divImageTool');
76366
+
76296
76367
  let resizeProcess = false;
76297
76368
  let imageResizer = document.querySelector('#divImageResizer');
76298
- if (imageResizer) if (imageResizer.getAttribute('data-resized') === '1') resizeProcess = true;
76299
- if (resizeProcess) return; // to prevent unwanted click/clearActiveCell during image resize end.
76300
-
76301
- if (!(b || j || m || n || target.tagName.toLowerCase() === 'img')) {
76302
- let imageTool = document.querySelector('#divImageTool');
76303
- imageTool.style.display = '';
76304
- // this.activeImage = null; // Commented => Additional (to prevent lost focus)
76305
-
76306
- let imageResizer = document.querySelector('#divImageResizer');
76307
- imageResizer.style.display = 'none';
76308
-
76309
- // moveable
76310
- imageResizer.style.top = '-10px';
76311
- imageResizer.style.left = '-10px';
76312
- imageResizer.style.width = '1px';
76313
- imageResizer.style.height = '1px';
76314
- if (this.moveable) {
76315
- this.moveable.updateRect();
76316
- document.querySelector('.moveable-control-box').style.display = 'none';
76317
- }
76369
+ if(imageResizer) if(imageResizer.getAttribute('data-resized')==='1') resizeProcess = true;
76370
+ if(resizeProcess) return; // to prevent unwanted click/clearActiveCell during image resize end.
76371
+ if(!(b||j||m||n||target.tagName.toLowerCase() === 'img')) {
76372
+ let imageTool = document.querySelector('#divImageTool');
76373
+ imageTool.style.display = '';
76374
+ // this.activeImage = null; // Commented => Additional (to prevent lost focus)
76375
+ let imageResizer = document.querySelector('#divImageResizer');
76376
+ imageResizer.style.display = 'none';
76377
+
76378
+ // moveable
76379
+ imageResizer.style.top = '-10px';
76380
+ imageResizer.style.left = '-10px';
76381
+ imageResizer.style.width = '1px';
76382
+ imageResizer.style.height = '1px';
76383
+ if(this.moveable) {
76384
+ this.moveable.updateRect();
76385
+ document.querySelector('.moveable-control-box').style.display = 'none';
76386
+ }
76318
76387
  }
76319
- if (!(a || p || b || c || d || f || g || h || i || j || o || isSpecialElement) || rowClicked && !i || containerClicked) {
76388
+ */
76389
+
76390
+ if (!(a || p || b || c || d || f || g || h || i || j || o || isSpecialElement || clrPicker) || rowClicked && !i || containerClicked) {
76320
76391
  // Click anywhere but is not inside builder area, modal, popup, tool or rte, then clear row/column (cell) selection
76321
76392
 
76322
76393
  if (!this.dom.getSelected()) {
@@ -76327,28 +76398,40 @@ class ContentBuilder {
76327
76398
 
76328
76399
  util.clearActiveCell();
76329
76400
  util.clearControls();
76330
- if (this.toolbarDisplay !== 'auto') {
76401
+ if (!this.controlPanel) if (this.toolbarDisplay !== 'auto') {
76331
76402
  this.rte.showDefaultToolbar();
76332
76403
  }
76333
76404
  if (this.settings.onSelectionChange) this.settings.onSelectionChange(e);
76405
+
76406
+ // if(this.settings.onPageContentClick) this.settings.onPageContentClick(e);
76334
76407
  }
76335
76408
  }
76409
+
76410
+ /*
76336
76411
  this.element.hyperlink.buttonEditor.hide();
76412
+ */
76337
76413
  }
76338
76414
 
76415
+ /*
76339
76416
  // Button Modal
76340
- if (!this.activeLinkButton && !this.activeButton && !target.closest('.buttoneditor') && !target.closest('.link-button-edit') && !target.closest('.is-modal')) {
76341
- this.element.hyperlink.buttonEditor.hide();
76417
+ if(!this.activeLinkButton && !this.activeButton &&
76418
+ !target.closest('.buttoneditor') && !target.closest('.link-button-edit') &&
76419
+ !target.closest('.is-modal')) {
76420
+ this.element.hyperlink.buttonEditor.hide();
76342
76421
  }
76422
+ */
76343
76423
 
76424
+ /*
76344
76425
  // Backward compatibility (for examples)
76345
- if (!d && !this.dom.parentsHasId(target, '_cbhtml')) {
76346
- const pops = document.querySelectorAll('.is-pop');
76347
- Array.prototype.forEach.call(pops, pop => {
76348
- if (!this.dom.parentsHasId(pop, '_cbhtml')) pop.style.display = '';
76349
- });
76426
+ if(!d && !this.dom.parentsHasId(target, '_cbhtml')) {
76427
+ const pops = document.querySelectorAll('.is-pop');
76428
+ Array.prototype.forEach.call(pops, (pop) => {
76429
+ if(!this.dom.parentsHasId(pop, '_cbhtml')) pop.style.display = '';
76430
+ });
76350
76431
  }
76432
+ */
76351
76433
  });
76434
+
76352
76435
  if (this.iframe) {
76353
76436
  this.doc.addEventListener('click', this.doDocumentClick);
76354
76437
  }
@@ -76651,11 +76734,14 @@ class ContentBuilder {
76651
76734
  // let outlineStyle = localStorage.getItem('_outlinestyle');
76652
76735
  // this.preferences.setOutlineStyle(outlineStyle);
76653
76736
  // }
76654
- this.preferences.initBuilder(builder);
76737
+ if (this.preferences) this.preferences.initBuilder(builder);
76655
76738
 
76656
76739
  // Apply behavior on each row
76657
76740
  const rows = this.dom.elementChildren(builder);
76658
76741
  rows.forEach(row => {
76742
+ // The saveForUndo also saves sortable class when start dragging. If Undo is performed, the classes are returned. Cleanup the classes here.
76743
+ row.classList.remove('sortable-ghost');
76744
+ row.classList.remove('sortable-chosen');
76659
76745
  if (this.dom.hasClass(row, 'row-add-initial')) return;
76660
76746
 
76661
76747
  // Hack. If a row has margin left/right specified, don't need to set hidden border (that is used to make smooth sortable)
@@ -76743,7 +76829,11 @@ class ContentBuilder {
76743
76829
  // col.addEventListener('focus', this.handleCellFocus.bind(this, col));
76744
76830
 
76745
76831
  // ON PASTE
76746
- col.addEventListener('paste', this.handleCellPaste.bind(this));
76832
+ // col.addEventListener('paste', this.handleCellPaste.bind(this));
76833
+ col.addEventListener('paste', e => {
76834
+ const clipboardData = (e.clipboardData || window.clipboardData).getData('text');
76835
+ this.handleCellPaste(clipboardData);
76836
+ });
76747
76837
  col.setAttribute('data-click', true);
76748
76838
  }
76749
76839
  });
@@ -76816,8 +76906,23 @@ class ContentBuilder {
76816
76906
  this.util.checkEmpty(); // for multiple instances check
76817
76907
 
76818
76908
  if (this.sortableOnPage) this.sortableOnPage.destroy(); // enable drop as section (ContentBox)
76819
- },
76820
76909
 
76910
+ if (this.controlPanel) {
76911
+ // && document.body.classList.contains('controlpanel') (already opens)
76912
+ this.controlpanel.getActive();
76913
+ this.controlpanel.select('column');
76914
+ setTimeout(() => {
76915
+ // Hide element tool
76916
+ this.elmTool.hide();
76917
+ }, 600);
76918
+ }
76919
+
76920
+ //Trigger Change event
76921
+ this.opts.onChange();
76922
+
76923
+ //Trigger Render event
76924
+ this.opts.onRender();
76925
+ },
76821
76926
  onAdd: evt => {
76822
76927
  var itemEl = evt.item;
76823
76928
  if (itemEl.getAttribute('data-id')) {
@@ -77291,6 +77396,8 @@ class ContentBuilder {
77291
77396
  ok = true;
77292
77397
  } else if (targetAssetType === 'media' && (ext === 'mp4' || ext === 'jpg' || ext === 'jpeg' || ext === 'png' || ext === 'gif' || ext === 'webm' || ext === 'webp')) {
77293
77398
  ok = true;
77399
+ } else if (targetAssetType === 'all') {
77400
+ ok = true;
77294
77401
  } else {
77295
77402
  if (targetAssetType === 'image') alert(out('Please select an image file.'));
77296
77403
  if (targetAssetType === 'video') alert(out('Please select an mp4 file.'));
@@ -77771,6 +77878,18 @@ class ContentBuilder {
77771
77878
  }
77772
77879
  addButton(pluginName, html, selector, exec) {
77773
77880
  if (!this.builderStuff) return;
77881
+ if (this.controlPanel && this.controlpanel.controlPanel) {
77882
+ const popMore = this.controlpanel.controlPanel.querySelector('.panel-pop.more');
77883
+ const pluginArea = popMore.querySelector('div.plugins');
77884
+ pluginArea.insertAdjacentHTML('beforeend', html);
77885
+ const btn = popMore.querySelector(selector);
77886
+ btn.addEventListener('click', e => {
77887
+ exec(e);
77888
+ });
77889
+ const label = popMore.querySelector('.label-plugins');
77890
+ label.style.display = ''; //show label
77891
+ }
77892
+
77774
77893
  const rteTool = this.builderStuff.querySelector('.is-rte-tool');
77775
77894
  const rteMoreOptions = this.builderStuff.querySelector('.rte-more-options');
77776
77895
  var bUseMore = false;
@@ -77998,16 +78117,16 @@ class ContentBuilder {
77998
78117
  htmlutil.view('full', area);
77999
78118
  }
78000
78119
  viewPreferences() {
78001
- this.preferences.view();
78120
+ if (this.preferences) this.preferences.view();
78002
78121
  }
78003
78122
  viewConfig() {
78004
78123
  //backward
78005
- this.preferences.view();
78124
+ if (this.preferences) this.preferences.view();
78006
78125
  }
78007
78126
  viewZoom() {
78008
78127
  this.rte.viewZoom();
78009
78128
  }
78010
- loadSnippets(snippetFile) {
78129
+ loadSnippets(snippetFile, snippetOpen) {
78011
78130
  if (this.preview) return;
78012
78131
  if (this.opts.snippetList === '#divSnippetList') {
78013
78132
  let snippetPanel = document.querySelector(this.opts.snippetList);
@@ -78025,7 +78144,7 @@ class ContentBuilder {
78025
78144
  this.opts.snippetPath = window._snippets_path;
78026
78145
  }
78027
78146
  if (this.opts.snippetJSON.snippets.length > 0) {
78028
- renderSnippetPanel(this); // Render Snippet Panel
78147
+ renderSnippetPanel(this, snippetOpen); // Render Snippet Panel
78029
78148
  }
78030
78149
  };
78031
78150
 
@@ -78203,9 +78322,6 @@ class ContentBuilder {
78203
78322
  // Font Family
78204
78323
  let iframeRte = this.rte.rteFontFamilyOptions.querySelector('iframe');
78205
78324
  let doc1 = iframeRte.contentWindow.document;
78206
- const fontModal = this.builderStuff.querySelector('.is-modal.pickfontfamily');
78207
- let iframePanel = fontModal.querySelector('iframe');
78208
- let doc2 = iframePanel.contentWindow.document;
78209
78325
 
78210
78326
  // Icons
78211
78327
  let iframeIcons = this.rte.rteIconOptions.querySelector('iframe');
@@ -78221,16 +78337,21 @@ class ContentBuilder {
78221
78337
  } else {
78222
78338
  this.util.refreshFontFamilyStyle1();
78223
78339
  }
78224
- if (doc2.body.innerHTML === '') {
78225
- doc2.open();
78226
- if (!this.opts.emailMode) {
78227
- doc2.write(util.getFontFamilyHTML(true));
78340
+ const fontModal = this.builderStuff.querySelector('.is-modal.pickfontfamily');
78341
+ if (fontModal) {
78342
+ let iframePanel = fontModal.querySelector('iframe');
78343
+ let doc2 = iframePanel.contentWindow.document;
78344
+ if (doc2.body.innerHTML === '') {
78345
+ doc2.open();
78346
+ if (!this.opts.emailMode) {
78347
+ doc2.write(util.getFontFamilyHTML(true));
78348
+ } else {
78349
+ doc2.write(util.getFontFamilyEmail(true));
78350
+ }
78351
+ doc2.close();
78228
78352
  } else {
78229
- doc2.write(util.getFontFamilyEmail(true));
78353
+ this.util.refreshFontFamilyStyle2();
78230
78354
  }
78231
- doc2.close();
78232
- } else {
78233
- this.util.refreshFontFamilyStyle2();
78234
78355
  }
78235
78356
  if (doc3.body.innerHTML === '') {
78236
78357
  doc3.open();
@@ -78502,43 +78623,76 @@ class ContentBuilder {
78502
78623
  util.clearActiveCell();
78503
78624
  this.activeCol = col;
78504
78625
  let elm = e.target;
78505
- this.dom.addClass(col, 'cell-active');
78506
- let row = col.parentNode; //Since a col can be moved to another row, then re-get the active row
78507
- this.dom.addClass(row, 'row-active');
78626
+ col.classList.add('cell-active');
78627
+ let row = col.parentNode;
78628
+ row.classList.add('row-active');
78508
78629
  const builders = this.doc.querySelectorAll(this.opts.container);
78509
- Array.prototype.forEach.call(builders, builder => {
78510
- this.dom.removeClass(builder, 'builder-active');
78630
+ builders.forEach(builder => {
78631
+ builder.classList.remove('builder-active');
78511
78632
  });
78512
- this.dom.addClass(row.parentNode, 'builder-active');
78513
- this.dom.addClass(this.doc.body, 'content-edit');
78633
+ row.parentNode.classList.add('builder-active');
78634
+ this.doc.body.classList.add('content-edit');
78514
78635
  if (row.childElementCount - 2 === 1) ; else {
78515
- this.dom.addClass(row, 'row-outline');
78636
+ row.classList.add('row-outline');
78516
78637
  }
78517
78638
 
78518
- //this.getState();
78519
-
78520
78639
  // Call onContentClick to indicate click on editable content (eg. for plugin usage)
78521
- // if (!col.hasAttribute('data-html')) {
78522
78640
  if (this.opts.onContentClick) this.opts.onContentClick(e);
78523
- // }
78524
-
78525
78641
  this.element.click(col, e);
78526
78642
  this.colTool.click(col);
78527
78643
  this.elmTool.click(col, e);
78528
- this.rte.click(col, e);
78644
+ if (!this.controlPanel) this.rte.click(col, e);else this.util.saveSelection(); // important (eg. for create/edit link)
78645
+
78646
+ /*
78647
+ // TODO: move to grideditor.js
78529
78648
  // Grid Editor Status
78530
78649
  // On/off lock button
78531
78650
  const grideditor = document.querySelector('.grideditor.active');
78532
- if (grideditor) {
78533
- const btnCellLocking = grideditor.querySelector('.cell-locking');
78534
- if (col.hasAttribute('data-noedit')) {
78535
- this.dom.addClass(btnCellLocking, 'on');
78536
- } else {
78537
- this.dom.removeClass(btnCellLocking, 'on');
78651
+ if(grideditor) {
78652
+ const btnCellLocking = grideditor.querySelector('.cell-locking');
78653
+ if(col.hasAttribute('data-noedit')) {
78654
+ btnCellLocking.classList.add('on');
78655
+ } else {
78656
+ btnCellLocking.classList.remove('on');
78657
+ }
78658
+ }
78659
+ */
78660
+
78661
+ // If column only has spacer, locked or unlocked,
78662
+ // the text should not be able to edit (cursor should not be able to be placed)
78663
+ // So, make the column uneditable (text) if only has a spacer.
78664
+ if (col.childElementCount === 1) {
78665
+ let elm = col.children[0];
78666
+ if (elm) if (this.dom.hasClass(elm, 'spacer')) {
78667
+ col.contentEditable = false;
78538
78668
  }
78539
78669
  }
78540
- let link = this.dom.getParentElement(elm, 'a');
78541
- if (elm.tagName.toLowerCase() === 'a' || link) {
78670
+
78671
+ // Show Lock Indicator
78672
+ this.colTool.showHideLockIndicator(col);
78673
+ if (this.opts.enableDragResize) {
78674
+ if (this.resize) {
78675
+ // console.log(this.resize);
78676
+ this.resize.destroy(); // destroy previous instance
78677
+ }
78678
+
78679
+ // Enable resizable on click
78680
+ if (!col.classList.contains('noresize')) {
78681
+ // Disable on mobile
78682
+ const viewportWidth = this.doc.body.clientWidth;
78683
+ if (viewportWidth > 768) {
78684
+ this.resize = new Resize(col, this);
78685
+ this.resize.enable();
78686
+ }
78687
+ }
78688
+ }
78689
+ if (this.settings.onSelectionChange) this.settings.onSelectionChange(e);
78690
+
78691
+ // if(this.settings.onPageContentClick) this.settings.onPageContentClick(e);
78692
+
78693
+ // Lightbox
78694
+ let link = elm.closest('a');
78695
+ if (link) {
78542
78696
  if (col.hasAttribute('data-noedit') || col.hasAttribute('data-protected')) {
78543
78697
  // Link & Lightbox click allowed only on locked column
78544
78698
 
@@ -78606,25 +78760,6 @@ class ContentBuilder {
78606
78760
  // return false;
78607
78761
  }
78608
78762
 
78609
- // LATER: (builder inside builder)
78610
- // if (jQuery(e.target).parents('.is-builder').length>1) {
78611
- // e.preventDefault();
78612
- // e.stopImmediatePropagation();
78613
- // }
78614
-
78615
- // If column only has spacer, locked or unlocked,
78616
- // the text should not be able to edit (cursor should not be able to be placed)
78617
- // So, make the column uneditable (text) if only has a spacer.
78618
- if (col.childElementCount === 1) {
78619
- let elm = col.children[0];
78620
- if (elm) if (this.dom.hasClass(elm, 'spacer')) {
78621
- col.contentEditable = false;
78622
- }
78623
- }
78624
-
78625
- // Show Lock Indicator
78626
- this.colTool.showHideLockIndicator(col);
78627
-
78628
78763
  // Extra: Check if last row, make sure the Row Add Tool visible
78629
78764
  const tool = row.querySelector('.is-rowadd-tool');
78630
78765
  const tollAddButton = tool.querySelector('button');
@@ -78647,23 +78782,6 @@ class ContentBuilder {
78647
78782
  }
78648
78783
  }
78649
78784
  }
78650
- if (this.opts.enableDragResize) {
78651
- if (this.resize) {
78652
- // console.log(this.resize);
78653
- this.resize.destroy(); // destroy previous instance
78654
- }
78655
-
78656
- // Enable resizable on click
78657
- if (!col.classList.contains('noresize')) {
78658
- // Disable on mobile
78659
- const viewportWidth = this.doc.body.clientWidth;
78660
- if (viewportWidth > 768) {
78661
- this.resize = new Resize(col, this);
78662
- this.resize.enable();
78663
- }
78664
- }
78665
- }
78666
- if (this.settings.onSelectionChange) this.settings.onSelectionChange(e);
78667
78785
  }
78668
78786
  handleCellKeypress(e) {
78669
78787
  if (e.ctrlKey || e.metaKey) {
@@ -78712,10 +78830,7 @@ class ContentBuilder {
78712
78830
  // });
78713
78831
  // this.autoclean=true;
78714
78832
 
78715
- if ((e.ctrlKey || e.metaKey) && e.which === 86) {
78716
- //CTRL-V
78717
- this.handleCellPaste();
78718
- }
78833
+ if ((e.ctrlKey || e.metaKey) && e.which === 86) ;
78719
78834
  if (this.opts.elementSelection && !this.emailMode) {
78720
78835
  if ((e.ctrlKey || e.metaKey) && e.which === 65) {
78721
78836
  //CTRL-A
@@ -79171,7 +79286,7 @@ class ContentBuilder {
79171
79286
  this.opts.onChange();
79172
79287
  }, 2000);
79173
79288
  }
79174
- handleCellPaste() {
79289
+ handleCellPaste(clipboardData) {
79175
79290
  this.uo.saveForUndo();
79176
79291
  const util = this.util;
79177
79292
  util.saveSelection(); //required. Without this, CTRL-A (select element) & CTRL-V won't replace the element, but will paste at the end of the element.
@@ -79230,22 +79345,26 @@ class ContentBuilder {
79230
79345
  }
79231
79346
  if (!bPasteObject) {
79232
79347
  if (this.opts.paste === 'text') {
79348
+ /*
79233
79349
  let elms = contentword.querySelectorAll('p,h1,h2,h3,h4,h5,h6');
79234
- Array.prototype.forEach.call(elms, elm => {
79235
- elm.innerHTML = elm.innerHTML + ' '; //add space (&nbsp;)
79350
+ Array.prototype.forEach.call(elms, (elm) => {
79351
+ elm.innerHTML = elm.innerHTML + ' '; //add space (&nbsp;)
79236
79352
  });
79237
-
79238
- // sPastedText = contentword.innerText;
79353
+ // sPastedText = contentword.innerText;
79239
79354
  sPastedText = contentword.innerHTML;
79240
- sPastedText = sPastedText.replace(/(<([^>]+)>)/ig, '<br>');
79355
+ sPastedText = sPastedText.replace(/(<([^>]+)>)/ig,'<br>');
79241
79356
  sPastedText = sPastedText.replace(/(<br\s*\/?>){3,}/gi, '<br>');
79242
- if (sPastedText.indexOf('<br>') === 0) {
79243
- sPastedText = sPastedText.substring(4);
79357
+ if(sPastedText.indexOf('<br>')===0) {
79358
+ sPastedText = sPastedText.substring(4);
79244
79359
  }
79245
- if (sPastedText.substring(sPastedText.length - 4) === '<br>') {
79246
- sPastedText = sPastedText.substring(0, sPastedText.length - 4);
79360
+ if(sPastedText.substring(sPastedText.length-4)==='<br>'){
79361
+ sPastedText = sPastedText.substring(0, sPastedText.length-4);
79247
79362
  }
79248
79363
  sPastedText = sPastedText.trim();
79364
+ */
79365
+
79366
+ sPastedText = clipboardData;
79367
+ // sPastedText = sPastedText.replace(/(?:\r\n|\r|\n)/g, '<br>');
79249
79368
  } else {
79250
79369
  sPastedText = contentword.innerHTML;
79251
79370
  if (this.opts.paste === 'html') {
@@ -79574,7 +79693,8 @@ class ContentBuilder {
79574
79693
  // </div>
79575
79694
  // `;
79576
79695
  itemEl.outerHTML = this.settings.sectionTemplate.replace('[%CONTENT%]', itemEl.outerHTML);
79577
- if (this.opts.onSectionAdd) this.opts.onSectionAdd();
79696
+ this.activeCol = null;
79697
+ if (this.opts.onBlockSectionAdd) this.opts.onBlockSectionAdd();
79578
79698
 
79579
79699
  // //Trigger Change event
79580
79700
  // this.opts.onChange();
@@ -79708,7 +79828,9 @@ class ContentBuilder {
79708
79828
  }
79709
79829
  // // After snippet has been added, re-apply behavior on builder areas
79710
79830
  // this.applyBehaviorOn(builder);
79711
- if (this.opts.onSectionAdd) this.opts.onSectionAdd();
79831
+
79832
+ this.activeCol = null;
79833
+ if (this.opts.onBlockSectionAdd) this.opts.onBlockSectionAdd();
79712
79834
 
79713
79835
  //Trigger Change event
79714
79836
  this.opts.onChange();
@@ -79727,17 +79849,18 @@ class ContentBuilder {
79727
79849
  }
79728
79850
  }
79729
79851
  hideElementTools() {
79730
- let elmTool = document.querySelector('.is-element-tool');
79731
- let divImageTool = document.querySelector('#divImageTool');
79732
- let divImageResizer = document.querySelector('#divImageResizer');
79733
- if (divImageTool) if (divImageTool.style.display === 'flex') {
79734
- if (this.editor.moveable) this.editor.moveable.updateRect();
79735
- let controlBox = this.doc.querySelector('.moveable-control-box');
79736
- if (controlBox) controlBox.style.display = 'none';
79737
- }
79852
+ let elmTool = this.doc.querySelector('.is-element-tool');
79738
79853
  if (elmTool) elmTool.style.display = '';
79739
- if (divImageTool) divImageTool.style.display = '';
79740
- if (divImageResizer) divImageResizer.style.display = '';
79854
+ let linkTool = this.doc.querySelector('#divLinkTool');
79855
+ if (linkTool) linkTool.style.display = '';
79856
+ this.element.image.hideImageTool();
79857
+ this.doc.querySelectorAll('.icon-active').forEach(elm => elm.classList.remove('icon-active'));
79858
+ this.doc.querySelectorAll('.elm-inspected').forEach(elm => elm.classList.remove('elm-inspected'));
79859
+ this.doc.querySelectorAll('.elm-active').forEach(elm => elm.classList.remove('elm-active'));
79860
+ this.activeImage = null;
79861
+ this.activeIcon = null;
79862
+ this.inspectedElement = null;
79863
+ this.activeElement = null;
79741
79864
  }
79742
79865
  }
79743
79866