@innovastudio/contentbox 1.6.21 → 1.6.23

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.
@@ -2433,7 +2433,7 @@ class SideBar {
2433
2433
 
2434
2434
  numberCount++;
2435
2435
 
2436
- let html = '<button tabindex="0" class="active" data-id="' + item.id + '" data-cat=""' + item.category + '">' +
2436
+ let html = '<button tabindex="0" class="active" data-id="' + item.id + '" data-cat="' + item.category + '">' +
2437
2437
  '<img class="lzy-img" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAaCAYAAAAjZdWPAAAEDmlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPpu5syskzoPUpqaSDv41lLRsUtGE2uj+ZbNt3CyTbLRBkMns3Z1pJjPj/KRpKT4UQRDBqOCT4P9bwSchaqvtiy2itFCiBIMo+ND6R6HSFwnruTOzu5O4a73L3PnmnO9+595z7t4LkLgsW5beJQIsGq4t5dPis8fmxMQ6dMF90A190C0rjpUqlSYBG+PCv9rt7yDG3tf2t/f/Z+uuUEcBiN2F2Kw4yiLiZQD+FcWyXYAEQfvICddi+AnEO2ycIOISw7UAVxieD/Cyz5mRMohfRSwoqoz+xNuIB+cj9loEB3Pw2448NaitKSLLRck2q5pOI9O9g/t/tkXda8Tbg0+PszB9FN8DuPaXKnKW4YcQn1Xk3HSIry5ps8UQ/2W5aQnxIwBdu7yFcgrxPsRjVXu8HOh0qao30cArp9SZZxDfg3h1wTzKxu5E/LUxX5wKdX5SnAzmDx4A4OIqLbB69yMesE1pKojLjVdoNsfyiPi45hZmAn3uLWdpOtfQOaVmikEs7ovj8hFWpz7EV6mel0L9Xy23FMYlPYZenAx0yDB1/PX6dledmQjikjkXCxqMJS9WtfFCyH9XtSekEF+2dH+P4tzITduTygGfv58a5VCTH5PtXD7EFZiNyUDBhHnsFTBgE0SQIA9pfFtgo6cKGuhooeilaKH41eDs38Ip+f4At1Rq/sjr6NEwQqb/I/DQqsLvaFUjvAx+eWirddAJZnAj1DFJL0mSg/gcIpPkMBkhoyCSJ8lTZIxk0TpKDjXHliJzZPO50dR5ASNSnzeLvIvod0HG/mdkmOC0z8VKnzcQ2M/Yz2vKldduXjp9bleLu0ZWn7vWc+l0JGcaai10yNrUnXLP/8Jf59ewX+c3Wgz+B34Df+vbVrc16zTMVgp9um9bxEfzPU5kPqUtVWxhs6OiWTVW+gIfywB9uXi7CGcGW/zk98k/kmvJ95IfJn/j3uQ+4c5zn3Kfcd+AyF3gLnJfcl9xH3OfR2rUee80a+6vo7EK5mmXUdyfQlrYLTwoZIU9wsPCZEtP6BWGhAlhL3p2N6sTjRdduwbHsG9kq32sgBepc+xurLPW4T9URpYGJ3ym4+8zA05u44QjST8ZIoVtu3qE7fWmdn5LPdqvgcZz8Ww8BWJ8X3w0PhQ/wnCDGd+LvlHs8dRy6bLLDuKMaZ20tZrqisPJ5ONiCq8yKhYM5cCgKOu66Lsc0aYOtZdo5QCwezI4wm9J/v0X23mlZXOfBjj8Jzv3WrY5D+CsA9D7aMs2gGfjve8ArD6mePZSeCfEYt8CONWDw8FXTxrPqx/r9Vt4biXeANh8vV7/+/16ffMD1N8AuKD/A/8leAvFY9bLAAAAOGVYSWZNTQAqAAAACAABh2kABAAAAAEAAAAaAAAAAAACoAIABAAAAAEAAAAtoAMABAAAAAEAAAAaAAAAAHZhQ/wAAABcSURBVFgJ7dLBCcAwEANBx/337IQUsK/FcLD3FQgx9nO+W8NuD9v7z230rVdLOmkQ6HsAjholrXJCWdKAo0ZJq5xQljTgqFHSKieUJQ04apS0ygllSQOOGo2UfgEpPQQwSb0YngAAAABJRU5ErkJggg==" data-src="' + gallery.path + item.thumbnail + '">' +
2438
2438
  '<span class="is-overlay"></span>' +
2439
2439
  (numbering? (showNumberOnHover?'<div class="is-number">'+(numberCount+'').padStart(3, '0')+'</div>':'<div class="is-number show">'+(numberCount+'').padStart(3, '0')+'</div>') :'') +
@@ -14307,7 +14307,7 @@ class PanelBlock {
14307
14307
  ${out('Ungroup')}
14308
14308
  </button>
14309
14309
  </div>
14310
- <div class="group flex mt-4 div-shape" style="width: 217px;display:none">
14310
+ <div class="group flex mt-4 div-shape" style="width: 217px;display:none;">
14311
14311
  <button title="${out('Enable Shape')}" class="btn-shape" style="width: 100%">
14312
14312
  ${out('Enable Shape')}
14313
14313
  </button>
@@ -14317,9 +14317,10 @@ class PanelBlock {
14317
14317
  </div>
14318
14318
 
14319
14319
  <div class="group editspacing mt-4">
14320
- <button title="${out('Spacing')}" class="btn-spacing" data-value="">${out('Spacing')}</button>
14320
+ <button title="${out('Spacing')}" class="btn-spacing">${out('Spacing')}</button>
14321
14321
  </div>
14322
14322
 
14323
+
14323
14324
  <!--
14324
14325
  <div class="label flex flex-row">${out('Viewport')}: &nbsp;<span class="val-viewport"></span></div>
14325
14326
 
@@ -14387,12 +14388,14 @@ class PanelBlock {
14387
14388
  this.builder.onChange();
14388
14389
  });
14389
14390
  const btnShape = panel.querySelector('.btn-shape');
14391
+ const btnRemoveShape = panel.querySelector('.btn-unshape');
14390
14392
  if (btnShape) btnShape.addEventListener('click', () => {
14391
14393
  this.builder.editor.saveForUndo();
14392
14394
  this.builder.eb.enableShape();
14393
14395
  this.builder.onChange();
14396
+ btnShape.style.display = 'none';
14397
+ btnRemoveShape.style.display = '';
14394
14398
  });
14395
- const btnRemoveShape = panel.querySelector('.btn-unshape');
14396
14399
  if (btnRemoveShape) btnRemoveShape.addEventListener('click', () => {
14397
14400
  this.builder.editor.saveForUndo();
14398
14401
  this.builder.eb.removeShape();
@@ -14740,6 +14743,17 @@ class PanelBlock {
14740
14743
  this.divUngroup.style.display = 'none';
14741
14744
  }
14742
14745
 
14746
+ const btnShape = panel.querySelector('.btn-shape');
14747
+ const btnRemoveShape = panel.querySelector('.btn-unshape');
14748
+
14749
+ if (block.classList.contains('is-shape')) {
14750
+ btnShape.style.display = 'none';
14751
+ btnRemoveShape.style.display = '';
14752
+ } else {
14753
+ btnShape.style.display = '';
14754
+ btnRemoveShape.style.display = 'none';
14755
+ }
14756
+
14743
14757
  if (block) {
14744
14758
  if (block.closest('.autolayout')) {
14745
14759
  this.divArrange.style.display = 'none';
@@ -16607,6 +16621,22 @@ class PanelRow {
16607
16621
  <input type="checkbox" class="chk-reverse" /> <!-- chkReverseColumns -->
16608
16622
  <span>${out('Reverse Columns')}</span>
16609
16623
  </label>
16624
+
16625
+ <div class="label mt-4 changedevice">
16626
+ <span>${out('Column Gap')}:</span>
16627
+ </div>
16628
+ <div class="group colsperline mt-2" style="width:217px;">
16629
+ <button title="10" data-columngap="10">10</button>
16630
+ <button title="20" data-columngap="20">20</button>
16631
+ <button title="30" data-columngap="30">30</button>
16632
+ <button title="40" data-columngap="40">40</button>
16633
+ <button title="50" data-columngap="50">50</button>
16634
+ <button title="60" data-columngap="60">60</button>
16635
+ <button title="70" data-columngap="70">70</button>
16636
+ <button title="80" data-columngap="80">80</button>
16637
+ <button title="90" data-columngap="90">90</button>
16638
+ <button title="${out('Clear')}" data-columngap="" class="btn-clear"><svg><use xlink:href="#icon-eraser"></use></svg></button>
16639
+ </div>
16610
16640
  </div>
16611
16641
 
16612
16642
  </div>
@@ -16787,6 +16817,28 @@ class PanelRow {
16787
16817
  activeRow.classList.remove(prefix + j);
16788
16818
  }
16789
16819
 
16820
+ if (val !== '') activeRow.classList.add(prefix + val);
16821
+ this.builder.onChange();
16822
+ });
16823
+ });
16824
+ const btnColumnGap = panel.querySelectorAll('[data-columngap]');
16825
+ btnColumnGap.forEach(btn => {
16826
+ btn.addEventListener('click', () => {
16827
+ let activeRow = this.builder.controlpanel.activeRow;
16828
+ this.builder.editor.saveForUndo();
16829
+ let val = btn.getAttribute('data-columngap');
16830
+ panel.querySelectorAll('[data-columngap]').forEach(elm => elm.classList.remove('on'));
16831
+ if (val !== '') btn.classList.add('on');
16832
+ let prefix = 'gap-'; // let screenMode = this.builder.screenMode;
16833
+ // if(screenMode==='desktop') prefix = 'gap-';
16834
+ // else if (screenMode==='tablet-landscape') prefix = 'md-gap-';
16835
+ // else if (screenMode==='tablet') prefix = 'sm-gap-';
16836
+ // else if (screenMode==='mobile') prefix = 'xs-gap-';
16837
+
16838
+ for (let j = 1; j <= 9; j++) {
16839
+ activeRow.classList.remove(prefix + j * 10);
16840
+ }
16841
+
16790
16842
  if (val !== '') activeRow.classList.add(prefix + val);
16791
16843
  this.builder.onChange();
16792
16844
  });
@@ -16975,7 +17027,9 @@ class PanelRow {
16975
17027
 
16976
17028
  let valReverse = activeRow.classList.contains(prefix + 'column-reverse');
16977
17029
  const chkReverseColumns = panel.querySelector('.chk-reverse');
16978
- chkReverseColumns.checked = valReverse; // Responsive
17030
+ chkReverseColumns.checked = valReverse;
17031
+ panel.querySelectorAll('[data-columngap]').forEach(elm => elm.classList.remove('on'));
17032
+ if (activeRow.classList.contains('gap-10')) panel.querySelector('[data-columngap="10"]').classList.add('on');else if (activeRow.classList.contains('gap-20')) panel.querySelector('[data-columngap="20"]').classList.add('on');else if (activeRow.classList.contains('gap-30')) panel.querySelector('[data-columngap="30"]').classList.add('on');else if (activeRow.classList.contains('gap-40')) panel.querySelector('[data-columngap="40"]').classList.add('on');else if (activeRow.classList.contains('gap-50')) panel.querySelector('[data-columngap="50"]').classList.add('on');else if (activeRow.classList.contains('gap-60')) panel.querySelector('[data-columngap="60"]').classList.add('on');else if (activeRow.classList.contains('gap-70')) panel.querySelector('[data-columngap="70"]').classList.add('on');else if (activeRow.classList.contains('gap-80')) panel.querySelector('[data-columngap="80"]').classList.add('on');else if (activeRow.classList.contains('gap-90')) panel.querySelector('[data-columngap="90"]').classList.add('on'); // Responsive
16979
17033
 
16980
17034
  this.realtimeVisibility(activeRow); // More
16981
17035
 
@@ -25137,6 +25191,7 @@ class Dom {
25137
25191
  }
25138
25192
  getScale(container) {
25139
25193
  let matrix = window.getComputedStyle(container).transform;
25194
+ if (matrix === 'none') return 1;
25140
25195
  let values = matrix.split('(')[1];
25141
25196
  values = values.split(')')[0];
25142
25197
  values = values.split(',');
@@ -33352,6 +33407,9 @@ class UndoRedo {
33352
33407
  let wrapper = this.builder.doc.querySelector(this.builder.opts.page);
33353
33408
  // return htmlutil.readHtml(wrapper, false);
33354
33409
  return wrapper.innerHTML;
33410
+ } else if (this.builder.docContainer) {
33411
+ let docContainer = this.builder.doc.querySelector(this.builder.docContainer);
33412
+ return docContainer.innerHTML;
33355
33413
  } else {
33356
33414
  const builders = this.builder.doc.querySelectorAll(this.builder.opts.container);
33357
33415
  let html = '';
@@ -33412,12 +33470,18 @@ class UndoRedo {
33412
33470
 
33413
33471
  // Use createContextualFragment() to make embedded script executable
33414
33472
  // https://ghinda.net/article/script-tags/
33415
- var range = document.createRange();
33473
+ let range = document.createRange();
33416
33474
  wrapper.innerHTML = '';
33417
33475
  wrapper.appendChild(range.createContextualFragment(html));
33418
33476
 
33419
33477
  // applyBehavior (in ContentBox, unUndo will call pageSetup/applyBehavior)
33420
33478
  this.cleaning(wrapper);
33479
+ } else if (this.builder.docContainer) {
33480
+ let docContainer = this.builder.doc.querySelector(this.builder.docContainer);
33481
+ let range = document.createRange();
33482
+ docContainer.innerHTML = '';
33483
+ docContainer.appendChild(range.createContextualFragment(html));
33484
+ this.cleaning(docContainer);
33421
33485
  } else {
33422
33486
  const builders = this.builder.doc.querySelectorAll(this.builder.opts.container);
33423
33487
  let n = 0;
@@ -40351,12 +40415,16 @@ const renderSnippetPanel = (builder, snippetOpen) => {
40351
40415
  }
40352
40416
 
40353
40417
  // destroy
40354
- if (builder.sortableOnCanvas) builder.sortableOnCanvas.forEach(obj => {
40355
- if (obj) {
40356
- obj.destroy();
40357
- }
40358
- });
40418
+ if (builder.sortableOnCanvas) {
40419
+ builder.sortableOnCanvas.forEach(obj => {
40420
+ if (obj) {
40421
+ obj.destroy();
40422
+ }
40423
+ });
40424
+ }
40359
40425
  if (builder.sortableOnPage) builder.sortableOnPage.destroy();
40426
+ let dummies = builder.doc.querySelectorAll('.block-dummy');
40427
+ dummies.forEach(elm => elm.parentNode.removeChild(elm));
40360
40428
  }
40361
40429
  });
40362
40430
  if (builder.opts.snippetList === '#divSnippetList') {
@@ -40437,6 +40505,22 @@ const renderSnippetPanel = (builder, snippetOpen) => {
40437
40505
  */
40438
40506
  };
40439
40507
 
40508
+ function openSnippets(builder) {
40509
+ const snippetPanel = document.querySelector('#divSnippetList');
40510
+ const snippethandle = snippetPanel.querySelector('#divSnippetHandle');
40511
+ snippetPanel.style.cssText = 'transition: all ease 0.8s;';
40512
+ snippetPanel.querySelector('.selectsnippet').style.display = 'block';
40513
+ snippetPanel.querySelector('.is-design-list').style.display = 'block';
40514
+ snippetPanel.classList.add('active');
40515
+ if (builder.opts.sidePanel === 'right') {
40516
+ snippethandle.innerHTML = '<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-right"></use></svg>';
40517
+ } else {
40518
+ snippethandle.innerHTML = '<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-left"></use></svg>';
40519
+ }
40520
+ setTimeout(function () {
40521
+ snippetPanel.style.cssText = '';
40522
+ }, 800);
40523
+ }
40440
40524
  function toggleSnippets(builder) {
40441
40525
  const dom = builder.dom;
40442
40526
  let snippetPanel = document.querySelector('#divSnippetList');
@@ -68842,7 +68926,7 @@ class Image$1 {
68842
68926
  }
68843
68927
  imageTool.style.top = top + 'px';
68844
68928
  imageTool.style.left = toolLeft + 'px';
68845
- if (!this.builder.activeImage.hasAttribute('data-noresize')) {
68929
+ if (!this.builder.activeImage.hasAttribute('data-noresize') && (this.builder.imageResizeOnBlock || !this.builder.activeImage.closest('.is-block'))) {
68846
68930
  let imageResizer = this.imageResizer;
68847
68931
  imageResizer.style.top = top + 'px';
68848
68932
  imageResizer.style.left = left + 'px';
@@ -68926,7 +69010,7 @@ class Image$1 {
68926
69010
  imageTool.style.left = toolLeft + 'px';
68927
69011
 
68928
69012
  // Image Resizer
68929
- if (!elm.hasAttribute('data-noresize')) {
69013
+ if (!elm.hasAttribute('data-noresize') && (this.builder.imageResizeOnBlock || !elm.closest('.is-block'))) {
68930
69014
  let imageResizer = this.imageResizer;
68931
69015
 
68932
69016
  /*
@@ -92960,7 +93044,7 @@ class Resizeable {
92960
93044
  let scale = this.getScale(container);
92961
93045
  if (!scale) {
92962
93046
  const wrapper = container.closest('.is-wrapper');
92963
- scale = this.getScale(wrapper);
93047
+ if (wrapper) scale = this.getScale(wrapper);else scale = 1;
92964
93048
  }
92965
93049
 
92966
93050
  // Minimum resize
@@ -97575,6 +97659,7 @@ class ContentBuilder {
97575
97659
  toolbar: 'top',
97576
97660
  toolbarDisplay: 'auto',
97577
97661
  shortenHTML: true,
97662
+ imageResizeOnBlock: true,
97578
97663
  simpleEditingBreakpoint: '970px',
97579
97664
  // iframe only
97580
97665
 
@@ -99244,6 +99329,7 @@ class ContentBuilder {
99244
99329
  } else {
99245
99330
  const area = this.doc.querySelector('.is-builder'); // get one of the builder area
99246
99331
  scale = this.dom.getScale(area);
99332
+ if (!scale) scale = 1;
99247
99333
  }
99248
99334
 
99249
99335
  // Make moving draggable item scaled & positioned correctly (due to zoom value)
@@ -99404,11 +99490,17 @@ class ContentBuilder {
99404
99490
 
99405
99491
  // Hide element tool
99406
99492
  this.elmTool.hide();
99407
- if (this.sortableOnCanvas) this.sortableOnCanvas.forEach(obj => {
99408
- if (obj) {
99409
- obj.destroy();
99410
- }
99411
- });
99493
+
99494
+ // // destroy
99495
+ // if(this.sortableOnCanvas) {
99496
+ // this.sortableOnCanvas.forEach(obj=>{
99497
+ // if(obj) {
99498
+ // obj.destroy();
99499
+ // }
99500
+ // });
99501
+ // let dummies = this.doc.querySelectorAll('.block-dummy');
99502
+ // dummies.forEach(elm=>elm.parentNode.removeChild(elm));
99503
+ // }
99412
99504
 
99413
99505
  // if(this.sortableOnPage) this.sortableOnPage.destroy();
99414
99506
  }
@@ -100508,7 +100600,10 @@ class ContentBuilder {
100508
100600
  if (this.preview) return;
100509
100601
  if (this.opts.snippetList === '#divSnippetList') {
100510
100602
  let snippetPanel = document.querySelector(this.opts.snippetList);
100511
- if (snippetPanel) return; // do not render if already rendered (just protection)
100603
+ if (snippetPanel) {
100604
+ if (snippetOpen) openSnippets(this);
100605
+ return; // do not render if already rendered (just protection)
100606
+ }
100512
100607
  }
100513
100608
 
100514
100609
  if (this.isScriptAlreadyIncluded(snippetFile)) return;
@@ -102052,13 +102147,21 @@ class ContentBuilder {
102052
102147
  }
102053
102148
 
102054
102149
  sectionDropSetup() {
102055
- if (this.page) {
102056
- if (this.page !== '.is-wrapper') return; // only for ContentBox
102057
- const wrapper = this.doc.querySelector(this.page);
102150
+ if (this.blockContainer) {
102058
102151
  this.sortableOnCanvas = [];
102059
- const sections = wrapper.querySelectorAll('.is-box.box-canvas');
102060
- sections.forEach(section => {
102061
- const obj = new Sortable(section, {
102152
+ let wrapper;
102153
+ let boxes;
102154
+ if (this.page && this.page === '.is-wrapper') {
102155
+ wrapper = this.doc.querySelector(this.page);
102156
+ boxes = wrapper.querySelectorAll('.is-box.box-canvas');
102157
+ } else {
102158
+ boxes = this.doc.querySelectorAll(this.blockContainer);
102159
+ }
102160
+ boxes.forEach(box => {
102161
+ box.insertAdjacentHTML('afterbegin', `
102162
+ <div class="is-block block-dummy" style="top: calc(97.2707% - 149.797px); left: calc(50% - 222px); width: 444px; height: 154px;z-index:-1000;visibility:hidden">
102163
+ </div>`);
102164
+ const obj = new Sortable(box, {
102062
102165
  scroll: true,
102063
102166
  group: 'shared',
102064
102167
  direction: 'horizontal',
@@ -102071,7 +102174,7 @@ class ContentBuilder {
102071
102174
 
102072
102175
  let snippetid = itemEl.getAttribute('data-id');
102073
102176
  let lastBlock;
102074
- let elements = Array.from(section.querySelectorAll('.is-block')).filter(elm => !elm.parentNode.classList.contains('is-block')); // exclude child blocks
102177
+ let elements = Array.from(box.querySelectorAll('.is-block')).filter(elm => !elm.parentNode.classList.contains('is-block')); // exclude child blocks
102075
102178
  if (elements.length > 0) {
102076
102179
  lastBlock = elements[elements.length - 1];
102077
102180
  }
@@ -102183,14 +102286,14 @@ class ContentBuilder {
102183
102286
  itemEl.outerHTML = blockTemplate.replace('[%CONTENT%]', itemEl.innerHTML);
102184
102287
  }
102185
102288
  this.activeCol = null;
102186
- const builders = section.querySelectorAll('.is-container.container-new');
102289
+ const builders = box.querySelectorAll('.is-container.container-new');
102187
102290
  builders.forEach(builder => {
102188
102291
  const block = builder.parentNode;
102189
102292
  if (lastBlock) {
102190
102293
  lastBlock.insertAdjacentElement('afterend', block);
102191
102294
  } else {
102192
- const ovarlay = section.querySelector('.is-overlay');
102193
- ovarlay.insertAdjacentElement('afterend', block);
102295
+ const ovarlay = box.querySelector('.is-overlay');
102296
+ if (ovarlay) ovarlay.insertAdjacentElement('afterend', block);else box.insertAdjacentElement('afterbegin', block);
102194
102297
  }
102195
102298
 
102196
102299
  // After snippet has been added, re-apply behavior on builder areas
@@ -102203,16 +102306,24 @@ class ContentBuilder {
102203
102306
  }
102204
102307
 
102205
102308
  // destroy
102206
- if (this.sortableOnCanvas) this.sortableOnCanvas.forEach(obj => {
102207
- if (obj) {
102208
- obj.destroy();
102209
- }
102210
- });
102309
+ if (this.sortableOnCanvas) {
102310
+ this.sortableOnCanvas.forEach(obj => {
102311
+ if (obj) {
102312
+ obj.destroy();
102313
+ }
102314
+ });
102315
+ let dummies = this.doc.querySelectorAll('.block-dummy');
102316
+ dummies.forEach(elm => elm.parentNode.removeChild(elm));
102317
+ }
102211
102318
  if (this.sortableOnPage) this.sortableOnPage.destroy();
102212
102319
  }
102213
102320
  });
102214
102321
  this.sortableOnCanvas.push(obj);
102215
102322
  });
102323
+ }
102324
+ if (this.page) {
102325
+ if (this.page !== '.is-wrapper') return; // only for ContentBox
102326
+ const wrapper = this.doc.querySelector(this.page);
102216
102327
  this.sortableOnPage = new Sortable(wrapper, {
102217
102328
  scroll: true,
102218
102329
  group: 'shared',
@@ -102412,11 +102523,15 @@ class ContentBuilder {
102412
102523
  // this.sortableOnPage.option('draggable', '.dummy');
102413
102524
 
102414
102525
  // destroy
102415
- if (this.sortableOnCanvas) this.sortableOnCanvas.forEach(obj => {
102416
- if (obj) {
102417
- obj.destroy();
102418
- }
102419
- });
102526
+ if (this.sortableOnCanvas) {
102527
+ this.sortableOnCanvas.forEach(obj => {
102528
+ if (obj) {
102529
+ obj.destroy();
102530
+ }
102531
+ });
102532
+ let dummies = this.doc.querySelectorAll('.block-dummy');
102533
+ dummies.forEach(elm => elm.parentNode.removeChild(elm));
102534
+ }
102420
102535
  if (this.sortableOnPage) this.sortableOnPage.destroy();
102421
102536
  }
102422
102537
  });
@@ -127658,7 +127773,7 @@ class Common {
127658
127773
  for (let i = 0; i < attributes.length; i++) {
127659
127774
  const attributeName = attributes[i].name;
127660
127775
 
127661
- if (attributeName.includes('data--y-') || attributeName.includes('data--x-') || attributeName.includes('data--w-') || attributeName.includes('data--h-')) {
127776
+ if (attributeName.includes('data--y-') || attributeName.includes('data--x-') || attributeName.includes('data--w-') || attributeName.includes('data--h-') || attributeName.includes('data--transform-') || attributeName.includes('data--matrix-')) {
127662
127777
  attributesToRemove.push(attributeName);
127663
127778
  }
127664
127779
  }
@@ -127688,7 +127803,7 @@ class Common {
127688
127803
  for (let i = 0; i < attributes.length; i++) {
127689
127804
  const attributeName = attributes[i].name;
127690
127805
 
127691
- if (attributeName.includes('data--y-') || attributeName.includes('data--x-') || attributeName.includes('data--w-') || attributeName.includes('data--h-')) {
127806
+ if (attributeName.includes('data--y-') || attributeName.includes('data--x-') || attributeName.includes('data--w-') || attributeName.includes('data--h-') || attributeName.includes('data--transform-') || attributeName.includes('data--matrix-')) {
127692
127807
  attributesToRemove.push(attributeName);
127693
127808
  }
127694
127809
  }
@@ -128362,7 +128477,17 @@ class Shape {
128362
128477
  target.addEventListener('touchstart', this.handleTouchStart, {
128363
128478
  passive: false
128364
128479
  });
128365
- this.repositionHandles(target);
128480
+ this.repositionHandles(target); // Like directly call selectBlock (below):
128481
+
128482
+ this.currentTarget = target;
128483
+ this.doc.addEventListener('mousemove', this.handleDragMove);
128484
+ this.doc.addEventListener('touchmove', this.handleDragMove, {
128485
+ passive: false
128486
+ });
128487
+ this.doc.addEventListener('mousedown', this.unSelectBlock);
128488
+ this.doc.addEventListener('touchstart', this.unSelectBlock, {
128489
+ passive: false
128490
+ });
128366
128491
  }
128367
128492
  }
128368
128493
 
@@ -128370,7 +128495,8 @@ class Shape {
128370
128495
  if (target.classList.contains('is-shape')) {
128371
128496
  target.classList.remove('is-shape');
128372
128497
  target.style.transform = '';
128373
- target.removeAttribute('data-matrix');
128498
+ target.removeAttribute('data--matrix');
128499
+ target.removeAttribute('data--transform');
128374
128500
  target.removeEventListener('mousedown', this.selectBlock);
128375
128501
  target.removeEventListener('touchstart', this.selectBlock);
128376
128502
  target.removeEventListener('dblclick', this.handleEditStart);
@@ -128387,6 +128513,11 @@ class Shape {
128387
128513
  this.line5.style.display = '';
128388
128514
  this.line6.style.display = '';
128389
128515
  }
128516
+
128517
+ this.doc.removeEventListener('mousedown', this.unSelectBlock);
128518
+ this.doc.removeEventListener('touchstart', this.unSelectBlock);
128519
+ this.doc.removeEventListener('mousemove', this.handleDragMove);
128520
+ this.doc.removeEventListener('touchmove', this.handleDragMove);
128390
128521
  }
128391
128522
 
128392
128523
  destroy(element) {
@@ -128467,7 +128598,15 @@ class Shape {
128467
128598
  }; // Current Matrix
128468
128599
 
128469
128600
  let cm;
128470
- const m = JSON.parse(target.getAttribute('data-matrix'));
128601
+ let m = JSON.parse(target.getAttribute('data--matrix')); // Adaptif
128602
+
128603
+ const breakpoint = target.getAttribute('data--transform-val');
128604
+
128605
+ if (breakpoint && breakpoint < 1920) {
128606
+ if (target.getAttribute('data--matrix-' + breakpoint)) {
128607
+ m = JSON.parse(target.getAttribute('data--matrix-' + breakpoint));
128608
+ }
128609
+ }
128471
128610
 
128472
128611
  if (m) {
128473
128612
  cm = {
@@ -128674,7 +128813,12 @@ class Shape {
128674
128813
  }
128675
128814
  }
128676
128815
 
128677
- this.repositionHandles(currentTarget);
128816
+ this.repositionHandles(currentTarget); // Clear previous (if any. because when enable() is called, the events are also added)
128817
+
128818
+ this.doc.removeEventListener('mousemove', this.handleDragMove);
128819
+ this.doc.removeEventListener('touchmove', this.handleDragMove);
128820
+ this.doc.removeEventListener('mousedown', this.unSelectBlock);
128821
+ this.doc.removeEventListener('touchstart', this.unSelectBlock);
128678
128822
  this.currentTarget = currentTarget;
128679
128823
  this.doc.addEventListener('mousemove', this.handleDragMove);
128680
128824
  this.doc.addEventListener('touchmove', this.handleDragMove, {
@@ -128766,8 +128910,17 @@ class Shape {
128766
128910
  this.target.setAttribute('data-starty', y);
128767
128911
  this.common.applyPixels(target); //Initial
128768
128912
 
128769
- if (this.block.hasAttribute('data-matrix')) {
128770
- const s = this.block.getAttribute('data-matrix');
128913
+ if (this.block.hasAttribute('data--matrix')) {
128914
+ let s = this.block.getAttribute('data--matrix'); // Adaptif
128915
+
128916
+ const breakpoint = this.block.getAttribute('data--transform-val');
128917
+
128918
+ if (breakpoint && breakpoint < 1920) {
128919
+ if (this.block.getAttribute('data--matrix-' + breakpoint)) {
128920
+ s = this.block.getAttribute('data--matrix-' + breakpoint);
128921
+ }
128922
+ }
128923
+
128771
128924
  this.initialCorners = JSON.parse(s);
128772
128925
  this.corners = JSON.parse(s);
128773
128926
  } else {
@@ -128868,14 +129021,50 @@ class Shape {
128868
129021
  updateBlockStyle(target) {
128869
129022
  this.common.applyPercentage(target);
128870
129023
  this.doc.querySelectorAll('[data-startx]').forEach(elm => elm.removeAttribute('data-startx'));
128871
- this.doc.querySelectorAll('[data-starty]').forEach(elm => elm.removeAttribute('data-starty'));
129024
+ this.doc.querySelectorAll('[data-starty]').forEach(elm => elm.removeAttribute('data-starty')); // Adaptif
129025
+
129026
+ const breakpoint = this.doc.body.getAttribute('data-breakpoint');
129027
+
129028
+ if (breakpoint && breakpoint < 1920) {
129029
+ target.setAttribute('data--y-' + breakpoint, target.style.top);
129030
+ target.setAttribute('data--x-' + breakpoint, target.style.left);
129031
+ target.setAttribute('data--w-' + breakpoint, target.style.width);
129032
+ target.setAttribute('data--h-' + breakpoint, target.style.height);
129033
+ } else {
129034
+ target.setAttribute('data--y', target.style.top);
129035
+ target.setAttribute('data--x', target.style.left);
129036
+ target.setAttribute('data--w', target.style.width);
129037
+ target.setAttribute('data--h', target.style.height);
129038
+ }
129039
+
129040
+ target.removeAttribute('data-prev'); // reset
129041
+
129042
+ target.removeAttribute('data-fluid'); //---
129043
+
128872
129044
  if (this.onChange) this.onChange();
128873
129045
  }
128874
129046
 
128875
129047
  setTransform(block) {
128876
129048
  let transform = this.common.transform2d(block, this.corners[0], this.corners[1], this.corners[2], this.corners[3], this.corners[4], this.corners[5], this.corners[6], this.corners[7]);
128877
129049
  block.style.transform = transform;
128878
- this.block.setAttribute('data-matrix', JSON.stringify(this.corners));
129050
+ let matrix = JSON.stringify(this.corners); // this.block.setAttribute('data--matrix', matrix);
129051
+ // Adaptif
129052
+
129053
+ const breakpoint = this.doc.body.getAttribute('data-breakpoint');
129054
+
129055
+ if (breakpoint && breakpoint < 1920) {
129056
+ this.block.setAttribute('data--transform-' + breakpoint, transform);
129057
+ this.block.setAttribute('data--transform-val', breakpoint);
129058
+ this.block.setAttribute('data--matrix-' + breakpoint, matrix);
129059
+ } else {
129060
+ this.block.setAttribute('data--transform', transform);
129061
+ this.block.setAttribute('data--transform-val', '');
129062
+ this.block.setAttribute('data--matrix', matrix);
129063
+ }
129064
+
129065
+ this.block.removeAttribute('data-prev'); // reset
129066
+
129067
+ this.block.removeAttribute('data-fluid'); //---
128879
129068
  }
128880
129069
 
128881
129070
  resizeTopLeft(deltaX, deltaY) {
@@ -129297,10 +129486,11 @@ class Draggable {
129297
129486
  this.onDelete = options && options.onDelete || null;
129298
129487
  this.onBeforeChange = options && options.onBeforeChange || null;
129299
129488
  this.onChange = options && options.onChange || null;
129300
- this.onSelectBlock = options && options.onSelectBlock || null;
129301
- this.onUnSelectBlock = options && options.onUnSelectBlock || null;
129489
+ this.onSelectStart = options && options.onSelectStart || null;
129490
+ this.onSelectClear = options && options.onSelectClear || null;
129302
129491
  this.disableOnMobile = options && options.disableOnMobile || 0;
129303
129492
  this.onMultipleSelect = options && options.onMultipleSelect || null;
129493
+ this.onSelectBlock = options && options.onSelectBlock || null;
129304
129494
  this.isDragging = false;
129305
129495
  this.startX = 0;
129306
129496
  this.startY = 0;
@@ -129494,7 +129684,7 @@ class Draggable {
129494
129684
 
129495
129685
  if (blocks.length === 1) {
129496
129686
  const block = blocks[0];
129497
- if (this.onSelectBlock) this.onSelectBlock(block); // on first block select (before clone)
129687
+ if (this.onSelectStart) this.onSelectStart(block); // on first block select (before clone)
129498
129688
  }
129499
129689
  }
129500
129690
 
@@ -129550,8 +129740,13 @@ class Draggable {
129550
129740
  const block = element.closest(this.selector);
129551
129741
 
129552
129742
  if (block) {
129553
- if (block.classList.contains('active')) return; // if clicked block is active
129554
- // if(block.parentNode.classList.contains('active')) return; // if group is active
129743
+ if (block.classList.contains('active')) {
129744
+ let actualBlock = block.classList.contains('clone') ? this.doc.querySelector(this.selector + '.cloned') : null;
129745
+ if (!actualBlock) actualBlock = block;
129746
+ if (this.onSelectBlock) this.onSelectBlock(actualBlock);
129747
+ return; // if clicked block is active
129748
+ } // if(block.parentNode.classList.contains('active')) return; // if group is active
129749
+
129555
129750
 
129556
129751
  if (block.matches(this.selector) && block.querySelector(this.selector)) {
129557
129752
  // if group is clicked, remove active childe's blocks
@@ -129563,11 +129758,16 @@ class Draggable {
129563
129758
  block.classList.add('active');
129564
129759
  if (this.onMultipleSelect) this.onMultipleSelect();
129565
129760
  } else {
129566
- if (this.onUnSelectBlock) this.onUnSelectBlock();
129761
+ if (this.onSelectClear) this.onSelectClear();
129567
129762
  this.doc.querySelectorAll(this.selector + '.active').forEach(elm => elm.classList.remove('active'));
129568
129763
  block.classList.add('active');
129569
- } // Higlight parent group if current child block is clicked
129764
+ let actualBlock = block.classList.contains('clone') ? this.doc.querySelector(this.selector + '.cloned') : null;
129765
+ if (!actualBlock) actualBlock = block;
129766
+ if (this.onSelectBlock) this.onSelectBlock(actualBlock);
129767
+ }
129570
129768
 
129769
+ if (!block.parentNode) return; // just in case
129770
+ // Higlight parent group if current child block is clicked
129571
129771
 
129572
129772
  if (block.parentNode.matches(this.selector)) {
129573
129773
  block.parentNode.classList.add('block-active');
@@ -129585,7 +129785,7 @@ class Draggable {
129585
129785
 
129586
129786
  this.doc.querySelectorAll(this.selector + '.active').forEach(elm => elm.classList.remove('active'));
129587
129787
  this.doc.querySelectorAll('.block-active').forEach(elm => elm.classList.remove('block-active'));
129588
- if (this.onUnSelectBlock) this.onUnSelectBlock();
129788
+ if (this.onSelectClear) this.onSelectClear();
129589
129789
  } // Check if multiple selection occurs. If so, add 'multi' class to hide all the handles
129590
129790
 
129591
129791
 
@@ -129970,12 +130170,8 @@ class EditableBlocks {
129970
130170
  // onEditStart: () => {},
129971
130171
  // onEditEnd: () => {},
129972
130172
  // onDuplicate: () => {},
129973
- onSelectBlock: block => {
129974
- this.selectBlock(block);
129975
- },
129976
- onUnSelectBlock: () => {
129977
- this.unSelectBlock();
129978
- },
130173
+ // onSelectBlock: (block) => {},
130174
+ // onUnSelectBlock: () => {},
129979
130175
  // onMultipleSelect: () => {},
129980
130176
  disableOnMobile: 0,
129981
130177
  rotate: true,
@@ -130014,7 +130210,9 @@ class EditableBlocks {
130014
130210
  target.style.zIndex = newZIndex;
130015
130211
  }
130016
130212
 
130017
- selectBlock(block) {
130213
+ selectStart(block) {
130214
+ if (block.classList.contains('is-shape')) return; // do not clone if block is shape
130215
+
130018
130216
  if (!this.clone) return;
130019
130217
  const viewportWidth = this.win.innerWidth;
130020
130218
 
@@ -130022,7 +130220,7 @@ class EditableBlocks {
130022
130220
  return;
130023
130221
  }
130024
130222
 
130025
- if (block.classList.contains('is-group')) return;
130223
+ if (block.classList.contains('is-group')) return; // do not clone if block is shape
130026
130224
 
130027
130225
  if (!block.classList.contains('clone')) {
130028
130226
  let clonedDiv = block.cloneNode(true);
@@ -130033,7 +130231,7 @@ class EditableBlocks {
130033
130231
  }
130034
130232
  }
130035
130233
 
130036
- unSelectBlock() {
130234
+ selectClear() {
130037
130235
  this.doc.querySelectorAll('.clone').forEach(elm => elm.parentNode.removeChild(elm));
130038
130236
  this.doc.querySelectorAll('.cloned').forEach(elm => elm.classList.remove('cloned'));
130039
130237
  }
@@ -130063,8 +130261,14 @@ class EditableBlocks {
130063
130261
  if (this.onChange) this.onChange();
130064
130262
  },
130065
130263
  onMultipleSelect: this.onMultipleSelect,
130066
- onSelectBlock: this.onSelectBlock,
130067
- onUnSelectBlock: this.onUnSelectBlock
130264
+ onSelectStart: block => {
130265
+ this.selectStart(block);
130266
+ },
130267
+ onSelectClear: () => {
130268
+ this.selectClear();
130269
+ if (this.onUnselectBlock) this.onUnselectBlock();
130270
+ },
130271
+ onSelectBlock: this.onSelectBlock
130068
130272
  });
130069
130273
  this.resizable = new Resizable({
130070
130274
  selector: this.selector,
@@ -130116,7 +130320,7 @@ class EditableBlocks {
130116
130320
  if (block.classList.contains('clone')) {
130117
130321
  const clonedTarget = this.doc.querySelector(this.selector + '.cloned');
130118
130322
  this.onEditStart(clonedTarget);
130119
- this.unSelectBlock(); // Disable drag during editing
130323
+ this.selectClear(); // Disable drag during editing
130120
130324
 
130121
130325
  if (!this.draggable) return;
130122
130326
  this.draggable.disableDrag(clonedTarget);
@@ -130194,8 +130398,24 @@ class EditableBlocks {
130194
130398
  }
130195
130399
 
130196
130400
  addBlock(html, container) {
130197
- this.blockSelector.unSelect();
130401
+ this.selectClear(); // clear clones
130402
+
130403
+ this.blockSelector.unSelect(); // clear active
130404
+
130405
+ const parser = new DOMParser();
130406
+ let doc = parser.parseFromString(html, 'text/html');
130407
+ const block = doc.querySelector('.is-block');
130408
+ block.classList.add('block-dummy');
130409
+ html = doc.body.innerHTML;
130198
130410
  container.insertAdjacentHTML('beforeend', html);
130411
+ const newBlock = document.querySelector('.block-dummy');
130412
+
130413
+ if (newBlock) {
130414
+ newBlock.classList.remove('block-dummy');
130415
+ if (this.onAddBlock) this.onAddBlock(newBlock);
130416
+ newBlock.classList.add('active');
130417
+ }
130418
+
130199
130419
  this.refresh();
130200
130420
  }
130201
130421
 
@@ -130210,6 +130430,7 @@ class EditableBlocks {
130210
130430
  }
130211
130431
 
130212
130432
  enableShape() {
130433
+ this.selectClear();
130213
130434
  let blocks = Array.from(this.doc.querySelectorAll(this.selector)).filter(elm => elm.classList.contains('active'));
130214
130435
  blocks.forEach(block => {
130215
130436
  this.shape.enable(block);
@@ -130240,6 +130461,13 @@ class EditableBlocks {
130240
130461
  this.common.clearAllBreakpoints(container);
130241
130462
  }
130242
130463
 
130464
+ isMultiSelect() {
130465
+ // Check if multiple selection occurs. If so, add 'multi' class to hide all the handles
130466
+ let blocks = Array.from(this.doc.querySelectorAll(this.selector)).filter(elm => elm.classList.contains('active') && !elm.classList.contains('clone'));
130467
+ if (blocks.length > 1) return true;
130468
+ return false;
130469
+ }
130470
+
130243
130471
  }
130244
130472
 
130245
130473
  const dom = new Dom$1();
@@ -130287,6 +130515,7 @@ class ContentBox {
130287
130515
  disableStaticSection: false,
130288
130516
  framework: '',
130289
130517
  imageRenameOnEdit: true,
130518
+ imageResizeOnBlock: false,
130290
130519
  htmlButton: true,
130291
130520
  // HTML button on left sidebar
130292
130521
  undoRedoButtons: true,
@@ -133544,10 +133773,10 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
133544
133773
  onChange: () => {
133545
133774
  this.onChange();
133546
133775
  },
133547
- onContentClick: e => {
133548
- const block = e.target.closest('.is-block');
133549
- this.editor.elmTool.click(block, e);
133550
- },
133776
+ // onContentClick: (e) => { // click during editing with ContentBuilder in a block
133777
+ // const block = e.target.closest('.is-block');
133778
+ // this.editor.elmTool.click(block, e);
133779
+ // },
133551
133780
  onEditStart: block => {
133552
133781
  block.classList.add('editable');
133553
133782
  const cols = block.querySelectorAll('[data-click="true"]'); // or [contentEditable="true"]
@@ -133674,6 +133903,7 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
133674
133903
  useMediaRecorder: this.settings.useMediaRecorder,
133675
133904
  encoderPath: this.settings.encoderPath,
133676
133905
  hideImageGeneration: this.settings.hideImageGeneration,
133906
+ imageResizeOnBlock: this.settings.imageResizeOnBlock,
133677
133907
  listFilesUrl: this.settings.listFilesUrl,
133678
133908
  listFoldersUrl: this.settings.listFoldersUrl,
133679
133909
  deleteFilesUrl: this.settings.deleteFilesUrl,
@@ -133759,6 +133989,7 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
133759
133989
  onBlockCanvasAdd: () => {
133760
133990
  this.eb.refresh();
133761
133991
  },
133992
+ blockContainer: '.is-box',
133762
133993
  slider: this.settings.slider,
133763
133994
  onRender: () => {
133764
133995
  this.settings.onRender();