@innovastudio/contentbox 1.3.17 → 1.3.20
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,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@innovastudio/contentbox",
|
3
|
-
"version": "1.3.
|
3
|
+
"version": "1.3.20",
|
4
4
|
"type": "module",
|
5
5
|
"description": "",
|
6
6
|
"main": "public/contentbox/contentbox.esm.js",
|
@@ -46,7 +46,7 @@
|
|
46
46
|
"webpack-dev-server": "^4.0.0"
|
47
47
|
},
|
48
48
|
"dependencies": {
|
49
|
-
"@innovastudio/contentbuilder": "^1.2.
|
49
|
+
"@innovastudio/contentbuilder": "^1.2.17",
|
50
50
|
"js-beautify": "^1.14.0"
|
51
51
|
}
|
52
52
|
}
|
@@ -1303,25 +1303,6 @@ class SideBar {
|
|
1303
1303
|
/* First Loading */
|
1304
1304
|
.is-category-list {opacity:0;transition: opacity ease 0.3s;}
|
1305
1305
|
.is-design-list {opacity:0;transition: opacity ease 0.3s;}
|
1306
|
-
.pace {
|
1307
|
-
-webkit-pointer-events: none;
|
1308
|
-
pointer-events: none;
|
1309
|
-
-webkit-user-select: none;
|
1310
|
-
-moz-user-select: none;
|
1311
|
-
user-select: none;
|
1312
|
-
}
|
1313
|
-
.pace-inactive {
|
1314
|
-
display: none;
|
1315
|
-
}
|
1316
|
-
.pace .pace-progress {
|
1317
|
-
background: #000000;
|
1318
|
-
position: fixed;
|
1319
|
-
z-index: 2000;
|
1320
|
-
top: 0;
|
1321
|
-
right: 100%;
|
1322
|
-
width: 100%;
|
1323
|
-
height: 2px;
|
1324
|
-
}
|
1325
1306
|
|
1326
1307
|
</style>
|
1327
1308
|
</head>`;
|
@@ -1399,6 +1380,14 @@ class SideBar {
|
|
1399
1380
|
<script src="${designUrl2}" type="text/javascript"></script>
|
1400
1381
|
|
1401
1382
|
<script>
|
1383
|
+
|
1384
|
+
applyParentStyles();
|
1385
|
+
setTimeout(()=>{
|
1386
|
+
document.querySelector('.is-category-list').style.opacity = 1;
|
1387
|
+
document.querySelector('.is-design-list').style.opacity = 1;
|
1388
|
+
},300);
|
1389
|
+
|
1390
|
+
|
1402
1391
|
function hasClass(element, classname) {
|
1403
1392
|
if(!element) return false;
|
1404
1393
|
try{
|
@@ -2345,12 +2334,6 @@ class SideBar {
|
|
2345
2334
|
}
|
2346
2335
|
});
|
2347
2336
|
|
2348
|
-
setTimeout(()=>{
|
2349
|
-
document.querySelector('.is-category-list').style.opacity = 1;
|
2350
|
-
document.querySelector('.is-design-list').style.opacity = 1;
|
2351
|
-
},300);
|
2352
|
-
|
2353
|
-
applyParentStyles();
|
2354
2337
|
</script>
|
2355
2338
|
</body>
|
2356
2339
|
</html>
|
@@ -10131,8 +10114,9 @@ class EditBox {
|
|
10131
10114
|
});
|
10132
10115
|
const btnModuleOk = modalEditModule.querySelector('.input-ok');
|
10133
10116
|
btnModuleOk.addEventListener('click', () => {
|
10134
|
-
let activeBox = this.builder.activeBox;
|
10135
|
-
let activeModule = activeBox.querySelector('.is-overlay-content[data-module]');
|
10117
|
+
// let activeBox = this.builder.activeBox;
|
10118
|
+
// let activeModule = activeBox.querySelector('.is-overlay-content[data-module]');
|
10119
|
+
let activeModule = document.querySelector('[data-module-active="1"]');
|
10136
10120
|
this.builder.editor.saveForUndo();
|
10137
10121
|
let modalIframe = modalEditModule.querySelector('iframe');
|
10138
10122
|
if (modalIframe.contentWindow.construct) modalIframe.contentWindow.construct();
|
@@ -10684,9 +10668,10 @@ class EditBox {
|
|
10684
10668
|
|
10685
10669
|
refreshModule() {
|
10686
10670
|
const modalEditModule = document.querySelector('.is-modal.editmodule');
|
10687
|
-
const builderStuff = this.builderStuff;
|
10688
|
-
let
|
10689
|
-
|
10671
|
+
const builderStuff = this.builderStuff; // let activeBox = this.builder.activeBox;
|
10672
|
+
// let activeModule = activeBox.querySelector('.is-overlay-content[data-module]');
|
10673
|
+
|
10674
|
+
let activeModule = document.querySelector('[data-module-active="1"]');
|
10690
10675
|
let modalIframe = modalEditModule.querySelector('iframe');
|
10691
10676
|
if (modalIframe.contentWindow.construct) modalIframe.contentWindow.construct();
|
10692
10677
|
const hidModuleCode = builderStuff.querySelector('#hidModuleCode');
|
@@ -15534,8 +15519,19 @@ class Util {
|
|
15534
15519
|
dom.addClass(pop, 'deactive');
|
15535
15520
|
}
|
15536
15521
|
|
15522
|
+
clearAllEventListener(pop) {
|
15523
|
+
for (let i = 0; i < 10; i++) {
|
15524
|
+
pop.removeEventListener('keydown', this.handlePopKeyDown);
|
15525
|
+
document.removeEventListener('click', this.handlePopClickOut);
|
15526
|
+
}
|
15527
|
+
}
|
15528
|
+
|
15537
15529
|
showPop(pop, cancelCallback, btn) {
|
15538
15530
|
const dom = this.dom;
|
15531
|
+
if (pop.style.display === 'flex') return; // important
|
15532
|
+
|
15533
|
+
this.clearAllEventListener(pop); // for safety of uncleared events as a result of closing without hidePop()
|
15534
|
+
|
15539
15535
|
pop.style.display = 'flex';
|
15540
15536
|
dom.addClass(pop, 'active');
|
15541
15537
|
pop.setAttribute('aria-hidden', false);
|
@@ -15544,37 +15540,40 @@ class Util {
|
|
15544
15540
|
preventScroll: true
|
15545
15541
|
});
|
15546
15542
|
|
15547
|
-
|
15543
|
+
this.handlePopClickOut = e => {
|
15548
15544
|
if (!pop.contains(e.target) && !btn.contains(e.target)) {
|
15549
15545
|
// click outside
|
15550
15546
|
// hide
|
15551
|
-
this.hidePop(pop);
|
15552
|
-
|
15553
|
-
|
15547
|
+
this.hidePop(pop); // pop.removeEventListener('keydown', this.handlePopKeyDown);
|
15548
|
+
// document.removeEventListener('click', this.handlePopClickOut);
|
15549
|
+
|
15554
15550
|
if (cancelCallback) cancelCallback();
|
15555
15551
|
}
|
15556
15552
|
};
|
15557
15553
|
|
15558
|
-
|
15554
|
+
this.handlePopKeyDown = e => {
|
15559
15555
|
if (e.keyCode === 27) {
|
15560
15556
|
// escape key
|
15561
15557
|
// hide
|
15562
|
-
this.hidePop(pop);
|
15563
|
-
|
15564
|
-
|
15558
|
+
this.hidePop(pop); // pop.removeEventListener('keydown', this.handlePopKeyDown);
|
15559
|
+
// document.removeEventListener('click', this.handlePopClickOut);
|
15560
|
+
|
15565
15561
|
if (cancelCallback) cancelCallback();
|
15566
15562
|
}
|
15567
15563
|
};
|
15568
15564
|
|
15569
|
-
pop.addEventListener('keydown',
|
15570
|
-
document.addEventListener('click',
|
15565
|
+
pop.addEventListener('keydown', this.handlePopKeyDown);
|
15566
|
+
document.addEventListener('click', this.handlePopClickOut);
|
15571
15567
|
}
|
15572
15568
|
|
15573
15569
|
hidePop(pop) {
|
15574
15570
|
const dom = this.dom;
|
15575
15571
|
pop.style.display = '';
|
15576
15572
|
dom.removeClass(pop, 'active');
|
15577
|
-
pop.setAttribute('aria-hidden', true);
|
15573
|
+
pop.setAttribute('aria-hidden', true); // pop.removeEventListener('keydown', this.handlePopKeyDown);
|
15574
|
+
// document.removeEventListener('click', this.handlePopClickOut);
|
15575
|
+
|
15576
|
+
this.clearAllEventListener(pop);
|
15578
15577
|
}
|
15579
15578
|
|
15580
15579
|
setupTabKeys(div) {
|
@@ -18182,6 +18181,17 @@ class Util {
|
|
18182
18181
|
|
18183
18182
|
}
|
18184
18183
|
class Dom {
|
18184
|
+
getScale(container) {
|
18185
|
+
let matrix = window.getComputedStyle(container).transform;
|
18186
|
+
let values = matrix.split('(')[1];
|
18187
|
+
values = values.split(')')[0];
|
18188
|
+
values = values.split(',');
|
18189
|
+
let a = values[0];
|
18190
|
+
let b = values[1];
|
18191
|
+
let scale = Math.sqrt(a * a + b * b);
|
18192
|
+
return scale;
|
18193
|
+
}
|
18194
|
+
|
18185
18195
|
createElement(tag) {
|
18186
18196
|
return document.createElement(tag);
|
18187
18197
|
}
|
@@ -32913,12 +32923,12 @@ const renderSnippetPanel = builder => {
|
|
32913
32923
|
let chromeAgent = userAgentString.indexOf('Chrome') > -1;
|
32914
32924
|
if ((chromeAgent) && (safariAgent)) safariAgent = false;
|
32915
32925
|
*/
|
32926
|
+
// let safariAgent = false;
|
32916
32927
|
|
32917
32928
|
|
32918
|
-
let safariAgent = false;
|
32919
32929
|
let activeBuilderArea;
|
32920
32930
|
new Sortable(snippetlist, {
|
32921
|
-
forceFallback: safariAgent,
|
32931
|
+
// forceFallback: safariAgent,
|
32922
32932
|
group: {
|
32923
32933
|
name: 'shared',
|
32924
32934
|
pull: 'clone',
|
@@ -32927,6 +32937,18 @@ const renderSnippetPanel = builder => {
|
|
32927
32937
|
},
|
32928
32938
|
sort: false,
|
32929
32939
|
animation: 150,
|
32940
|
+
onChoose: () => {
|
32941
|
+
// Make moving draggable item scaled & positioned correctly (due to zoom value)
|
32942
|
+
// const newCss = `
|
32943
|
+
// <style id="css-scale">
|
32944
|
+
// .sortable-drag::before {
|
32945
|
+
// transform: scale(1);
|
32946
|
+
// }
|
32947
|
+
// </style>
|
32948
|
+
// `;
|
32949
|
+
const oldCss = builder.contentStuff.querySelector('#css-scale');
|
32950
|
+
if (oldCss) oldCss.parentNode.removeChild(oldCss); // builder.contentStuff.insertAdjacentHTML('afterbegin', newCss);
|
32951
|
+
},
|
32930
32952
|
onMove: () => {
|
32931
32953
|
let emptyinfo = document.querySelector('.row-add-initial'); // if there is empty info, remove it during snippet drag drop
|
32932
32954
|
// if(emptyinfo) emptyinfo.parentNode.removeChild(emptyinfo);
|
@@ -80938,8 +80960,23 @@ class ContentBuilder {
|
|
80938
80960
|
['column sixth', 'column two-sixth'], ['column fifth', 'column two-fifth'], ['column fourth', 'column two-fourth'], ['column third', 'column two-third'], ['column half', 'column half'], ['column two-third', 'column third'], ['column two-fourth', 'column fourth'], ['column two-fifth', 'column fifth'], ['column two-sixth', 'column sixth']]];
|
80939
80961
|
}
|
80940
80962
|
}
|
80963
|
+
} // Experimental for iframe
|
80964
|
+
|
80965
|
+
|
80966
|
+
let doc;
|
80967
|
+
if (this.iframeDocument) doc = this.iframeDocument;else doc = document;
|
80968
|
+
this.doc = doc; // Content stuff
|
80969
|
+
|
80970
|
+
let contentStuff = doc.querySelector('.content-stuff');
|
80971
|
+
|
80972
|
+
if (!contentStuff) {
|
80973
|
+
contentStuff = document.createElement('div');
|
80974
|
+
contentStuff.className = 'content-stuff is-ui';
|
80975
|
+
doc.body.appendChild(contentStuff);
|
80941
80976
|
}
|
80942
80977
|
|
80978
|
+
this.contentStuff = contentStuff;
|
80979
|
+
this.addStuff();
|
80943
80980
|
this.sortableObjects = [];
|
80944
80981
|
const util = new Util(this); // General utilities
|
80945
80982
|
|
@@ -81477,12 +81514,40 @@ class ContentBuilder {
|
|
81477
81514
|
scroll: true,
|
81478
81515
|
// invertSwap: true, /* https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#swap-threshold */
|
81479
81516
|
group: 'shared',
|
81480
|
-
direction: 'dummy',
|
81517
|
+
// direction: 'dummy',
|
81481
81518
|
animation: 300,
|
81482
81519
|
handle: '.row-handle',
|
81483
81520
|
// swapThreshold: 0.1, // this cause drag drop snippet sometimes difficult
|
81484
81521
|
// invertedSwapThreshold: 0.1,
|
81485
81522
|
sort: true,
|
81523
|
+
//new
|
81524
|
+
swapThreshold: 0.5,
|
81525
|
+
// & comment the direction setting above
|
81526
|
+
onChoose: () => {
|
81527
|
+
// Get zoom (scale) value
|
81528
|
+
let scale;
|
81529
|
+
|
81530
|
+
if (this.opts.page !== '') {
|
81531
|
+
const wrapper = this.doc.querySelector(this.opts.page);
|
81532
|
+
scale = dom$L.getScale(wrapper);
|
81533
|
+
} else {
|
81534
|
+
const area = this.doc.querySelector('.is-builder'); // get one of the builder area
|
81535
|
+
|
81536
|
+
scale = dom$L.getScale(area);
|
81537
|
+
} // Make moving draggable item scaled & positioned correctly (due to zoom value)
|
81538
|
+
|
81539
|
+
|
81540
|
+
const newCss = `
|
81541
|
+
<style id="css-scale">
|
81542
|
+
.sortable-drag::before {
|
81543
|
+
transform: scale(${scale});
|
81544
|
+
}
|
81545
|
+
</style>
|
81546
|
+
`;
|
81547
|
+
const oldCss = this.contentStuff.querySelector('#css-scale');
|
81548
|
+
if (oldCss) oldCss.parentNode.removeChild(oldCss);
|
81549
|
+
this.contentStuff.insertAdjacentHTML('afterbegin', newCss);
|
81550
|
+
},
|
81486
81551
|
onStart: () => {
|
81487
81552
|
this.uo.saveForUndo(); // Even if cancelled, saveForUndo will make sure not to save if there is no change
|
81488
81553
|
|
@@ -83804,6 +83869,45 @@ class ContentBuilder {
|
|
83804
83869
|
// return currentScript.replace(currentScriptFile, '');
|
83805
83870
|
}
|
83806
83871
|
|
83872
|
+
addStuff() {
|
83873
|
+
const css = `
|
83874
|
+
<style>
|
83875
|
+
/* sortable */
|
83876
|
+
.sortable-drag {
|
83877
|
+
background: transparent;
|
83878
|
+
outline:none !important;
|
83879
|
+
}
|
83880
|
+
.sortable-drag * {
|
83881
|
+
opacity:0;
|
83882
|
+
}
|
83883
|
+
|
83884
|
+
.sortable-ghost {
|
83885
|
+
background: rgba(0, 0, 0 , 0.03);
|
83886
|
+
width: 100%;
|
83887
|
+
outline: none !important;
|
83888
|
+
}
|
83889
|
+
.sortable-ghost * {
|
83890
|
+
outline: none !important;
|
83891
|
+
|
83892
|
+
}
|
83893
|
+
.sortable-ghost .is-row-tool {
|
83894
|
+
display:none !important;
|
83895
|
+
}
|
83896
|
+
|
83897
|
+
.sortable-drag::before {
|
83898
|
+
content: ' ';
|
83899
|
+
width: 100%;
|
83900
|
+
height: 100%;
|
83901
|
+
position: absolute;
|
83902
|
+
top: 0; left:0;
|
83903
|
+
background: rgba(0, 0, 0 , 0.03);
|
83904
|
+
transform-origin: top left;
|
83905
|
+
}
|
83906
|
+
</style>
|
83907
|
+
`;
|
83908
|
+
this.contentStuff.insertAdjacentHTML('afterbegin', css);
|
83909
|
+
}
|
83910
|
+
|
83807
83911
|
}
|
83808
83912
|
|
83809
83913
|
var pace = {exports: {}};
|