@innovastudio/contentbuilder 1.4.62 → 1.4.63

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.4.62",
4
+ "version": "1.4.63",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -5468,3 +5468,17 @@ button:focus-visible {
5468
5468
  background-color: rgb(130 130 130 / 14%) !important;
5469
5469
  }
5470
5470
  }*/
5471
+ div[data-html] {
5472
+ min-height: 70px;
5473
+ }
5474
+
5475
+ [data-module=slider-builder] *,
5476
+ [data-module=text-builder] * {
5477
+ outline: none !important;
5478
+ }
5479
+
5480
+ /* Make slider block resizable */
5481
+ .padding-0[data-module=slider-builder],
5482
+ .padding-0[data-module=text-builder] {
5483
+ padding: 0 2px 4px !important;
5484
+ }
@@ -4343,6 +4343,16 @@ class Util {
4343
4343
  cell.classList.remove('eleventh');
4344
4344
  cell.classList.remove('twelfth');
4345
4345
  }
4346
+ getAllColumns(row) {
4347
+ let arrCells = [];
4348
+ const dom = this.dom;
4349
+ const cols = dom.elementChildren(row);
4350
+ cols.forEach(col => {
4351
+ if (dom.hasClass(col, 'is-row-tool') || dom.hasClass(col, 'is-col-tool') || dom.hasClass(col, 'is-rowadd-tool') || dom.hasClass(col, 'is-row-overlay')) return;
4352
+ arrCells.push(col);
4353
+ });
4354
+ return arrCells;
4355
+ }
4346
4356
  fixLayout(row) {
4347
4357
  const dom = this.dom;
4348
4358
 
@@ -4364,8 +4374,25 @@ class Util {
4364
4374
  if (item.classList.contains('is-row-tool')) return;
4365
4375
  if (item.classList.contains('is-col-tool')) return;
4366
4376
  if (item.classList.contains('is-rowadd-tool')) return;
4367
- item.style.width = '';
4368
- item.style.flex = '';
4377
+
4378
+ // item.style.width = '';
4379
+ // item.style.flex = '';
4380
+ if (item.getAttribute('data-html')) {
4381
+ // Don't change width on custom block
4382
+ if (!item.style.width) {
4383
+ // But if width is not set, add default 50%
4384
+ item.style.width = '50%';
4385
+ item.style.flex = '0 0 auto';
4386
+ }
4387
+ if (this.getAllColumns(row).length === 1) {
4388
+ // only 1 col in a row
4389
+ item.style.width = '';
4390
+ item.style.flex = '';
4391
+ }
4392
+ } else {
4393
+ item.style.width = '';
4394
+ item.style.flex = '';
4395
+ }
4369
4396
  if (item.classList.contains('sm-hidden')) {
4370
4397
  smHidden = true;
4371
4398
  }
@@ -17826,16 +17853,27 @@ class Grid {
17826
17853
  this.builder.uo.saveForUndo();
17827
17854
  let w = this.resizeColumn(cell, true, arrColumns.length);
17828
17855
  if (w) {
17829
- for (let i = 1; i < arrColumns.length; i++) {
17830
- let cellNext = arrColumns[i];
17831
- // cellNext.style.width = '100%';
17832
- cellNext.style.width = '';
17833
- cellNext.style.flex = '';
17834
- this.removeColClasses(cellNext);
17835
- }
17836
17856
  cell.style.width = w;
17837
17857
  cell.style.flex = '0 0 auto';
17838
17858
  this.removeColClasses(cell);
17859
+ for (let i = 1; i < arrColumns.length; i++) {
17860
+ let cellNext = arrColumns[i];
17861
+ if (cellNext !== cell) {
17862
+ // cellNext.style.width = '';
17863
+ // cellNext.style.flex = '';
17864
+ if (!cellNext.getAttribute('data-html')) {
17865
+ cellNext.style.width = '';
17866
+ cellNext.style.flex = '';
17867
+ } else {
17868
+ // For module, don't change width, except if there are 2 columns only
17869
+ if (arrColumns.length === 2) {
17870
+ cellNext.style.width = 100 - parseFloat(w) + '%';
17871
+ cellNext.style.flex = '0 0 auto';
17872
+ }
17873
+ }
17874
+ this.removeColClasses(cellNext);
17875
+ }
17876
+ }
17839
17877
  }
17840
17878
  this.builder.opts.onChange();
17841
17879
  }
@@ -18000,16 +18038,27 @@ class Grid {
18000
18038
  this.builder.uo.saveForUndo();
18001
18039
  let w = this.resizeColumn(cell, false, arrColumns.length);
18002
18040
  if (w) {
18003
- for (let i = 1; i < arrColumns.length; i++) {
18004
- let cellNext = arrColumns[i];
18005
- // cellNext.style.width = '100%';
18006
- cellNext.style.width = '';
18007
- cellNext.style.flex = '';
18008
- this.removeColClasses(cellNext);
18009
- }
18010
18041
  cell.style.width = w;
18011
18042
  cell.style.flex = '0 0 auto';
18012
18043
  this.removeColClasses(cell);
18044
+ for (let i = 1; i < arrColumns.length; i++) {
18045
+ let cellNext = arrColumns[i];
18046
+ if (cellNext !== cell) {
18047
+ // cellNext.style.width = '';
18048
+ // cellNext.style.flex = '';
18049
+ if (!cellNext.getAttribute('data-html')) {
18050
+ cellNext.style.width = '';
18051
+ cellNext.style.flex = '';
18052
+ } else {
18053
+ // For module, don't change width, except if there are 2 columns only
18054
+ if (arrColumns.length === 2) {
18055
+ cellNext.style.width = 100 - parseFloat(w) + '%';
18056
+ cellNext.style.flex = '0 0 auto';
18057
+ }
18058
+ }
18059
+ this.removeColClasses(cellNext);
18060
+ }
18061
+ }
18013
18062
  }
18014
18063
  this.builder.opts.onChange();
18015
18064
  }
@@ -74347,25 +74396,33 @@ class Resize {
74347
74396
  if (item === col) return;
74348
74397
 
74349
74398
  // // item.style.width = '100%';
74350
- // if(!item.getAttribute('data-module')) item.style.width = '100%';
74399
+ // if(!item.getAttribute('data-html')) item.style.width = '100%';
74351
74400
  // item.style.flex = '';
74352
74401
  if (numOfCols === 2) {
74353
- if (!item.getAttribute('data-module')) {
74402
+ if (!item.getAttribute('data-html')) {
74354
74403
  item.style.width = '100%';
74355
74404
  item.style.flex = '';
74356
74405
  }
74357
74406
  } /*else {
74358
- // if(!item.getAttribute('data-module') && !item.style.width) {
74407
+ // if(!item.getAttribute('data-html') && !item.style.width) {
74359
74408
  // item.style.width = '100%';
74360
74409
  // item.style.flex = '';
74361
74410
  // }
74362
- if(!item.getAttribute('data-module') && item===col.nextElementSibling) {
74411
+ if(!item.getAttribute('data-html') && item===col.nextElementSibling) {
74363
74412
  item.style.width = '100%';
74364
74413
  item.style.flex = '';
74365
74414
  }
74366
74415
  }*/
74367
- });
74368
74416
 
74417
+ /* New: Specify width for module only, and only if num of columns = 2 */
74418
+ if (numOfCols === 2) {
74419
+ if (item.getAttribute('data-html')) {
74420
+ let percentage = col.offsetWidth / col.parentNode.offsetWidth * 100;
74421
+ item.style.width = 100 - percentage + '%';
74422
+ item.style.flex = '0 0 auto';
74423
+ }
74424
+ }
74425
+ });
74369
74426
  if (numOfCols === 1) {
74370
74427
  col.style.width = '100%';
74371
74428
  }
@@ -74380,9 +74437,18 @@ class Resize {
74380
74437
  if (item === col) return;
74381
74438
  if (item.style.width === '') {
74382
74439
  // item.style.width = '100%';
74383
- if (!item.getAttribute('data-module')) item.style.width = '100%';
74440
+ if (!item.getAttribute('data-html')) item.style.width = '100%';
74384
74441
  item.style.flex = '';
74385
74442
  }
74443
+
74444
+ /* New: Specify width for module only, and only if num of columns = 2 */
74445
+ if (numOfCols === 2) {
74446
+ if (item.getAttribute('data-html')) {
74447
+ let percentage = col.offsetWidth / col.parentNode.offsetWidth * 100;
74448
+ item.style.width = 100 - percentage + '%';
74449
+ item.style.flex = '0 0 auto';
74450
+ }
74451
+ }
74386
74452
  });
74387
74453
  }
74388
74454
  // /adjust others
@@ -74437,19 +74503,19 @@ class Resize {
74437
74503
  if (item === col) return;
74438
74504
 
74439
74505
  // // item.style.width = '100%';
74440
- // if(!item.getAttribute('data-module')) item.style.width = '100%';
74506
+ // if(!item.getAttribute('data-html')) item.style.width = '100%';
74441
74507
  // item.style.flex = '';
74442
74508
  if (numOfCols === 2) {
74443
- if (!item.getAttribute('data-module')) {
74509
+ if (!item.getAttribute('data-html')) {
74444
74510
  item.style.width = '100%';
74445
74511
  item.style.flex = '';
74446
74512
  }
74447
74513
  } /*else {
74448
- // if(!item.getAttribute('data-module') && !item.style.width) {
74514
+ // if(!item.getAttribute('data-html') && !item.style.width) {
74449
74515
  // item.style.width = '100%';
74450
74516
  // item.style.flex = '';
74451
74517
  // }
74452
- if(!item.getAttribute('data-module') && item===col.nextElementSibling) {
74518
+ if(!item.getAttribute('data-html') && item===col.nextElementSibling) {
74453
74519
  item.style.width = '100%';
74454
74520
  item.style.flex = '';
74455
74521
  }
@@ -74468,7 +74534,7 @@ class Resize {
74468
74534
  // if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
74469
74535
 
74470
74536
  // // Refresh Module
74471
- // if(item.getAttribute('data-module')) {
74537
+ // if(item.getAttribute('data-html')) {
74472
74538
  // this.builder.util.refreshModuleLayout(item);
74473
74539
  // }
74474
74540
 
@@ -74489,7 +74555,7 @@ class Resize {
74489
74555
  if (item.classList.contains('is-row-tool')) return;
74490
74556
  if (item.classList.contains('is-rowadd-tool')) return;
74491
74557
  if (item.classList.contains('is-col-tool')) return;
74492
- if (item.getAttribute('data-module')) {
74558
+ if (item.getAttribute('data-html')) {
74493
74559
  let moduleWidth = item.offsetWidth / row.offsetWidth * 100;
74494
74560
  item.style.width = moduleWidth + '%';
74495
74561
  item.style.flex = 'none';
@@ -75544,10 +75610,24 @@ class ContentStuff {
75544
75610
 
75545
75611
  /* Make slider block resizable */
75546
75612
  .is-builder > div > div[data-module=slider-builder].cell-active {
75547
- padding: 0 2px 4px !important;
75613
+ /*padding: 0 2px 4px !important;*/
75548
75614
  z-index: 1 !important;
75549
75615
  }
75616
+
75617
+ div[data-html] {
75618
+ min-height: 70px;
75619
+ }
75550
75620
 
75621
+ [data-module="slider-builder"] *,
75622
+ [data-module="text-builder"] * {
75623
+ outline: none !important;
75624
+ }
75625
+
75626
+ /* Make slider block resizable */
75627
+ .padding-0[data-module="slider-builder"],
75628
+ .padding-0[data-module="text-builder"] {
75629
+ padding: 0 2px 4px !important;
75630
+ }
75551
75631
  `;
75552
75632
  builder.contentStuff.insertAdjacentHTML('afterbegin', `
75553
75633
  <style>