@innovastudio/contentbox 1.3.19 → 1.3.22
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.22",
|
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.18",
|
50
50
|
"js-beautify": "^1.14.0"
|
51
51
|
}
|
52
52
|
}
|
@@ -2612,7 +2612,7 @@ class EditSection {
|
|
2612
2612
|
this.builder = builder;
|
2613
2613
|
const builderStuff = this.builder.builderStuff;
|
2614
2614
|
this.builderStuff = builderStuff;
|
2615
|
-
let html = '<div class="is-modal delsectionconfirm" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">' + '<div style="max-width:
|
2615
|
+
let html = '<div class="is-modal delsectionconfirm" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">' + '<div style="max-width: 450px;">' + '<div style="margin: 20px 0 30px;text-align:center;font-size: 14px;">' + out('Are you sure you want to delete this section?') + '</div>' + '<button title="' + out('Delete') + '" class="input-ok classic">' + out('Delete') + '</button>' + '</div>' + '</div>' + '' + '<div class="is-modal editsection" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">' + '<div class="is-modal-content" style="max-width:313px;padding:0;">' + '<div class="is-modal-bar is-draggable">' + out('Section Settings') + '</div>' + '<div class="is-tabs clearfix" style="padding-top:37px;" data-group="sectionsettings">' + '<a id="tabSectionGeneral" title="' + out('General') + '" href="" data-content="divSectionGeneral" class="active">' + out('General') + '</a>' + '<a id="tabSectionAnimation" title="' + out('Animation') + '" href="" data-content="divSectionAnimation">' + out('Animation') + '</a>' + '<a id="tabSectionScrollButton" title="' + out('Scroll') + '" href="" data-content="divSectionScrollButton">' + out('Scroll') + '</a>' + '</div>';
|
2616
2616
|
html += '<div id="divSectionGeneral" class="is-tab-content active" data-group="sectionsettings" style="display:flex;padding-top:0">' + '<div style="display:flex;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Move Section') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Move Up') + '" class="cmd-section-up" style="">↑</button>' + '<button title="' + out('Move Down') + '" class="cmd-section-down">↓</button>' + '<button title="' + out('Move to Top') + '" class="cmd-section-top"><span style="transform:rotate(90deg);position:absolute;top:13px;left:15px;">⇤</span></button>' + '<button title="' + out('Move to Bottom') + '" class="cmd-section-bottom"><span style="transform:rotate(90deg);position:absolute;top:13px;left:15px;">⇥</span></button>' + '<button title="' + out('Duplicate') + '" class="cmd-section-duplicate" style="margin-left:20px;"><svg class="is-icon-flex" style="width:16px;height:16px;"><use xlink:href="#ion-ios-copy-outline"></use></svg></button>' + '</div>' + '</div>';
|
2617
2617
|
html += '<div style="display:flex;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Height') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Auto') + '" class="cmd-section-height" data-value="0">' + out('Auto') + '</button>' + '<button title="20%" class="cmd-section-height" data-value="20">20%</button>' + '<button title="25%" class="cmd-section-height" data-value="25">25%</button>' + '<button title="30%" class="cmd-section-height" data-value="30">30%</button>' + '<button title="40%" class="cmd-section-height" data-value="40">40%</button>' + '<button title="50%" class="cmd-section-height" data-value="50">50%</button>' + '</div>' + '<div style="display:flex">' + '<button title="60%" class="cmd-section-height" data-value="60" style="border-left:none;border-top:none;">60%</button>' + '<button title="70%" class="cmd-section-height" data-value="70" style="border-left:none;border-top:none;">70%</button>' + '<button title="75%" class="cmd-section-height" data-value="75" style="border-left:none;border-top:none;">75%</button>' + '<button title="80%" class="cmd-section-height" data-value="80" style="border-left:none;border-top:none;">80%</button>' + '<button title="90%" class="cmd-section-height" data-value="90" style="border-left:none;border-top:none;">90%</button>' + '<button title="100%" class="cmd-section-height" data-value="100" style="border-left:none;border-top:none;">100%</button>' + '</div>' + '</div>' + '<div style="display:flex;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Spacing') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('xs') + '" class="cmd-box-spacing" data-value="default">' + out('xs') + '</button>' + '<button title="' + out('sm') + '" class="cmd-box-spacing" data-value="sm">' + out('sm') + '</button>' + '<button title="' + out('m') + '" class="cmd-box-spacing" data-value="m">' + out('m') + '</button>' + '<button title="' + out('lg') + '" class="cmd-box-spacing" data-value="lg">' + out('lg') + '</button>' + '<button title="' + out('Clear') + '" class="cmd-box-spacing" data-value=""><svg class="is-icon-flex"><use xlink:href="#icon-clean"></use></svg></button>' + '</div>' + '</div>';
|
2618
2618
|
html += '<div class="div-section-bgcolor" style="display:flex;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Background Color') + ':</div>' + '<div style="display:flex;">' + '<button title="' + out('Background Color') + '" class="input-section-bgcolor is-btn-color" style="margin-right:15px"></button>' + '<button title="' + out('Gradient') + '" class="input-section-gradient classic" data-value="+">' + out('Gradient') + '</button>' + '</div>' + '</div>' + '</div>' + '<div id="divSectionAnimation" class="is-tab-content" data-group="sectionsettings" style="display:none;padding-top:0">' + '<div style="display:flex;flex-direction:column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Start') + ':</div>' + '<div style="display:flex;flex-flow:wrap;">' + '<button title="' + out('Slide Left') + '" class="cmd-section-anim-start" data-value="slide-left">' + out('Slide Left') + '</button>' + '<button title="' + out('Slide Right') + '" class="cmd-section-anim-start" data-value="slide-right">' + out('Slide Right') + '</button>' + '<button title="' + out('Zoom In') + '" class="cmd-section-anim-start" data-value="zoom-in">' + out('Zoom In') + '</button>' + // '<button title="' + out('Zoom Out') + '" class="cmd-section-anim-start" data-value="zoom-out">' + out('Zoom Out') + '</button>' +
|
@@ -15431,7 +15431,7 @@ class Util {
|
|
15431
15431
|
let html = '';
|
15432
15432
|
html = `<div class="is-modal is-confirm" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
15433
15433
|
<div class="is-modal-content" style="padding-bottom:20px;">
|
15434
|
-
<
|
15434
|
+
<div style="margin: 20px 0 30px;font-size: 14px;">${message}</div>
|
15435
15435
|
<button title="${this.out('Delete')}" class="input-ok classic focus-warning">${this.out('Delete')}</button>
|
15436
15436
|
</div>
|
15437
15437
|
</div>`;
|
@@ -15439,7 +15439,7 @@ class Util {
|
|
15439
15439
|
if (yesno) {
|
15440
15440
|
html = `<div class="is-modal is-confirm" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
15441
15441
|
<div class="is-modal-content" style="padding-bottom:20px;">
|
15442
|
-
<
|
15442
|
+
<div style="margin: 20px 0 30px;font-size: 14px;">${message}</div>
|
15443
15443
|
<button title="${this.out('Cancel')}" class="input-cancel classic-secondary">${this.out('Cancel')}</button>
|
15444
15444
|
<button title="${yestext}" class="input-ok classic-primary">${yestext}</button>
|
15445
15445
|
</div>
|
@@ -15519,8 +15519,19 @@ class Util {
|
|
15519
15519
|
dom.addClass(pop, 'deactive');
|
15520
15520
|
}
|
15521
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
|
+
|
15522
15529
|
showPop(pop, cancelCallback, btn) {
|
15523
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
|
+
|
15524
15535
|
pop.style.display = 'flex';
|
15525
15536
|
dom.addClass(pop, 'active');
|
15526
15537
|
pop.setAttribute('aria-hidden', false);
|
@@ -15529,37 +15540,40 @@ class Util {
|
|
15529
15540
|
preventScroll: true
|
15530
15541
|
});
|
15531
15542
|
|
15532
|
-
|
15543
|
+
this.handlePopClickOut = e => {
|
15533
15544
|
if (!pop.contains(e.target) && !btn.contains(e.target)) {
|
15534
15545
|
// click outside
|
15535
15546
|
// hide
|
15536
|
-
this.hidePop(pop);
|
15537
|
-
|
15538
|
-
|
15547
|
+
this.hidePop(pop); // pop.removeEventListener('keydown', this.handlePopKeyDown);
|
15548
|
+
// document.removeEventListener('click', this.handlePopClickOut);
|
15549
|
+
|
15539
15550
|
if (cancelCallback) cancelCallback();
|
15540
15551
|
}
|
15541
15552
|
};
|
15542
15553
|
|
15543
|
-
|
15554
|
+
this.handlePopKeyDown = e => {
|
15544
15555
|
if (e.keyCode === 27) {
|
15545
15556
|
// escape key
|
15546
15557
|
// hide
|
15547
|
-
this.hidePop(pop);
|
15548
|
-
|
15549
|
-
|
15558
|
+
this.hidePop(pop); // pop.removeEventListener('keydown', this.handlePopKeyDown);
|
15559
|
+
// document.removeEventListener('click', this.handlePopClickOut);
|
15560
|
+
|
15550
15561
|
if (cancelCallback) cancelCallback();
|
15551
15562
|
}
|
15552
15563
|
};
|
15553
15564
|
|
15554
|
-
pop.addEventListener('keydown',
|
15555
|
-
document.addEventListener('click',
|
15565
|
+
pop.addEventListener('keydown', this.handlePopKeyDown);
|
15566
|
+
document.addEventListener('click', this.handlePopClickOut);
|
15556
15567
|
}
|
15557
15568
|
|
15558
15569
|
hidePop(pop) {
|
15559
15570
|
const dom = this.dom;
|
15560
15571
|
pop.style.display = '';
|
15561
15572
|
dom.removeClass(pop, 'active');
|
15562
|
-
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);
|
15563
15577
|
}
|
15564
15578
|
|
15565
15579
|
setupTabKeys(div) {
|
@@ -18167,6 +18181,17 @@ class Util {
|
|
18167
18181
|
|
18168
18182
|
}
|
18169
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
|
+
|
18170
18195
|
createElement(tag) {
|
18171
18196
|
return document.createElement(tag);
|
18172
18197
|
}
|
@@ -32898,12 +32923,12 @@ const renderSnippetPanel = builder => {
|
|
32898
32923
|
let chromeAgent = userAgentString.indexOf('Chrome') > -1;
|
32899
32924
|
if ((chromeAgent) && (safariAgent)) safariAgent = false;
|
32900
32925
|
*/
|
32926
|
+
// let safariAgent = false;
|
32901
32927
|
|
32902
32928
|
|
32903
|
-
let safariAgent = false;
|
32904
32929
|
let activeBuilderArea;
|
32905
32930
|
new Sortable(snippetlist, {
|
32906
|
-
forceFallback: safariAgent,
|
32931
|
+
// forceFallback: safariAgent,
|
32907
32932
|
group: {
|
32908
32933
|
name: 'shared',
|
32909
32934
|
pull: 'clone',
|
@@ -32912,6 +32937,18 @@ const renderSnippetPanel = builder => {
|
|
32912
32937
|
},
|
32913
32938
|
sort: false,
|
32914
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
|
+
},
|
32915
32952
|
onMove: () => {
|
32916
32953
|
let emptyinfo = document.querySelector('.row-add-initial'); // if there is empty info, remove it during snippet drag drop
|
32917
32954
|
// if(emptyinfo) emptyinfo.parentNode.removeChild(emptyinfo);
|
@@ -64211,7 +64248,7 @@ class Modal {
|
|
64211
64248
|
confirm(message, callback, animated) {
|
64212
64249
|
let html = `<div class="is-modal is-confirm" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
64213
64250
|
<div class="is-modal-content" style="padding-bottom:20px;">
|
64214
|
-
<
|
64251
|
+
<div style="margin: 20px 0 30px;font-size: 14px;">${message}</div>
|
64215
64252
|
<button title="${this.out('Delete')}" class="input-ok classic">${this.out('Delete')}</button>
|
64216
64253
|
</div>
|
64217
64254
|
</div>`;
|
@@ -80923,8 +80960,23 @@ class ContentBuilder {
|
|
80923
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']]];
|
80924
80961
|
}
|
80925
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);
|
80926
80976
|
}
|
80927
80977
|
|
80978
|
+
this.contentStuff = contentStuff;
|
80979
|
+
this.addStuff();
|
80928
80980
|
this.sortableObjects = [];
|
80929
80981
|
const util = new Util(this); // General utilities
|
80930
80982
|
|
@@ -81462,12 +81514,40 @@ class ContentBuilder {
|
|
81462
81514
|
scroll: true,
|
81463
81515
|
// invertSwap: true, /* https://github.com/SortableJS/Sortable/wiki/Swap-Thresholds-and-Direction#swap-threshold */
|
81464
81516
|
group: 'shared',
|
81465
|
-
direction: 'dummy',
|
81517
|
+
// direction: 'dummy',
|
81466
81518
|
animation: 300,
|
81467
81519
|
handle: '.row-handle',
|
81468
81520
|
// swapThreshold: 0.1, // this cause drag drop snippet sometimes difficult
|
81469
81521
|
// invertedSwapThreshold: 0.1,
|
81470
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
|
+
},
|
81471
81551
|
onStart: () => {
|
81472
81552
|
this.uo.saveForUndo(); // Even if cancelled, saveForUndo will make sure not to save if there is no change
|
81473
81553
|
|
@@ -83789,6 +83869,45 @@ class ContentBuilder {
|
|
83789
83869
|
// return currentScript.replace(currentScriptFile, '');
|
83790
83870
|
}
|
83791
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
|
+
|
83792
83911
|
}
|
83793
83912
|
|
83794
83913
|
var pace = {exports: {}};
|