@innovastudio/contentbuilder 1.5.205 → 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
|
@@ -70834,6 +70834,7 @@ class Rte {
|
|
|
70834
70834
|
// Reset Zoom
|
|
70835
70835
|
const btnResetZoom = builderStuff.querySelector('.reset-zoom');
|
|
70836
70836
|
btnResetZoom.addEventListener('click', () => {
|
|
70837
|
+
hideTools();
|
|
70837
70838
|
this.rteZoomSlider.value = 100;
|
|
70838
70839
|
this.builder.opts.zoom = 1;
|
|
70839
70840
|
localStorage.setItem('_zoom', 1); // Save
|
|
@@ -70855,6 +70856,7 @@ class Rte {
|
|
|
70855
70856
|
|
|
70856
70857
|
// setZoomOnArea
|
|
70857
70858
|
this.builder.setZoomOnArea();
|
|
70859
|
+
showTools();
|
|
70858
70860
|
});
|
|
70859
70861
|
|
|
70860
70862
|
// Zoom Modal
|
|
@@ -100527,6 +100529,146 @@ Please obtain a license at: https://innovastudio.com/contentbox`);
|
|
|
100527
100529
|
plugin.setAttribute('data-cb-original-content', newHTML);
|
|
100528
100530
|
}
|
|
100529
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
|
+
}
|
|
100530
100672
|
}
|
|
100531
100673
|
|
|
100532
100674
|
export { ContentBuilder as default };
|