@innovastudio/contentbuilder 1.4.32 → 1.4.34

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.32",
4
+ "version": "1.4.34",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -52820,6 +52820,11 @@ class ButtonEditor {
52820
52820
  }
52821
52821
 
52822
52822
  activeButton.classList.remove('active');
52823
+
52824
+ if (activeButton.tagName.toLowerCase() === 'a') {
52825
+ activeButton.setAttribute('role', 'button');
52826
+ }
52827
+
52823
52828
  this.realtime();
52824
52829
  this.builder.opts.onChange();
52825
52830
  e.preventDefault();
@@ -52885,6 +52890,11 @@ class ButtonEditor {
52885
52890
  }
52886
52891
 
52887
52892
  activeButton.classList.remove('active');
52893
+
52894
+ if (activeButton.tagName.toLowerCase() === 'a') {
52895
+ activeButton.setAttribute('role', 'button');
52896
+ }
52897
+
52888
52898
  this.builder.opts.onChange();
52889
52899
  this.realtime();
52890
52900
  e.preventDefault();
@@ -52957,6 +52967,10 @@ class ButtonEditor {
52957
52967
  link.removeAttribute('data-hover-color');
52958
52968
  link.removeAttribute('data-hover-bordercolor');
52959
52969
  dom.addClass(link, 'whitespace-nowrap');
52970
+
52971
+ if (link.tagName.toLowerCase() === 'a') {
52972
+ link.setAttribute('role', 'button');
52973
+ }
52960
52974
  }
52961
52975
 
52962
52976
  cleanupOldClasses(link) {
@@ -77496,20 +77510,26 @@ class LivePreview {
77496
77510
  let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
77497
77511
 
77498
77512
  if (iframeDocument) {
77499
- if (iframeDocument.body.innerHTML === '') {
77513
+ if (!iframeDocument.body) {
77500
77514
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77501
77515
  } else {
77502
- // sync. html
77503
- let html = this.builder.html();
77504
- let container = iframeDocument.querySelector('.container');
77505
- if (!container) container = iframeDocument.querySelector('.is-container');
77506
-
77507
- if (container) {
77508
- container.innerHTML = html;
77509
- } else {
77516
+ if (iframeDocument.body.innerHTML === '') {
77510
77517
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77518
+ } else {
77519
+ // sync. html
77520
+ let html = this.builder.html();
77521
+ let container = iframeDocument.querySelector('.container');
77522
+ if (!container) container = iframeDocument.querySelector('.is-container');
77523
+
77524
+ if (container) {
77525
+ container.innerHTML = html;
77526
+ } else {
77527
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77528
+ }
77511
77529
  }
77512
77530
  }
77531
+ } else {
77532
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77513
77533
  }
77514
77534
  }
77515
77535
  } else {
@@ -77535,80 +77555,84 @@ class LivePreview {
77535
77555
  let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
77536
77556
 
77537
77557
  if (iframeDocument) {
77538
- if (iframeDocument.body.innerHTML === '') {
77558
+ if (!iframeDocument.body) {
77539
77559
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77540
77560
  } else {
77541
- // sync. html
77542
- let html = localStorage.getItem('preview-html');
77543
- let wrapper = iframeDocument.querySelector('.is-wrapper');
77544
- wrapper.innerHTML = html; // sync. styles
77545
- // let mainCss = localStorage.getItem('preview-maincss');
77546
- // let sectionCss = localStorage.getItem('preview-sectioncss');
77547
-
77548
- let elms = iframeDocument.querySelectorAll('link');
77549
- let links = this.builder.doc.getElementsByTagName('link');
77550
- Array.from(links).map(link => {
77551
- let href = link.href.toLowerCase();
77552
-
77553
- if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
77554
- // check
77555
- let exist = false;
77556
- elms.forEach(elm => {
77557
- let elmHref = elm.href.toLowerCase();
77558
-
77559
- if (elmHref) {
77560
- if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
77561
- if (href === elmHref) {
77562
- exist = true;
77561
+ if (iframeDocument.body.innerHTML === '') {
77562
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77563
+ } else {
77564
+ // sync. html
77565
+ let html = localStorage.getItem('preview-html');
77566
+ let wrapper = iframeDocument.querySelector('.is-wrapper');
77567
+ wrapper.innerHTML = html; // sync. styles
77568
+ // let mainCss = localStorage.getItem('preview-maincss');
77569
+ // let sectionCss = localStorage.getItem('preview-sectioncss');
77570
+
77571
+ let elms = iframeDocument.querySelectorAll('link');
77572
+ let links = this.builder.doc.getElementsByTagName('link');
77573
+ Array.from(links).map(link => {
77574
+ let href = link.href.toLowerCase();
77575
+
77576
+ if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
77577
+ // check
77578
+ let exist = false;
77579
+ elms.forEach(elm => {
77580
+ let elmHref = elm.href.toLowerCase();
77581
+
77582
+ if (elmHref) {
77583
+ if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
77584
+ if (href === elmHref) {
77585
+ exist = true;
77586
+ }
77563
77587
  }
77564
77588
  }
77565
- }
77566
- });
77589
+ });
77567
77590
 
77568
- if (!exist) {
77569
- // clone is needed, otherwise, parent resource may dissapear when loading on iframe
77570
- const clone = link.cloneNode(true);
77571
- iframeDocument.head.appendChild(clone); // ADD
77591
+ if (!exist) {
77592
+ // clone is needed, otherwise, parent resource may dissapear when loading on iframe
77593
+ const clone = link.cloneNode(true);
77594
+ iframeDocument.head.appendChild(clone); // ADD
77595
+ }
77572
77596
  }
77573
- }
77574
- });
77575
- elms.forEach(elm => {
77576
- let href = elm.href.toLowerCase();
77577
-
77578
- if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
77579
- // check
77580
- let exist = false;
77581
- Array.from(links).map(link => {
77582
- let elmHref = link.href.toLowerCase();
77583
-
77584
- if (elmHref) {
77585
- if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
77586
- if (href === elmHref) {
77587
- exist = true;
77597
+ });
77598
+ elms.forEach(elm => {
77599
+ let href = elm.href.toLowerCase();
77600
+
77601
+ if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
77602
+ // check
77603
+ let exist = false;
77604
+ Array.from(links).map(link => {
77605
+ let elmHref = link.href.toLowerCase();
77606
+
77607
+ if (elmHref) {
77608
+ if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
77609
+ if (href === elmHref) {
77610
+ exist = true;
77611
+ }
77588
77612
  }
77589
77613
  }
77590
- }
77591
- });
77614
+ });
77592
77615
 
77593
- if (!exist) {
77594
- iframeDocument.head.removeChild(elm); // REMOVE
77616
+ if (!exist) {
77617
+ iframeDocument.head.removeChild(elm); // REMOVE
77618
+ }
77595
77619
  }
77596
- }
77597
- }); // reload box js
77598
-
77599
- elms = iframeDocument.querySelectorAll('script');
77600
- elms.forEach(elm => {
77601
- let src = elm.getAttribute('src');
77602
-
77603
- if (src) {
77604
- if (src.indexOf('box-flex.js') !== -1 || src.indexOf('box.js') !== -1) {
77605
- elm.parentElement.removeChild(elm);
77606
- let scriptElm = document.createElement('script');
77607
- scriptElm.setAttribute('src', src);
77608
- iframeDocument.body.appendChild(scriptElm);
77620
+ }); // reload box js
77621
+
77622
+ elms = iframeDocument.querySelectorAll('script');
77623
+ elms.forEach(elm => {
77624
+ let src = elm.getAttribute('src');
77625
+
77626
+ if (src) {
77627
+ if (src.indexOf('box-flex.js') !== -1 || src.indexOf('box.js') !== -1) {
77628
+ elm.parentElement.removeChild(elm);
77629
+ let scriptElm = document.createElement('script');
77630
+ scriptElm.setAttribute('src', src);
77631
+ iframeDocument.body.appendChild(scriptElm);
77632
+ }
77609
77633
  }
77610
- }
77611
- });
77634
+ });
77635
+ }
77612
77636
  }
77613
77637
  } else {
77614
77638
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);