@innovastudio/contentbuilder 1.5.204 → 1.5.206
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/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -48835,7 +48835,7 @@ class ButtonEditor {
|
|
|
48835
48835
|
}
|
|
48836
48836
|
|
|
48837
48837
|
// Build style and attributes based on type
|
|
48838
|
-
if (type === '
|
|
48838
|
+
if (type === 'outline2') {
|
|
48839
48839
|
// Outline button
|
|
48840
48840
|
const borderClass = borderColor ? '' : 'border-current hover:border-current';
|
|
48841
48841
|
classes += ` ${borderClass}`;
|
|
@@ -48845,6 +48845,31 @@ class ButtonEditor {
|
|
|
48845
48845
|
return {
|
|
48846
48846
|
html: `<a href="${href}" role="button" class="${classes}"${styleAttr ? ' ' + styleAttr : ''}>${text}</a>`
|
|
48847
48847
|
};
|
|
48848
|
+
} else if (type === 'outline') {
|
|
48849
|
+
// Solid button with background
|
|
48850
|
+
classes += ' border-current hover:border-transparent';
|
|
48851
|
+
let html = '<a\n';
|
|
48852
|
+
html += ` href="${href}"\n`;
|
|
48853
|
+
html += ' role="button"\n';
|
|
48854
|
+
html += ` class="${classes}"\n`;
|
|
48855
|
+
if (color || bg) {
|
|
48856
|
+
const styles = [];
|
|
48857
|
+
if (color) styles.push(`color: ${color}`);
|
|
48858
|
+
if (bg) styles.push(`background-color: ${bg}`);
|
|
48859
|
+
html += ` style="${styles.join('; ')};"`;
|
|
48860
|
+
}
|
|
48861
|
+
if (bg && hoverBg) {
|
|
48862
|
+
html += `\n data-bg="${bg}"`;
|
|
48863
|
+
html += `\n data-hover-bg="${hoverBg}"`;
|
|
48864
|
+
html += '\n onmouseover="if(this.getAttribute(\'data-hover-bg\'))this.style.backgroundColor=this.getAttribute(\'data-hover-bg\');"';
|
|
48865
|
+
html += '\n onmouseout="if(this.getAttribute(\'data-bg\'))this.style.backgroundColor=this.getAttribute(\'data-bg\');else this.style.backgroundColor=\'\';"';
|
|
48866
|
+
}
|
|
48867
|
+
html += '>\n';
|
|
48868
|
+
html += ` ${text}\n`;
|
|
48869
|
+
html += '</a>';
|
|
48870
|
+
return {
|
|
48871
|
+
html
|
|
48872
|
+
};
|
|
48848
48873
|
} else if (type === 'solid') {
|
|
48849
48874
|
// Solid button with background
|
|
48850
48875
|
classes += ' border-transparent hover:border-transparent';
|
|
@@ -48887,7 +48912,11 @@ class ButtonEditor {
|
|
|
48887
48912
|
}, {
|
|
48888
48913
|
type: 'outline',
|
|
48889
48914
|
shape: 'rounded',
|
|
48890
|
-
text: 'Read More'
|
|
48915
|
+
text: 'Read More',
|
|
48916
|
+
color: 'rgb(24, 24, 27)',
|
|
48917
|
+
bg: 'transparent',
|
|
48918
|
+
hoverBg: 'rgb(24, 24, 27)',
|
|
48919
|
+
customClasses: 'hover:text-white'
|
|
48891
48920
|
}, {
|
|
48892
48921
|
type: 'solid',
|
|
48893
48922
|
shape: 'rounded',
|
|
@@ -48908,7 +48937,8 @@ class ButtonEditor {
|
|
|
48908
48937
|
text: 'Read More',
|
|
48909
48938
|
color: 'rgb(250, 250, 250)',
|
|
48910
48939
|
bg: 'transparent',
|
|
48911
|
-
hoverBg: '
|
|
48940
|
+
hoverBg: '#fff',
|
|
48941
|
+
customClasses: 'hover:text-black'
|
|
48912
48942
|
}, {
|
|
48913
48943
|
type: 'solid',
|
|
48914
48944
|
shape: 'rounded',
|
|
@@ -49025,7 +49055,11 @@ class ButtonEditor {
|
|
|
49025
49055
|
}, {
|
|
49026
49056
|
type: 'outline',
|
|
49027
49057
|
shape: 'slightly-rounded',
|
|
49028
|
-
text: 'Read More'
|
|
49058
|
+
text: 'Read More',
|
|
49059
|
+
color: 'rgb(24, 24, 27)',
|
|
49060
|
+
bg: 'transparent',
|
|
49061
|
+
hoverBg: 'rgb(24, 24, 27)',
|
|
49062
|
+
customClasses: 'hover:text-white'
|
|
49029
49063
|
}, {
|
|
49030
49064
|
type: 'solid',
|
|
49031
49065
|
shape: 'slightly-rounded',
|
|
@@ -49046,7 +49080,8 @@ class ButtonEditor {
|
|
|
49046
49080
|
text: 'Read More',
|
|
49047
49081
|
color: 'rgb(250, 250, 250)',
|
|
49048
49082
|
bg: 'transparent',
|
|
49049
|
-
hoverBg: '
|
|
49083
|
+
hoverBg: '#fff',
|
|
49084
|
+
customClasses: 'hover:text-black'
|
|
49050
49085
|
}, {
|
|
49051
49086
|
type: 'solid',
|
|
49052
49087
|
shape: 'slightly-rounded',
|
|
@@ -49163,7 +49198,11 @@ class ButtonEditor {
|
|
|
49163
49198
|
}, {
|
|
49164
49199
|
type: 'outline',
|
|
49165
49200
|
shape: 'square',
|
|
49166
|
-
text: 'Read More'
|
|
49201
|
+
text: 'Read More',
|
|
49202
|
+
color: 'rgb(24, 24, 27)',
|
|
49203
|
+
bg: 'transparent',
|
|
49204
|
+
hoverBg: 'rgb(24, 24, 27)',
|
|
49205
|
+
customClasses: 'hover:text-white'
|
|
49167
49206
|
}, {
|
|
49168
49207
|
type: 'solid',
|
|
49169
49208
|
shape: 'square',
|
|
@@ -49184,7 +49223,8 @@ class ButtonEditor {
|
|
|
49184
49223
|
text: 'Read More',
|
|
49185
49224
|
color: 'rgb(250, 250, 250)',
|
|
49186
49225
|
bg: 'transparent',
|
|
49187
|
-
hoverBg: '
|
|
49226
|
+
hoverBg: '#fff',
|
|
49227
|
+
customClasses: 'hover:text-black'
|
|
49188
49228
|
}, {
|
|
49189
49229
|
type: 'solid',
|
|
49190
49230
|
shape: 'square',
|
|
@@ -49303,7 +49343,11 @@ class ButtonEditor {
|
|
|
49303
49343
|
type: 'outline',
|
|
49304
49344
|
shape: 'rounded',
|
|
49305
49345
|
size: 'small',
|
|
49306
|
-
text: 'Read More'
|
|
49346
|
+
text: 'Read More',
|
|
49347
|
+
color: 'rgb(24, 24, 27)',
|
|
49348
|
+
bg: 'transparent',
|
|
49349
|
+
hoverBg: 'rgb(24, 24, 27)',
|
|
49350
|
+
customClasses: 'hover:text-white'
|
|
49307
49351
|
}, {
|
|
49308
49352
|
type: 'solid',
|
|
49309
49353
|
shape: 'rounded',
|
|
@@ -49327,7 +49371,8 @@ class ButtonEditor {
|
|
|
49327
49371
|
text: 'Read More',
|
|
49328
49372
|
color: 'rgb(250, 250, 250)',
|
|
49329
49373
|
bg: 'transparent',
|
|
49330
|
-
hoverBg: '
|
|
49374
|
+
hoverBg: '#fff',
|
|
49375
|
+
customClasses: 'hover:text-black'
|
|
49331
49376
|
}, {
|
|
49332
49377
|
type: 'solid',
|
|
49333
49378
|
shape: 'rounded',
|
|
@@ -49449,7 +49494,11 @@ class ButtonEditor {
|
|
|
49449
49494
|
type: 'outline',
|
|
49450
49495
|
shape: 'slightly-rounded',
|
|
49451
49496
|
size: 'small',
|
|
49452
|
-
text: 'Read More'
|
|
49497
|
+
text: 'Read More',
|
|
49498
|
+
color: 'rgb(24, 24, 27)',
|
|
49499
|
+
bg: 'transparent',
|
|
49500
|
+
hoverBg: 'rgb(24, 24, 27)',
|
|
49501
|
+
customClasses: 'hover:text-white'
|
|
49453
49502
|
}, {
|
|
49454
49503
|
type: 'solid',
|
|
49455
49504
|
shape: 'slightly-rounded',
|
|
@@ -49473,7 +49522,8 @@ class ButtonEditor {
|
|
|
49473
49522
|
text: 'Read More',
|
|
49474
49523
|
color: 'rgb(250, 250, 250)',
|
|
49475
49524
|
bg: 'transparent',
|
|
49476
|
-
hoverBg: '
|
|
49525
|
+
hoverBg: '#fff',
|
|
49526
|
+
customClasses: 'hover:text-black'
|
|
49477
49527
|
}, {
|
|
49478
49528
|
type: 'solid',
|
|
49479
49529
|
shape: 'slightly-rounded',
|
|
@@ -49595,7 +49645,11 @@ class ButtonEditor {
|
|
|
49595
49645
|
type: 'outline',
|
|
49596
49646
|
shape: 'rounded',
|
|
49597
49647
|
size: 'large',
|
|
49598
|
-
text: 'Read More'
|
|
49648
|
+
text: 'Read More',
|
|
49649
|
+
color: 'rgb(24, 24, 27)',
|
|
49650
|
+
bg: 'transparent',
|
|
49651
|
+
hoverBg: 'rgb(24, 24, 27)',
|
|
49652
|
+
customClasses: 'hover:text-white'
|
|
49599
49653
|
}, {
|
|
49600
49654
|
type: 'solid',
|
|
49601
49655
|
shape: 'rounded',
|
|
@@ -49619,7 +49673,8 @@ class ButtonEditor {
|
|
|
49619
49673
|
text: 'Read More',
|
|
49620
49674
|
color: 'rgb(250, 250, 250)',
|
|
49621
49675
|
bg: 'transparent',
|
|
49622
|
-
hoverBg: '
|
|
49676
|
+
hoverBg: '#fff',
|
|
49677
|
+
customClasses: 'hover:text-black'
|
|
49623
49678
|
}, {
|
|
49624
49679
|
type: 'solid',
|
|
49625
49680
|
shape: 'rounded',
|
|
@@ -49741,7 +49796,11 @@ class ButtonEditor {
|
|
|
49741
49796
|
type: 'outline',
|
|
49742
49797
|
shape: 'slightly-rounded',
|
|
49743
49798
|
size: 'large',
|
|
49744
|
-
text: 'Read More'
|
|
49799
|
+
text: 'Read More',
|
|
49800
|
+
color: 'rgb(24, 24, 27)',
|
|
49801
|
+
bg: 'transparent',
|
|
49802
|
+
hoverBg: 'rgb(24, 24, 27)',
|
|
49803
|
+
customClasses: 'hover:text-white'
|
|
49745
49804
|
}, {
|
|
49746
49805
|
type: 'solid',
|
|
49747
49806
|
shape: 'slightly-rounded',
|
|
@@ -49765,7 +49824,8 @@ class ButtonEditor {
|
|
|
49765
49824
|
text: 'Read More',
|
|
49766
49825
|
color: 'rgb(250, 250, 250)',
|
|
49767
49826
|
bg: 'transparent',
|
|
49768
|
-
hoverBg: '
|
|
49827
|
+
hoverBg: '#fff',
|
|
49828
|
+
customClasses: 'hover:text-black'
|
|
49769
49829
|
}, {
|
|
49770
49830
|
type: 'solid',
|
|
49771
49831
|
shape: 'slightly-rounded',
|
|
@@ -49887,7 +49947,11 @@ class ButtonEditor {
|
|
|
49887
49947
|
type: 'outline',
|
|
49888
49948
|
shape: 'square',
|
|
49889
49949
|
size: 'large',
|
|
49890
|
-
text: 'Read More'
|
|
49950
|
+
text: 'Read More',
|
|
49951
|
+
color: 'rgb(24, 24, 27)',
|
|
49952
|
+
bg: 'transparent',
|
|
49953
|
+
hoverBg: 'rgb(24, 24, 27)',
|
|
49954
|
+
customClasses: 'hover:text-white'
|
|
49891
49955
|
}, {
|
|
49892
49956
|
type: 'solid',
|
|
49893
49957
|
shape: 'square',
|
|
@@ -49911,7 +49975,8 @@ class ButtonEditor {
|
|
|
49911
49975
|
text: 'Read More',
|
|
49912
49976
|
color: 'rgb(250, 250, 250)',
|
|
49913
49977
|
bg: 'transparent',
|
|
49914
|
-
hoverBg: '
|
|
49978
|
+
hoverBg: '#fff',
|
|
49979
|
+
customClasses: 'hover:text-black'
|
|
49915
49980
|
}, {
|
|
49916
49981
|
type: 'solid',
|
|
49917
49982
|
shape: 'square',
|
|
@@ -70769,6 +70834,7 @@ class Rte {
|
|
|
70769
70834
|
// Reset Zoom
|
|
70770
70835
|
const btnResetZoom = builderStuff.querySelector('.reset-zoom');
|
|
70771
70836
|
btnResetZoom.addEventListener('click', () => {
|
|
70837
|
+
hideTools();
|
|
70772
70838
|
this.rteZoomSlider.value = 100;
|
|
70773
70839
|
this.builder.opts.zoom = 1;
|
|
70774
70840
|
localStorage.setItem('_zoom', 1); // Save
|
|
@@ -70790,6 +70856,7 @@ class Rte {
|
|
|
70790
70856
|
|
|
70791
70857
|
// setZoomOnArea
|
|
70792
70858
|
this.builder.setZoomOnArea();
|
|
70859
|
+
showTools();
|
|
70793
70860
|
});
|
|
70794
70861
|
|
|
70795
70862
|
// Zoom Modal
|
|
@@ -100462,6 +100529,146 @@ Please obtain a license at: https://innovastudio.com/contentbox`);
|
|
|
100462
100529
|
plugin.setAttribute('data-cb-original-content', newHTML);
|
|
100463
100530
|
}
|
|
100464
100531
|
}
|
|
100532
|
+
applyDragDropBlocks(snippetlist) {
|
|
100533
|
+
if (!this.iframeDragDrop) new Sortable(snippetlist, {
|
|
100534
|
+
// forceFallback: safariAgent,
|
|
100535
|
+
group: {
|
|
100536
|
+
name: 'shared',
|
|
100537
|
+
pull: 'clone',
|
|
100538
|
+
put: false // Do not allow items to be put into this list
|
|
100539
|
+
},
|
|
100540
|
+
|
|
100541
|
+
sort: false,
|
|
100542
|
+
animation: 150,
|
|
100543
|
+
onChoose: evt => {
|
|
100544
|
+
// Adjust temmporary
|
|
100545
|
+
const newCss = `
|
|
100546
|
+
<style id="css-scale">
|
|
100547
|
+
.sortable-ghost {
|
|
100548
|
+
height: 50px;
|
|
100549
|
+
}
|
|
100550
|
+
.sortable-ghost * {
|
|
100551
|
+
display: none
|
|
100552
|
+
}
|
|
100553
|
+
</style>
|
|
100554
|
+
`;
|
|
100555
|
+
this.itemHeight = evt.item.offsetHeight;
|
|
100556
|
+
if (this.iframe) {
|
|
100557
|
+
const oldCss = this.contentStuff.querySelector('#css-scale');
|
|
100558
|
+
if (oldCss) oldCss.parentNode.removeChild(oldCss);
|
|
100559
|
+
this.contentStuff.insertAdjacentHTML('afterbegin', newCss);
|
|
100560
|
+
} else {
|
|
100561
|
+
const oldCss = this.builderStuff.querySelector('#css-scale');
|
|
100562
|
+
if (oldCss) oldCss.parentNode.removeChild(oldCss);
|
|
100563
|
+
this.builderStuff.insertAdjacentHTML('afterbegin', newCss);
|
|
100564
|
+
}
|
|
100565
|
+
this.uo.saveForUndo(true); // Must be called before sectionDropSetup() to prevent saving extra 'block-dummy' helpers.
|
|
100566
|
+
|
|
100567
|
+
this.sectionDropSetup();
|
|
100568
|
+
this.util.clearPops();
|
|
100569
|
+
this.hideElementTools();
|
|
100570
|
+
},
|
|
100571
|
+
onClone: evt => {
|
|
100572
|
+
// fix broken image on cloned element
|
|
100573
|
+
var cloneEl = evt.clone;
|
|
100574
|
+
let img = cloneEl.querySelector('img');
|
|
100575
|
+
img.style.opacity = 0.0001;
|
|
100576
|
+
cloneEl.style.height = this.itemHeight + 'px';
|
|
100577
|
+
let timestamp = new Date().getTime();
|
|
100578
|
+
let separator = img.src.includes('?') ? '&' : '?';
|
|
100579
|
+
img.src = img.src + separator + timestamp;
|
|
100580
|
+
img.style.opacity = '';
|
|
100581
|
+
},
|
|
100582
|
+
onMove: () => {
|
|
100583
|
+
let emptyinfo = this.doc.querySelector('.row-add-initial'); // if there is empty info, remove it during snippet drag drop
|
|
100584
|
+
// if(emptyinfo) emptyinfo.parentNode.removeChild(emptyinfo);
|
|
100585
|
+
if (emptyinfo) emptyinfo.style.display = 'none';
|
|
100586
|
+
|
|
100587
|
+
// if(this.sortableOnPage) if(evt.related.getBoundingClientRect().top<0 ||
|
|
100588
|
+
// evt.related.getBoundingClientRect().top>window.innerHeight) {
|
|
100589
|
+
// return false;
|
|
100590
|
+
// }
|
|
100591
|
+
|
|
100592
|
+
// to prevent flicker caused by snippet panel above wrapper (see contentthis.js sectionDropSetup)
|
|
100593
|
+
if (this.page && this.page === '.is-wrapper') {
|
|
100594
|
+
const wrapper = this.doc.querySelector(this.page);
|
|
100595
|
+
if (wrapper) wrapper.style.marginLeft = '';
|
|
100596
|
+
}
|
|
100597
|
+
},
|
|
100598
|
+
onSort: evt => {
|
|
100599
|
+
if (!this.canvas) return;
|
|
100600
|
+
let snippetX = evt.originalEvent.clientX;
|
|
100601
|
+
let snippetY = evt.originalEvent.clientY;
|
|
100602
|
+
const block = this.doc.querySelector('[data-new-dummy]');
|
|
100603
|
+
if (block) {
|
|
100604
|
+
const docContainer = block.parentNode;
|
|
100605
|
+
const rectContainer = docContainer.getBoundingClientRect();
|
|
100606
|
+
block.offsetWidth / 2;
|
|
100607
|
+
let x = (snippetX - block.offsetWidth / 2 - rectContainer.left) / docContainer.offsetWidth * 100;
|
|
100608
|
+
let y = (snippetY - block.offsetHeight / 2 - rectContainer.top) / docContainer.offsetHeight * 100;
|
|
100609
|
+
if (y < 0) y = 15; // if block is not fully loaded, block height may be incorrect (y can be negative). Adjust to 15%.
|
|
100610
|
+
block.style.top = y + '%';
|
|
100611
|
+
block.style.left = x + '%';
|
|
100612
|
+
block.removeAttribute('data-new-dummy');
|
|
100613
|
+
}
|
|
100614
|
+
},
|
|
100615
|
+
onStart: () => {
|
|
100616
|
+
// Remove .builder-active during dragging (because this class makes rows have border-right/left 120px)
|
|
100617
|
+
this.activeBuilderArea = null;
|
|
100618
|
+
const area = this.doc.querySelector('.builder-active');
|
|
100619
|
+
if (area) {
|
|
100620
|
+
this.activeBuilderArea = area;
|
|
100621
|
+
this.activeBuilderArea.classList.remove('builder-active');
|
|
100622
|
+
}
|
|
100623
|
+
|
|
100624
|
+
// this.uo.saveForUndo(); // Even if cancelled, saveForUndo will make sure not to save if there is no change => commented (moved to onChoose).
|
|
100625
|
+
|
|
100626
|
+
let elm = document.querySelector('.is-sidebar-overlay');
|
|
100627
|
+
if (elm) elm.style.display = 'none'; // LATER: ContentBox
|
|
100628
|
+
},
|
|
100629
|
+
|
|
100630
|
+
onEnd: () => {
|
|
100631
|
+
let elm = document.querySelector('.is-sidebar-overlay');
|
|
100632
|
+
if (elm) elm.style.display = 'block'; // LATER: ContentBox
|
|
100633
|
+
this.util.checkEmpty(); // In case container is still empty (drag drop snippet cancelled)
|
|
100634
|
+
|
|
100635
|
+
let emptyinfo = this.doc.querySelector('.row-add-initial');
|
|
100636
|
+
if (emptyinfo) emptyinfo.style.display = '';
|
|
100637
|
+
|
|
100638
|
+
// Return back the .builder-active
|
|
100639
|
+
if (this.activeBuilderArea) {
|
|
100640
|
+
this.activeBuilderArea.classList.add('builder-active');
|
|
100641
|
+
}
|
|
100642
|
+
},
|
|
100643
|
+
onUnchoose: () => {
|
|
100644
|
+
setTimeout(() => {
|
|
100645
|
+
// Give time for onAdd to finish
|
|
100646
|
+
// Destroy placed in onUnchoose in case a snippet is just clicked (no drag/drop) so that onAdd is not triggered.
|
|
100647
|
+
// destroy
|
|
100648
|
+
if (this.sortableOnCanvas) {
|
|
100649
|
+
this.sortableOnCanvas.forEach(obj => {
|
|
100650
|
+
if (obj) {
|
|
100651
|
+
obj.destroy();
|
|
100652
|
+
}
|
|
100653
|
+
});
|
|
100654
|
+
this.sortableOnCanvas = [];
|
|
100655
|
+
}
|
|
100656
|
+
if (this.sortableOnPage) {
|
|
100657
|
+
this.sortableOnPage.destroy();
|
|
100658
|
+
this.sortableOnPage = null;
|
|
100659
|
+
}
|
|
100660
|
+
let dummies = this.doc.querySelectorAll('.block-dummy');
|
|
100661
|
+
dummies.forEach(elm => elm.parentNode.removeChild(elm));
|
|
100662
|
+
|
|
100663
|
+
// to prevent flicker caused by snippet panel above wrapper (see contentthis.js sectionDropSetup)
|
|
100664
|
+
if (this.page && this.page === '.is-wrapper') {
|
|
100665
|
+
const wrapper = this.doc.querySelector(this.page);
|
|
100666
|
+
if (wrapper) wrapper.style.marginLeft = '';
|
|
100667
|
+
}
|
|
100668
|
+
}, 10);
|
|
100669
|
+
}
|
|
100670
|
+
});
|
|
100671
|
+
}
|
|
100465
100672
|
}
|
|
100466
100673
|
|
|
100467
100674
|
export { ContentBuilder as default };
|