@innovastudio/contentbox 1.6.91 → 1.6.93
Sign up to get free protection for your applications and to get access to all the features.
@@ -13193,6 +13193,11 @@ class PanelBox {
|
|
13193
13193
|
<button title="${out('Increase')}" data-content-size="+"><svg><use xlink:href="#icon-plus2"></use></svg></button>
|
13194
13194
|
</div>
|
13195
13195
|
|
13196
|
+
<label class="label checkbox mt-3" style="margin-bottom:15px">
|
13197
|
+
<input type="checkbox" class="chk-lock-contentsize" />
|
13198
|
+
<span>${out('Lock Content Size')}</span>
|
13199
|
+
</label>
|
13200
|
+
|
13196
13201
|
<div class="flex">
|
13197
13202
|
<div class="mr-4">
|
13198
13203
|
<div class="label mt-2">${out('Position')}:</div>
|
@@ -13729,6 +13734,11 @@ class PanelBox {
|
|
13729
13734
|
chkParallax.addEventListener('click', () => {
|
13730
13735
|
let isParallax = chkParallax.checked;
|
13731
13736
|
this.box.parallaxContent(isParallax);
|
13737
|
+
});
|
13738
|
+
const chkLockContentSize = panel.querySelector('.chk-lock-contentsize');
|
13739
|
+
chkLockContentSize.addEventListener('click', () => {
|
13740
|
+
let isLockContentSize = chkLockContentSize.checked;
|
13741
|
+
this.box.lockContentSize(isLockContentSize);
|
13732
13742
|
}); // Text
|
13733
13743
|
|
13734
13744
|
const btnTextAlign = panel.querySelectorAll('[data-align]');
|
@@ -14285,6 +14295,16 @@ class PanelBox {
|
|
14285
14295
|
chkParallax.checked = true;
|
14286
14296
|
}
|
14287
14297
|
}
|
14298
|
+
} // Lock Content Size
|
14299
|
+
|
14300
|
+
|
14301
|
+
const chkLockContentSize = panel.querySelector('.chk-lock-contentsize');
|
14302
|
+
chkLockContentSize.checked = false;
|
14303
|
+
|
14304
|
+
if (container) {
|
14305
|
+
if (container.classList.contains('v3')) {
|
14306
|
+
chkLockContentSize.checked = true;
|
14307
|
+
}
|
14288
14308
|
} // Text Color
|
14289
14309
|
|
14290
14310
|
|
@@ -27883,10 +27903,10 @@ const renderQuickAdd = builder => {
|
|
27883
27903
|
elm = quickadd.querySelector('.add-video');
|
27884
27904
|
dom.addEventListener(elm, 'click', () => {
|
27885
27905
|
const mode = quickadd.getAttribute('data-mode');
|
27886
|
-
let html = `<video style="width: 100%;" loop="" autoplay="">
|
27906
|
+
let html = `<video style="width: 100%;" loop="" playsinline="" muted="" autoplay="">
|
27887
27907
|
<source src="${builder.opts.snippetPath}example.mp4" type="video/mp4"></video>`;
|
27888
27908
|
if (builder.opts.snippetSampleVideo) {
|
27889
|
-
html = `<video style="width: 100%;" loop="" autoplay="">
|
27909
|
+
html = `<video style="width: 100%;" loop="" playsinline="" muted="" autoplay="">
|
27890
27910
|
<source src="${builder.opts.snippetSampleVideo}" type="video/mp4"></video>`;
|
27891
27911
|
}
|
27892
27912
|
util.addContent(html, mode);
|
@@ -31723,15 +31743,15 @@ class Util$1 {
|
|
31723
31743
|
} else {
|
31724
31744
|
newelement.click();
|
31725
31745
|
}
|
31726
|
-
const builderStuff = this.builder.builderStuff;
|
31727
|
-
let quickadd = builderStuff.querySelector('.quickadd');
|
31728
|
-
this.hidePop(quickadd);
|
31729
31746
|
|
31730
31747
|
// LATER: auto scroll
|
31731
31748
|
|
31732
31749
|
// LATER: If image, then it needs time to load (resulting incorrect position), so hide element tool.
|
31733
31750
|
}
|
31734
31751
|
|
31752
|
+
const builderStuff = this.builder.builderStuff;
|
31753
|
+
let quickadd = builderStuff.querySelector('.quickadd');
|
31754
|
+
if (quickadd) this.hidePop(quickadd);
|
31735
31755
|
if (this.builder.useCssClasses) {
|
31736
31756
|
let builderActive = this.builder.doc.querySelector('.builder-active');
|
31737
31757
|
if (builderActive) dom.contentReformat(builderActive, this.builder.cssClasses);
|
@@ -41026,6 +41046,16 @@ class HtmlUtil {
|
|
41026
41046
|
imgUrl = convertMediaUrl(imgUrl);
|
41027
41047
|
elm.setAttribute('href', `${imgUrl}`);
|
41028
41048
|
}
|
41049
|
+
if (elm.tagName.toLowerCase() === 'a') {
|
41050
|
+
//lightbox
|
41051
|
+
let s = elm.getAttribute('href');
|
41052
|
+
let extension = s.split('.').pop().split('?')[0].split('#')[0]; //
|
41053
|
+
extension = extension.toLowerCase();
|
41054
|
+
if (extension === 'jpg' || extension === 'jpeg' || extension === 'png' || extension === 'gif' || extension === 'webm' || extension === 'webp' || extension === 'mp4' || extension === 'mp3') {
|
41055
|
+
let mediaUrl = convertMediaUrl(s);
|
41056
|
+
elm.setAttribute('href', `${mediaUrl}`);
|
41057
|
+
}
|
41058
|
+
}
|
41029
41059
|
}
|
41030
41060
|
});
|
41031
41061
|
}
|
@@ -44265,6 +44295,7 @@ const renderSnippetPanel = (builder, snippetOpen) => {
|
|
44265
44295
|
block.offsetWidth / 2;
|
44266
44296
|
let x = (snippetX - block.offsetWidth / 2 - rectContainer.left) / docContainer.offsetWidth * 100;
|
44267
44297
|
let y = (snippetY - block.offsetHeight / 2 - rectContainer.top) / docContainer.offsetHeight * 100;
|
44298
|
+
if (y < 0) y = 15; // if block is not fully loaded, block height may be incorrect (y can be negative). Adjust to 15%.
|
44268
44299
|
block.style.top = y + '%';
|
44269
44300
|
block.style.left = x + '%';
|
44270
44301
|
block.removeAttribute('data-new-dummy');
|
@@ -72780,28 +72811,33 @@ class Image$1 {
|
|
72780
72811
|
if (this.builder.moveable) this.builder.moveable.updateRect();
|
72781
72812
|
const movControlBox = document.querySelector('.moveable-control-box');
|
72782
72813
|
if (movControlBox && !this.builder.hideImageResizer) movControlBox.style.display = 'block';
|
72783
|
-
|
72784
|
-
|
72785
|
-
|
72786
|
-
|
72787
|
-
|
72788
|
-
|
72789
|
-
|
72790
|
-
|
72791
|
-
|
72792
|
-
|
72793
|
-
|
72814
|
+
|
72815
|
+
/*
|
72816
|
+
const handleImageToolClickOut = e =>{
|
72817
|
+
let elm = e.target;
|
72818
|
+
if(!elm) return;
|
72819
|
+
if(!elm.closest('#divImageResizer') && !elm.closest('#divImageTool') &&
|
72820
|
+
!elm.closest('.is-modal') && !elm.closest('.keep-selection') &&
|
72821
|
+
!elm.closest('.sl-wrapper') && !elm.closest('.sl-overlay') && !elm.closest('.sl-close') &&
|
72822
|
+
!elm.closest('img')) { // click outside
|
72823
|
+
|
72824
|
+
// hide
|
72825
|
+
this.hideImageTool();
|
72826
|
+
document.removeEventListener('click', handleImageToolClickOut);
|
72827
|
+
if(this.builder.iframeDocument) {
|
72828
|
+
this.builder.doc.removeEventListener('click', handleImageToolClickOut);
|
72829
|
+
}
|
72830
|
+
this.builder.handleImageToolClickOut_=false;
|
72794
72831
|
}
|
72795
|
-
this.builder.handleImageToolClickOut_ = false;
|
72796
|
-
}
|
72797
72832
|
};
|
72798
|
-
if
|
72799
|
-
|
72800
|
-
|
72801
|
-
|
72802
|
-
|
72803
|
-
|
72833
|
+
if(!this.builder.handleImageToolClickOut_) {
|
72834
|
+
document.addEventListener('click', handleImageToolClickOut);
|
72835
|
+
if(this.builder.iframeDocument) {
|
72836
|
+
this.builder.doc.addEventListener('click', handleImageToolClickOut);
|
72837
|
+
}
|
72838
|
+
this.builder.handleImageToolClickOut_=true;
|
72804
72839
|
}
|
72840
|
+
*/
|
72805
72841
|
} else {
|
72806
72842
|
let imageResizer = this.imageResizer;
|
72807
72843
|
imageResizer.style.display = 'none';
|
@@ -72815,6 +72851,28 @@ class Image$1 {
|
|
72815
72851
|
const movControlBox = document.querySelector('.moveable-control-box');
|
72816
72852
|
if (movControlBox) movControlBox.style.display = 'none';
|
72817
72853
|
}
|
72854
|
+
const handleImageToolClickOut = e => {
|
72855
|
+
let elm = e.target;
|
72856
|
+
if (!elm) return;
|
72857
|
+
if (!elm.closest('#divImageResizer') && !elm.closest('#divImageTool') && !elm.closest('.is-modal') && !elm.closest('.keep-selection') && !elm.closest('.sl-wrapper') && !elm.closest('.sl-overlay') && !elm.closest('.sl-close') && !elm.closest('img')) {
|
72858
|
+
// click outside
|
72859
|
+
|
72860
|
+
// hide
|
72861
|
+
this.hideImageTool();
|
72862
|
+
document.removeEventListener('click', handleImageToolClickOut);
|
72863
|
+
if (this.builder.iframeDocument) {
|
72864
|
+
this.builder.doc.removeEventListener('click', handleImageToolClickOut);
|
72865
|
+
}
|
72866
|
+
this.builder.handleImageToolClickOut_ = false;
|
72867
|
+
}
|
72868
|
+
};
|
72869
|
+
if (!this.builder.handleImageToolClickOut_) {
|
72870
|
+
document.addEventListener('click', handleImageToolClickOut);
|
72871
|
+
if (this.builder.iframeDocument) {
|
72872
|
+
this.builder.doc.addEventListener('click', handleImageToolClickOut);
|
72873
|
+
}
|
72874
|
+
this.builder.handleImageToolClickOut_ = true;
|
72875
|
+
}
|
72818
72876
|
if (this.builder.canvas) ; else {
|
72819
72877
|
let prog = false;
|
72820
72878
|
if (e.screenX && e.screenX !== 0 && e.screenY && e.screenY !== 0) ; else {
|
@@ -73168,7 +73226,7 @@ class ButtonEditor {
|
|
73168
73226
|
<div class="flex flex-row" style="margin:15px 0 0">
|
73169
73227
|
<div class="flex flex-col" style="margin-right: 40px;">
|
73170
73228
|
<div>
|
73171
|
-
<span>${util.out('Border
|
73229
|
+
<span>${util.out('Border Style')}</span>:
|
73172
73230
|
</div>
|
73173
73231
|
<div class="flex flex-row flex-wrap" style="margin-top:5px">
|
73174
73232
|
<button title="${util.out('Transparent')}" data-command="transparent" class="border-color-command" style="margin-right:4px">${util.out('Transparent')}</button>
|
@@ -73358,7 +73416,7 @@ class ButtonEditor {
|
|
73358
73416
|
|
73359
73417
|
<div class="flex flex-col" style="margin:15px 0 0">
|
73360
73418
|
<div>
|
73361
|
-
<span>${util.out('Border
|
73419
|
+
<span>${util.out('Border Style')}</span>:
|
73362
73420
|
</div>
|
73363
73421
|
<div class="flex flex-row flex-wrap" style="margin-top:5px">
|
73364
73422
|
<button title="${util.out('Transparent')}" data-command="transparent" class="border-color-hover-command" style="margin-right:4px">${util.out('Transparent')}</button>
|
@@ -76954,6 +77012,12 @@ class Video {
|
|
76954
77012
|
} else {
|
76955
77013
|
inpAutoplay.checked = false;
|
76956
77014
|
}
|
77015
|
+
const inpMuted = videoModal.querySelector('.input-video-muted');
|
77016
|
+
if (video.hasAttribute('muted')) {
|
77017
|
+
inpMuted.checked = true;
|
77018
|
+
} else {
|
77019
|
+
inpMuted.checked = false;
|
77020
|
+
}
|
76957
77021
|
util.showModal(videoModal, true, () => {
|
76958
77022
|
btn.removeAttribute('data-focus');
|
76959
77023
|
btn.focus();
|
@@ -76997,6 +77061,9 @@ class Video {
|
|
76997
77061
|
<label style="display:block;margin-top:5px;">
|
76998
77062
|
<input class="input-video-autoplay" id="__input_video_autoplay" type="checkbox" /> ${util.out('Autoplay')}
|
76999
77063
|
</label>
|
77064
|
+
<label style="display:block;margin-top:5px;">
|
77065
|
+
<input class="input-video-muted" id="__input_video_muted" type="checkbox" /> ${util.out('Muted')}
|
77066
|
+
</label>
|
77000
77067
|
|
77001
77068
|
<div style="text-align:right;margin-top:14px;">
|
77002
77069
|
<button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
|
@@ -77075,6 +77142,11 @@ class Video {
|
|
77075
77142
|
} else {
|
77076
77143
|
video.removeAttribute('autoplay');
|
77077
77144
|
}
|
77145
|
+
if (videoModal.querySelector('.input-video-muted').checked) {
|
77146
|
+
video.setAttribute('muted', '');
|
77147
|
+
} else {
|
77148
|
+
video.removeAttribute('muted');
|
77149
|
+
}
|
77078
77150
|
if (videoModal.querySelector('.input-url').value !== '') {
|
77079
77151
|
let url = videoModal.querySelector('.input-url').value;
|
77080
77152
|
let source = video.querySelector('source');
|
@@ -77726,8 +77798,8 @@ class RowTool {
|
|
77726
77798
|
const builderStuff = this.builder.builderStuff;
|
77727
77799
|
let rowtool = row.querySelector('.is-row-tool');
|
77728
77800
|
if (!rowtool) {
|
77729
|
-
let html = `<div class="is-tool is-row-tool">
|
77730
|
-
<div title="${util.out('Move')}" role="button" tabindex="-1" class="row-handle" style="width:100%;cursor:move;text-align:center;"><svg class="is-icon-flex"><use xlink:href="#ion-move"></use></svg></div>
|
77801
|
+
let html = `<div class="is-tool is-row-tool" style="${!this.builder.rowTool && this.builder.rowTool !== '' ? 'display:none;' : ''}">
|
77802
|
+
<div title="${util.out('Move')}" role="button" tabindex="-1" class="row-handle" style="${this.builder.rowHandle ? '' : 'display:none;'}width:100%;cursor:move;text-align:center;"><svg class="is-icon-flex"><use xlink:href="#ion-move"></use></svg></div>
|
77731
77803
|
<button type="button" tabindex="-1" title="${util.out('More')}" class="row-more"><svg class="is-icon-flex"><use xlink:href="#ion-more"></use></svg></button>
|
77732
77804
|
<button type="button" tabindex="-1" title="${util.out('Grid Editor')}" class="row-grideditor"><svg class="is-icon-flex"><use xlink:href="#ion-grid"></use></svg></button>
|
77733
77805
|
<button type="button" tabindex="-1" title="${util.out('Delete')}" class="row-remove"><svg class="is-icon-flex"><use xlink:href="#ion-ios-close-empty"></use></svg></button>
|
@@ -89900,6 +89972,10 @@ class ColorPicker {
|
|
89900
89972
|
const poppicker = builderStuff.querySelector('.pop-picker');
|
89901
89973
|
poppicker.style.display = 'flex';
|
89902
89974
|
poppicker.style.opacity = 0;
|
89975
|
+
if (this.opts.colors.length <= 21) poppicker.style.height = '360px'; // 3 lines
|
89976
|
+
else if (this.opts.colors.length > 21 && this.opts.colors.length <= 28) poppicker.style.height = '390px'; // 4 lines
|
89977
|
+
else if (this.opts.colors.length > 28) poppicker.style.height = '420px'; // 5 lines
|
89978
|
+
|
89903
89979
|
const pickr = Pickr.create({
|
89904
89980
|
el: '._pop-colpick',
|
89905
89981
|
theme: 'nano',
|
@@ -93788,6 +93864,10 @@ class Rte {
|
|
93788
93864
|
btnRteColor.forEach(btn => {
|
93789
93865
|
btn.addEventListener('click', () => {
|
93790
93866
|
const pop = this.rteColorPicker;
|
93867
|
+
const numOfColors = this.builder.colors.length;
|
93868
|
+
if (numOfColors > 21 && numOfColors <= 28) pop.classList.add('_4lines'); // 4 lines
|
93869
|
+
else if (numOfColors > 28) pop.classList.add('_5lines'); // 5 lines
|
93870
|
+
|
93791
93871
|
if (!dom.hasClass(pop, 'active')) {
|
93792
93872
|
this.util.showRtePop(pop, () => {
|
93793
93873
|
const top = btn.getBoundingClientRect().top;
|
@@ -94717,15 +94797,15 @@ class Rte {
|
|
94717
94797
|
activeCol = this.builder.activeCol;
|
94718
94798
|
spans = activeCol.querySelectorAll('span');
|
94719
94799
|
Array.prototype.forEach.call(spans, span => {
|
94720
|
-
let attr = span.
|
94800
|
+
let attr = span.hasAttribute('data-keep');
|
94721
94801
|
if (!attr) {
|
94722
94802
|
span.outerHTML = span.innerHTML;
|
94723
94803
|
}
|
94724
94804
|
});
|
94725
94805
|
Array.prototype.forEach.call(spans, span => {
|
94726
|
-
let attr = span.
|
94806
|
+
let attr = span.hasAttribute('data-keep');
|
94727
94807
|
if (attr) {
|
94728
|
-
|
94808
|
+
span.removeAttribute('data-keep');
|
94729
94809
|
}
|
94730
94810
|
});
|
94731
94811
|
this.getState();
|
@@ -108468,8 +108548,6 @@ Important: Do not change the 'div.is-container' element!
|
|
108468
108548
|
}
|
108469
108549
|
}
|
108470
108550
|
|
108471
|
-
// import RecordRTC from 'recordrtc';
|
108472
|
-
// import Recorder from 'opus-recorder'; // Using Recorder
|
108473
108551
|
const dom$i = new Dom();
|
108474
108552
|
class Dictation {
|
108475
108553
|
constructor(opts = {}, builder) {
|
@@ -108817,6 +108895,9 @@ class Dictation {
|
|
108817
108895
|
dom$i.appendHtml(builderStuff, html);
|
108818
108896
|
const modalCommand = builderStuff.querySelector('.page-command');
|
108819
108897
|
this.modalCommand = modalCommand;
|
108898
|
+
new Draggable$2({
|
108899
|
+
selector: '.is-modal.page-command .is-draggable'
|
108900
|
+
});
|
108820
108901
|
const modalCommandList = builderStuff.querySelector('.commandlist');
|
108821
108902
|
this.modalCommandList = modalCommandList;
|
108822
108903
|
const modalConfig = builderStuff.querySelector('.commandconfig');
|
@@ -115298,6 +115379,8 @@ class Editable {
|
|
115298
115379
|
this.handleEditStart = this.handleEditStart.bind(this);
|
115299
115380
|
this.handleMouseClick = this.handleMouseClick.bind(this);
|
115300
115381
|
this.handleTouchStart = this.handleTouchStart.bind(this);
|
115382
|
+
this.handleMouseDown = this.handleMouseDown.bind(this);
|
115383
|
+
this.handleMouseUp = this.handleMouseUp.bind(this);
|
115301
115384
|
this.setup();
|
115302
115385
|
}
|
115303
115386
|
setup() {
|
@@ -115306,6 +115389,7 @@ class Editable {
|
|
115306
115389
|
element.addEventListener('touchstart', this.handleTouchStart, {
|
115307
115390
|
passive: false
|
115308
115391
|
});
|
115392
|
+
element.addEventListener('mousedown', this.handleMouseDown);
|
115309
115393
|
});
|
115310
115394
|
}
|
115311
115395
|
refresh() {
|
@@ -115313,23 +115397,49 @@ class Editable {
|
|
115313
115397
|
this.elements.forEach(element => {
|
115314
115398
|
element.removeEventListener('dblclick', this.handleEditStart);
|
115315
115399
|
element.removeEventListener('touchstart', this.handleTouchStart);
|
115400
|
+
element.removeEventListener('mousedown', this.handleMouseDown);
|
115316
115401
|
});
|
115317
115402
|
this.elements.forEach(element => {
|
115318
115403
|
element.addEventListener('dblclick', this.handleEditStart);
|
115319
115404
|
element.addEventListener('touchstart', this.handleTouchStart, {
|
115320
115405
|
passive: false
|
115321
115406
|
});
|
115407
|
+
element.addEventListener('mousedown', this.handleMouseDown);
|
115322
115408
|
});
|
115323
115409
|
}
|
115410
|
+
handleMouseDown(event) {
|
115411
|
+
const currentTarget = event.currentTarget;
|
115412
|
+
this.lastClickTime = false;
|
115413
|
+
if (!currentTarget.classList.contains('active')) return;
|
115414
|
+
if (currentTarget.classList.contains('editable')) return;
|
115415
|
+
currentTarget.addEventListener('mouseup', this.handleMouseUp);
|
115416
|
+
const now = new Date().getTime();
|
115417
|
+
this.lastClickTime = now;
|
115418
|
+
}
|
115419
|
+
handleMouseUp(event) {
|
115420
|
+
if (!this.lastClickTime) return;
|
115421
|
+
const currentTarget = event.currentTarget;
|
115422
|
+
currentTarget.removeEventListener('mouseup', this.handleMouseUp);
|
115423
|
+
const now = new Date().getTime();
|
115424
|
+
const lastClickTime = this.lastClickTime || now;
|
115425
|
+
const timeDiff = now - lastClickTime;
|
115426
|
+
if (timeDiff < 300 && timeDiff > 0) {
|
115427
|
+
// Less than 300ms since the last touch, enable editing
|
115428
|
+
this.handleEditStart(event);
|
115429
|
+
}
|
115430
|
+
this.lastClickTime = now;
|
115431
|
+
}
|
115324
115432
|
destroy(element) {
|
115325
115433
|
if (element) {
|
115326
115434
|
element.removeEventListener('dblclick', this.handleEditStart);
|
115327
115435
|
element.removeEventListener('touchstart', this.handleTouchStart);
|
115436
|
+
element.removeEventListener('mousedown', this.handleMouseDown);
|
115328
115437
|
} else {
|
115329
115438
|
this.elements = this.doc.querySelectorAll(this.selector);
|
115330
115439
|
this.elements.forEach(element => {
|
115331
115440
|
element.removeEventListener('dblclick', this.handleEditStart);
|
115332
115441
|
element.removeEventListener('touchstart', this.handleTouchStart);
|
115442
|
+
element.removeEventListener('mousedown', this.handleMouseDown);
|
115333
115443
|
});
|
115334
115444
|
}
|
115335
115445
|
}
|
@@ -115642,6 +115752,8 @@ class EditableBlocks {
|
|
115642
115752
|
target.style.zIndex = newZIndex;
|
115643
115753
|
}
|
115644
115754
|
selectStart(block) {
|
115755
|
+
if (block.classList.contains('editable')) return; // do not proceed if in editing mode
|
115756
|
+
|
115645
115757
|
if (block.classList.contains('is-shape')) return; // do not clone if block is shape
|
115646
115758
|
|
115647
115759
|
if (!this.clone) return;
|
@@ -117853,6 +117965,7 @@ class ContentBuilder {
|
|
117853
117965
|
outlineMode: '',
|
117854
117966
|
toolStyle: '',
|
117855
117967
|
outlineStyle: '',
|
117968
|
+
rowHandle: true,
|
117856
117969
|
snippetAddTool: true,
|
117857
117970
|
elementTool: true,
|
117858
117971
|
elementHighlight: true,
|
@@ -120626,7 +120739,118 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
120626
120739
|
// let outlineStyle = localStorage.getItem('_outlinestyle');
|
120627
120740
|
// this.preferences.setOutlineStyle(outlineStyle);
|
120628
120741
|
// }
|
120629
|
-
if (this.preferences) this.preferences.initBuilder(builder);
|
120742
|
+
if (this.preferences) this.preferences.initBuilder(builder);else {
|
120743
|
+
const setColumnTool = hidecolumntool => {
|
120744
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120745
|
+
if (hidecolumntool) {
|
120746
|
+
Array.prototype.forEach.call(builders, builder => {
|
120747
|
+
builder.setAttribute('hidecolumntool', '');
|
120748
|
+
});
|
120749
|
+
} else {
|
120750
|
+
Array.prototype.forEach.call(builders, builder => {
|
120751
|
+
builder.removeAttribute('hidecolumntool');
|
120752
|
+
});
|
120753
|
+
}
|
120754
|
+
};
|
120755
|
+
setColumnTool(!this.columnTool);
|
120756
|
+
const setElementTool = hideelementtool => {
|
120757
|
+
const builderStuff = this.builderStuff;
|
120758
|
+
if (hideelementtool) {
|
120759
|
+
builderStuff.setAttribute('hideelementtool', '');
|
120760
|
+
} else {
|
120761
|
+
builderStuff.removeAttribute('hideelementtool', '');
|
120762
|
+
}
|
120763
|
+
if (this.iframe) {
|
120764
|
+
const contentStuff = this.contentStuff;
|
120765
|
+
if (hideelementtool) {
|
120766
|
+
contentStuff.setAttribute('hideelementtool', '');
|
120767
|
+
} else {
|
120768
|
+
contentStuff.removeAttribute('hideelementtool', '');
|
120769
|
+
}
|
120770
|
+
}
|
120771
|
+
};
|
120772
|
+
setElementTool(!this.elementTool);
|
120773
|
+
const setOutline = hideoutline => {
|
120774
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120775
|
+
Array.prototype.forEach.call(builders, builder => {
|
120776
|
+
if (hideoutline) {
|
120777
|
+
builder.setAttribute('hideoutline', '');
|
120778
|
+
} else {
|
120779
|
+
builder.removeAttribute('hideoutline');
|
120780
|
+
}
|
120781
|
+
});
|
120782
|
+
};
|
120783
|
+
setOutline(!this.rowcolOutline);
|
120784
|
+
const setOutlineStyle = outlineStyle => {
|
120785
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120786
|
+
Array.prototype.forEach.call(builders, builder => {
|
120787
|
+
if (outlineStyle === 'grayoutline') {
|
120788
|
+
builder.setAttribute('grayoutline', '');
|
120789
|
+
} else {
|
120790
|
+
builder.removeAttribute('grayoutline');
|
120791
|
+
}
|
120792
|
+
});
|
120793
|
+
};
|
120794
|
+
setOutlineStyle(this.outlineStyle);
|
120795
|
+
const setElementHighlight = hideelementhighlight => {
|
120796
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120797
|
+
Array.prototype.forEach.call(builders, builder => {
|
120798
|
+
if (hideelementhighlight) {
|
120799
|
+
builder.setAttribute('hideelementhighlight', '');
|
120800
|
+
} else {
|
120801
|
+
builder.removeAttribute('hideelementhighlight', '');
|
120802
|
+
}
|
120803
|
+
});
|
120804
|
+
};
|
120805
|
+
setElementHighlight(!this.elementHighlight);
|
120806
|
+
const setToolStyle = toolStyle => {
|
120807
|
+
const builderStuff = this.builderStuff;
|
120808
|
+
if (toolStyle === 'gray') {
|
120809
|
+
builderStuff.setAttribute('gray', '');
|
120810
|
+
} else {
|
120811
|
+
builderStuff.removeAttribute('gray', '');
|
120812
|
+
}
|
120813
|
+
if (this.iframe) {
|
120814
|
+
const contentStuff = this.contentStuff;
|
120815
|
+
if (toolStyle === 'gray') {
|
120816
|
+
contentStuff.setAttribute('gray', '');
|
120817
|
+
} else {
|
120818
|
+
contentStuff.removeAttribute('gray', '');
|
120819
|
+
}
|
120820
|
+
}
|
120821
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120822
|
+
Array.prototype.forEach.call(builders, builder => {
|
120823
|
+
if (toolStyle === 'gray') {
|
120824
|
+
builder.setAttribute('gray', '');
|
120825
|
+
} else {
|
120826
|
+
builder.removeAttribute('gray');
|
120827
|
+
}
|
120828
|
+
});
|
120829
|
+
};
|
120830
|
+
setToolStyle(this.toolStyle);
|
120831
|
+
const setSnippetAddTool = hidesnippetaddtool => {
|
120832
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120833
|
+
Array.prototype.forEach.call(builders, builder => {
|
120834
|
+
if (hidesnippetaddtool) {
|
120835
|
+
builder.setAttribute('hidesnippetaddtool', '');
|
120836
|
+
} else {
|
120837
|
+
builder.removeAttribute('hidesnippetaddtool', '');
|
120838
|
+
}
|
120839
|
+
});
|
120840
|
+
};
|
120841
|
+
setSnippetAddTool(!this.snippetAddTool);
|
120842
|
+
const setRowToolPosition = rowTool => {
|
120843
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120844
|
+
Array.prototype.forEach.call(builders, builder => {
|
120845
|
+
if (rowTool === 'right') {
|
120846
|
+
builder.removeAttribute('leftrowtool');
|
120847
|
+
} else {
|
120848
|
+
builder.setAttribute('leftrowtool', '');
|
120849
|
+
}
|
120850
|
+
});
|
120851
|
+
};
|
120852
|
+
setRowToolPosition(this.rowTool);
|
120853
|
+
}
|
120630
120854
|
|
120631
120855
|
// Apply behavior on each row
|
120632
120856
|
const rows = this.dom.elementChildren(builder);
|
@@ -122895,8 +123119,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
122895
123119
|
*/
|
122896
123120
|
src = this.viewFileUrl + '?url=' + src;
|
122897
123121
|
}
|
122898
|
-
const width =
|
122899
|
-
const height = 512;
|
123122
|
+
const width = this.ai_width; //768;
|
123123
|
+
const height = this.ai_height; //512;
|
122900
123124
|
const img = new Image();
|
122901
123125
|
img.src = src;
|
122902
123126
|
img.crossOrigin = 'anonymous';
|
@@ -122928,6 +123152,47 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
122928
123152
|
callback(result.url);
|
122929
123153
|
};
|
122930
123154
|
}
|
123155
|
+
getOrientation(width, height) {
|
123156
|
+
const aspectRatio = width / height;
|
123157
|
+
const predefinedRatios = [{
|
123158
|
+
ratio: '1:1',
|
123159
|
+
value: 1 / 1
|
123160
|
+
}, {
|
123161
|
+
ratio: '4:5',
|
123162
|
+
value: 4 / 5
|
123163
|
+
}, {
|
123164
|
+
ratio: '2:3',
|
123165
|
+
value: 2 / 3
|
123166
|
+
}, {
|
123167
|
+
ratio: '9:16',
|
123168
|
+
value: 9 / 16
|
123169
|
+
}, {
|
123170
|
+
ratio: '4:7',
|
123171
|
+
value: 4 / 7
|
123172
|
+
}, {
|
123173
|
+
ratio: '5:4',
|
123174
|
+
value: 5 / 4
|
123175
|
+
}, {
|
123176
|
+
ratio: '3:2',
|
123177
|
+
value: 3 / 2
|
123178
|
+
}, {
|
123179
|
+
ratio: '16:9',
|
123180
|
+
value: 16 / 9
|
123181
|
+
}, {
|
123182
|
+
ratio: '7:4',
|
123183
|
+
value: 7 / 4
|
123184
|
+
}];
|
123185
|
+
let closestRatio = predefinedRatios[0].ratio;
|
123186
|
+
let smallestDifference = Math.abs(aspectRatio - predefinedRatios[0].value);
|
123187
|
+
for (let i = 1; i < predefinedRatios.length; i++) {
|
123188
|
+
const difference = Math.abs(aspectRatio - predefinedRatios[i].value);
|
123189
|
+
if (difference < smallestDifference) {
|
123190
|
+
smallestDifference = difference;
|
123191
|
+
closestRatio = predefinedRatios[i].ratio;
|
123192
|
+
}
|
123193
|
+
}
|
123194
|
+
return closestRatio;
|
123195
|
+
}
|
122931
123196
|
async generateImage(prompt, callback) {
|
122932
123197
|
this.controller = new AbortController(); // Create a new AbortController
|
122933
123198
|
this.signal = this.controller.signal; // Get a new signal object
|
@@ -122937,12 +123202,82 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
122937
123202
|
let steps = this.imageSteps || 25;
|
122938
123203
|
let guidance = this.imageGuidance || 7.5;
|
122939
123204
|
let scheduler = this.imageScheduler || 'dpmsolver++';
|
123205
|
+
let width = 768;
|
123206
|
+
let height = 512;
|
123207
|
+
if (this.activeImage) {
|
123208
|
+
// check selected image dimension
|
123209
|
+
const activeImage = this.activeImage;
|
123210
|
+
const w = activeImage.offsetWidth;
|
123211
|
+
const h = activeImage.offsetHeight;
|
123212
|
+
const ratio = this.getOrientation(w, h);
|
123213
|
+
if (model === 'flux-schnell') {
|
123214
|
+
if (ratio === '1:1') {
|
123215
|
+
width = 1024;
|
123216
|
+
height = 1024;
|
123217
|
+
} else if (ratio === '4:5') {
|
123218
|
+
width = 768;
|
123219
|
+
height = 960;
|
123220
|
+
} else if (ratio === '2:3') {
|
123221
|
+
width = 768;
|
123222
|
+
height = 1152;
|
123223
|
+
} else if (ratio === '9:16') {
|
123224
|
+
width = 720;
|
123225
|
+
height = 1280;
|
123226
|
+
} else if (ratio === '4:7') {
|
123227
|
+
width = 512;
|
123228
|
+
height = 896;
|
123229
|
+
} else if (ratio === '5:4') {
|
123230
|
+
width = 960;
|
123231
|
+
height = 768;
|
123232
|
+
} else if (ratio === '3:2') {
|
123233
|
+
width = 1152;
|
123234
|
+
height = 768;
|
123235
|
+
} else if (ratio === '16:9') {
|
123236
|
+
width = 1280;
|
123237
|
+
height = 720;
|
123238
|
+
} else if (ratio === '7:4') {
|
123239
|
+
width = 896;
|
123240
|
+
height = 512;
|
123241
|
+
}
|
123242
|
+
} else {
|
123243
|
+
if (ratio === '1:1') {
|
123244
|
+
width = 512;
|
123245
|
+
height = 512;
|
123246
|
+
} else if (ratio === '4:5') {
|
123247
|
+
width = 512;
|
123248
|
+
height = 640;
|
123249
|
+
} else if (ratio === '2:3') {
|
123250
|
+
width = 512;
|
123251
|
+
height = 768;
|
123252
|
+
} else if (ratio === '9:16') {
|
123253
|
+
width = 576;
|
123254
|
+
height = 1024;
|
123255
|
+
} else if (ratio === '4:7') {
|
123256
|
+
width = 512;
|
123257
|
+
height = 896;
|
123258
|
+
} else if (ratio === '5:4') {
|
123259
|
+
width = 640;
|
123260
|
+
height = 512;
|
123261
|
+
} else if (ratio === '3:2') {
|
123262
|
+
width = 768;
|
123263
|
+
height = 512;
|
123264
|
+
} else if (ratio === '16:9') {
|
123265
|
+
width = 1024;
|
123266
|
+
height = 576;
|
123267
|
+
} else if (ratio === '7:4') {
|
123268
|
+
width = 896;
|
123269
|
+
height = 512;
|
123270
|
+
}
|
123271
|
+
}
|
123272
|
+
}
|
123273
|
+
this.ai_width = width;
|
123274
|
+
this.ai_height = height;
|
122940
123275
|
const messages = {
|
122941
123276
|
model,
|
122942
123277
|
prompt: prompt,
|
122943
123278
|
negative_prompt,
|
122944
|
-
width:
|
122945
|
-
height:
|
123279
|
+
width: this.ai_width,
|
123280
|
+
height: this.ai_height,
|
122946
123281
|
steps,
|
122947
123282
|
guidance,
|
122948
123283
|
scheduler,
|
@@ -122968,10 +123303,15 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
122968
123303
|
return;
|
122969
123304
|
}
|
122970
123305
|
const imageUrl = result.url;
|
122971
|
-
if (this.
|
122972
|
-
|
122973
|
-
} else {
|
123306
|
+
if (this.activeImage) {
|
123307
|
+
// selectable image on content doesn't need tp be upscaled
|
122974
123308
|
callback(imageUrl);
|
123309
|
+
} else {
|
123310
|
+
if (this.imageAutoUpscale) {
|
123311
|
+
this.upscaleImage(imageUrl, callback);
|
123312
|
+
} else {
|
123313
|
+
callback(imageUrl);
|
123314
|
+
}
|
122975
123315
|
}
|
122976
123316
|
} catch (error) {
|
122977
123317
|
if (error.name === 'AbortError') ; else {
|
@@ -123635,18 +123975,21 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
123635
123975
|
}
|
123636
123976
|
|
123637
123977
|
if (this.dom.textSelection()) {
|
123638
|
-
if (e.keyCode ===
|
123978
|
+
if (e.keyCode === 38) {
|
123639
123979
|
// Up arrow
|
123640
123980
|
this.util.saveSelection();
|
123641
|
-
} else if (e.keyCode ===
|
123981
|
+
} else if (e.keyCode === 40) {
|
123642
123982
|
// Down arrow
|
123643
123983
|
this.util.saveSelection();
|
123644
|
-
} else if (e.keyCode ===
|
123984
|
+
} else if (e.keyCode === 37) {
|
123645
123985
|
// Left arrow
|
123646
123986
|
this.util.saveSelection();
|
123647
|
-
} else if (e.keyCode ===
|
123987
|
+
} else if (e.keyCode === 39) {
|
123648
123988
|
// Right arrow
|
123649
123989
|
this.util.saveSelection();
|
123990
|
+
} else if (e.keyCode === 13) {
|
123991
|
+
// Enter
|
123992
|
+
this.util.saveSelection();
|
123650
123993
|
}
|
123651
123994
|
}
|
123652
123995
|
|
@@ -138817,6 +139160,18 @@ class Box {
|
|
138817
139160
|
this.builder.onChange();
|
138818
139161
|
}
|
138819
139162
|
|
139163
|
+
lockContentSize(isLock) {
|
139164
|
+
this.builder.editor.saveForUndo();
|
139165
|
+
let activeBox = this.builder.activeBox;
|
139166
|
+
let container = activeBox.querySelector('.is-builder');
|
139167
|
+
|
139168
|
+
if (isLock) {
|
139169
|
+
container.classList.add('v3');
|
139170
|
+
} else {
|
139171
|
+
container.classList.remove('v3');
|
139172
|
+
}
|
139173
|
+
}
|
139174
|
+
|
138820
139175
|
parallaxContent(isParallax) {
|
138821
139176
|
this.builder.editor.saveForUndo();
|
138822
139177
|
let activeBox = this.builder.activeBox;
|
@@ -154981,6 +155336,7 @@ class ContentBox {
|
|
154981
155336
|
rowTool: 'right',
|
154982
155337
|
toolStyle: '',
|
154983
155338
|
outlineStyle: '',
|
155339
|
+
rowHandle: true,
|
154984
155340
|
snippetAddTool: true,
|
154985
155341
|
mobileSimpleEdit: false,
|
154986
155342
|
clearPreferences: false,
|
@@ -158537,6 +158893,7 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
|
|
158537
158893
|
rowTool: this.settings.rowTool,
|
158538
158894
|
toolStyle: this.settings.toolStyle,
|
158539
158895
|
outlineStyle: this.settings.outlineStyle,
|
158896
|
+
rowHandle: this.settings.rowHandle,
|
158540
158897
|
snippetAddTool: this.settings.snippetAddTool,
|
158541
158898
|
mobileSimpleEdit: this.settings.mobileSimpleEdit,
|
158542
158899
|
clearPreferences: this.settings.clearPreferences,
|
@@ -160273,65 +160630,93 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
|
|
160273
160630
|
|
160274
160631
|
|
160275
160632
|
boxRender() {
|
160633
|
+
if (!this.linksWithClickListeners) {
|
160634
|
+
this.linksWithClickListeners = new Set();
|
160635
|
+
}
|
160636
|
+
|
160637
|
+
const links = this.wrapperEl.querySelectorAll('.is-box .is-overlay a'); // eg. slider links
|
160638
|
+
|
160639
|
+
links.forEach(link => {
|
160640
|
+
let url = link.getAttribute('href');
|
160641
|
+
|
160642
|
+
if (url.indexOf('#') === 0 || link.classList.contains('glightbox')) ; else {
|
160643
|
+
if (!this.linksWithClickListeners.has(link)) {
|
160644
|
+
link.addEventListener('click', e => {
|
160645
|
+
// Will go to the link
|
160646
|
+
const answer = window.confirm(out('Do you really want to leave?')); // Cancel the navigation and stay on the same page
|
160647
|
+
|
160648
|
+
if (!answer) {
|
160649
|
+
e.preventDefault();
|
160650
|
+
}
|
160651
|
+
|
160652
|
+
e.stopImmediatePropagation();
|
160653
|
+
});
|
160654
|
+
this.linksWithClickListeners.add(link); // Mark the listener as added
|
160655
|
+
}
|
160656
|
+
}
|
160657
|
+
});
|
160276
160658
|
const navbar = this.doc.querySelector('.is-section-navbar');
|
160277
160659
|
|
160278
160660
|
if (navbar) {
|
160279
160661
|
const links = navbar.querySelectorAll('a');
|
160280
160662
|
links.forEach(link => {
|
160281
|
-
|
160282
|
-
|
160283
|
-
|
160284
|
-
|
160285
|
-
if (url
|
160286
|
-
|
160287
|
-
|
160288
|
-
|
160289
|
-
|
160290
|
-
|
160291
|
-
|
160292
|
-
|
160293
|
-
|
160294
|
-
|
160295
|
-
|
160296
|
-
if (
|
160297
|
-
|
160663
|
+
if (!this.linksWithClickListeners.has(link)) {
|
160664
|
+
link.addEventListener('click', e => {
|
160665
|
+
let url = link.getAttribute('href');
|
160666
|
+
|
160667
|
+
if (url) {
|
160668
|
+
if (url.indexOf('#') === 0) {
|
160669
|
+
// Will go to bookmark
|
160670
|
+
if (url.indexOf('#section') === 0) {
|
160671
|
+
let num = url.replace('#section', '');
|
160672
|
+
|
160673
|
+
if (!isNaN(parseInt(num))) {
|
160674
|
+
let sections = this.doc.querySelectorAll('.is-section');
|
160675
|
+
let gotoSection;
|
160676
|
+
let x = 0;
|
160677
|
+
sections.forEach(function (section) {
|
160678
|
+
if (!dom.hasClass(section, 'is-section-navbar')) {
|
160679
|
+
if (x === num - 1) {
|
160680
|
+
gotoSection = section;
|
160681
|
+
}
|
160682
|
+
|
160683
|
+
x++;
|
160298
160684
|
}
|
160685
|
+
});
|
160299
160686
|
|
160300
|
-
|
160687
|
+
if (gotoSection) {
|
160688
|
+
this.scrollTo(gotoSection);
|
160301
160689
|
}
|
160302
|
-
});
|
160303
160690
|
|
160304
|
-
|
160305
|
-
this.scrollTo(gotoSection);
|
160691
|
+
e.preventDefault();
|
160306
160692
|
}
|
160693
|
+
} else {
|
160694
|
+
try {
|
160695
|
+
let bookmark = this.doc.querySelector(url);
|
160307
160696
|
|
160308
|
-
|
160309
|
-
|
160310
|
-
|
160311
|
-
|
160312
|
-
|
160313
|
-
|
160314
|
-
if (bookmark) {
|
160315
|
-
this.scrollTo(bookmark);
|
160316
|
-
e.preventDefault();
|
160697
|
+
if (bookmark) {
|
160698
|
+
this.scrollTo(bookmark);
|
160699
|
+
e.preventDefault();
|
160700
|
+
}
|
160701
|
+
} catch (e) {// Do Nothing
|
160317
160702
|
}
|
160318
|
-
} catch (e) {// Do Nothing
|
160319
160703
|
}
|
160704
|
+
} else {
|
160705
|
+
// Prevent to go to the link
|
160706
|
+
if (e.target.closest('#is-menu-toggle')) return;
|
160707
|
+
e.preventDefault();
|
160708
|
+
e.stopImmediatePropagation();
|
160320
160709
|
}
|
160321
160710
|
} else {
|
160322
|
-
|
160323
|
-
|
160324
|
-
|
160325
|
-
|
160326
|
-
|
160327
|
-
} else {
|
160328
|
-
if (link.closest('.is-menu-search')) ; else {
|
160329
|
-
if (!e.target.getAttribute('href')) return;
|
160330
|
-
e.preventDefault();
|
160331
|
-
e.stopImmediatePropagation();
|
160711
|
+
if (link.closest('.is-menu-search')) ; else {
|
160712
|
+
if (!e.target.getAttribute('href')) return;
|
160713
|
+
e.preventDefault();
|
160714
|
+
e.stopImmediatePropagation();
|
160715
|
+
}
|
160332
160716
|
}
|
160333
|
-
}
|
160334
|
-
|
160717
|
+
});
|
160718
|
+
this.linksWithClickListeners.add(link); // Mark the listener as added
|
160719
|
+
}
|
160335
160720
|
});
|
160336
160721
|
}
|
160337
160722
|
} // box
|
@@ -160498,7 +160883,7 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
|
|
160498
160883
|
'</div>');
|
160499
160884
|
*/
|
160500
160885
|
|
160501
|
-
dom.appendHtml(box, '<div class="is-box-tool" data-tool="1">' + '<button type="button" class="is-cover-upload" tabindex="-1" data-tooltip-top data-title="' + out('
|
160886
|
+
dom.appendHtml(box, '<div class="is-box-tool" data-tool="1">' + '<button type="button" class="is-cover-upload" tabindex="-1" data-tooltip-top data-title="' + out('Upload Background') + '" title="' + out('Upload Background') + '" style="background:rgb(78 170 57)"><svg class="is-icon-flex" style="position: absolute;top: 9px;left: 9px;fill:rgb(255,255,255);"><use xlink:href="#ion-image"></use></svg></button>' + '<button type="button" class="is-select-image" tabindex="-1" data-tooltip-top data-title="' + out('Select Background') + '" title="' + out('Select Background') + '" style="background:rgb(251 173 27)"><svg class="is-icon-flex" style="color:#fff;width:17px;height:17px;"><use style="color: #fff;" xlink:href="#icon-folder2"></use></svg></button>' + '<button type="button" class="is-box-edit" tabindex="-1" data-tooltip-top data-title="' + out('Box Settings') + '" title="' + out('Box Settings') + '"><svg class="is-icon-flex"><use xlink:href="#ion-wrench"></use></svg></button>' + '<button type="button" class="is-module-edit" tabindex="-1" data-tooltip-top data-title="' + out('Module Settings') + '" title="' + out('Module Settings') + '" style="background:rgb(135 116 215)"><svg class="is-icon-flex"><use xlink:href="#ion-ios-gear"></use></svg></button>' + '</div>');
|
160502
160887
|
let info = box.querySelector('.is-box-info');
|
160503
160888
|
if (info) info.parentNode.removeChild(info);
|
160504
160889
|
|