@innovastudio/contentbox 1.5.32 → 1.5.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/contentbox",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.34",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "public/contentbox/contentbox.esm.js",
|
|
7
7
|
"files": [
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"webpack-dev-server": "^4.0.0"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@innovastudio/contentbuilder": "^1.4.
|
|
49
|
+
"@innovastudio/contentbuilder": "^1.4.26",
|
|
50
50
|
"js-beautify": "^1.14.0"
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -12781,11 +12781,13 @@ class EditBox {
|
|
|
12781
12781
|
|
|
12782
12782
|
activeModule.setAttribute('data-html', encodeURIComponent(hidModuleCode.value)); //Save Settings (original)
|
|
12783
12783
|
|
|
12784
|
-
activeModule.setAttribute('data-settings', encodeURIComponent(hidModuleSettings.value));
|
|
12784
|
+
activeModule.setAttribute('data-settings', encodeURIComponent(hidModuleSettings.value));
|
|
12785
|
+
let html = hidModuleCode.value;
|
|
12786
|
+
html = html.replace(/{id}/g, dom$l.uniqueId()); //Render (programmatically)
|
|
12785
12787
|
|
|
12786
12788
|
let range = document.createRange();
|
|
12787
12789
|
activeModule.innerHTML = '';
|
|
12788
|
-
activeModule.appendChild(range.createContextualFragment(
|
|
12790
|
+
activeModule.appendChild(range.createContextualFragment(html)); // We use createContextualFragment so that embedded javascript code (code block) will be executed
|
|
12789
12791
|
//Trigger Render event
|
|
12790
12792
|
|
|
12791
12793
|
this.builder.settings.onRender(); //Trigger Change event
|
|
@@ -73110,6 +73112,7 @@ class ColumnTool {
|
|
|
73110
73112
|
const util = this.builder.util;
|
|
73111
73113
|
const builderStuff = this.builder.builderStuff;
|
|
73112
73114
|
this.util = util;
|
|
73115
|
+
this.builderStuff = builderStuff;
|
|
73113
73116
|
const dom = this.builder.dom;
|
|
73114
73117
|
this.dom = dom;
|
|
73115
73118
|
let columnMore = builderStuff.querySelector('.is-pop.columnmore');
|
|
@@ -73218,9 +73221,6 @@ class ColumnTool {
|
|
|
73218
73221
|
<button title="${util.out('Desktop')}" class="input-device on" data-value="" style="width:40px;height:25px;">
|
|
73219
73222
|
<svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-desktop"></use></svg>
|
|
73220
73223
|
</button>
|
|
73221
|
-
<!--<button title="${util.out('Laptop/Tablet (Landscape)')}" class="input-device" data-value="md" style="width:40px;height:25px;">
|
|
73222
|
-
<svg class="is-icon-flex" style="width:19px;height:19px;"><use xlink:href="#icon-device-laptop"></use></svg>
|
|
73223
|
-
</button>-->
|
|
73224
73224
|
<button title="${util.out('Laptop/Tablet (Landscape)')}" class="input-device" data-value="md" style="width:40px;height:25px;">
|
|
73225
73225
|
<svg class="is-icon-flex" style="width:16px;height:16px;transform:rotate(-90deg)"><use xlink:href="#icon-device-tablet"></use></svg>
|
|
73226
73226
|
</button>
|
|
@@ -73411,6 +73411,21 @@ class ColumnTool {
|
|
|
73411
73411
|
|
|
73412
73412
|
<div style="padding:0;margin-top:25px;">
|
|
73413
73413
|
|
|
73414
|
+
<div class="div-target" style="display: flex;justify-content: flex-end;padding: 5px 0 0;">
|
|
73415
|
+
<button title="${util.out('Desktop')}" class="input-device on" data-value="" style="width:40px;height:25px;">
|
|
73416
|
+
<svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-desktop"></use></svg>
|
|
73417
|
+
</button>
|
|
73418
|
+
<button title="${util.out('Laptop/Tablet (Landscape)')}" class="input-device" data-value="md" style="width:40px;height:25px;">
|
|
73419
|
+
<svg class="is-icon-flex" style="width:16px;height:16px;transform:rotate(-90deg)"><use xlink:href="#icon-device-tablet"></use></svg>
|
|
73420
|
+
</button>
|
|
73421
|
+
<button title="${util.out('Tablet (Portrait)')}" class="input-device" data-value="sm" style="width:40px;height:25px;">
|
|
73422
|
+
<svg class="is-icon-flex" style="width:16px;height:16px"><use xlink:href="#icon-device-tablet"></use></svg>
|
|
73423
|
+
</button>
|
|
73424
|
+
<button title="${util.out('Mobile')}" class="input-device" data-value="xs" style="width:40px;height:25px;">
|
|
73425
|
+
<svg class="is-icon-flex" style="width:13px;height:13px"><use xlink:href="#icon-device-mobile"></use></svg>
|
|
73426
|
+
</button>
|
|
73427
|
+
</div>
|
|
73428
|
+
|
|
73414
73429
|
<div style="padding-bottom:3px;">${util.out('Scale')}:</div>
|
|
73415
73430
|
<div style="padding-top:4px">
|
|
73416
73431
|
<input type="range" min="100" max="500" value="0" class="image-scale-slider is-rangeslider">
|
|
@@ -75029,6 +75044,25 @@ class ColumnTool {
|
|
|
75029
75044
|
btnHidden.classList.add('on'); //Trigger Change event
|
|
75030
75045
|
|
|
75031
75046
|
this.builder.opts.onChange();
|
|
75047
|
+
}); // Responsive Image Adjust
|
|
75048
|
+
|
|
75049
|
+
btns = this.imageAdjust.querySelectorAll('.input-device');
|
|
75050
|
+
btns.forEach(btn => {
|
|
75051
|
+
btn.addEventListener('click', () => {
|
|
75052
|
+
let elms = this.imageAdjust.querySelectorAll('.input-device');
|
|
75053
|
+
elms.forEach(elm => {
|
|
75054
|
+
elm.classList.remove('on');
|
|
75055
|
+
});
|
|
75056
|
+
btn.classList.add('on');
|
|
75057
|
+
const modal = builderStuff.querySelector('.is-modal.content-preview');
|
|
75058
|
+
|
|
75059
|
+
if (!modal.classList.contains('active')) {
|
|
75060
|
+
this.builder.openPreview();
|
|
75061
|
+
}
|
|
75062
|
+
|
|
75063
|
+
this.realtimeImageAdjust();
|
|
75064
|
+
this.readImageAdjust(this.builder.elementSelected, this.useTarget);
|
|
75065
|
+
});
|
|
75032
75066
|
});
|
|
75033
75067
|
}
|
|
75034
75068
|
|
|
@@ -75296,9 +75330,8 @@ class ColumnTool {
|
|
|
75296
75330
|
if (btn) btn.setAttribute('data-focus', true);
|
|
75297
75331
|
}
|
|
75298
75332
|
|
|
75299
|
-
|
|
75300
|
-
|
|
75301
|
-
|
|
75333
|
+
readImageAdjust(elm, useTarget) {
|
|
75334
|
+
//Current value
|
|
75302
75335
|
const imageAdjust = this.imageAdjust;
|
|
75303
75336
|
const inpImageScaleSlider = imageAdjust.querySelector('.image-scale-slider');
|
|
75304
75337
|
const inpImageHorSlider = imageAdjust.querySelector('.image-hor-slider');
|
|
@@ -75306,6 +75339,7 @@ class ColumnTool {
|
|
|
75306
75339
|
inpImageScaleSlider.value = 100;
|
|
75307
75340
|
inpImageHorSlider.value = 0;
|
|
75308
75341
|
inpImageVertSlider.value = 0;
|
|
75342
|
+
inpImageScaleSlider.disabled = false;
|
|
75309
75343
|
|
|
75310
75344
|
if (useTarget) {
|
|
75311
75345
|
inpImageHorSlider.value = 50;
|
|
@@ -75384,16 +75418,79 @@ class ColumnTool {
|
|
|
75384
75418
|
} //elementSelected
|
|
75385
75419
|
|
|
75386
75420
|
|
|
75387
|
-
this.builder.elementSelected = elm;
|
|
75421
|
+
this.builder.elementSelected = elm;
|
|
75422
|
+
}
|
|
75423
|
+
|
|
75424
|
+
openImageAdjust(elm, btn, useTarget) {
|
|
75425
|
+
if (useTarget) this.useTarget = true;else this.useTarget = false;
|
|
75426
|
+
const divTarget = this.imageAdjust.querySelector('.div-target');
|
|
75427
|
+
|
|
75428
|
+
if (useTarget) {
|
|
75429
|
+
divTarget.style.display = 'flex';
|
|
75430
|
+
} else {
|
|
75431
|
+
divTarget.style.display = 'none';
|
|
75432
|
+
}
|
|
75388
75433
|
|
|
75389
|
-
|
|
75390
|
-
this.
|
|
75434
|
+
const modal = this.builderStuff.querySelector('.is-modal.content-preview');
|
|
75435
|
+
let elms = this.imageAdjust.querySelectorAll('.input-device');
|
|
75436
|
+
elms.forEach(elm => {
|
|
75437
|
+
elm.classList.remove('on');
|
|
75438
|
+
});
|
|
75439
|
+
|
|
75440
|
+
if (!modal.classList.contains('active')) {
|
|
75441
|
+
this.imageAdjust.querySelector('.input-device[data-value=""]').classList.add('on');
|
|
75442
|
+
}
|
|
75443
|
+
|
|
75444
|
+
this.readImageAdjust(elm, useTarget); //Show modal
|
|
75445
|
+
|
|
75446
|
+
this.imageAdjust.style.zIndex = '10005';
|
|
75447
|
+
this.util.showModal(this.imageAdjust, false, () => {
|
|
75391
75448
|
if (btn) {
|
|
75392
75449
|
btn.removeAttribute('data-focus');
|
|
75393
75450
|
btn.focus();
|
|
75394
75451
|
}
|
|
75395
75452
|
});
|
|
75396
75453
|
if (btn) btn.setAttribute('data-focus', true);
|
|
75454
|
+
this.realtimeImageAdjust(true);
|
|
75455
|
+
}
|
|
75456
|
+
|
|
75457
|
+
realtimeImageAdjust(initialOpen) {
|
|
75458
|
+
if (initialOpen) {
|
|
75459
|
+
const builderStuff = this.builder.builderStuff;
|
|
75460
|
+
const modal = builderStuff.querySelector('.is-modal.content-preview.active');
|
|
75461
|
+
|
|
75462
|
+
if (modal) {
|
|
75463
|
+
let elms = this.imageAdjust.querySelectorAll('.input-device');
|
|
75464
|
+
elms.forEach(elm => {
|
|
75465
|
+
elm.classList.remove('on');
|
|
75466
|
+
});
|
|
75467
|
+
|
|
75468
|
+
if (modal.classList.contains('is-screen-1920')) {
|
|
75469
|
+
this.imageAdjust.querySelector('.input-device[data-value=""]').classList.add('on');
|
|
75470
|
+
} else if (modal.classList.contains('is-screen-1440')) {
|
|
75471
|
+
this.imageAdjust.querySelector('.input-device[data-value=""]').classList.add('on');
|
|
75472
|
+
} else if (modal.classList.contains('is-screen-1024')) {
|
|
75473
|
+
this.imageAdjust.querySelector('.input-device[data-value="md"]').classList.add('on');
|
|
75474
|
+
} else if (modal.classList.contains('is-screen-768')) {
|
|
75475
|
+
this.imageAdjust.querySelector('.input-device[data-value="sm"]').classList.add('on');
|
|
75476
|
+
} else if (modal.classList.contains('is-screen-375')) {
|
|
75477
|
+
this.imageAdjust.querySelector('.input-device[data-value="xs"]').classList.add('on');
|
|
75478
|
+
}
|
|
75479
|
+
}
|
|
75480
|
+
}
|
|
75481
|
+
|
|
75482
|
+
let divTarget = this.imageAdjust.querySelector('.div-target');
|
|
75483
|
+
let target = this.builder.responsive.readTarget(divTarget); // Live Preview Sync
|
|
75484
|
+
|
|
75485
|
+
if (target === 'xs') {
|
|
75486
|
+
if (!initialOpen) this.builder.livePreview.resizePreview(375);
|
|
75487
|
+
} else if (target === 'sm') {
|
|
75488
|
+
if (!initialOpen) this.builder.livePreview.resizePreview(768);
|
|
75489
|
+
} else if (target === 'md') {
|
|
75490
|
+
if (!initialOpen) this.builder.livePreview.resizePreview(1024);
|
|
75491
|
+
} else {
|
|
75492
|
+
if (!initialOpen) this.builder.livePreview.resizePreview(1920);
|
|
75493
|
+
}
|
|
75397
75494
|
}
|
|
75398
75495
|
|
|
75399
75496
|
resetImage(elm) {
|
|
@@ -91576,7 +91673,28 @@ class LivePreview {
|
|
|
91576
91673
|
if (!this.builder.doc.querySelector('.is-wrapper')) {
|
|
91577
91674
|
// ContentBuilder
|
|
91578
91675
|
if (this.builder.previewURL) {
|
|
91579
|
-
|
|
91676
|
+
if (this.builder.livePreviewAlwaysReload) {
|
|
91677
|
+
iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
|
|
91678
|
+
} else {
|
|
91679
|
+
let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
|
91680
|
+
|
|
91681
|
+
if (iframeDocument) {
|
|
91682
|
+
if (iframeDocument.body.innerHTML === '') {
|
|
91683
|
+
iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
|
|
91684
|
+
} else {
|
|
91685
|
+
// sync. html
|
|
91686
|
+
let html = this.builder.html();
|
|
91687
|
+
let container = iframeDocument.querySelector('.container');
|
|
91688
|
+
if (!container) container = iframeDocument.querySelector('.is-container');
|
|
91689
|
+
|
|
91690
|
+
if (container) {
|
|
91691
|
+
container.innerHTML = html;
|
|
91692
|
+
} else {
|
|
91693
|
+
iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
|
|
91694
|
+
}
|
|
91695
|
+
}
|
|
91696
|
+
}
|
|
91697
|
+
}
|
|
91580
91698
|
} else {
|
|
91581
91699
|
try {
|
|
91582
91700
|
this.writeHtml(iframe);
|
|
@@ -91584,7 +91702,92 @@ class LivePreview {
|
|
|
91584
91702
|
}
|
|
91585
91703
|
}
|
|
91586
91704
|
} else {
|
|
91587
|
-
|
|
91705
|
+
// ContentBox
|
|
91706
|
+
if (this.builder.livePreviewAlwaysReload) {
|
|
91707
|
+
iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
|
|
91708
|
+
} else {
|
|
91709
|
+
let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
|
|
91710
|
+
|
|
91711
|
+
if (iframeDocument) {
|
|
91712
|
+
if (iframeDocument.body.innerHTML === '') {
|
|
91713
|
+
iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
|
|
91714
|
+
} else {
|
|
91715
|
+
// sync. html
|
|
91716
|
+
let html = localStorage.getItem('preview-html');
|
|
91717
|
+
let wrapper = iframeDocument.querySelector('.is-wrapper');
|
|
91718
|
+
wrapper.innerHTML = html; // sync. styles
|
|
91719
|
+
// let mainCss = localStorage.getItem('preview-maincss');
|
|
91720
|
+
// let sectionCss = localStorage.getItem('preview-sectioncss');
|
|
91721
|
+
|
|
91722
|
+
let elms = iframeDocument.querySelectorAll('link');
|
|
91723
|
+
let links = this.builder.doc.getElementsByTagName('link');
|
|
91724
|
+
Array.from(links).map(link => {
|
|
91725
|
+
let href = link.href.toLowerCase();
|
|
91726
|
+
|
|
91727
|
+
if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
|
|
91728
|
+
// check
|
|
91729
|
+
let exist = false;
|
|
91730
|
+
elms.forEach(elm => {
|
|
91731
|
+
let elmHref = elm.href.toLowerCase();
|
|
91732
|
+
|
|
91733
|
+
if (elmHref) {
|
|
91734
|
+
if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
|
|
91735
|
+
if (href === elmHref) {
|
|
91736
|
+
exist = true;
|
|
91737
|
+
}
|
|
91738
|
+
}
|
|
91739
|
+
}
|
|
91740
|
+
});
|
|
91741
|
+
|
|
91742
|
+
if (!exist) {
|
|
91743
|
+
// clone is needed, otherwise, parent resource may dissapear when loading on iframe
|
|
91744
|
+
const clone = link.cloneNode(true);
|
|
91745
|
+
iframeDocument.head.appendChild(clone); // ADD
|
|
91746
|
+
}
|
|
91747
|
+
}
|
|
91748
|
+
});
|
|
91749
|
+
elms.forEach(elm => {
|
|
91750
|
+
let href = elm.href.toLowerCase();
|
|
91751
|
+
|
|
91752
|
+
if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
|
|
91753
|
+
// check
|
|
91754
|
+
let exist = false;
|
|
91755
|
+
Array.from(links).map(link => {
|
|
91756
|
+
let elmHref = link.href.toLowerCase();
|
|
91757
|
+
|
|
91758
|
+
if (elmHref) {
|
|
91759
|
+
if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
|
|
91760
|
+
if (href === elmHref) {
|
|
91761
|
+
exist = true;
|
|
91762
|
+
}
|
|
91763
|
+
}
|
|
91764
|
+
}
|
|
91765
|
+
});
|
|
91766
|
+
|
|
91767
|
+
if (!exist) {
|
|
91768
|
+
iframeDocument.head.removeChild(elm); // REMOVE
|
|
91769
|
+
}
|
|
91770
|
+
}
|
|
91771
|
+
}); // reload box js
|
|
91772
|
+
|
|
91773
|
+
elms = iframeDocument.querySelectorAll('script');
|
|
91774
|
+
elms.forEach(elm => {
|
|
91775
|
+
let src = elm.getAttribute('src');
|
|
91776
|
+
|
|
91777
|
+
if (src) {
|
|
91778
|
+
if (src.indexOf('box-flex.js') !== -1 || src.indexOf('box.js') !== -1) {
|
|
91779
|
+
elm.parentElement.removeChild(elm);
|
|
91780
|
+
let scriptElm = document.createElement('script');
|
|
91781
|
+
scriptElm.setAttribute('src', src);
|
|
91782
|
+
iframeDocument.body.appendChild(scriptElm);
|
|
91783
|
+
}
|
|
91784
|
+
}
|
|
91785
|
+
});
|
|
91786
|
+
}
|
|
91787
|
+
} else {
|
|
91788
|
+
iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
|
|
91789
|
+
}
|
|
91790
|
+
}
|
|
91588
91791
|
}
|
|
91589
91792
|
|
|
91590
91793
|
iframe.onload = () => {
|
|
@@ -91719,6 +91922,7 @@ class ContentBuilder {
|
|
|
91719
91922
|
// onPreviewClose: ()=>{},
|
|
91720
91923
|
previewStyle: 'top:auto;bottom:50px;left:50px;right:auto;',
|
|
91721
91924
|
livePreviewOpen: false,
|
|
91925
|
+
livePreviewAlwaysReload: false,
|
|
91722
91926
|
scriptPath: '',
|
|
91723
91927
|
// Deprecated
|
|
91724
91928
|
// Old way:
|
|
@@ -99823,14 +100027,12 @@ class AnimateScroll {
|
|
|
99823
100027
|
this.clickContent();
|
|
99824
100028
|
}, 30);
|
|
99825
100029
|
}; //Extend onChange
|
|
100030
|
+
// let old2 = this.builder.settings.onChange;
|
|
100031
|
+
// this.builder.settings.onChange = ()=>{
|
|
100032
|
+
// old2.call(this);
|
|
100033
|
+
// this.builder.editor.livePreview.previewRefresh();
|
|
100034
|
+
// };
|
|
99826
100035
|
|
|
99827
|
-
|
|
99828
|
-
let old2 = this.builder.settings.onChange;
|
|
99829
|
-
|
|
99830
|
-
this.builder.settings.onChange = () => {
|
|
99831
|
-
old2.call(this);
|
|
99832
|
-
this.builder.editor.livePreview.previewRefresh();
|
|
99833
|
-
};
|
|
99834
100036
|
}
|
|
99835
100037
|
|
|
99836
100038
|
openPreview() {
|