@innovastudio/contentbox 1.6.169 → 1.6.171

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.
@@ -2395,16 +2395,25 @@ class SideBar {
2395
2395
  const imageObserver = new IntersectionObserver((entries, imgObserver) => {
2396
2396
  entries.forEach((entry) => {
2397
2397
  if (entry.isIntersecting) {
2398
- const lazyImage = entry.target
2399
- // console.log("lazy loading ", lazyImage)
2400
- lazyImage.src = lazyImage.dataset.src
2401
- lazyImage.classList.remove("lzy-img");
2402
- imgObserver.unobserve(lazyImage);
2398
+ try {
2399
+ const lazyImage = entry.target
2400
+ // console.log("lazy loading ", lazyImage)
2401
+ lazyImage.src = lazyImage.dataset.src
2402
+ lazyImage.classList.remove("lzy-img");
2403
+ imgObserver.unobserve(lazyImage);
2404
+ } catch(e) {
2405
+ console.error('Image loading error:', e);
2406
+ imgObserver.unobserve(entry.target);
2407
+ }
2403
2408
  }
2404
2409
  })
2410
+ }, {
2411
+ rootMargin: '50px'
2405
2412
  });
2406
2413
 
2407
- const makeid = () => { //http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript
2414
+ let renderTimeout = null;
2415
+
2416
+ const makeid = () => {
2408
2417
  var text = "";
2409
2418
  var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
2410
2419
  for (var i = 0; i < 2; i++)
@@ -2588,7 +2597,17 @@ class SideBar {
2588
2597
  });
2589
2598
  });
2590
2599
  }
2591
-
2600
+
2601
+ // Setup single event listener for all design buttons (prevents memory leak)
2602
+ const designList = document.querySelector('.is-design-list');
2603
+ designList.addEventListener('click', (e) => {
2604
+ const btn = e.target.closest('button[data-id]');
2605
+ if (btn) {
2606
+ const designid = btn.getAttribute('data-id');
2607
+ addDesign(designid);
2608
+ }
2609
+ });
2610
+
2592
2611
  const showDesigns = (catId, designId) => {
2593
2612
 
2594
2613
  if(template_list.length>0) {
@@ -2597,8 +2616,16 @@ class SideBar {
2597
2616
  }
2598
2617
 
2599
2618
  const designList = document.querySelector('.is-design-list');
2619
+
2620
+ // Unobserve old images to prevent memory leak
2621
+ const oldImages = designList.querySelectorAll('img.lzy-img');
2622
+ oldImages.forEach(img => imageObserver.unobserve(img));
2623
+
2624
+ // Cancel any pending render
2625
+ if (renderTimeout) clearTimeout(renderTimeout);
2626
+
2600
2627
  designList.style.opacity = 0;
2601
- setTimeout(()=>{
2628
+ renderTimeout = setTimeout(()=>{
2602
2629
  designList.innerHTML = '';
2603
2630
  designList.style.opacity = 1;
2604
2631
  designList.scrollTop = 0;
@@ -2637,54 +2664,24 @@ class SideBar {
2637
2664
  if(slider==='glide') {
2638
2665
  if(item.type === 'glide') {
2639
2666
  designList.insertAdjacentHTML('beforeend', html);
2640
- const btn = designList.querySelector('[data-id="' + item.id + '"]');
2641
- btn.addEventListener('click', (e)=>{
2642
- const designid = btn.getAttribute('data-id');
2643
- addDesign(designid);
2644
- });
2645
2667
  }
2646
2668
  } else if(slider==='slick') {
2647
2669
  if(item.type === 'slick') {
2648
2670
  designList.insertAdjacentHTML('beforeend', html);
2649
- const btn = designList.querySelector('[data-id="' + item.id + '"]');
2650
- btn.addEventListener('click', (e)=>{
2651
- const designid = btn.getAttribute('data-id');
2652
- addDesign(designid);
2653
- });
2654
2671
  }
2655
2672
  } else if(slider==='all') {
2656
2673
  designList.insertAdjacentHTML('beforeend', html);
2657
- const btn = designList.querySelector('[data-id="' + item.id + '"]');
2658
- btn.addEventListener('click', (e)=>{
2659
- const designid = btn.getAttribute('data-id');
2660
- addDesign(designid);
2661
- });
2662
2674
  }
2663
2675
  } else if(item.type === 'navbar' ) {
2664
2676
  if(navbar) {
2665
2677
  designList.insertAdjacentHTML('beforeend', html);
2666
- const btn = designList.querySelector('[data-id="' + item.id + '"]');
2667
- btn.addEventListener('click', (e)=>{
2668
- const designid = btn.getAttribute('data-id');
2669
- addDesign(designid);
2670
- });
2671
2678
  }
2672
2679
  } else if(item.type === 'canvas' ) {
2673
2680
  if(canvas) {
2674
2681
  designList.insertAdjacentHTML('beforeend', html);
2675
- const btn = designList.querySelector('[data-id="' + item.id + '"]');
2676
- btn.addEventListener('click', (e)=>{
2677
- const designid = btn.getAttribute('data-id');
2678
- addDesign(designid);
2679
- });
2680
2682
  }
2681
2683
  } else {
2682
2684
  designList.insertAdjacentHTML('beforeend', html);
2683
- const btn = designList.querySelector('[data-id="' + item.id + '"]');
2684
- btn.addEventListener('click', (e)=>{
2685
- const designid = btn.getAttribute('data-id');
2686
- addDesign(designid);
2687
- });
2688
2685
  }
2689
2686
  }`;
2690
2687
  html += `
@@ -8807,6 +8804,7 @@ class Text {
8807
8804
  // Get element block (eg. h1, h2, p, div, ..) that is under the column (column's child)
8808
8805
  let activeColumn = this.builder.controlpanel.activeColumn;
8809
8806
  let elm = this.getElm();
8807
+ if (!activeColumn) activeColumn = elm.parentNode;
8810
8808
  let children = this.elementChildren(activeColumn);
8811
8809
  let elmBlock;
8812
8810
  children.forEach(item => {
@@ -8870,15 +8868,30 @@ class Text {
8870
8868
  activeColumn.querySelectorAll('.grow').forEach(elm => elm.classList.remove('grow'));
8871
8869
  }
8872
8870
 
8871
+ cleanColorClasses(elm) {
8872
+ elm.classList.remove('text-gray-50');
8873
+ elm.classList.remove('text-gray-100');
8874
+ elm.classList.remove('text-gray-200');
8875
+ elm.classList.remove('text-gray-300');
8876
+ elm.classList.remove('text-gray-400');
8877
+ elm.classList.remove('text-gray-500');
8878
+ elm.classList.remove('text-gray-600');
8879
+ elm.classList.remove('text-gray-700');
8880
+ elm.classList.remove('text-gray-800');
8881
+ elm.classList.remove('text-gray-900');
8882
+ }
8883
+
8873
8884
  setTextColor(color) {
8874
8885
  let elm = this.getElm();
8875
8886
  const text = this.getSelectedText();
8876
8887
 
8877
8888
  if (text.trim() === '') {
8878
8889
  elm.style.color = color;
8890
+ this.cleanColorClasses(elm);
8879
8891
  } else {
8880
8892
  if (elm.innerText === text) {
8881
8893
  elm.style.color = color;
8894
+ this.cleanColorClasses(elm);
8882
8895
  } else {
8883
8896
  this.builder.doc.execCommand('ForeColor', false, color); //Cleanup FONTs
8884
8897
 
@@ -8913,48 +8926,55 @@ class Text {
8913
8926
 
8914
8927
  setAction(command, onFinish) {
8915
8928
  let activeColumn = this.builder.controlpanel.activeColumn;
8916
- let spans = activeColumn.querySelectorAll('span');
8917
- Array.prototype.forEach.call(spans, span => {
8918
- span.setAttribute('data-keep', '1');
8919
- if (span.style.cssText) span.setAttribute('data-style', span.style.cssText);
8920
- });
8929
+
8930
+ if (activeColumn) {
8931
+ let spans = activeColumn.querySelectorAll('span');
8932
+ Array.prototype.forEach.call(spans, span => {
8933
+ span.setAttribute('data-keep', '1');
8934
+ if (span.style.cssText) span.setAttribute('data-style', span.style.cssText);
8935
+ });
8936
+ }
8937
+
8921
8938
  setTimeout(() => {
8922
8939
  this.builder.doc.execCommand(command, false, null);
8923
8940
  activeColumn = this.builder.controlpanel.activeColumn;
8924
- spans = activeColumn.querySelectorAll('span');
8925
- Array.prototype.forEach.call(spans, span => {
8926
- let attr = span.getAttribute('data-keep');
8927
8941
 
8928
- if (attr) {
8929
- // span.removeAttribute('data-keep');
8930
- let cssText = span.getAttribute('data-style');
8931
- if (cssText) span.style.cssText = cssText;
8932
- span.removeAttribute('data-style');
8933
- }
8934
- });
8935
- spans = activeColumn.querySelectorAll('span');
8936
- Array.prototype.forEach.call(spans, span => {
8937
- let attr = span.getAttribute('data-keep');
8942
+ if (activeColumn) {
8943
+ let spans = activeColumn.querySelectorAll('span');
8944
+ Array.prototype.forEach.call(spans, span => {
8945
+ let attr = span.getAttribute('data-keep');
8938
8946
 
8939
- if (!attr) {
8940
- span.outerHTML = span.innerHTML;
8941
- }
8942
- });
8943
- spans = activeColumn.querySelectorAll('span');
8944
- Array.prototype.forEach.call(spans, span => {
8945
- let attr = span.getAttribute('data-keep');
8947
+ if (attr) {
8948
+ // span.removeAttribute('data-keep');
8949
+ let cssText = span.getAttribute('data-style');
8950
+ if (cssText) span.style.cssText = cssText;
8951
+ span.removeAttribute('data-style');
8952
+ }
8953
+ });
8954
+ spans = activeColumn.querySelectorAll('span');
8955
+ Array.prototype.forEach.call(spans, span => {
8956
+ let attr = span.getAttribute('data-keep');
8946
8957
 
8947
- if (attr) {
8948
- span.removeAttribute('data-keep');
8949
- }
8950
- }); // clean
8951
- // let elms = activeColumn.querySelectorAll('ul,p');
8952
- // Array.prototype.forEach.call(elms, (elm) => {
8953
- // let text = elm.innerHTML.trim();
8954
- // if(text==='') {
8955
- // elm.parentNode.removeChild(elm);
8956
- // }
8957
- // });
8958
+ if (!attr) {
8959
+ span.outerHTML = span.innerHTML;
8960
+ }
8961
+ });
8962
+ spans = activeColumn.querySelectorAll('span');
8963
+ Array.prototype.forEach.call(spans, span => {
8964
+ let attr = span.getAttribute('data-keep');
8965
+
8966
+ if (attr) {
8967
+ span.removeAttribute('data-keep');
8968
+ }
8969
+ }); // clean
8970
+ // let elms = activeColumn.querySelectorAll('ul,p');
8971
+ // Array.prototype.forEach.call(elms, (elm) => {
8972
+ // let text = elm.innerHTML.trim();
8973
+ // if(text==='') {
8974
+ // elm.parentNode.removeChild(elm);
8975
+ // }
8976
+ // });
8977
+ }
8958
8978
 
8959
8979
  let elm = this.getElm();
8960
8980
  const ul = elm.closest('ul,ol');
@@ -10322,7 +10342,7 @@ class Text {
10322
10342
  if (!anchorNode) return false;
10323
10343
  let container = anchorNode.nodeType !== Node.TEXT_NODE && anchorNode.nodeType !== Node.COMMENT_NODE ? anchorNode : anchorNode.parentElement;
10324
10344
 
10325
- if (container && container.closest('.is-overlay') && this.builder.controlpanel.activeElement) {
10345
+ if (container && container.closest('.is-overlay') && this.builder.controlpanel.activeElement && !container.closest('[data-cb-type]')) {
10326
10346
  return this.builder.controlpanel.activeElement; // container => is-overlay when drag & drop bloxk
10327
10347
  }
10328
10348
  /*
@@ -11166,14 +11186,16 @@ class PanelText {
11166
11186
  this.panel.querySelectorAll('[data-justify]').forEach(elm => elm.classList.remove('on'));
11167
11187
  let activeColumn = this.builder.controlpanel.activeColumn;
11168
11188
 
11169
- if (activeColumn.classList.contains('justify-start')) {
11170
- this.panel.querySelector('[data-justify=justify-start]').classList.add('on');
11171
- } else if (activeColumn.classList.contains('justify-center')) {
11172
- this.panel.querySelector('[data-justify=justify-center]').classList.add('on');
11173
- } else if (activeColumn.classList.contains('justify-end')) {
11174
- this.panel.querySelector('[data-justify=justify-end]').classList.add('on');
11175
- } else if (activeColumn.classList.contains('justify-between')) {
11176
- this.panel.querySelector('[data-justify=justify-between]').classList.add('on');
11189
+ if (activeColumn) {
11190
+ if (activeColumn.classList.contains('justify-start')) {
11191
+ this.panel.querySelector('[data-justify=justify-start]').classList.add('on');
11192
+ } else if (activeColumn.classList.contains('justify-center')) {
11193
+ this.panel.querySelector('[data-justify=justify-center]').classList.add('on');
11194
+ } else if (activeColumn.classList.contains('justify-end')) {
11195
+ this.panel.querySelector('[data-justify=justify-end]').classList.add('on');
11196
+ } else if (activeColumn.classList.contains('justify-between')) {
11197
+ this.panel.querySelector('[data-justify=justify-between]').classList.add('on');
11198
+ }
11177
11199
  }
11178
11200
 
11179
11201
  if (!document.body.classList.contains('controlpanel')) return;
@@ -11237,6 +11259,13 @@ class PanelText {
11237
11259
  } catch (e) {// Do Nothing
11238
11260
  }
11239
11261
 
11262
+ if (activeElement.closest('[data-cb-type]')) {
11263
+ btnPlacementText.style.display = 'none';
11264
+ btnPlacementText.setAttribute('aria-expanded', 'false');
11265
+ btnPlacementText.nextElementSibling.style.display = 'none';
11266
+ btnPlacementText.nextElementSibling.setAttribute('aria-hidden', 'true');
11267
+ }
11268
+
11240
11269
  const config = this.builder.cssClasses;
11241
11270
  let elm = this.text.getElm();
11242
11271
  this.panel.querySelector('button[data-format=uppercase]').classList.remove('on');
@@ -12257,9 +12286,14 @@ class PanelSpacer {
12257
12286
  });
12258
12287
  let html = `
12259
12288
  <div class="submain">
12260
- <div class="label mt-0">${out('Height')}:</div>
12289
+ <div class="label mt-2 changedevice" style="width:222px;">
12290
+ <span>${out('Height')}: &nbsp;<span class="val-box-size"></span></span>
12291
+ <button title="${out('Change Device')}" class="btn-device"><svg style="width:13px;height:13px;"><use xlink:href="#icon-devices"></use></svg></button>
12292
+ </div>
12293
+
12261
12294
  <div class="group fontsizes">
12262
12295
  ${spacerHtml}
12296
+ <button title="${out('Clear')}" data-spacer=""><svg><use xlink:href="#icon-eraser"></use></svg></button>
12263
12297
  </div>
12264
12298
  </div>
12265
12299
  `;
@@ -12270,10 +12304,61 @@ class PanelSpacer {
12270
12304
  btn.addEventListener('click', () => {
12271
12305
  const val = btn.getAttribute('data-spacer');
12272
12306
  let spacer = this.builder.controlpanel.activeElement;
12273
- spacerList.forEach(val => spacer.classList.remove(`height-${val}`));
12274
- spacer.classList.add(`height-${val}`);
12275
12307
  btns.forEach(elm => elm.classList.remove('on'));
12276
12308
  btn.classList.add('on');
12309
+ let prefix = '';
12310
+ let screenMode = this.builder.screenMode;
12311
+
12312
+ if (screenMode === 'desktop') {
12313
+ prefix = '';
12314
+ } else if (screenMode === 'tablet-landscape') {
12315
+ prefix = 'md-';
12316
+ } else if (screenMode === 'tablet') {
12317
+ prefix = 'sm-';
12318
+ } else if (screenMode === 'mobile') {
12319
+ prefix = 'xs-';
12320
+ }
12321
+
12322
+ if (this.builder.doc.body.hasAttribute('data-breakpoint')) {
12323
+ const breakpoint = this.builder.doc.body.getAttribute('data-breakpoint');
12324
+
12325
+ if (breakpoint <= 760) {
12326
+ prefix = 'xs-';
12327
+ } else if (760 < breakpoint && breakpoint <= 970) {
12328
+ prefix = 'sm-';
12329
+ } else if (970 < breakpoint && breakpoint <= 1280) {
12330
+ prefix = 'md-';
12331
+ } else if (1280 < breakpoint && breakpoint <= 1920) {
12332
+ prefix = '';
12333
+ } else {
12334
+ // 1920<breakpoint
12335
+ prefix = '';
12336
+ }
12337
+ }
12338
+
12339
+ if (val !== '') {
12340
+ // Clear
12341
+ spacer.classList.forEach(item => {
12342
+ if (prefix === '' && item.startsWith('height-')) {
12343
+ spacer.classList.remove(item);
12344
+ }
12345
+
12346
+ if (prefix === 'md-' && item.startsWith('md-')) spacer.classList.remove(item);
12347
+ if (prefix === 'sm-' && item.startsWith('sm-')) spacer.classList.remove(item);
12348
+ if (prefix === 'xs-' && item.startsWith('xs-')) spacer.classList.remove(item);
12349
+ });
12350
+ spacer.classList.add(prefix + 'height-' + val);
12351
+ } else {
12352
+ // Clear
12353
+ spacer.classList.forEach(item => {
12354
+ if (prefix === 'md-' && item.startsWith('md-')) spacer.classList.remove(item);
12355
+ if (prefix === 'sm-' && item.startsWith('sm-')) spacer.classList.remove(item);
12356
+ if (prefix === 'xs-' && item.startsWith('xs-')) spacer.classList.remove(item);
12357
+ });
12358
+ }
12359
+
12360
+ this.getState();
12361
+ this.builder.editor.hideElementTools();
12277
12362
  });
12278
12363
  });
12279
12364
  }
@@ -12291,16 +12376,65 @@ class PanelSpacer {
12291
12376
  }
12292
12377
 
12293
12378
  getState() {
12379
+ this.getStateTargeted();
12380
+ }
12381
+
12382
+ getStateTargeted() {
12294
12383
  let spacer = this.builder.controlpanel.activeElement;
12295
12384
  const panel = this.panel;
12385
+ let prefix = '';
12386
+ let screenMode = this.builder.screenMode;
12387
+
12388
+ if (screenMode === 'desktop') {
12389
+ prefix = '';
12390
+ } else if (screenMode === 'tablet-landscape') {
12391
+ prefix = 'md-';
12392
+ } else if (screenMode === 'tablet') {
12393
+ prefix = 'sm-';
12394
+ } else if (screenMode === 'mobile') {
12395
+ prefix = 'xs-';
12396
+ }
12397
+
12398
+ if (this.builder.doc.body.hasAttribute('data-breakpoint')) {
12399
+ const breakpoint = parseInt(this.builder.doc.body.getAttribute('data-breakpoint'));
12400
+
12401
+ if (breakpoint <= 760) {
12402
+ prefix = 'xs-';
12403
+ } else if (760 < breakpoint && breakpoint <= 970) {
12404
+ prefix = 'sm-';
12405
+ } else if (970 < breakpoint && breakpoint <= 1280) {
12406
+ prefix = 'md-';
12407
+ } else if (1280 < breakpoint && breakpoint <= 1920) {
12408
+ prefix = '';
12409
+ } else {
12410
+ // 1920<breakpoint
12411
+ prefix = '';
12412
+ }
12413
+ }
12414
+
12296
12415
  const btns = panel.querySelectorAll('[data-spacer]');
12297
- spacer.classList.forEach(item => {
12298
- if (item.indexOf('height-') !== -1) {
12299
- let val = item.replace('height-', '');
12416
+ if (spacer) spacer.classList.forEach(item => {
12417
+ let val;
12418
+ if (prefix === '' && item.startsWith('height-')) val = item.replace('height-', '');
12419
+ if (prefix === 'md-' && item.startsWith('md-')) val = item.replace('md-height-', '');
12420
+ if (prefix === 'sm-' && item.startsWith('sm-')) val = item.replace('sm-height-', '');
12421
+ if (prefix === 'xs-' && item.startsWith('xs-')) val = item.replace('xs-height-', '');
12422
+
12423
+ if (val) {
12424
+ panel.querySelector('.val-box-size').innerHTML = val === 'none' ? '' : val;
12300
12425
  btns.forEach(elm => elm.classList.remove('on'));
12301
12426
  panel.querySelector(`[data-spacer="${val}"]`).classList.add('on');
12302
12427
  }
12303
12428
  });
12429
+
12430
+ if (prefix !== '') {
12431
+ const hasPrefix = Array.from(spacer.classList).some(c => c.startsWith(prefix));
12432
+
12433
+ if (!hasPrefix) {
12434
+ btns.forEach(elm => elm.classList.remove('on'));
12435
+ panel.querySelector('.val-box-size').innerHTML = '';
12436
+ }
12437
+ }
12304
12438
  }
12305
12439
 
12306
12440
  }
@@ -12335,6 +12469,7 @@ class SettingsUIGenerator$1 {
12335
12469
  if (!plugin.editor) return this.createEmptyForm();
12336
12470
  }
12337
12471
 
12472
+ if (!plugin.settings) plugin.settings = {};
12338
12473
  const form = document.createElement('div');
12339
12474
  form.className = 'cb-settings-form'; // Get current values from element
12340
12475
 
@@ -12788,6 +12923,7 @@ class SettingsUIGenerator$1 {
12788
12923
 
12789
12924
  getCurrentValues(element, settings) {
12790
12925
  const values = {};
12926
+ if (!settings) return values;
12791
12927
  Object.keys(settings).forEach(key => {
12792
12928
  if (key.startsWith('_')) return;
12793
12929
  const attrName = 'data-cb-' + key.replace(/([A-Z])/g, '-$1').toLowerCase();
@@ -12914,9 +13050,16 @@ class PanelPlugin {
12914
13050
  if (child.nodeType === 1 && child.tagName !== 'STYLE' && child.tagName !== 'SCRIPT') child.setAttribute('data-index', index);
12915
13051
  });
12916
13052
  } //----
12917
- // Store edited content from clone
13053
+ // Add data-edit-id for editable area
12918
13054
 
12919
13055
 
13056
+ let editables = editableClone.querySelectorAll('.edit');
13057
+ editables.forEach((area, index) => {
13058
+ const id = `content-${Date.now()}-${index}`;
13059
+ area.setAttribute('data-edit-id', id);
13060
+ }); //-----
13061
+ // Store edited content from clone
13062
+
12920
13063
  currentElement.setAttribute('data-cb-original-content', editableClone.innerHTML); // Also performs similar value updates like the applyChanges()
12921
13064
  // currentElement.setAttribute('data-cb-content', editableClone.getAttribute('data-cb-content'));
12922
13065
 
@@ -13817,7 +13960,7 @@ class PanelBox {
13817
13960
  </div>
13818
13961
  </div>
13819
13962
 
13820
- <div class="box-bg-settings">
13963
+ <div class="box-bg-color">
13821
13964
  <div class="flex">
13822
13965
  <div class="mr-8">
13823
13966
  <div class="label mt-3">${out('Background Color')}:</div>
@@ -13832,7 +13975,8 @@ class PanelBox {
13832
13975
  </div>
13833
13976
  </div>
13834
13977
  </div>
13835
-
13978
+ </div>
13979
+ <div class="box-bg-image">
13836
13980
  <div class="label mt-3">${out('Background Image')}:</div>
13837
13981
 
13838
13982
  <div class="asset-preview"></div>
@@ -15284,9 +15428,12 @@ class PanelBox {
15284
15428
  this.divPluginSettings = divPluginSettings;
15285
15429
  const runtime = this.builder.win.builderRuntime; // Reset (can be changed by renderPluginSettings)
15286
15430
 
15287
- const divBgSettings = this.panel.querySelector('.box-bg-settings');
15288
- divBgSettings.style.display = '';
15289
- this.divBgSettings = divBgSettings;
15431
+ const divBgColor = this.panel.querySelector('.box-bg-color');
15432
+ divBgColor.style.display = '';
15433
+ this.divBgColor = divBgColor;
15434
+ const divBgImage = this.panel.querySelector('.box-bg-image');
15435
+ divBgImage.style.display = '';
15436
+ this.divBgImage = divBgImage;
15290
15437
  const divPanelTitle = this.panel.parentNode.querySelector('.part-title');
15291
15438
  divPanelTitle.style.display = '';
15292
15439
  this.divPanelTitle = divPanelTitle;
@@ -15315,20 +15462,84 @@ class PanelBox {
15315
15462
  const pluginName = currentElement.getAttribute('data-cb-type');
15316
15463
  const plugin = runtime.getPlugin(pluginName);
15317
15464
  if (!plugin) return;
15318
- let displayName = out(plugin.displayName || plugin.name);
15465
+ let displayName = out(plugin.displayName || plugin.name); // Hide unused tabs for plugin
15466
+
15467
+ /*
15468
+ contentbox: {
15469
+ title: false,
15470
+ bg: false,
15471
+ text: false,
15472
+ //...
15473
+ },
15474
+ */
15319
15475
 
15320
15476
  if (plugin.contentbox) {
15321
- if (!plugin.contentbox.bg) {
15322
- this.divBgSettings.style.display = 'none';
15477
+ if (plugin.contentbox.bg !== undefined && plugin.contentbox.bg !== null && plugin.contentbox.bg === false) {
15478
+ this.divBgColor.style.display = 'none';
15479
+ this.divBgImage.style.display = 'none';
15323
15480
  }
15324
15481
 
15325
- if (!plugin.contentbox.text) {
15482
+ if (plugin.contentbox.bgColor !== undefined && plugin.contentbox.bgColor !== null && plugin.contentbox.bgColor === false) {
15483
+ this.divBgColor.style.display = 'none';
15484
+ }
15485
+
15486
+ if (plugin.contentbox.bgImage !== undefined && plugin.contentbox.bgImage !== null && plugin.contentbox.bgImage === false) {
15487
+ this.divBgImage.style.display = 'none';
15488
+ }
15489
+
15490
+ if (plugin.contentbox.text !== undefined && plugin.contentbox.text !== null && plugin.contentbox.text === false) {
15326
15491
  this.divDefaultTextColor.style.display = 'none';
15327
15492
  }
15328
15493
 
15329
- if (!plugin.contentbox.title) {
15494
+ if (plugin.contentbox.title !== undefined && plugin.contentbox.title !== null && plugin.contentbox.title === false) {
15330
15495
  this.divPanelTitle.style.display = 'none';
15331
15496
  }
15497
+
15498
+ if (plugin.contentbox.boxTabs !== undefined && plugin.contentbox.boxTabs !== null && plugin.contentbox.boxTabs === false) {
15499
+ const tabs = this.panel.querySelectorAll('.accordion-item');
15500
+ tabs.forEach(tab => {
15501
+ tab.style.display = 'none';
15502
+ tab.setAttribute('aria-expanded', false);
15503
+ });
15504
+ const tabContents = this.panel.querySelectorAll('.accordion-content');
15505
+ tabContents.forEach(tabContent => {
15506
+ tabContent.style.display = 'none';
15507
+ tabContent.setAttribute('aria-hidden', true);
15508
+ });
15509
+ }
15510
+
15511
+ if (plugin.contentbox.boxTabContent !== undefined && plugin.contentbox.boxTabContent !== null && plugin.contentbox.boxTabContent === false) {
15512
+ const tabs = this.panel.querySelectorAll('.accordion-item.btn-accordion-content');
15513
+ tabs.forEach(tab => {
15514
+ tab.style.display = 'none';
15515
+ tab.setAttribute('aria-expanded', false);
15516
+ const tabContent = tab.nextElementSibling;
15517
+ tabContent.style.display = 'none';
15518
+ tabContent.setAttribute('aria-hidden', true);
15519
+ });
15520
+ }
15521
+
15522
+ if (plugin.contentbox.boxTabOnClick !== undefined && plugin.contentbox.boxTabOnClick !== null && plugin.contentbox.boxTabOnClick === false) {
15523
+ const tabs = this.panel.querySelectorAll('.accordion-item.btn-accordion-boxonclick');
15524
+ tabs.forEach(tab => {
15525
+ tab.style.display = 'none';
15526
+ tab.setAttribute('aria-expanded', false);
15527
+ const tabContent = tab.nextElementSibling;
15528
+ tabContent.style.display = 'none';
15529
+ tabContent.setAttribute('aria-hidden', true);
15530
+ });
15531
+ }
15532
+
15533
+ if (plugin.contentbox.boxTabResponsive !== undefined && plugin.contentbox.boxTabResponsive !== null && plugin.contentbox.boxTabResponsive === false) {
15534
+ const tabs = this.panel.querySelectorAll('.accordion-item.btn-accordion-boxresponsive');
15535
+ tabs.forEach(tab => {
15536
+ tab.style.display = 'none';
15537
+ tab.setAttribute('aria-expanded', false);
15538
+ const tabContent = tab.nextElementSibling;
15539
+ tabContent.style.display = 'none';
15540
+ tabContent.setAttribute('aria-hidden', true);
15541
+ });
15542
+ }
15332
15543
  }
15333
15544
 
15334
15545
  const divTitle = document.createElement('h3');
@@ -15354,7 +15565,8 @@ class PanelBox {
15354
15565
  const originalElement = editableClone.cloneNode(false); // Let plugin handle everything - pass the editable clone
15355
15566
 
15356
15567
  const editorUI = plugin.editor.openContentEditor(editableClone, this.builder, async () => {
15357
- this.builder.editor.saveForUndo(); // Add index for sortable grid (for easy reorder)
15568
+ this.builder.editor.saveForUndo(); // Do the same process like reinitialize, needed for newly added item (which requires data-cb-original-content update)
15569
+ // Add index for sortable grid (for easy reorder)
15358
15570
 
15359
15571
  let grid = editableClone.querySelector('.grid-sortable');
15360
15572
 
@@ -15369,9 +15581,16 @@ class PanelBox {
15369
15581
  if (child.nodeType === 1 && child.tagName !== 'STYLE' && child.tagName !== 'SCRIPT') child.setAttribute('data-index', index);
15370
15582
  });
15371
15583
  } //----
15372
- // Store edited content from clone
15584
+ // Add data-edit-id for editable area
15373
15585
 
15374
15586
 
15587
+ let editables = editableClone.querySelectorAll('.edit');
15588
+ editables.forEach((area, index) => {
15589
+ const id = `content-${Date.now()}-${index}`;
15590
+ area.setAttribute('data-edit-id', id);
15591
+ }); //-----
15592
+ // Store edited content from clone
15593
+
15375
15594
  currentElement.setAttribute('data-cb-original-content', editableClone.innerHTML); // Also performs similar value updates like the applyChanges()
15376
15595
  // currentElement.setAttribute('data-cb-content', editableClone.getAttribute('data-cb-content'));
15377
15596
 
@@ -16956,23 +17175,25 @@ class PanelSection {
16956
17175
  </button>
16957
17176
  </div>
16958
17177
 
16959
- <div class="label">${out('Height')}:</div>
16960
- <div class="group sectionheight">
16961
- <button title="10%" data-height="10">10%</button>
16962
- <button title="15%" data-height="15">15%</button>
16963
- <button title="20%" data-height="20">20%</button>
16964
- <button title="25%" data-height="25">25%</button>
16965
- <button title="30%" data-height="30">30%</button>
16966
- <button title="40%" data-height="40">40%</button>
16967
- <button title="50%" data-height="50">50%</button>
16968
- <button title="60%" data-height="60">60%</button>
16969
- <button title="70%" data-height="70">70%</button>
16970
- <button title="75%" data-height="75">75%</button>
16971
- <button title="80%" data-height="80">80%</button>
16972
- <button title="85%" data-height="85">85%</button>
16973
- <button title="90%" data-height="90">90%</button>
16974
- <button title="100%" data-height="100">100%</button>
16975
- <button title="${out('Clear')}" class="btn-clear" data-height="0"><svg><use xlink:href="#icon-eraser"></use></svg></button>
17178
+ <div class="div-section-height">
17179
+ <div class="label">${out('Height')}:</div>
17180
+ <div class="group sectionheight">
17181
+ <button title="10%" data-height="10">10%</button>
17182
+ <button title="15%" data-height="15">15%</button>
17183
+ <button title="20%" data-height="20">20%</button>
17184
+ <button title="25%" data-height="25">25%</button>
17185
+ <button title="30%" data-height="30">30%</button>
17186
+ <button title="40%" data-height="40">40%</button>
17187
+ <button title="50%" data-height="50">50%</button>
17188
+ <button title="60%" data-height="60">60%</button>
17189
+ <button title="70%" data-height="70">70%</button>
17190
+ <button title="75%" data-height="75">75%</button>
17191
+ <button title="80%" data-height="80">80%</button>
17192
+ <button title="85%" data-height="85">85%</button>
17193
+ <button title="90%" data-height="90">90%</button>
17194
+ <button title="100%" data-height="100">100%</button>
17195
+ <button title="${out('Clear')}" class="btn-clear" data-height="0"><svg><use xlink:href="#icon-eraser"></use></svg></button>
17196
+ </div>
16976
17197
  </div>
16977
17198
 
16978
17199
  </div>
@@ -17154,6 +17375,7 @@ class PanelSection {
17154
17375
  this.panel = panel;
17155
17376
  this.btnClearHeight = panel.querySelector('.sectionheight .btn-clear');
17156
17377
  this.btnAccordionSpacing = panel.querySelector('.btn-accordion-spacing');
17378
+ this.divSectionHeight = panel.querySelector('.div-section-height');
17157
17379
  const btnMove = panel.querySelectorAll('[data-move]');
17158
17380
  btnMove.forEach(btn => {
17159
17381
  btn.addEventListener('click', () => {
@@ -17579,6 +17801,44 @@ class PanelSection {
17579
17801
  } else {
17580
17802
  divReverseBoxes.style.display = 'none';
17581
17803
  divBoxesPerLine.style.display = 'none';
17804
+ } // Hide unused tabs and height settings for plugin
17805
+
17806
+
17807
+ const tabs = this.panel.querySelectorAll('.accordion-item');
17808
+ tabs.forEach(tab => {
17809
+ tab.style.display = '';
17810
+ });
17811
+ const tabContents = this.panel.querySelectorAll('.accordion-content');
17812
+ tabContents.forEach(tabContent => {
17813
+ tabContent.style.display = '';
17814
+ });
17815
+ this.divSectionHeight.style.display = '';
17816
+ const singleSectionBox = activeSection.classList.contains('is-box');
17817
+ const pluginElement = activeSection.querySelector('.is-overlay-content [data-cb-type]');
17818
+
17819
+ if (singleSectionBox && pluginElement) {
17820
+ const runtime = this.builder.win.builderRuntime;
17821
+ const pluginName = pluginElement.getAttribute('data-cb-type');
17822
+ const plugin = runtime.getPlugin(pluginName);
17823
+
17824
+ if (plugin.contentbox) {
17825
+ if (plugin.contentbox.sectionHeight !== undefined && plugin.contentbox.sectionHeight !== null && plugin.contentbox.sectionHeight === false) {
17826
+ this.divSectionHeight.style.display = 'none';
17827
+ }
17828
+
17829
+ if (plugin.contentbox.sectionTabs !== undefined && plugin.contentbox.sectionTabs !== null && plugin.contentbox.sectionTabs === false) {
17830
+ const tabs = this.panel.querySelectorAll('.accordion-item');
17831
+ tabs.forEach(tab => {
17832
+ tab.style.display = 'none';
17833
+ tab.setAttribute('aria-expanded', false);
17834
+ });
17835
+ const tabContents = this.panel.querySelectorAll('.accordion-content');
17836
+ tabContents.forEach(tabContent => {
17837
+ tabContent.style.display = 'none';
17838
+ tabContent.setAttribute('aria-hidden', true);
17839
+ });
17840
+ }
17841
+ }
17582
17842
  }
17583
17843
  }
17584
17844
 
@@ -26439,6 +26699,47 @@ class ControlPanel {
26439
26699
  let old = this.builder.onPageContentClick;
26440
26700
 
26441
26701
  this.builder.onPageContentClick = e => {
26702
+ const editArea = e.target.closest('.is-subblock');
26703
+
26704
+ if (editArea) {
26705
+ this.builder.editor.elmTool.click(editArea, e); // Icon
26706
+
26707
+ const icons = this.builder.doc.querySelectorAll('.icon-active');
26708
+ icons.forEach(icon => icon.classList.remove('icon-active'));
26709
+ this.builder.editor.activeIcon = null;
26710
+
26711
+ if (e.target.closest('i') && e.target.innerHTML === '') {
26712
+ e.target.classList.add('icon-active');
26713
+ this.builder.editor.dom.selectElementContents(e.target);
26714
+ this.builder.editor.activeIcon = e.target; // prevent text selection
26715
+
26716
+ if (document.selection) {
26717
+ document.selection.empty();
26718
+ } else {
26719
+ window.getSelection().removeAllRanges();
26720
+ }
26721
+ } // Image (must be placed before //Link)
26722
+
26723
+
26724
+ this.builder.editor.element.image.click(e); // Button
26725
+
26726
+ this.builder.editor.element.button.click(editArea, e); // Link
26727
+
26728
+ this.builder.editor.element.hyperlink.click(editArea, e); // Table
26729
+
26730
+ this.builder.editor.element.table.click(e); // Iframe
26731
+
26732
+ this.builder.editor.element.iframe.click(e); // Video
26733
+
26734
+ this.builder.editor.element.video.click(e); // Audio
26735
+
26736
+ this.builder.editor.element.audio.click(e); // Spacer
26737
+
26738
+ this.builder.editor.element.spacer.click(e); // Svg
26739
+
26740
+ this.builder.editor.element.svg.click(e);
26741
+ }
26742
+
26442
26743
  if (old) old.call(this);
26443
26744
 
26444
26745
  if (this.builder.controlPanel && !document.body.classList.contains('controlpanel')) {
@@ -26821,6 +27122,17 @@ class ControlPanel {
26821
27122
 
26822
27123
  getActive() {
26823
27124
  let activeElement = this.builder.editor.inspectedElement;
27125
+
27126
+ if (activeElement && activeElement.closest('[data-cb-type]') && activeElement.closest('.is-overlay-content')) {
27127
+ this.activeElement = activeElement; // this.activeContainer = activeElement.closest('.is-container');
27128
+ // this.activeColumn = this.activeContainer;
27129
+ // this.activeRow = this.activeContainer;
27130
+
27131
+ this.activeBox = this.builder.activeBox;
27132
+ this.activeSection = this.activeBox.closest('.is-section');
27133
+ return;
27134
+ }
27135
+
26824
27136
  let col = this.builder.editor.activeCol;
26825
27137
  let row, container;
26826
27138
 
@@ -26917,6 +27229,10 @@ class ControlPanel {
26917
27229
  breadcrumbHtml = '';
26918
27230
  }
26919
27231
 
27232
+ if (selection === 'element' && this.activeElement.closest('[data-cb-type]') && this.activeElement.closest('.is-overlay-content')) {
27233
+ breadcrumbHtml = `<div>${section} ${sep} ${box} ${sep}</div>`;
27234
+ }
27235
+
26920
27236
  if (this.activeBlock) {
26921
27237
  // freeform
26922
27238
  if (selection === 'element') {
@@ -27035,10 +27351,10 @@ class ControlPanel {
27035
27351
 
27036
27352
  if (what === 'box') {
27037
27353
  let box = this.activeBox;
27038
- let section = this.activeSection;
27039
- this.builder.editor.util.clearActiveCell();
27040
- this.builder.editor.util.clearPops();
27041
- this.builder.editor.hideElementTools();
27354
+ let section = this.activeSection; // this.builder.editor.util.clearActiveCell();
27355
+ // this.builder.editor.util.clearPops();
27356
+ // this.builder.editor.hideElementTools();
27357
+
27042
27358
  this.closeContentDialogs();
27043
27359
  this.builder.wrapperEl.classList.add('hard-select');
27044
27360
  this.builder.wrapperEl.classList.remove('is-clean-edit'); // Select box
@@ -32813,7 +33129,7 @@ class Util$1 {
32813
33129
  if (elm && elm.closest('.is-block')) ; else {
32814
33130
  // If no active cell, check if it is from .row-add-initial (empty info)
32815
33131
  row = this.builder.doc.querySelector('.row-active');
32816
- if (!row) return;else {
33132
+ if (row) {
32817
33133
  // Empty content will always use 'row' mode to insert block.
32818
33134
  mode = 'row';
32819
33135
  }
@@ -32993,7 +33309,7 @@ class Util$1 {
32993
33309
  element.insertAdjacentHTML('afterend', html);
32994
33310
  newelement = element.nextElementSibling;
32995
33311
  }
32996
- let builderActive = this.builder.doc.querySelector('.builder-active');
33312
+ let builderActive = element.closest('.is-container'); // this.builder.doc.querySelector('.builder-active');
32997
33313
  if (builderActive) this.builder.applyBehaviorOn(builderActive);
32998
33314
  if (newelement.tagName.toLowerCase() === 'img') {
32999
33315
  let checkLoad = setInterval(() => {
@@ -41091,145 +41407,113 @@ function get_beautify(js_beautify, css_beautify, html_beautify) {
41091
41407
 
41092
41408
  var JsBeautify$1 = js$1.exports;
41093
41409
 
41094
- function _defineProperty$2(obj, key, value) {
41095
- if (key in obj) {
41096
- Object.defineProperty(obj, key, {
41097
- value: value,
41098
- enumerable: true,
41099
- configurable: true,
41100
- writable: true
41101
- });
41102
- } else {
41103
- obj[key] = value;
41104
- }
41105
-
41106
- return obj;
41410
+ function _arrayLikeToArray$1(r, a) {
41411
+ (null == a || a > r.length) && (a = r.length);
41412
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
41413
+ return n;
41107
41414
  }
41108
-
41109
- function ownKeys$2(object, enumerableOnly) {
41110
- var keys = Object.keys(object);
41111
-
41112
- if (Object.getOwnPropertySymbols) {
41113
- var symbols = Object.getOwnPropertySymbols(object);
41114
- if (enumerableOnly) symbols = symbols.filter(function (sym) {
41115
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
41116
- });
41117
- keys.push.apply(keys, symbols);
41118
- }
41119
-
41120
- return keys;
41415
+ function _arrayWithHoles(r) {
41416
+ if (Array.isArray(r)) return r;
41121
41417
  }
41122
-
41123
- function _objectSpread2$2(target) {
41124
- for (var i = 1; i < arguments.length; i++) {
41125
- var source = arguments[i] != null ? arguments[i] : {};
41126
-
41127
- if (i % 2) {
41128
- ownKeys$2(Object(source), true).forEach(function (key) {
41129
- _defineProperty$2(target, key, source[key]);
41130
- });
41131
- } else if (Object.getOwnPropertyDescriptors) {
41132
- Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
41133
- } else {
41134
- ownKeys$2(Object(source)).forEach(function (key) {
41135
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
41136
- });
41418
+ function _defineProperty$2(e, r, t) {
41419
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
41420
+ value: t,
41421
+ enumerable: true,
41422
+ configurable: true,
41423
+ writable: true
41424
+ }) : e[r] = t, e;
41425
+ }
41426
+ function _iterableToArrayLimit(r, l) {
41427
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
41428
+ if (null != t) {
41429
+ var e,
41430
+ n,
41431
+ i,
41432
+ u,
41433
+ a = [],
41434
+ f = true,
41435
+ o = false;
41436
+ try {
41437
+ if (i = (t = t.call(r)).next, 0 === l) ; else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
41438
+ } catch (r) {
41439
+ o = true, n = r;
41440
+ } finally {
41441
+ try {
41442
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
41443
+ } finally {
41444
+ if (o) throw n;
41445
+ }
41137
41446
  }
41447
+ return a;
41138
41448
  }
41139
-
41140
- return target;
41141
41449
  }
41142
-
41143
- function _objectWithoutPropertiesLoose$2(source, excluded) {
41144
- if (source == null) return {};
41145
- var target = {};
41146
- var sourceKeys = Object.keys(source);
41147
- var key, i;
41148
-
41149
- for (i = 0; i < sourceKeys.length; i++) {
41150
- key = sourceKeys[i];
41151
- if (excluded.indexOf(key) >= 0) continue;
41152
- target[key] = source[key];
41153
- }
41154
-
41155
- return target;
41450
+ function _nonIterableRest() {
41451
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
41156
41452
  }
41157
-
41158
- function _objectWithoutProperties$2(source, excluded) {
41159
- if (source == null) return {};
41160
-
41161
- var target = _objectWithoutPropertiesLoose$2(source, excluded);
41162
-
41163
- var key, i;
41164
-
41453
+ function ownKeys$2(e, r) {
41454
+ var t = Object.keys(e);
41165
41455
  if (Object.getOwnPropertySymbols) {
41166
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
41167
-
41168
- for (i = 0; i < sourceSymbolKeys.length; i++) {
41169
- key = sourceSymbolKeys[i];
41170
- if (excluded.indexOf(key) >= 0) continue;
41171
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
41172
- target[key] = source[key];
41173
- }
41456
+ var o = Object.getOwnPropertySymbols(e);
41457
+ r && (o = o.filter(function (r) {
41458
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
41459
+ })), t.push.apply(t, o);
41174
41460
  }
41175
-
41176
- return target;
41461
+ return t;
41177
41462
  }
41178
-
41179
- function _slicedToArray(arr, i) {
41180
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray$1(arr, i) || _nonIterableRest();
41463
+ function _objectSpread2$2(e) {
41464
+ for (var r = 1; r < arguments.length; r++) {
41465
+ var t = null != arguments[r] ? arguments[r] : {};
41466
+ r % 2 ? ownKeys$2(Object(t), true).forEach(function (r) {
41467
+ _defineProperty$2(e, r, t[r]);
41468
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) {
41469
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
41470
+ });
41471
+ }
41472
+ return e;
41181
41473
  }
41182
-
41183
- function _arrayWithHoles(arr) {
41184
- if (Array.isArray(arr)) return arr;
41474
+ function _objectWithoutProperties$2(e, t) {
41475
+ if (null == e) return {};
41476
+ var o,
41477
+ r,
41478
+ i = _objectWithoutPropertiesLoose$2(e, t);
41479
+ if (Object.getOwnPropertySymbols) {
41480
+ var n = Object.getOwnPropertySymbols(e);
41481
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
41482
+ }
41483
+ return i;
41185
41484
  }
41186
-
41187
- function _iterableToArrayLimit(arr, i) {
41188
- if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return;
41189
- var _arr = [];
41190
- var _n = true;
41191
- var _d = false;
41192
- var _e = undefined;
41193
-
41194
- try {
41195
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
41196
- _arr.push(_s.value);
41197
-
41198
- if (i && _arr.length === i) break;
41199
- }
41200
- } catch (err) {
41201
- _d = true;
41202
- _e = err;
41203
- } finally {
41204
- try {
41205
- if (!_n && _i["return"] != null) _i["return"]();
41206
- } finally {
41207
- if (_d) throw _e;
41208
- }
41485
+ function _objectWithoutPropertiesLoose$2(r, e) {
41486
+ if (null == r) return {};
41487
+ var t = {};
41488
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
41489
+ if (-1 !== e.indexOf(n)) continue;
41490
+ t[n] = r[n];
41209
41491
  }
41210
-
41211
- return _arr;
41492
+ return t;
41212
41493
  }
41213
-
41214
- function _unsupportedIterableToArray$1(o, minLen) {
41215
- if (!o) return;
41216
- if (typeof o === "string") return _arrayLikeToArray$1(o, minLen);
41217
- var n = Object.prototype.toString.call(o).slice(8, -1);
41218
- if (n === "Object" && o.constructor) n = o.constructor.name;
41219
- if (n === "Map" || n === "Set") return Array.from(o);
41220
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$1(o, minLen);
41494
+ function _slicedToArray(r, e) {
41495
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray$1(r, e) || _nonIterableRest();
41221
41496
  }
41222
-
41223
- function _arrayLikeToArray$1(arr, len) {
41224
- if (len == null || len > arr.length) len = arr.length;
41225
-
41226
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
41227
-
41228
- return arr2;
41497
+ function _toPrimitive(t, r) {
41498
+ if ("object" != typeof t || !t) return t;
41499
+ var e = t[Symbol.toPrimitive];
41500
+ if (void 0 !== e) {
41501
+ var i = e.call(t, r);
41502
+ if ("object" != typeof i) return i;
41503
+ throw new TypeError("@@toPrimitive must return a primitive value.");
41504
+ }
41505
+ return ("string" === r ? String : Number)(t);
41229
41506
  }
41230
-
41231
- function _nonIterableRest() {
41232
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
41507
+ function _toPropertyKey(t) {
41508
+ var i = _toPrimitive(t, "string");
41509
+ return "symbol" == typeof i ? i : i + "";
41510
+ }
41511
+ function _unsupportedIterableToArray$1(r, a) {
41512
+ if (r) {
41513
+ if ("string" == typeof r) return _arrayLikeToArray$1(r, a);
41514
+ var t = {}.toString.call(r).slice(8, -1);
41515
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray$1(r, a) : void 0;
41516
+ }
41233
41517
  }
41234
41518
 
41235
41519
  function _defineProperty$1(obj, key, value) {
@@ -41426,23 +41710,20 @@ var index$2 = {
41426
41710
 
41427
41711
  var config$1 = {
41428
41712
  paths: {
41429
- vs: 'https://cdn.jsdelivr.net/npm/monaco-editor@0.33.0/min/vs'
41713
+ vs: 'https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs'
41430
41714
  }
41431
41715
  };
41432
41716
 
41433
41717
  function curry(fn) {
41434
41718
  return function curried() {
41435
41719
  var _this = this;
41436
-
41437
41720
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
41438
41721
  args[_key] = arguments[_key];
41439
41722
  }
41440
-
41441
41723
  return args.length >= fn.length ? fn.apply(this, args) : function () {
41442
41724
  for (var _len2 = arguments.length, nextArgs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
41443
41725
  nextArgs[_key2] = arguments[_key2];
41444
41726
  }
41445
-
41446
41727
  return curried.apply(_this, [].concat(args, nextArgs));
41447
41728
  };
41448
41729
  };
@@ -41457,11 +41738,9 @@ function isObject$3(value) {
41457
41738
  * @param {Object} config - the configuration object
41458
41739
  * @return {Object} config - the validated configuration object
41459
41740
  */
41460
-
41461
41741
  function validateConfig(config) {
41462
41742
  if (!config) errorHandler('configIsRequired');
41463
41743
  if (!isObject$3(config)) errorHandler('configType');
41464
-
41465
41744
  if (config.urls) {
41466
41745
  informAboutDeprecation();
41467
41746
  return {
@@ -41470,22 +41749,18 @@ function validateConfig(config) {
41470
41749
  }
41471
41750
  };
41472
41751
  }
41473
-
41474
41752
  return config;
41475
41753
  }
41754
+
41476
41755
  /**
41477
41756
  * logs deprecation message
41478
41757
  */
41479
-
41480
-
41481
41758
  function informAboutDeprecation() {
41482
41759
  console.warn(errorMessages.deprecation);
41483
41760
  }
41484
-
41485
41761
  function throwError(errorMessages, type) {
41486
41762
  throw new Error(errorMessages[type] || errorMessages["default"]);
41487
41763
  }
41488
-
41489
41764
  var errorMessages = {
41490
41765
  configIsRequired: 'the configuration object is required',
41491
41766
  configType: 'the configuration object should be an object',
@@ -41501,7 +41776,6 @@ var compose = function compose() {
41501
41776
  for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
41502
41777
  fns[_key] = arguments[_key];
41503
41778
  }
41504
-
41505
41779
  return function (x) {
41506
41780
  return fns.reduceRight(function (y, f) {
41507
41781
  return f(y);
@@ -41521,11 +41795,11 @@ function merge(target, source) {
41521
41795
  }
41522
41796
 
41523
41797
  // The source (has been changed) is https://github.com/facebook/react/issues/5465#issuecomment-157888325
41798
+
41524
41799
  var CANCELATION_MESSAGE = {
41525
41800
  type: 'cancelation',
41526
41801
  msg: 'operation is manually canceled'
41527
41802
  };
41528
-
41529
41803
  function makeCancelable(promise) {
41530
41804
  var hasCanceled_ = false;
41531
41805
  var wrappedPromise = new Promise(function (resolve, reject) {
@@ -41539,29 +41813,28 @@ function makeCancelable(promise) {
41539
41813
  }, wrappedPromise;
41540
41814
  }
41541
41815
 
41542
- /** the local state of the module */
41816
+ var _excluded$2 = ["monaco"];
41543
41817
 
41818
+ /** the local state of the module */
41544
41819
  var _state$create = index$2.create({
41545
- config: config$1,
41546
- isInitialized: false,
41547
- resolve: null,
41548
- reject: null,
41549
- monaco: null
41550
- }),
41551
- _state$create2 = _slicedToArray(_state$create, 2),
41552
- getState = _state$create2[0],
41553
- setState = _state$create2[1];
41820
+ config: config$1,
41821
+ isInitialized: false,
41822
+ resolve: null,
41823
+ reject: null,
41824
+ monaco: null
41825
+ }),
41826
+ _state$create2 = _slicedToArray(_state$create, 2),
41827
+ getState = _state$create2[0],
41828
+ setState = _state$create2[1];
41829
+
41554
41830
  /**
41555
41831
  * set the loader configuration
41556
41832
  * @param {Object} config - the configuration object
41557
41833
  */
41558
-
41559
-
41560
41834
  function config(globalConfig) {
41561
41835
  var _validators$config = validators.config(globalConfig),
41562
- monaco = _validators$config.monaco,
41563
- config = _objectWithoutProperties$2(_validators$config, ["monaco"]);
41564
-
41836
+ monaco = _validators$config.monaco,
41837
+ config = _objectWithoutProperties$2(_validators$config, _excluded$2);
41565
41838
  setState(function (state) {
41566
41839
  return {
41567
41840
  config: merge(state.config, config),
@@ -41569,100 +41842,88 @@ function config(globalConfig) {
41569
41842
  };
41570
41843
  });
41571
41844
  }
41845
+
41572
41846
  /**
41573
41847
  * handles the initialization of the monaco-editor
41574
41848
  * @return {Promise} - returns an instance of monaco (with a cancelable promise)
41575
41849
  */
41576
-
41577
-
41578
41850
  function init() {
41579
41851
  var state = getState(function (_ref) {
41580
41852
  var monaco = _ref.monaco,
41581
- isInitialized = _ref.isInitialized,
41582
- resolve = _ref.resolve;
41853
+ isInitialized = _ref.isInitialized,
41854
+ resolve = _ref.resolve;
41583
41855
  return {
41584
41856
  monaco: monaco,
41585
41857
  isInitialized: isInitialized,
41586
41858
  resolve: resolve
41587
41859
  };
41588
41860
  });
41589
-
41590
41861
  if (!state.isInitialized) {
41591
41862
  setState({
41592
41863
  isInitialized: true
41593
41864
  });
41594
-
41595
41865
  if (state.monaco) {
41596
41866
  state.resolve(state.monaco);
41597
41867
  return makeCancelable(wrapperPromise);
41598
41868
  }
41599
-
41600
41869
  if (window.monaco && window.monaco.editor) {
41601
41870
  storeMonacoInstance(window.monaco);
41602
41871
  state.resolve(window.monaco);
41603
41872
  return makeCancelable(wrapperPromise);
41604
41873
  }
41605
-
41606
41874
  compose(injectScripts, getMonacoLoaderScript)(configureLoader);
41607
41875
  }
41608
-
41609
41876
  return makeCancelable(wrapperPromise);
41610
41877
  }
41878
+
41611
41879
  /**
41612
41880
  * injects provided scripts into the document.body
41613
41881
  * @param {Object} script - an HTML script element
41614
41882
  * @return {Object} - the injected HTML script element
41615
41883
  */
41616
-
41617
-
41618
41884
  function injectScripts(script) {
41619
41885
  return document.body.appendChild(script);
41620
41886
  }
41887
+
41621
41888
  /**
41622
41889
  * creates an HTML script element with/without provided src
41623
41890
  * @param {string} [src] - the source path of the script
41624
41891
  * @return {Object} - the created HTML script element
41625
41892
  */
41626
-
41627
-
41628
41893
  function createScript(src) {
41629
41894
  var script = document.createElement('script');
41630
41895
  return src && (script.src = src), script;
41631
41896
  }
41897
+
41632
41898
  /**
41633
41899
  * creates an HTML script element with the monaco loader src
41634
41900
  * @return {Object} - the created HTML script element
41635
41901
  */
41636
-
41637
-
41638
41902
  function getMonacoLoaderScript(configureLoader) {
41639
41903
  var state = getState(function (_ref2) {
41640
41904
  var config = _ref2.config,
41641
- reject = _ref2.reject;
41905
+ reject = _ref2.reject;
41642
41906
  return {
41643
41907
  config: config,
41644
41908
  reject: reject
41645
41909
  };
41646
41910
  });
41647
41911
  var loaderScript = createScript("".concat(state.config.paths.vs, "/loader.js"));
41648
-
41649
41912
  loaderScript.onload = function () {
41650
41913
  return configureLoader();
41651
41914
  };
41652
-
41653
41915
  loaderScript.onerror = state.reject;
41654
41916
  return loaderScript;
41655
41917
  }
41918
+
41656
41919
  /**
41657
41920
  * configures the monaco loader
41658
41921
  */
41659
-
41660
-
41661
41922
  function configureLoader() {
41662
41923
  var state = getState(function (_ref3) {
41663
41924
  var config = _ref3.config,
41664
- resolve = _ref3.resolve,
41665
- reject = _ref3.reject;
41925
+ resolve = _ref3.resolve,
41926
+ reject = _ref3.reject;
41666
41927
  return {
41667
41928
  config: config,
41668
41929
  resolve: resolve,
@@ -41670,21 +41931,19 @@ function configureLoader() {
41670
41931
  };
41671
41932
  });
41672
41933
  var require = window.require;
41673
-
41674
41934
  require.config(state.config);
41675
-
41676
- require(['vs/editor/editor.main'], function (monaco) {
41935
+ require(['vs/editor/editor.main'], function (_ref4) {
41936
+ var monaco = _ref4.m;
41677
41937
  storeMonacoInstance(monaco);
41678
41938
  state.resolve(monaco);
41679
41939
  }, function (error) {
41680
41940
  state.reject(error);
41681
41941
  });
41682
41942
  }
41943
+
41683
41944
  /**
41684
41945
  * store monaco instance in local state
41685
41946
  */
41686
-
41687
-
41688
41947
  function storeMonacoInstance(monaco) {
41689
41948
  if (!getState().monaco) {
41690
41949
  setState({
@@ -41692,20 +41951,18 @@ function storeMonacoInstance(monaco) {
41692
41951
  });
41693
41952
  }
41694
41953
  }
41954
+
41695
41955
  /**
41696
41956
  * internal helper function
41697
41957
  * extracts stored monaco instance
41698
41958
  * @return {Object|null} - the monaco instance
41699
41959
  */
41700
-
41701
-
41702
41960
  function __getMonacoInstance() {
41703
- return getState(function (_ref4) {
41704
- var monaco = _ref4.monaco;
41961
+ return getState(function (_ref5) {
41962
+ var monaco = _ref5.monaco;
41705
41963
  return monaco;
41706
41964
  });
41707
41965
  }
41708
-
41709
41966
  var wrapperPromise = new Promise(function (resolve, reject) {
41710
41967
  return setState({
41711
41968
  resolve: resolve,
@@ -41853,7 +42110,14 @@ class HtmlUtil {
41853
42110
  const cell = util.cellSelected();
41854
42111
  cell.innerHTML = html;
41855
42112
  let builderActive = this.builder.doc.querySelector('.builder-active');
41856
- if (builderActive) this.builder.applyBehaviorOn(builderActive);
42113
+ if (builderActive) {
42114
+ this.builder.applyBehaviorOn(builderActive);
42115
+
42116
+ // reinit after apply html
42117
+ if (this.builder.win.builderRuntime && builderActive.querySelector('[data-cb-type]')) {
42118
+ this.builder.win.builderRuntime.reinitialize(builderActive);
42119
+ }
42120
+ }
41857
42121
 
41858
42122
  //Trigger Change event
41859
42123
  this.builder.opts.onChange();
@@ -41872,7 +42136,14 @@ class HtmlUtil {
41872
42136
  if (!row) return;
41873
42137
  row.innerHTML = html;
41874
42138
  let builderActive = this.builder.doc.querySelector('.builder-active');
41875
- if (builderActive) this.builder.applyBehaviorOn(builderActive);
42139
+ if (builderActive) {
42140
+ this.builder.applyBehaviorOn(builderActive);
42141
+
42142
+ // reinit after apply html
42143
+ if (this.builder.win.builderRuntime && builderActive.querySelector('[data-cb-type]')) {
42144
+ this.builder.win.builderRuntime.reinitialize(builderActive);
42145
+ }
42146
+ }
41876
42147
 
41877
42148
  //Trigger Change event
41878
42149
  this.builder.opts.onChange();
@@ -41907,6 +42178,12 @@ class HtmlUtil {
41907
42178
  // let builderActive = this.builder.doc.querySelector('.builder-active');
41908
42179
  // if(builderActive) this.builder.applyBehaviorOn(builderActive);
41909
42180
  this.builder.applyBehaviorOn(area);
42181
+
42182
+ // reinit after apply html
42183
+ if (this.builder.win.builderRuntime && area.querySelector('[data-cb-type]')) {
42184
+ this.builder.win.builderRuntime.reinitialize(area);
42185
+ }
42186
+
41910
42187
  /*else {
41911
42188
  const builders = this.builder.doc.querySelectorAll(this.builder.opts.container);
41912
42189
  if(builders.length > 1) {
@@ -42504,6 +42781,11 @@ class HtmlUtil {
42504
42781
  element.removeAttribute(name);
42505
42782
  }
42506
42783
  });
42784
+ const areas = element.querySelectorAll('.is-container');
42785
+ Array.from(areas).forEach(area => {
42786
+ area.removeAttribute('data-sort');
42787
+ area.classList.remove('is-builder');
42788
+ });
42507
42789
 
42508
42790
  // Remove runtime-added classes
42509
42791
  const type = element.getAttribute('data-cb-type');
@@ -42526,13 +42808,20 @@ class HtmlUtil {
42526
42808
  elm.removeAttribute('data-item-id');
42527
42809
  });
42528
42810
  }
42811
+ // Cleanup data-item-id
42812
+ let elms = element.querySelectorAll('[data-item-id],[data-slide-id],[contenteditable]');
42813
+ elms.forEach(elm => {
42814
+ elm.removeAttribute('data-item-id');
42815
+ elm.removeAttribute('data-slide-id');
42816
+ elm.removeAttribute('contenteditable');
42817
+ });
42529
42818
 
42530
42819
  // Clean data-edit-id in editable area
42531
42820
  let editables = element.querySelectorAll('.edit');
42532
42821
  editables.forEach(area => {
42533
42822
  area.removeAttribute('data-edit-id');
42534
42823
  });
42535
- let elms = element.querySelectorAll('[data-scroll], [data-scroll-once]');
42824
+ elms = element.querySelectorAll('[data-scroll], [data-scroll-once]');
42536
42825
  elms.forEach(elm => {
42537
42826
  elm.removeAttribute('data-scroll');
42538
42827
  elm.removeAttribute('data-scroll-once');
@@ -78561,9 +78850,10 @@ class SettingsUIGenerator {
78561
78850
  generateForm(pluginName, element, onChange) {
78562
78851
  const plugin = this.runtime.getPlugin(pluginName);
78563
78852
  if (!plugin || !plugin.settings) {
78564
- console.warn(`Plugin "${pluginName}" has no settings schema`);
78853
+ // console.warn(`Plugin "${pluginName}" has no settings schema`);
78565
78854
  if (!plugin.editor) return this.createEmptyForm();
78566
78855
  }
78856
+ if (!plugin.settings) plugin.settings = {};
78567
78857
  const form = document.createElement('div');
78568
78858
  form.className = 'cb-settings-form';
78569
78859
 
@@ -78939,6 +79229,7 @@ class SettingsUIGenerator {
78939
79229
  */
78940
79230
  getCurrentValues(element, settings) {
78941
79231
  const values = {};
79232
+ if (!settings) return values;
78942
79233
  Object.keys(settings).forEach(key => {
78943
79234
  if (key.startsWith('_')) return;
78944
79235
  const attrName = 'data-cb-' + key.replace(/([A-Z])/g, '-$1').toLowerCase();
@@ -90434,6 +90725,40 @@ class ElementTool {
90434
90725
  dom.addClass(quickadd, 'center');
90435
90726
  }
90436
90727
  quickadd.setAttribute('data-mode', 'elm');
90728
+ const plugin = builder.activeElement && builder.activeElement.closest('[data-cb-type]');
90729
+ const btnAddHeadline = quickadd.querySelector('.add-headline');
90730
+ const btnAddQuote = quickadd.querySelector('.add-quote');
90731
+ const btnAddTable = quickadd.querySelector('.add-table');
90732
+ const btnAddCode = quickadd.querySelector('.add-code');
90733
+ const btnAddForm = quickadd.querySelector('.add-form');
90734
+ const btnAddMap = quickadd.querySelector('.add-map');
90735
+ const btnAddYoutube = quickadd.querySelector('.add-youtube');
90736
+ const btnAddVideo = quickadd.querySelector('.add-video');
90737
+ const btnAddMore = quickadd.querySelector('.add-more');
90738
+ const separator = quickadd.querySelector('.pop-separator');
90739
+ if (plugin) {
90740
+ if (btnAddHeadline) btnAddHeadline.style.display = 'none';
90741
+ if (btnAddQuote) btnAddQuote.style.display = 'none';
90742
+ if (btnAddCode) btnAddCode.style.display = 'none';
90743
+ if (btnAddTable) btnAddTable.style.display = 'none';
90744
+ if (btnAddForm) btnAddForm.style.display = 'none';
90745
+ if (btnAddMap) btnAddMap.style.display = 'none';
90746
+ if (btnAddYoutube) btnAddYoutube.style.display = 'none';
90747
+ if (btnAddVideo) btnAddVideo.style.display = 'none';
90748
+ if (btnAddMore) btnAddMore.style.display = 'none';
90749
+ if (separator) separator.style.display = 'none';
90750
+ } else {
90751
+ if (btnAddHeadline) btnAddHeadline.style.display = '';
90752
+ if (btnAddQuote) btnAddQuote.style.display = '';
90753
+ if (btnAddCode) btnAddCode.style.display = '';
90754
+ if (btnAddTable) btnAddTable.style.display = '';
90755
+ if (btnAddForm) btnAddForm.style.display = '';
90756
+ if (btnAddMap) btnAddMap.style.display = '';
90757
+ if (btnAddYoutube) btnAddYoutube.style.display = '';
90758
+ if (btnAddVideo) btnAddVideo.style.display = '';
90759
+ if (btnAddMore) btnAddMore.style.display = '';
90760
+ if (separator) separator.style.display = '';
90761
+ }
90437
90762
 
90438
90763
  //handleQuickAddClickOut
90439
90764
  const handleQuickAddClickOut = e => {
@@ -90837,7 +91162,7 @@ class ElementTool {
90837
91162
  }
90838
91163
  let subblock = false;
90839
91164
  //if(dom.parentsHasAttribute(elm, 'data-subblock')) {
90840
- if (dom.parentsHasClass(elm, 'is-subblock')) {
91165
+ if (elm.closest('.is-subblock') && !elm.classList.contains('is-subblock')) {
90841
91166
  subblock = true;
90842
91167
  }
90843
91168
  const plugin = elm.closest('[data-cb-type]');
@@ -90994,6 +91319,14 @@ class ElementTool {
90994
91319
  let elementTool = this.elementTool;
90995
91320
  let elm = this.builder.activeElement;
90996
91321
  if (!elm) return;
91322
+ const editableArea = elm.closest('[data-edit-actions]');
91323
+ if (editableArea) {
91324
+ const editActions = editableArea.dataset.editActions || '';
91325
+ if (editActions.includes('no-add')) {
91326
+ // Adding elements is disabled
91327
+ return;
91328
+ }
91329
+ }
90997
91330
  if (elm.closest('.is-dock')) return;
90998
91331
  // if(elm.closest('[data-cb-type]')) return;
90999
91332
 
@@ -125184,6 +125517,25 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
125184
125517
  }
125185
125518
  applyBehaviorOn(builder) {
125186
125519
  const util = this.util;
125520
+ if (builder.closest('[data-cb-type]')) {
125521
+ // Fix buttons not wrapped in <div style="white-space: nowrap;">
125522
+ let linkButtons = builder.querySelectorAll('a[role="button"]');
125523
+ Array.prototype.forEach.call(linkButtons, btn => {
125524
+ if (btn.parentNode && btn.parentNode === builder) {
125525
+ btn.outerHTML = `
125526
+ <div style="white-space: nowrap;">
125527
+ ${btn.outerHTML}
125528
+ </div>
125529
+ `;
125530
+ }
125531
+ });
125532
+ linkButtons = builder.querySelectorAll('a[role="button"]');
125533
+ Array.prototype.forEach.call(linkButtons, btn => {
125534
+ btn.parentNode.setAttribute('contenteditable', 'false');
125535
+ btn.setAttribute('contenteditable', 'true');
125536
+ });
125537
+ return;
125538
+ }
125187
125539
 
125188
125540
  // upload
125189
125541
  if (this.opts.onImageUpload) {
@@ -130222,7 +130574,7 @@ Please obtain a license at: https://innovastudio.com/contentbox`);
130222
130574
  if (lockIndicator) lockIndicator.style.display = '';
130223
130575
  let linkTool = this.doc.querySelector('#divLinkTool');
130224
130576
  if (linkTool) linkTool.style.display = '';
130225
- let spacerTool = this.builderStuff.querySelector('.is-spacer-tool');
130577
+ let spacerTool = this.doc.querySelector('.is-spacer-tool');
130226
130578
  if (spacerTool) spacerTool.style.display = '';
130227
130579
  this.element.image.hideImageTool();
130228
130580
  this.doc.querySelectorAll('.icon-active').forEach(elm => elm.classList.remove('icon-active'));
@@ -130468,6 +130820,10 @@ class ContentStuff {
130468
130820
  overflow-y: unset !important;
130469
130821
  }
130470
130822
 
130823
+ [data-cb-type] .elm-active:not(button) {
130824
+ background: rgba(200, 200, 201, 0.11);
130825
+ }
130826
+
130471
130827
  `; // .is-wrapper.is-edit > div {
130472
130828
  // overflow-x: unset;
130473
130829
  // overflow-y: unset;
@@ -157388,7 +157744,7 @@ class IframePanel {
157388
157744
  .is-content-view {
157389
157745
  transition: all 300ms ease 0s;
157390
157746
  /* overflow: hidden; */
157391
- background: #f5f5f5;
157747
+ background: #fff;
157392
157748
  position: relative;
157393
157749
  ${this.builder.controlPanel ? 'margin-top: 6vh;' : 'margin-top:10vh;'}
157394
157750
  transform-origin: top;
@@ -160808,7 +161164,7 @@ class ContentBox {
160808
161164
  {
160809
161165
  id: 1,
160810
161166
  designId: 2,
160811
- name: 'Header'
161167
+ name: 'Hero'
160812
161168
  }, {
160813
161169
  id: 2,
160814
161170
  designId: 1,
@@ -160863,7 +161219,8 @@ class ContentBox {
160863
161219
  ['#282828','dark','contentbuilder/themes/dark.css'],
160864
161220
  ],
160865
161221
  */
160866
- backgroundColor: '#f1f1f1',
161222
+ backgroundColor: 'transparent',
161223
+ //'#f1f1f1',
160867
161224
  imageselect: '',
160868
161225
  fileselect: '',
160869
161226
  imageSelect: '',
@@ -164211,27 +164568,7 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
164211
164568
  }
164212
164569
 
164213
164570
  dom.addClass(this.wrapperEl, 'is-wrapper');
164214
- dom.addClass(this.wrapperEl, 'is-edit'); //Extend onRender with built-in plugins
164215
-
164216
- let old = this.settings.onRender;
164217
-
164218
- this.settings.onRender = () => {
164219
- old.call(this); // call user's defined onRender
164220
-
164221
- try {
164222
- // Built-in onRender
164223
- //Run parts of box(-flex).js
164224
- this.boxRender(); // //Run built-in plugin inside the builder
164225
- // setTimeout(()=>{
164226
- // if (this.win.skrollr) {
164227
- // let obj = this.win.skrollr.get();
164228
- // if(obj) obj.refresh();
164229
- // }
164230
- // }, 100);
164231
- } catch (e) {// Do Nothing
164232
- }
164233
- }; //Extend onChange
164234
-
164571
+ dom.addClass(this.wrapperEl, 'is-edit'); //Extend onChange
164235
164572
 
164236
164573
  let old2 = this.settings.onChange;
164237
164574
 
@@ -164389,6 +164726,10 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
164389
164726
  this.controlpanel.objPanelText.getStateTargeted();
164390
164727
  }
164391
164728
 
164729
+ if (this.controlpanel.panelSpacer.classList.contains('active')) {
164730
+ this.controlpanel.objPanelSpacer.getStateTargeted();
164731
+ }
164732
+
164392
164733
  if (this.controlpanel.panelBox.classList.contains('active')) {
164393
164734
  this.controlpanel.objPanelBox.getStateTargeted();
164394
164735
  }
@@ -164457,6 +164798,13 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
164457
164798
 
164458
164799
 
164459
164800
  if (this.topSpace) document.body.classList.add('topspace');
164801
+ window.addEventListener('error', e => {
164802
+ if (e.message === 'Script error.' && e.filename === '') {
164803
+ // Prevent global crash from cross-origin Monaco scripts
164804
+ e.preventDefault();
164805
+ e.stopImmediatePropagation(); // console.warn("Suppressed cross-origin Monaco focus error.");
164806
+ }
164807
+ }, true);
164460
164808
  };
164461
164809
 
164462
164810
  if (this.iframeSrc) {
@@ -166628,99 +166976,6 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
166628
166976
  } // pageSetup
166629
166977
 
166630
166978
 
166631
- boxRender() {
166632
- if (!this.linksWithClickListeners) {
166633
- this.linksWithClickListeners = new Set();
166634
- }
166635
-
166636
- const links = this.wrapperEl.querySelectorAll('.is-box .is-overlay a'); // eg. slider links
166637
-
166638
- links.forEach(link => {
166639
- let url = link.getAttribute('href');
166640
-
166641
- if (url.indexOf('#') === 0 || link.classList.contains('glightbox')) ; else {
166642
- if (!this.linksWithClickListeners.has(link)) {
166643
- link.addEventListener('click', e => {
166644
- // Will go to the link
166645
- const answer = window.confirm(out('Do you really want to leave?')); // Cancel the navigation and stay on the same page
166646
-
166647
- if (!answer) {
166648
- e.preventDefault();
166649
- }
166650
-
166651
- e.stopImmediatePropagation();
166652
- });
166653
- this.linksWithClickListeners.add(link); // Mark the listener as added
166654
- }
166655
- }
166656
- });
166657
- const navbar = this.doc.querySelector('.is-section-navbar');
166658
-
166659
- if (navbar) {
166660
- const links = navbar.querySelectorAll('a');
166661
- links.forEach(link => {
166662
- if (!this.linksWithClickListeners.has(link)) {
166663
- link.addEventListener('click', e => {
166664
- let url = link.getAttribute('href');
166665
-
166666
- if (url) {
166667
- if (url.indexOf('#') === 0) {
166668
- // Will go to bookmark
166669
- if (url.indexOf('#section') === 0) {
166670
- let num = url.replace('#section', '');
166671
-
166672
- if (!isNaN(parseInt(num))) {
166673
- let sections = this.doc.querySelectorAll('.is-section');
166674
- let gotoSection;
166675
- let x = 0;
166676
- sections.forEach(function (section) {
166677
- if (!dom.hasClass(section, 'is-section-navbar')) {
166678
- if (x === num - 1) {
166679
- gotoSection = section;
166680
- }
166681
-
166682
- x++;
166683
- }
166684
- });
166685
-
166686
- if (gotoSection) {
166687
- this.scrollTo(gotoSection);
166688
- }
166689
-
166690
- e.preventDefault();
166691
- }
166692
- } else {
166693
- try {
166694
- let bookmark = this.doc.querySelector(url);
166695
-
166696
- if (bookmark) {
166697
- this.scrollTo(bookmark);
166698
- e.preventDefault();
166699
- }
166700
- } catch (e) {// Do Nothing
166701
- }
166702
- }
166703
- } else {
166704
- // Prevent to go to the link
166705
- if (e.target.closest('#is-menu-toggle')) return;
166706
- e.preventDefault();
166707
- e.stopImmediatePropagation();
166708
- }
166709
- } else {
166710
- if (link.closest('.is-menu-search')) ; else {
166711
- if (!e.target.getAttribute('href')) return;
166712
- e.preventDefault();
166713
- e.stopImmediatePropagation();
166714
- }
166715
- }
166716
- });
166717
- this.linksWithClickListeners.add(link); // Mark the listener as added
166718
- }
166719
- });
166720
- }
166721
- } // box
166722
-
166723
-
166724
166979
  addSpace() {// Do Nothing
166725
166980
  // Now is not needed.
166726
166981
  // (Replaced by // Zoom Adjustment)
@@ -166759,20 +167014,21 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
166759
167014
  }, 1000);
166760
167015
  }, delay);
166761
167016
  }
166762
-
167017
+ /*
166763
167018
  defineLastBox(section) {
166764
- const boxes = section.querySelectorAll('.is-box');
166765
- boxes.forEach(box => {
166766
- box.classList.remove('last-box');
166767
- });
166768
-
166769
- if (boxes.length === 0) {
166770
- section.classList.add('last-box');
166771
- } else {
166772
- const lastBox = boxes[boxes.length - 1];
166773
- if (lastBox) lastBox.classList.add('last-box');
166774
- }
167019
+ const boxes = section.querySelectorAll('.is-box');
167020
+ boxes.forEach(box=>{
167021
+ box.classList.remove('last-box');
167022
+ });
167023
+ if(boxes.length===0) {
167024
+ section.classList.add('last-box');
167025
+ } else {
167026
+ const lastBox = boxes[boxes.length-1];
167027
+ if(lastBox) lastBox.classList.add('last-box');
167028
+ }
166775
167029
  }
167030
+ */
167031
+
166776
167032
 
166777
167033
  sectionSetup(section) {
166778
167034
  let tool = section.querySelector('.is-section-tool');
@@ -166790,8 +167046,8 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
166790
167046
  <button type="button" class="btn-section-remove" tabindex="-1" data-title="${out('Remove')}" title="${out('Remove')}">
166791
167047
  <svg class="is-icon-flex" style="width:18px;height:18px;margin-top:-3px;"><use xlink:href="#icon-trash2"></use></svg>
166792
167048
  </button>
166793
- </div>`);
166794
- this.defineLastBox(section);
167049
+ </div>`); // this.defineLastBox(section);
167050
+
166795
167051
  let info = section.querySelector('.is-section-info');
166796
167052
  if (info) info.parentNode.removeChild(info);
166797
167053
  const sectionId = section.getAttribute('id');
@@ -167078,6 +167334,70 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
167078
167334
  if (typePanel.classList.contains('active')) this.sidebar.selectType();
167079
167335
  });
167080
167336
  this.makeSortable(box, true);
167337
+ box.addEventListener('click', e => {
167338
+ const elm = e.target;
167339
+ if (elm.closest('.is-container')) return;
167340
+ let link = elm.closest('a');
167341
+
167342
+ if (link) {
167343
+ let url = link.getAttribute('href');
167344
+
167345
+ if (url) {
167346
+ if (url.indexOf('#') === 0 && url.trim() !== '#') {
167347
+ if (url.indexOf('#section') === 0) {
167348
+ let num = url.replace('#section', '');
167349
+
167350
+ if (!isNaN(parseInt(num))) {
167351
+ let sections = this.doc.querySelectorAll('.is-section');
167352
+ let gotoSection;
167353
+ let x = 0;
167354
+ sections.forEach(function (section) {
167355
+ if (!dom.hasClass(section, 'is-section-navbar')) {
167356
+ if (x === num - 1) {
167357
+ gotoSection = section;
167358
+ }
167359
+
167360
+ x++;
167361
+ }
167362
+ });
167363
+
167364
+ if (gotoSection) {
167365
+ this.scrollTo(gotoSection);
167366
+ }
167367
+
167368
+ e.preventDefault();
167369
+ }
167370
+ } else {
167371
+ let bookmark = this.doc.querySelector(url);
167372
+
167373
+ if (bookmark) {
167374
+ this.scrollTo(bookmark);
167375
+ e.preventDefault();
167376
+ }
167377
+ }
167378
+ } else {
167379
+ /*
167380
+ // Will go to the link
167381
+ const answer = window.confirm(
167382
+ out('Do you really want to leave?')
167383
+ );
167384
+ // Cancel the navigation and stay on the same page
167385
+ if (!answer) {
167386
+ e.preventDefault();
167387
+ }
167388
+ e.stopImmediatePropagation();
167389
+ */
167390
+ const answer = window.confirm(out('Do you want to open the link?'));
167391
+
167392
+ if (answer) {
167393
+ window.open(url, '_blank');
167394
+ }
167395
+
167396
+ e.preventDefault();
167397
+ }
167398
+ }
167399
+ }
167400
+ });
167081
167401
  } // boxSetup
167082
167402
  // Make list inside plugin element sortable
167083
167403
 
@@ -167311,7 +167631,7 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
167311
167631
  let newSection;
167312
167632
  let arrSections = [];
167313
167633
 
167314
- if (newArea.indexOf('is-section-navbar') !== -1) {
167634
+ if (newArea.indexOf('is-section-navbar') !== -1 || newArea.indexOf('data-cb-type="nav-menu"') !== -1) {
167315
167635
  // Insert first
167316
167636
  const sectionNavbar = this.wrapperEl.querySelector('.is-section-navbar');
167317
167637
 
@@ -167853,6 +168173,21 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
167853
168173
  sectionTool.style.display = 'block';
167854
168174
  sectionTool.style.transform = 'scale(' + 1 / zoom + ')';
167855
168175
  sectionTool.style.transformOrigin = 'top right';
168176
+ }
168177
+
168178
+ const btnSectionUp = sectionTool.querySelector('.btn-move-section-up');
168179
+ const btnSectionDown = sectionTool.querySelector('.btn-move-section-down');
168180
+ const btnSectionRemove = sectionTool.querySelector('.btn-section-remove');
168181
+
168182
+ if (box.offsetHeight < 160) {
168183
+ btnSectionUp.style.display = 'none';
168184
+ btnSectionDown.style.display = 'none';
168185
+ btnSectionRemove.style.display = 'none';
168186
+ sectionTool.style.top = '17px'; //'calc(50% - 17px)';
168187
+ } else {
168188
+ btnSectionUp.style.display = '';
168189
+ btnSectionDown.style.display = '';
168190
+ btnSectionRemove.style.display = '';
167856
168191
  } //new box tool
167857
168192
 
167858
168193
 
@@ -167923,6 +168258,14 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
167923
168258
  }
167924
168259
  }
167925
168260
  }
168261
+ }
168262
+
168263
+ const content = box.querySelector('.is-container');
168264
+ const plugin = box.querySelector('[data-cb-type]');
168265
+
168266
+ if (!content && plugin) {
168267
+ boxTool.style.zIndex = -10;
168268
+ boxTool.style.visibility = 'hidden';
167926
168269
  } // tools scaling for iframe
167927
168270
 
167928
168271
 
@@ -168521,7 +168864,12 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
168521
168864
  this.cleanupUnused(); // Clean pinned sections
168522
168865
 
168523
168866
  const wrapperEl = this.wrapperEl.cloneNode(true); // Clone the child element
168867
+ // Pause all videos in the clone immediately
168524
168868
 
168869
+ const videos = wrapperEl.querySelectorAll('video');
168870
+ videos.forEach(video => {
168871
+ video.pause(); // video.muted = true;
168872
+ });
168525
168873
  let pinWraps = wrapperEl.querySelectorAll('.pin-wrap');
168526
168874
  pinWraps.forEach(pinWrap => {
168527
168875
  const sectionElm = pinWrap.firstElementChild;
@@ -168538,7 +168886,9 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
168538
168886
  }
168539
168887
  });
168540
168888
  const html = this.editor.readHtml(wrapperEl, bForView, true); // const html = this.editor.readHtml(this.wrapperEl, bForView, true);
168889
+ // Clean up clone immediately
168541
168890
 
168891
+ wrapperEl.remove();
168542
168892
  return html;
168543
168893
  }
168544
168894
 
@@ -168741,6 +169091,11 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
168741
169091
  elms.forEach(elm => {
168742
169092
  elm.parentNode.removeChild(elm);
168743
169093
  });
169094
+ elms = this.doc.querySelectorAll('.scroll-target, .last-box');
169095
+ elms.forEach(elm => {
169096
+ elm.classList.remove('scroll-target');
169097
+ elm.classList.remove('last-box');
169098
+ });
168744
169099
  }
168745
169100
 
168746
169101
  calculateVisibleArea(rect) {