@innovastudio/contentbuilder 1.4.32 → 1.4.33

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.33",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -77496,20 +77496,26 @@ class LivePreview {
77496
77496
  let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
77497
77497
 
77498
77498
  if (iframeDocument) {
77499
- if (iframeDocument.body.innerHTML === '') {
77499
+ if (!iframeDocument.body) {
77500
77500
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77501
77501
  } 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 {
77502
+ if (iframeDocument.body.innerHTML === '') {
77510
77503
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77504
+ } else {
77505
+ // sync. html
77506
+ let html = this.builder.html();
77507
+ let container = iframeDocument.querySelector('.container');
77508
+ if (!container) container = iframeDocument.querySelector('.is-container');
77509
+
77510
+ if (container) {
77511
+ container.innerHTML = html;
77512
+ } else {
77513
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77514
+ }
77511
77515
  }
77512
77516
  }
77517
+ } else {
77518
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77513
77519
  }
77514
77520
  }
77515
77521
  } else {
@@ -77535,80 +77541,84 @@ class LivePreview {
77535
77541
  let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
77536
77542
 
77537
77543
  if (iframeDocument) {
77538
- if (iframeDocument.body.innerHTML === '') {
77544
+ if (!iframeDocument.body) {
77539
77545
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77540
77546
  } 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;
77547
+ if (iframeDocument.body.innerHTML === '') {
77548
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
77549
+ } else {
77550
+ // sync. html
77551
+ let html = localStorage.getItem('preview-html');
77552
+ let wrapper = iframeDocument.querySelector('.is-wrapper');
77553
+ wrapper.innerHTML = html; // sync. styles
77554
+ // let mainCss = localStorage.getItem('preview-maincss');
77555
+ // let sectionCss = localStorage.getItem('preview-sectioncss');
77556
+
77557
+ let elms = iframeDocument.querySelectorAll('link');
77558
+ let links = this.builder.doc.getElementsByTagName('link');
77559
+ Array.from(links).map(link => {
77560
+ let href = link.href.toLowerCase();
77561
+
77562
+ if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
77563
+ // check
77564
+ let exist = false;
77565
+ elms.forEach(elm => {
77566
+ let elmHref = elm.href.toLowerCase();
77567
+
77568
+ if (elmHref) {
77569
+ if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
77570
+ if (href === elmHref) {
77571
+ exist = true;
77572
+ }
77563
77573
  }
77564
77574
  }
77565
- }
77566
- });
77575
+ });
77567
77576
 
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
77577
+ if (!exist) {
77578
+ // clone is needed, otherwise, parent resource may dissapear when loading on iframe
77579
+ const clone = link.cloneNode(true);
77580
+ iframeDocument.head.appendChild(clone); // ADD
77581
+ }
77572
77582
  }
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;
77583
+ });
77584
+ elms.forEach(elm => {
77585
+ let href = elm.href.toLowerCase();
77586
+
77587
+ if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
77588
+ // check
77589
+ let exist = false;
77590
+ Array.from(links).map(link => {
77591
+ let elmHref = link.href.toLowerCase();
77592
+
77593
+ if (elmHref) {
77594
+ if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
77595
+ if (href === elmHref) {
77596
+ exist = true;
77597
+ }
77588
77598
  }
77589
77599
  }
77590
- }
77591
- });
77600
+ });
77592
77601
 
77593
- if (!exist) {
77594
- iframeDocument.head.removeChild(elm); // REMOVE
77602
+ if (!exist) {
77603
+ iframeDocument.head.removeChild(elm); // REMOVE
77604
+ }
77595
77605
  }
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);
77606
+ }); // reload box js
77607
+
77608
+ elms = iframeDocument.querySelectorAll('script');
77609
+ elms.forEach(elm => {
77610
+ let src = elm.getAttribute('src');
77611
+
77612
+ if (src) {
77613
+ if (src.indexOf('box-flex.js') !== -1 || src.indexOf('box.js') !== -1) {
77614
+ elm.parentElement.removeChild(elm);
77615
+ let scriptElm = document.createElement('script');
77616
+ scriptElm.setAttribute('src', src);
77617
+ iframeDocument.body.appendChild(scriptElm);
77618
+ }
77609
77619
  }
77610
- }
77611
- });
77620
+ });
77621
+ }
77612
77622
  }
77613
77623
  } else {
77614
77624
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);