@innovastudio/contentbuilder 1.5.34 → 1.5.35

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.5.34",
4
+ "version": "1.5.35",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -81534,10 +81534,14 @@ class Common {
81534
81534
  applyPercentage(block) {
81535
81535
  const zoom = this.zoom;
81536
81536
  const rect = this.getRect(block);
81537
- const container = block.closest('.box-canvas');
81537
+ let container = block.closest('.box-canvas');
81538
+ if (block.parentNode.closest(this.selector)) {
81539
+ // block is in group
81540
+ container = block.parentNode.closest(this.selector);
81541
+ }
81538
81542
  const containerRect = this.getRect(container); // if container has top/left
81539
81543
 
81540
- this.horizontalRulerTop = container.querySelector('.h-ruler-top');
81544
+ this.horizontalRulerTop = container.querySelector('.h-ruler-top'); // no rulers in group
81541
81545
  this.horizontalRulerBottom = container.querySelector('.h-ruler-bottom');
81542
81546
  this.horizontalRulerMiddle = container.querySelector('.h-ruler-middle');
81543
81547
  this.verticalRulerLeft = container.querySelector('.v-ruler-left');
@@ -81549,10 +81553,10 @@ class Common {
81549
81553
  let bottomTouched = false;
81550
81554
  let leftTouched = false;
81551
81555
  let rightTouched = false;
81552
- if (this.horizontalRulerTop.hasAttribute('data-topTouched')) topTouched = true;
81553
- if (this.horizontalRulerBottom.hasAttribute('data-bottomTouched')) bottomTouched = true;
81554
- if (this.verticalRulerLeft.hasAttribute('data-leftTouched')) leftTouched = true;
81555
- if (this.verticalRulerRight.hasAttribute('data-rightTouched')) rightTouched = true;
81556
+ if (this.horizontalRulerTop && this.horizontalRulerTop.hasAttribute('data-topTouched')) topTouched = true;
81557
+ if (this.horizontalRulerBottom && this.horizontalRulerBottom.hasAttribute('data-bottomTouched')) bottomTouched = true;
81558
+ if (this.verticalRulerLeft && this.verticalRulerLeft.hasAttribute('data-leftTouched')) leftTouched = true;
81559
+ if (this.verticalRulerRight && this.verticalRulerRight.hasAttribute('data-rightTouched')) rightTouched = true;
81556
81560
  let isChildBlock = false;
81557
81561
  if (block.parentNode.matches(this.selector)) {
81558
81562
  // child block
@@ -81631,10 +81635,10 @@ class Common {
81631
81635
 
81632
81636
  // reset
81633
81637
  setTimeout(() => {
81634
- this.horizontalRulerTop.removeAttribute('data-topTouched');
81635
- this.horizontalRulerBottom.removeAttribute('data-bottomTouched');
81636
- this.verticalRulerLeft.removeAttribute('data-leftTouched');
81637
- this.verticalRulerRight.removeAttribute('data-rightTouched');
81638
+ if (this.horizontalRulerTop) this.horizontalRulerTop.removeAttribute('data-topTouched');
81639
+ if (this.horizontalRulerBottom) this.horizontalRulerBottom.removeAttribute('data-bottomTouched');
81640
+ if (this.verticalRulerLeft) this.verticalRulerLeft.removeAttribute('data-leftTouched');
81641
+ if (this.verticalRulerRight) this.verticalRulerRight.removeAttribute('data-rightTouched');
81638
81642
  }, 10);
81639
81643
  }
81640
81644
  applyPixels(block) {
@@ -82132,6 +82136,8 @@ class Ruler {
82132
82136
  this.rulerRight = null;
82133
82137
  }
82134
82138
  updateRulers(block) {
82139
+ if (block.parentNode.closest(this.selector)) return; // block is in group
82140
+
82135
82141
  const container = block.closest('.box-canvas');
82136
82142
  this.horizontalRulerTop = container.querySelector('.h-ruler-top');
82137
82143
  this.horizontalRulerBottom = container.querySelector('.h-ruler-bottom');
@@ -82156,6 +82162,8 @@ class Ruler {
82156
82162
  this.rulerRight = null;
82157
82163
  this.elements = container.querySelectorAll(this.selector);
82158
82164
  this.elements.forEach(element => {
82165
+ if (element.parentNode.closest(this.selector)) return; // block is in group
82166
+
82159
82167
  if (!this.doc.body.contains(element)) return; // in case element removed (eg. unGroup, block deleted)
82160
82168
 
82161
82169
  if (block.contains(element)) return; // In case of group moving