@innovastudio/contentbuilder 1.4.62 → 1.4.64

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.4.62",
4
+ "version": "1.4.64",
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
  }
@@ -5452,6 +5479,7 @@ class Util {
5452
5479
  localStorage.removeItem('_dictation');
5453
5480
  localStorage.removeItem('_mic');
5454
5481
  localStorage.removeItem('_autosendcommand');
5482
+ localStorage.removeItem('_sampleshown');
5455
5483
 
5456
5484
  //NOT USED
5457
5485
  localStorage.removeItem('_scrollableeditor');
@@ -14681,7 +14709,7 @@ class HtmlUtil {
14681
14709
  }
14682
14710
  return html;
14683
14711
  }
14684
- readHtml(content, view, multiple) {
14712
+ readHtml(content, view, multiple, excludeCustomBlock) {
14685
14713
  //view = true (hide internal attributes). view = false (actual html)
14686
14714
 
14687
14715
  //Make absolute
@@ -14974,6 +15002,12 @@ class HtmlUtil {
14974
15002
  }
14975
15003
  }
14976
15004
  });
15005
+ if (excludeCustomBlock) {
15006
+ const elmCustomBlocks = tmp.querySelectorAll('[data-html]');
15007
+ elmCustomBlocks.forEach(elm => {
15008
+ elm.innerHTML = '';
15009
+ });
15010
+ }
14977
15011
  html = '';
14978
15012
  if (multiple) {
14979
15013
  //ContentBox
@@ -17826,16 +17860,27 @@ class Grid {
17826
17860
  this.builder.uo.saveForUndo();
17827
17861
  let w = this.resizeColumn(cell, true, arrColumns.length);
17828
17862
  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
17863
  cell.style.width = w;
17837
17864
  cell.style.flex = '0 0 auto';
17838
17865
  this.removeColClasses(cell);
17866
+ for (let i = 1; i < arrColumns.length; i++) {
17867
+ let cellNext = arrColumns[i];
17868
+ if (cellNext !== cell) {
17869
+ // cellNext.style.width = '';
17870
+ // cellNext.style.flex = '';
17871
+ if (!cellNext.getAttribute('data-html')) {
17872
+ cellNext.style.width = '';
17873
+ cellNext.style.flex = '';
17874
+ } else {
17875
+ // For module, don't change width, except if there are 2 columns only
17876
+ if (arrColumns.length === 2) {
17877
+ cellNext.style.width = 100 - parseFloat(w) + '%';
17878
+ cellNext.style.flex = '0 0 auto';
17879
+ }
17880
+ }
17881
+ this.removeColClasses(cellNext);
17882
+ }
17883
+ }
17839
17884
  }
17840
17885
  this.builder.opts.onChange();
17841
17886
  }
@@ -18000,16 +18045,27 @@ class Grid {
18000
18045
  this.builder.uo.saveForUndo();
18001
18046
  let w = this.resizeColumn(cell, false, arrColumns.length);
18002
18047
  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
18048
  cell.style.width = w;
18011
18049
  cell.style.flex = '0 0 auto';
18012
18050
  this.removeColClasses(cell);
18051
+ for (let i = 1; i < arrColumns.length; i++) {
18052
+ let cellNext = arrColumns[i];
18053
+ if (cellNext !== cell) {
18054
+ // cellNext.style.width = '';
18055
+ // cellNext.style.flex = '';
18056
+ if (!cellNext.getAttribute('data-html')) {
18057
+ cellNext.style.width = '';
18058
+ cellNext.style.flex = '';
18059
+ } else {
18060
+ // For module, don't change width, except if there are 2 columns only
18061
+ if (arrColumns.length === 2) {
18062
+ cellNext.style.width = 100 - parseFloat(w) + '%';
18063
+ cellNext.style.flex = '0 0 auto';
18064
+ }
18065
+ }
18066
+ this.removeColClasses(cellNext);
18067
+ }
18068
+ }
18013
18069
  }
18014
18070
  this.builder.opts.onChange();
18015
18071
  }
@@ -74347,25 +74403,33 @@ class Resize {
74347
74403
  if (item === col) return;
74348
74404
 
74349
74405
  // // item.style.width = '100%';
74350
- // if(!item.getAttribute('data-module')) item.style.width = '100%';
74406
+ // if(!item.getAttribute('data-html')) item.style.width = '100%';
74351
74407
  // item.style.flex = '';
74352
74408
  if (numOfCols === 2) {
74353
- if (!item.getAttribute('data-module')) {
74409
+ if (!item.getAttribute('data-html')) {
74354
74410
  item.style.width = '100%';
74355
74411
  item.style.flex = '';
74356
74412
  }
74357
74413
  } /*else {
74358
- // if(!item.getAttribute('data-module') && !item.style.width) {
74414
+ // if(!item.getAttribute('data-html') && !item.style.width) {
74359
74415
  // item.style.width = '100%';
74360
74416
  // item.style.flex = '';
74361
74417
  // }
74362
- if(!item.getAttribute('data-module') && item===col.nextElementSibling) {
74418
+ if(!item.getAttribute('data-html') && item===col.nextElementSibling) {
74363
74419
  item.style.width = '100%';
74364
74420
  item.style.flex = '';
74365
74421
  }
74366
74422
  }*/
74367
- });
74368
74423
 
74424
+ /* New: Specify width for module only, and only if num of columns = 2 */
74425
+ if (numOfCols === 2) {
74426
+ if (item.getAttribute('data-html')) {
74427
+ let percentage = col.offsetWidth / col.parentNode.offsetWidth * 100;
74428
+ item.style.width = 100 - percentage + '%';
74429
+ item.style.flex = '0 0 auto';
74430
+ }
74431
+ }
74432
+ });
74369
74433
  if (numOfCols === 1) {
74370
74434
  col.style.width = '100%';
74371
74435
  }
@@ -74380,9 +74444,18 @@ class Resize {
74380
74444
  if (item === col) return;
74381
74445
  if (item.style.width === '') {
74382
74446
  // item.style.width = '100%';
74383
- if (!item.getAttribute('data-module')) item.style.width = '100%';
74447
+ if (!item.getAttribute('data-html')) item.style.width = '100%';
74384
74448
  item.style.flex = '';
74385
74449
  }
74450
+
74451
+ /* New: Specify width for module only, and only if num of columns = 2 */
74452
+ if (numOfCols === 2) {
74453
+ if (item.getAttribute('data-html')) {
74454
+ let percentage = col.offsetWidth / col.parentNode.offsetWidth * 100;
74455
+ item.style.width = 100 - percentage + '%';
74456
+ item.style.flex = '0 0 auto';
74457
+ }
74458
+ }
74386
74459
  });
74387
74460
  }
74388
74461
  // /adjust others
@@ -74437,19 +74510,19 @@ class Resize {
74437
74510
  if (item === col) return;
74438
74511
 
74439
74512
  // // item.style.width = '100%';
74440
- // if(!item.getAttribute('data-module')) item.style.width = '100%';
74513
+ // if(!item.getAttribute('data-html')) item.style.width = '100%';
74441
74514
  // item.style.flex = '';
74442
74515
  if (numOfCols === 2) {
74443
- if (!item.getAttribute('data-module')) {
74516
+ if (!item.getAttribute('data-html')) {
74444
74517
  item.style.width = '100%';
74445
74518
  item.style.flex = '';
74446
74519
  }
74447
74520
  } /*else {
74448
- // if(!item.getAttribute('data-module') && !item.style.width) {
74521
+ // if(!item.getAttribute('data-html') && !item.style.width) {
74449
74522
  // item.style.width = '100%';
74450
74523
  // item.style.flex = '';
74451
74524
  // }
74452
- if(!item.getAttribute('data-module') && item===col.nextElementSibling) {
74525
+ if(!item.getAttribute('data-html') && item===col.nextElementSibling) {
74453
74526
  item.style.width = '100%';
74454
74527
  item.style.flex = '';
74455
74528
  }
@@ -74468,7 +74541,7 @@ class Resize {
74468
74541
  // if(this.opts.filterSibling) if(item.classList.contains(this.opts.filterSibling)) return;
74469
74542
 
74470
74543
  // // Refresh Module
74471
- // if(item.getAttribute('data-module')) {
74544
+ // if(item.getAttribute('data-html')) {
74472
74545
  // this.builder.util.refreshModuleLayout(item);
74473
74546
  // }
74474
74547
 
@@ -74489,7 +74562,7 @@ class Resize {
74489
74562
  if (item.classList.contains('is-row-tool')) return;
74490
74563
  if (item.classList.contains('is-rowadd-tool')) return;
74491
74564
  if (item.classList.contains('is-col-tool')) return;
74492
- if (item.getAttribute('data-module')) {
74565
+ if (item.getAttribute('data-html')) {
74493
74566
  let moduleWidth = item.offsetWidth / row.offsetWidth * 100;
74494
74567
  item.style.width = moduleWidth + '%';
74495
74568
  item.style.flex = 'none';
@@ -75544,10 +75617,24 @@ class ContentStuff {
75544
75617
 
75545
75618
  /* Make slider block resizable */
75546
75619
  .is-builder > div > div[data-module=slider-builder].cell-active {
75547
- padding: 0 2px 4px !important;
75620
+ /*padding: 0 2px 4px !important;*/
75548
75621
  z-index: 1 !important;
75549
75622
  }
75623
+
75624
+ div[data-html] {
75625
+ min-height: 70px;
75626
+ }
75550
75627
 
75628
+ [data-module="slider-builder"] *,
75629
+ [data-module="text-builder"] * {
75630
+ outline: none !important;
75631
+ }
75632
+
75633
+ /* Make slider block resizable */
75634
+ .padding-0[data-module="slider-builder"],
75635
+ .padding-0[data-module="text-builder"] {
75636
+ padding: 0 2px 4px !important;
75637
+ }
75551
75638
  `;
75552
75639
  builder.contentStuff.insertAdjacentHTML('afterbegin', `
75553
75640
  <style>
@@ -77400,7 +77487,7 @@ class Dictation {
77400
77487
  align-items: center;">
77401
77488
  ${util.out('Send a Command')}</span>
77402
77489
  <button class="is-modal-close" tabindex="-1" title="${util.out('Close')}">
77403
- <svg class="is-icon-flex"><use xlink:href="#ion-ios-close-empty"></use></svg>
77490
+ <svg class="is-icon-flex"style="width:20px;height:20px"><use xlink:href="#ion-ios-close-empty"></use></svg>
77404
77491
  </button>
77405
77492
  </div>
77406
77493
  <div style="display:flex;flex-direction:column;justify-content:space-between;position:absolute;box-sizing:border-box;top:0;left:0;width:100%;height:100%;border-top:transparent 35px solid;overflow-y:hidden;overflow-x:auto;">
@@ -77447,6 +77534,11 @@ class Dictation {
77447
77534
  const btnClear = builderStuff.querySelector('.cmd-clear-command');
77448
77535
  const chkAutoSend = builderStuff.querySelector('#chkAutoSendCommand');
77449
77536
  const btnCommandList = builderStuff.querySelector('.cmd-command-list');
77537
+ const inpCommand = this.builderStuff.querySelector('.inp-command');
77538
+ if (localStorage.getItem('_sampleshown') === null) {
77539
+ inpCommand.setAttribute('placeholder', this.builder.sampleCommand);
77540
+ localStorage.setItem('_sampleshown', true);
77541
+ }
77450
77542
  this.builder.commandText = '';
77451
77543
  this.builder.autoSendCommand = false;
77452
77544
  if (localStorage.getItem('_dictation') !== null) {
@@ -77557,7 +77649,6 @@ class Dictation {
77557
77649
 
77558
77650
  this.opts.send(question);
77559
77651
  });
77560
- const inpCommand = this.builderStuff.querySelector('.inp-command');
77561
77652
  inpCommand.addEventListener('keydown', e => {
77562
77653
  if (e.keyCode === 13 && !e.shiftKey) {
77563
77654
  e.preventDefault();
@@ -77591,7 +77682,17 @@ class Dictation {
77591
77682
  }
77592
77683
  }
77593
77684
  openDictation() {
77685
+ if (this.modalCommand.classList.contains('active')) {
77686
+ setTimeout(() => {
77687
+ // Needed if opens programmatically on builder start (wait until all loaded)
77688
+ const inpCommand = this.modalCommand.querySelector('.inp-command');
77689
+ inpCommand.focus();
77690
+ }, 600);
77691
+ return;
77692
+ }
77594
77693
  this.modalCommand.classList.add('active');
77694
+ const inpCommand = this.modalCommand.querySelector('.inp-command');
77695
+ inpCommand.focus();
77595
77696
  localStorage.setItem('_dictation', '1');
77596
77697
  const chkAutoSend = this.builderStuff.querySelector('#chkAutoSendCommand');
77597
77698
  const btnClear = this.builderStuff.querySelector('.cmd-clear-command');
@@ -78419,6 +78520,7 @@ class ContentBuilder {
78419
78520
  /* Prompt/Command Stuff */
78420
78521
  isContentBox: false,
78421
78522
  sendCommandUrl: 'http://localhost:8081/answer',
78523
+ //sampleCommand: '',
78422
78524
  speechRecognitionLang: 'en-US',
78423
78525
  headlineList: ['We create simple and effective designs.', 'Ultimate Experiences With Story, Emotion, And Purpose.', 'Build Anything Beautifully', 'With Less Stuff and More Compassion', 'We\'re [CompanyName]. Full stack development with a spark of creativity.', 'Transforming your digital experience with [CompanyName]. Achieve your online goals with our customized solutions.', 'Revolutionizing web development with [CompanyName]. Unleash your digital potential with our high-performance solutions.', 'Creative and Inspiring'],
78424
78526
  shortCommandList: {
@@ -79693,9 +79795,9 @@ class ContentBuilder {
79693
79795
  const htmlutil = new HtmlUtil(this);
79694
79796
  htmlutil.viewHtmlExternal();
79695
79797
  }
79696
- readHtml(content, view, multiple) {
79798
+ readHtml(content, view, multiple, excludeCustomBlock) {
79697
79799
  const htmlutil = new HtmlUtil(this);
79698
- return htmlutil.readHtml(content, view, multiple);
79800
+ return htmlutil.readHtml(content, view, multiple, excludeCustomBlock);
79699
79801
  }
79700
79802
  fromViewToActual(html) {
79701
79803
  const htmlutil = new HtmlUtil(this);