@innovastudio/contentbuilder 1.2.13 → 1.2.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
- "version": "1.2.13",
3
+ "version": "1.2.16",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
@@ -121,29 +121,40 @@ button:focus {
121
121
  display: flex;
122
122
  }
123
123
  }
124
+ /*
124
125
  .sortable-drag {
125
- background: transparent;
126
- outline: none !important;
127
- }
128
- .sortable-drag * {
129
- opacity: 0;
130
- }
131
- .sortable-drag .is-row-tool {
132
- opacity: 0;
126
+ background: transparent; // background:rgba(0,0,0,0.04);
127
+ outline:none !important;
128
+ * {
129
+ opacity:0;
130
+ }
131
+ .is-row-tool {
132
+ opacity:0;
133
+ }
133
134
  }
134
135
 
135
136
  .sortable-ghost {
136
- background: rgba(204, 204, 204, 0.15);
137
- width: 100%;
138
- outline: none !important;
139
- }
140
- .sortable-ghost * {
141
- outline: none !important;
142
- }
143
- .sortable-ghost .is-row-tool {
144
- display: none !important;
137
+ background: $ui-sortable-ghost-color;
138
+ width: 100%;
139
+ outline: none !important;
140
+ * {
141
+ outline: none !important;
142
+ }
143
+ .is-row-tool {
144
+ display:none !important;
145
+ }
145
146
  }
146
147
 
148
+ .sortable-drag::before {
149
+ content: ' ';
150
+ width: 100%;
151
+ height: 100%;
152
+ position: absolute;
153
+ top: 0; left:0;
154
+ background: rgba(0, 0, 0 , 0.03);
155
+ transform-origin: top left;
156
+ }
157
+ */
147
158
  #_cbhtml .snippet-item {
148
159
  cursor: move !important;
149
160
  }
@@ -4196,8 +4196,19 @@ class Util {
4196
4196
  dom.addClass(pop, 'deactive');
4197
4197
  }
4198
4198
 
4199
+ clearAllEventListener(pop) {
4200
+ for (let i = 0; i < 10; i++) {
4201
+ pop.removeEventListener('keydown', this.handlePopKeyDown);
4202
+ document.removeEventListener('click', this.handlePopClickOut);
4203
+ }
4204
+ }
4205
+
4199
4206
  showPop(pop, cancelCallback, btn) {
4200
4207
  const dom = this.dom;
4208
+ if (pop.style.display === 'flex') return; // important
4209
+
4210
+ this.clearAllEventListener(pop); // for safety of uncleared events as a result of closing without hidePop()
4211
+
4201
4212
  pop.style.display = 'flex';
4202
4213
  dom.addClass(pop, 'active');
4203
4214
  pop.setAttribute('aria-hidden', false);
@@ -4206,37 +4217,40 @@ class Util {
4206
4217
  preventScroll: true
4207
4218
  });
4208
4219
 
4209
- const handleClickOut = e => {
4220
+ this.handlePopClickOut = e => {
4210
4221
  if (!pop.contains(e.target) && !btn.contains(e.target)) {
4211
4222
  // click outside
4212
4223
  // hide
4213
- this.hidePop(pop);
4214
- pop.removeEventListener('keydown', handleKeyDown);
4215
- document.removeEventListener('click', handleClickOut);
4224
+ this.hidePop(pop); // pop.removeEventListener('keydown', this.handlePopKeyDown);
4225
+ // document.removeEventListener('click', this.handlePopClickOut);
4226
+
4216
4227
  if (cancelCallback) cancelCallback();
4217
4228
  }
4218
4229
  };
4219
4230
 
4220
- const handleKeyDown = e => {
4231
+ this.handlePopKeyDown = e => {
4221
4232
  if (e.keyCode === 27) {
4222
4233
  // escape key
4223
4234
  // hide
4224
- this.hidePop(pop);
4225
- pop.removeEventListener('keydown', handleKeyDown);
4226
- document.removeEventListener('click', handleClickOut);
4235
+ this.hidePop(pop); // pop.removeEventListener('keydown', this.handlePopKeyDown);
4236
+ // document.removeEventListener('click', this.handlePopClickOut);
4237
+
4227
4238
  if (cancelCallback) cancelCallback();
4228
4239
  }
4229
4240
  };
4230
4241
 
4231
- pop.addEventListener('keydown', handleKeyDown);
4232
- document.addEventListener('click', handleClickOut);
4242
+ pop.addEventListener('keydown', this.handlePopKeyDown);
4243
+ document.addEventListener('click', this.handlePopClickOut);
4233
4244
  }
4234
4245
 
4235
4246
  hidePop(pop) {
4236
4247
  const dom = this.dom;
4237
4248
  pop.style.display = '';
4238
4249
  dom.removeClass(pop, 'active');
4239
- pop.setAttribute('aria-hidden', true);
4250
+ pop.setAttribute('aria-hidden', true); // pop.removeEventListener('keydown', this.handlePopKeyDown);
4251
+ // document.removeEventListener('click', this.handlePopClickOut);
4252
+
4253
+ this.clearAllEventListener(pop);
4240
4254
  }
4241
4255
 
4242
4256
  setupTabKeys(div) {
@@ -6844,6 +6858,17 @@ class Util {
6844
6858
 
6845
6859
  }
6846
6860
  class Dom {
6861
+ getScale(container) {
6862
+ let matrix = window.getComputedStyle(container).transform;
6863
+ let values = matrix.split('(')[1];
6864
+ values = values.split(')')[0];
6865
+ values = values.split(',');
6866
+ let a = values[0];
6867
+ let b = values[1];
6868
+ let scale = Math.sqrt(a * a + b * b);
6869
+ return scale;
6870
+ }
6871
+
6847
6872
  createElement(tag) {
6848
6873
  return document.createElement(tag);
6849
6874
  }
@@ -21575,12 +21600,12 @@ const renderSnippetPanel = builder => {
21575
21600
  let chromeAgent = userAgentString.indexOf('Chrome') > -1;
21576
21601
  if ((chromeAgent) && (safariAgent)) safariAgent = false;
21577
21602
  */
21603
+ // let safariAgent = false;
21578
21604
 
21579
21605
 
21580
- let safariAgent = false;
21581
21606
  let activeBuilderArea;
21582
21607
  new Sortable(snippetlist, {
21583
- forceFallback: safariAgent,
21608
+ // forceFallback: safariAgent,
21584
21609
  group: {
21585
21610
  name: 'shared',
21586
21611
  pull: 'clone',
@@ -21589,6 +21614,19 @@ const renderSnippetPanel = builder => {
21589
21614
  },
21590
21615
  sort: false,
21591
21616
  animation: 150,
21617
+ onChoose: () => {
21618
+ // Make moving draggable item scaled & positioned correctly (due to zoom value)
21619
+ const newCss = `
21620
+ <style id="css-scale">
21621
+ .sortable-drag::before {
21622
+ transform: scale(1);
21623
+ }
21624
+ </style>
21625
+ `;
21626
+ const oldCss = builder.contentStuff.querySelector('#css-scale');
21627
+ if (oldCss) oldCss.parentNode.removeChild(oldCss);
21628
+ builder.contentStuff.insertAdjacentHTML('afterbegin', newCss);
21629
+ },
21592
21630
  onMove: () => {
21593
21631
  let emptyinfo = document.querySelector('.row-add-initial'); // if there is empty info, remove it during snippet drag drop
21594
21632
  // if(emptyinfo) emptyinfo.parentNode.removeChild(emptyinfo);
@@ -54917,37 +54955,30 @@ class ColumnTool {
54917
54955
 
54918
54956
  <div style="padding:0;margin-top:25px;">
54919
54957
 
54920
- <div style="padding-bottom:3px;">${util.out('Scale')}:</div>
54958
+ <div style="padding-bottom:3px;display:flex;">
54959
+ <span>${util.out('Scale')}:</span>
54960
+ </div>
54921
54961
  <div style="padding-top:4px">
54922
54962
  <input type="range" min="100" max="500" value="0" class="image-scale-slider is-rangeslider">
54923
54963
  </div>
54924
54964
 
54925
- <div style="display:none;padding-bottom:3px;padding-top: 20px;">${util.out('Scale')} (${util.out('Width')}):</div>
54926
- <div style="display:none;padding-top:4px">
54927
- <input type="range" min="100" max="500" value="100" class="image-container-width-slider is-rangeslider">
54928
- </div>
54929
-
54930
- <div style="display:none;padding-bottom:3px;padding-top: 20px;">${util.out('Scale')} (${util.out('Height')}):</div>
54931
- <div style="display:none;padding-top:4px">
54932
- <input type="range" min="100" max="500" value="100" class="image-container-height-slider is-rangeslider">
54933
- </div>
54934
-
54935
- <div style="padding-bottom:3px;padding-top: 20px;display:flex;justify-content:space-between;align-items:center;">
54965
+ <div style="padding-bottom:3px;padding-top: 20px;display:flex;">
54936
54966
  <span>${util.out('Horizontal')}:</span>
54937
- <button title="${util.out('Reset')}" class="image-hor-reset" style="display:flex;width:30px;height:20px;"><svg class="is-icon-flex" style="width:11px;height:11px;"><use xlink:href="#icon-clean"></use></svg></button>
54938
54967
  </div>
54939
54968
  <div style="padding-top:4px">
54940
54969
  <input type="range" min="-150" max="150" value="0" class="image-hor-slider is-rangeslider">
54941
54970
  </div>
54942
54971
 
54943
- <div style="padding-bottom:3px;padding-top: 20px;display:flex;justify-content:space-between;align-items:center;">
54972
+ <div style="padding-bottom:3px;padding-top: 20px;display:flex;">
54944
54973
  <span>${util.out('Vertical')}:</span>
54945
- <button title="${util.out('Reset')}" class="image-vert-reset" style="display:flex;width:30px;height:20px;"><svg class="is-icon-flex" style="width:11px;height:11px;"><use xlink:href="#icon-clean"></use></svg></button>
54946
54974
  </div>
54947
54975
  <div style="padding-top:4px">
54948
54976
  <input type="range" min="-150" max="150" value="0" class="image-vert-slider is-rangeslider">
54949
54977
  </div>
54950
54978
 
54979
+ <div style="padding-bottom:3px;padding-top: 10px;display:flex;justify-content:right;align-items:center;">
54980
+ <button title="${util.out('Reset')}" class="image-reset" style="display:flex;width:30px;height:30px;"><svg class="is-icon-flex" style="width:11px;height:11px;"><use xlink:href="#icon-clean"></use></svg></button>
54981
+ </div>
54951
54982
  </div>
54952
54983
 
54953
54984
  </div>
@@ -55367,38 +55398,16 @@ class ColumnTool {
55367
55398
  let val = inpImageScaleSlider2.value;
55368
55399
 
55369
55400
  if (this.scaleWidth) {
55370
- cell.style.width = val + '%';
55371
- cell.style.height = '';
55401
+ cell.style.width = val + '%'; // cell.style.height = '';
55402
+
55403
+ cell.style.height = val * 100 / inpImageScaleSlider2.min + '%';
55372
55404
  } else {
55373
- cell.style.height = val + '%';
55374
- cell.style.width = '';
55375
- }
55376
-
55377
- cell.setAttribute('data-scale', val); // let cell = this.builder.elementSelected;
55378
- // cell.style.backgroundSize = '';
55379
- // //val: 0 - 100
55380
- // let val = inpImageScaleSlider2.value;
55381
- // cell.setAttribute('data-scale', val);
55382
- // // vall => -100-100
55383
- // if(val!==0) {
55384
- // // cell.style.width = 'unset';
55385
- // // cell.style.height = 'unset';
55386
- // cell.style.left = `-${val}vw`;
55387
- // cell.style.right = `-${val}vw`;
55388
- // cell.style.top = `-${val}vh`;
55389
- // cell.style.bottom = `-${val}vh`;
55390
- // } else {
55391
- // // cell.style.width = '';
55392
- // // cell.style.height = '';
55393
- // cell.style.left = '';
55394
- // cell.style.right = '';
55395
- // cell.style.top = '';
55396
- // cell.style.bottom = '';
55397
- // }
55398
- // //val: 100 - 500
55399
- // let val = inpImageScaleSlider2.value;
55400
- // let cell = this.builder.elementSelected; //util.cellSelected();
55401
- // cell.style.backgroundSize = val + '%';
55405
+ cell.style.height = val + '%'; // cell.style.width = '';
55406
+
55407
+ cell.style.width = val * 100 / inpImageScaleSlider2.min + '%';
55408
+ }
55409
+
55410
+ cell.setAttribute('data-scale', val);
55402
55411
  };
55403
55412
 
55404
55413
  inpImageScaleSlider2.onchange = () => {
@@ -55438,31 +55447,12 @@ class ColumnTool {
55438
55447
  };
55439
55448
 
55440
55449
  inpImageHorSlider2.oninput = () => {
55441
- // let cell = this.builder.elementSelected;
55442
- // let normalWidth = (cell.parentNode.offsetWidth/window.innerWidth) * 100; // vw
55443
- // let scaleInc = parseFloat(inpImageScaleSlider2.value);
55444
- // const enlarge = (normalWidth + (2*scaleInc))/normalWidth;
55445
- // //val: -100 - 100
55446
- // let val = parseFloat(inpImageHorSlider2.value);
55447
- // cell.setAttribute('data-x', val);
55448
- // let currentWidth = cell.parentNode.offsetWidth*enlarge;
55449
- // currentWidth = (currentWidth/window.innerWidth) * 100; // vw
55450
- // let currentLeft = (currentWidth-normalWidth)/2; // vw
55451
- // let currentRight = (currentWidth-normalWidth)/2;
55452
- // const left = -currentLeft+val;
55453
- // const right = -currentRight-val;
55454
- // // cell.style.width = 'unset';
55455
- // cell.style.left = `${left}vw`;
55456
- // cell.style.right = `${right}vw`;
55457
55450
  let cell = this.builder.elementSelected; //val: -100 - 100
55458
55451
 
55459
55452
  let val = parseFloat(inpImageHorSlider2.value);
55460
55453
  cell.style.left = `${val}%`;
55461
55454
  cell.style.right = '';
55462
- cell.setAttribute('data-x', val); // //val: 0 - 100
55463
- // let val = inpImageHorSlider2.value;
55464
- // let cell = this.builder.elementSelected; //util.cellSelected();
55465
- // cell.style.backgroundPositionX = val + '%';
55455
+ cell.setAttribute('data-x', val);
55466
55456
  };
55467
55457
 
55468
55458
  inpImageHorSlider2.onchange = () => {
@@ -55502,103 +55492,24 @@ class ColumnTool {
55502
55492
  };
55503
55493
 
55504
55494
  inpImageVertSlider2.oninput = () => {
55505
- // let cell = this.builder.elementSelected;
55506
- // let normalHeight = (cell.parentNode.offsetHeight/window.innerHeight) * 100; // vh
55507
- // let scaleInc = parseFloat(inpImageScaleSlider2.value);
55508
- // const enlarge = (normalHeight + (2*scaleInc))/normalHeight;
55509
- // //val: -100 - 100
55510
- // let val = parseFloat(inpImageVertSlider2.value);
55511
- // cell.setAttribute('data-y', val);
55512
- // let currentHeight = cell.parentNode.offsetHeight*enlarge;
55513
- // currentHeight = (currentHeight/window.innerHeight) * 100; // vh
55514
- // let currentTop = (currentHeight-normalHeight)/2; // vh
55515
- // let currentBottom = (currentHeight-normalHeight)/2;
55516
- // const top = -currentTop+val;
55517
- // const bottom = -currentBottom-val;
55518
- // // cell.style.height = 'unset';
55519
- // cell.style.top = `${top}vh`;
55520
- // cell.style.bottom = `${bottom}vh`;
55521
55495
  let cell = this.builder.elementSelected; //val: -100 - 100
55522
55496
 
55523
55497
  let val = parseFloat(inpImageVertSlider2.value);
55524
55498
  cell.style.top = `${val}%`;
55525
55499
  cell.style.bottom = '';
55526
- cell.setAttribute('data-y', val); // //val: 0 - 100
55527
- // let val = inpImageVertSlider2.value;
55528
- // let cell = this.builder.elementSelected; //util.cellSelected();
55529
- // cell.style.backgroundPositionY = val + '%';
55500
+ cell.setAttribute('data-y', val);
55530
55501
  };
55531
55502
 
55532
55503
  inpImageVertSlider2.onchange = () => {
55533
55504
  //Trigger Change event
55534
55505
  this.builder.opts.onChange();
55535
- }; // Image Container Width
55536
-
55537
-
55538
- const inpImageConWidthSlider = imageAdjust2.querySelector('.image-container-width-slider');
55539
-
55540
- inpImageConWidthSlider.onfocus = () => {
55541
- this.builder.uo.saveForUndo(true);
55542
55506
  };
55543
55507
 
55544
- inpImageConWidthSlider.oninput = () => {
55545
- let cell = this.builder.elementSelected; //val: 100 - 500
55546
-
55547
- let val = parseFloat(inpImageConWidthSlider.value);
55548
- cell.setAttribute('data-con-w', val);
55549
- cell.style.width = `${val}%`;
55550
- };
55551
-
55552
- inpImageConWidthSlider.onchange = () => {
55553
- this.builder.opts.onChange();
55554
- }; // Image Container Height
55555
-
55556
-
55557
- const inpImageConHeightSlider = imageAdjust2.querySelector('.image-container-height-slider');
55558
-
55559
- inpImageConHeightSlider.onfocus = () => {
55560
- this.builder.uo.saveForUndo(true);
55561
- };
55562
-
55563
- inpImageConHeightSlider.oninput = () => {
55564
- let cell = this.builder.elementSelected; //val: 100 - 500
55565
-
55566
- let val = parseFloat(inpImageConHeightSlider.value);
55567
- cell.setAttribute('data-con-h', val);
55568
- cell.style.height = `${val}%`;
55569
- };
55570
-
55571
- inpImageConHeightSlider.onchange = () => {
55572
- this.builder.opts.onChange();
55573
- };
55574
-
55575
- const btnHorReset = imageAdjust2.querySelector('.image-hor-reset');
55576
- btnHorReset.addEventListener('click', () => {
55508
+ const btnImageReset = imageAdjust2.querySelector('.image-reset');
55509
+ btnImageReset.addEventListener('click', () => {
55577
55510
  this.builder.uo.saveForUndo();
55578
55511
  let cell = this.builder.elementSelected;
55579
- inpImageHorSlider2.value = 0; // cell.style.width = '';
55580
-
55581
- cell.style.left = '';
55582
- cell.style.right = '';
55583
- cell.removeAttribute('data-x'); // // fix
55584
- // cell.style.backgroundPositionX = '';
55585
- // inpImageHorSlider2.value = 50;
55586
- //Trigger Change event
55587
-
55588
- this.builder.opts.onChange();
55589
- });
55590
- const btnVertReset = imageAdjust2.querySelector('.image-vert-reset');
55591
- btnVertReset.addEventListener('click', () => {
55592
- this.builder.uo.saveForUndo();
55593
- let cell = this.builder.elementSelected;
55594
- inpImageVertSlider2.value = 0; // cell.style.height = '';
55595
-
55596
- cell.style.top = '';
55597
- cell.style.bottom = '';
55598
- cell.removeAttribute('data-y'); // // fix
55599
- // cell.style.backgroundPositionY = '';
55600
- // inpImageVertSlider2.value = 60;
55601
- //Trigger Change event
55512
+ this.resetImage(cell); //Trigger Change event
55602
55513
 
55603
55514
  this.builder.opts.onChange();
55604
55515
  }); // Row Enlarge (Currently not used)
@@ -56573,6 +56484,81 @@ class ColumnTool {
56573
56484
  if (btn) btn.setAttribute('data-focus', true);
56574
56485
  }
56575
56486
 
56487
+ resetImage(elm) {
56488
+ //Current value
56489
+ const imageAdjust2 = this.imageAdjust2;
56490
+ const inpImageScaleSlider = imageAdjust2.querySelector('.image-scale-slider');
56491
+ const inpImageHorSlider = imageAdjust2.querySelector('.image-hor-slider');
56492
+ const inpImageVertSlider = imageAdjust2.querySelector('.image-vert-slider');
56493
+ let overlayDimension = {
56494
+ width: elm.parentNode.offsetWidth,
56495
+ height: elm.parentNode.offsetHeight
56496
+ };
56497
+ let dimension, image;
56498
+ image = new Image();
56499
+ image.src = elm.style.backgroundImage.replace(/"/g, '').replace(/url\(|\)$/ig, '');
56500
+
56501
+ image.onload = () => {
56502
+ dimension = {
56503
+ width: image.naturalWidth,
56504
+ height: image.naturalHeight
56505
+ };
56506
+ this.dimension = dimension;
56507
+
56508
+ if (overlayDimension.width / overlayDimension.height <= dimension.width / dimension.height) {
56509
+ this.scaleWidth = true;
56510
+ this.scaleHeight = false; // let h = overlayDimension.height; //px
56511
+
56512
+ let w = overlayDimension.height * (dimension.width / dimension.height);
56513
+ w = w / overlayDimension.width * 100; //%
56514
+
56515
+ if (!elm.style.width) {
56516
+ elm.style.width = w + '%';
56517
+ elm.style.height = '';
56518
+ }
56519
+
56520
+ inpImageScaleSlider.min = w;
56521
+ let val = -(w - 100) * 0.5;
56522
+ inpImageHorSlider.value = val; //50%
56523
+
56524
+ elm.style.left = val + '%';
56525
+ elm.setAttribute('data-x', val);
56526
+ inpImageVertSlider.value = 0;
56527
+ elm.style.top = '0%';
56528
+ elm.setAttribute('data-y', 0);
56529
+ inpImageScaleSlider.value = w;
56530
+ elm.style.width = w + '%';
56531
+ elm.setAttribute('data-scale', w);
56532
+ elm.style.height = '100%'; //((w*this.dimension.height)/this.dimension.width) + '%';
56533
+ } else {
56534
+ this.scaleHeight = true;
56535
+ this.scaleWidth = false; // let w = overlayDimension.width;
56536
+
56537
+ let h = overlayDimension.width * (dimension.height / dimension.width);
56538
+ h = h / overlayDimension.height * 100; //%
56539
+
56540
+ if (!elm.style.height) {
56541
+ elm.style.height = h + '%';
56542
+ elm.style.width = '';
56543
+ }
56544
+
56545
+ inpImageScaleSlider.min = h;
56546
+ let val = -(h - 100) * 0.6;
56547
+ inpImageVertSlider.value = val; //60%
56548
+
56549
+ elm.style.top = val + '%';
56550
+ elm.setAttribute('data-y', val);
56551
+ inpImageHorSlider.value = 0;
56552
+ elm.style.left = '0%';
56553
+ elm.setAttribute('data-x', 0);
56554
+ inpImageScaleSlider.value = h;
56555
+ elm.style.height = h + '%';
56556
+ elm.setAttribute('data-scale', h);
56557
+ elm.style.width = '100%'; //((h*this.dimension.width)/this.dimension.height) + '%';
56558
+ }
56559
+ };
56560
+ }
56561
+
56576
56562
  openImageAdjust2(elm, btn) {
56577
56563
  //Current value
56578
56564
  const imageAdjust2 = this.imageAdjust2;
@@ -56581,7 +56567,7 @@ class ColumnTool {
56581
56567
  const inpImageVertSlider = imageAdjust2.querySelector('.image-vert-slider');
56582
56568
  inpImageScaleSlider.value = 0;
56583
56569
  inpImageHorSlider.value = 0;
56584
- inpImageVertSlider.value = 0;
56570
+ inpImageVertSlider.value = 15;
56585
56571
  const scale = elm.getAttribute('data-scale');
56586
56572
 
56587
56573
  if (scale) {
@@ -56613,7 +56599,8 @@ class ColumnTool {
56613
56599
  dimension = {
56614
56600
  width: image.naturalWidth,
56615
56601
  height: image.naturalHeight
56616
- }; // console.log(dimension)
56602
+ };
56603
+ this.dimension = dimension; // console.log(dimension)
56617
56604
 
56618
56605
  if (overlayDimension.width / overlayDimension.height <= dimension.width / dimension.height) {
56619
56606
  this.scaleWidth = true;
@@ -56628,6 +56615,19 @@ class ColumnTool {
56628
56615
  }
56629
56616
 
56630
56617
  inpImageScaleSlider.min = w;
56618
+
56619
+ if (!posX) {
56620
+ inpImageHorSlider.value = -(w - 100) * 0.5; //50%
56621
+
56622
+ elm.style.left = -(w - 100) * 0.5 + '%';
56623
+ inpImageVertSlider.value = 0;
56624
+ }
56625
+
56626
+ const scale = elm.getAttribute('data-scale');
56627
+
56628
+ if (!scale) {
56629
+ inpImageScaleSlider.value = w;
56630
+ }
56631
56631
  } else {
56632
56632
  this.scaleHeight = true;
56633
56633
  this.scaleWidth = false; // let w = overlayDimension.width;
@@ -56641,6 +56641,19 @@ class ColumnTool {
56641
56641
  }
56642
56642
 
56643
56643
  inpImageScaleSlider.min = h;
56644
+
56645
+ if (!posY) {
56646
+ inpImageVertSlider.value = -(h - 100) * 0.6; //60%
56647
+
56648
+ elm.style.top = -(h - 100) * 0.6 + '%';
56649
+ inpImageHorSlider.value = 0;
56650
+ }
56651
+
56652
+ const scale = elm.getAttribute('data-scale');
56653
+
56654
+ if (!scale) {
56655
+ inpImageScaleSlider.value = h;
56656
+ }
56644
56657
  }
56645
56658
  }; // const imageAdjust2 = this.imageAdjust2;
56646
56659
  // const inpImageScaleSlider = imageAdjust2.querySelector('.image-scale-slider');
@@ -69625,8 +69638,23 @@ class ContentBuilder {
69625
69638
  ['column sixth', 'column two-sixth'], ['column fifth', 'column two-fifth'], ['column fourth', 'column two-fourth'], ['column third', 'column two-third'], ['column half', 'column half'], ['column two-third', 'column third'], ['column two-fourth', 'column fourth'], ['column two-fifth', 'column fifth'], ['column two-sixth', 'column sixth']]];
69626
69639
  }
69627
69640
  }
69641
+ } // Experimental for iframe
69642
+
69643
+
69644
+ let doc;
69645
+ if (this.iframeDocument) doc = this.iframeDocument;else doc = document;
69646
+ this.doc = doc; // Content stuff
69647
+
69648
+ let contentStuff = doc.querySelector('.content-stuff');
69649
+
69650
+ if (!contentStuff) {
69651
+ contentStuff = document.createElement('div');
69652
+ contentStuff.className = 'content-stuff is-ui';
69653
+ doc.body.appendChild(contentStuff);
69628
69654
  }
69629
69655
 
69656
+ this.contentStuff = contentStuff;
69657
+ this.addStuff();
69630
69658
  this.sortableObjects = [];
69631
69659
  const util = new Util(this); // General utilities
69632
69660
 
@@ -70164,12 +70192,32 @@ class ContentBuilder {
70164
70192
  scroll: true,
70165
70193
  // invertSwap: true, /* https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#swap-threshold */
70166
70194
  group: 'shared',
70167
- direction: 'dummy',
70195
+ // direction: 'dummy',
70168
70196
  animation: 300,
70169
70197
  handle: '.row-handle',
70170
70198
  // swapThreshold: 0.1, // this cause drag drop snippet sometimes difficult
70171
70199
  // invertedSwapThreshold: 0.1,
70172
70200
  sort: true,
70201
+ //new
70202
+ swapThreshold: 0.5,
70203
+ // & comment the direction setting above
70204
+ onChoose: () => {
70205
+ // Get zoom (scale) value
70206
+ const area = this.doc.querySelector('.is-builder'); // get one of the builder area
70207
+
70208
+ const scale = dom.getScale(area); // Make moving draggable item scaled & positioned correctly (due to zoom value)
70209
+
70210
+ const newCss = `
70211
+ <style id="css-scale">
70212
+ .sortable-drag::before {
70213
+ transform: scale(${scale});
70214
+ }
70215
+ </style>
70216
+ `;
70217
+ const oldCss = this.contentStuff.querySelector('#css-scale');
70218
+ if (oldCss) oldCss.parentNode.removeChild(oldCss);
70219
+ this.contentStuff.insertAdjacentHTML('afterbegin', newCss);
70220
+ },
70173
70221
  onStart: () => {
70174
70222
  this.uo.saveForUndo(); // Even if cancelled, saveForUndo will make sure not to save if there is no change
70175
70223
 
@@ -72491,6 +72539,45 @@ class ContentBuilder {
72491
72539
  // return currentScript.replace(currentScriptFile, '');
72492
72540
  }
72493
72541
 
72542
+ addStuff() {
72543
+ const css = `
72544
+ <style>
72545
+ /* sortable */
72546
+ .sortable-drag {
72547
+ background: transparent;
72548
+ outline:none !important;
72549
+ }
72550
+ .sortable-drag * {
72551
+ opacity:0;
72552
+ }
72553
+
72554
+ .sortable-ghost {
72555
+ background: rgba(0, 0, 0 , 0.03);
72556
+ width: 100%;
72557
+ outline: none !important;
72558
+ }
72559
+ .sortable-ghost * {
72560
+ outline: none !important;
72561
+
72562
+ }
72563
+ .sortable-ghost .is-row-tool {
72564
+ display:none !important;
72565
+ }
72566
+
72567
+ .sortable-drag::before {
72568
+ content: ' ';
72569
+ width: 100%;
72570
+ height: 100%;
72571
+ position: absolute;
72572
+ top: 0; left:0;
72573
+ background: rgba(0, 0, 0 , 0.03);
72574
+ transform-origin: top left;
72575
+ }
72576
+ </style>
72577
+ `;
72578
+ this.contentStuff.insertAdjacentHTML('afterbegin', css);
72579
+ }
72580
+
72494
72581
  }
72495
72582
  // var run = (opts = {}) => {
72496
72583
  // return new ContentBuilder(opts);