@innovastudio/contentbuilder 1.4.31 → 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
@@ -77435,12 +77435,16 @@ class LivePreview {
|
|
77435
77435
|
resizePreview(size) {
|
77436
77436
|
let modal = this.modal;
|
77437
77437
|
let util = this.util;
|
77438
|
+
modal.classList.remove('is-screen-1920');
|
77438
77439
|
modal.classList.remove('is-screen-1440');
|
77439
77440
|
modal.classList.remove('is-screen-1920');
|
77440
77441
|
modal.classList.remove('is-screen-1024');
|
77441
77442
|
modal.classList.remove('is-screen-768');
|
77442
77443
|
modal.classList.remove('is-screen-375');
|
77443
77444
|
const infoDevice = modal.querySelector('.is-modal-device');
|
77445
|
+
const previewScreen = modal.querySelector('.preview-screen');
|
77446
|
+
previewScreen.style.transition = 'none';
|
77447
|
+
previewScreen.style.opacity = '0';
|
77444
77448
|
|
77445
77449
|
if (size === 1440) {
|
77446
77450
|
modal.classList.add('is-screen-1440');
|
@@ -77448,7 +77452,6 @@ class LivePreview {
|
|
77448
77452
|
infoDevice.setAttribute('title', util.out('Laptop'));
|
77449
77453
|
infoDevice.innerHTML = '<svg class="is-icon-flex" style="width:18px;height:18px"><use xlink:href="#icon-device-laptop"></use></svg>';
|
77450
77454
|
} else if (size === 1024) {
|
77451
|
-
modal.classList.remove('is-screen-1440');
|
77452
77455
|
modal.classList.add('is-screen-1024');
|
77453
77456
|
infoDevice.setAttribute('title', util.out('Tablet (Landscape)'));
|
77454
77457
|
localStorage.setItem('_livepreviewscreen', 'is-screen-1024');
|
@@ -77471,6 +77474,10 @@ class LivePreview {
|
|
77471
77474
|
}
|
77472
77475
|
|
77473
77476
|
this.previewRefresh(true);
|
77477
|
+
setTimeout(() => {
|
77478
|
+
previewScreen.style.opacity = '';
|
77479
|
+
previewScreen.style.transition = '';
|
77480
|
+
}, 100);
|
77474
77481
|
}
|
77475
77482
|
|
77476
77483
|
previewRefresh(disableOnContentLoad, hardReload) {
|
@@ -77489,20 +77496,26 @@ class LivePreview {
|
|
77489
77496
|
let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
77490
77497
|
|
77491
77498
|
if (iframeDocument) {
|
77492
|
-
if (iframeDocument.body
|
77499
|
+
if (!iframeDocument.body) {
|
77493
77500
|
iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
|
77494
77501
|
} else {
|
77495
|
-
|
77496
|
-
let html = this.builder.html();
|
77497
|
-
let container = iframeDocument.querySelector('.container');
|
77498
|
-
if (!container) container = iframeDocument.querySelector('.is-container');
|
77499
|
-
|
77500
|
-
if (container) {
|
77501
|
-
container.innerHTML = html;
|
77502
|
-
} else {
|
77502
|
+
if (iframeDocument.body.innerHTML === '') {
|
77503
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
|
+
}
|
77504
77515
|
}
|
77505
77516
|
}
|
77517
|
+
} else {
|
77518
|
+
iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
|
77506
77519
|
}
|
77507
77520
|
}
|
77508
77521
|
} else {
|
@@ -77528,80 +77541,84 @@ class LivePreview {
|
|
77528
77541
|
let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
77529
77542
|
|
77530
77543
|
if (iframeDocument) {
|
77531
|
-
if (iframeDocument.body
|
77544
|
+
if (!iframeDocument.body) {
|
77532
77545
|
iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
|
77533
77546
|
} else {
|
77534
|
-
|
77535
|
-
|
77536
|
-
|
77537
|
-
|
77538
|
-
|
77539
|
-
|
77540
|
-
|
77541
|
-
|
77542
|
-
|
77543
|
-
|
77544
|
-
let
|
77545
|
-
|
77546
|
-
|
77547
|
-
|
77548
|
-
|
77549
|
-
|
77550
|
-
|
77551
|
-
|
77552
|
-
|
77553
|
-
|
77554
|
-
|
77555
|
-
|
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
|
+
}
|
77556
77573
|
}
|
77557
77574
|
}
|
77558
|
-
}
|
77559
|
-
});
|
77575
|
+
});
|
77560
77576
|
|
77561
|
-
|
77562
|
-
|
77563
|
-
|
77564
|
-
|
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
|
+
}
|
77565
77582
|
}
|
77566
|
-
}
|
77567
|
-
|
77568
|
-
|
77569
|
-
|
77570
|
-
|
77571
|
-
|
77572
|
-
|
77573
|
-
|
77574
|
-
|
77575
|
-
|
77576
|
-
|
77577
|
-
|
77578
|
-
|
77579
|
-
|
77580
|
-
|
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
|
+
}
|
77581
77598
|
}
|
77582
77599
|
}
|
77583
|
-
}
|
77584
|
-
});
|
77600
|
+
});
|
77585
77601
|
|
77586
|
-
|
77587
|
-
|
77602
|
+
if (!exist) {
|
77603
|
+
iframeDocument.head.removeChild(elm); // REMOVE
|
77604
|
+
}
|
77588
77605
|
}
|
77589
|
-
}
|
77590
|
-
|
77591
|
-
|
77592
|
-
|
77593
|
-
|
77594
|
-
|
77595
|
-
|
77596
|
-
|
77597
|
-
|
77598
|
-
|
77599
|
-
|
77600
|
-
|
77601
|
-
|
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
|
+
}
|
77602
77619
|
}
|
77603
|
-
}
|
77604
|
-
}
|
77620
|
+
});
|
77621
|
+
}
|
77605
77622
|
}
|
77606
77623
|
} else {
|
77607
77624
|
iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
|