@innovastudio/contentbuilder 1.5.94 → 1.5.96

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,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.5.94",
4
+ "version": "1.5.96",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "types": "index.d.ts",
@@ -1464,22 +1464,27 @@ const renderQuickAdd = builder => {
1464
1464
 
1465
1465
  ${encodeURIComponent(`
1466
1466
  <div id="_style_{id}" style="display:none">
1467
- .animate-spin {
1468
- animation: spin 1s linear infinite;
1467
+ #{id} {
1468
+ transition: all 0.3s ease-out;
1469
+ height: auto;
1469
1470
  }
1470
- @keyframes spin {
1471
- from {
1472
- transform: rotate(0deg);
1473
- }
1474
- to {
1475
- transform: rotate(360deg);
1476
- }
1471
+ #{id}.collapsed {
1472
+ overflow: hidden;
1473
+ height: 0;
1474
+ }
1475
+ #status_{id} {
1476
+ transition: all 0.3s ease-out;
1477
+ height: auto;
1478
+ }
1479
+ #status_{id}.collapsed {
1480
+ overflow: hidden;
1481
+ height: 0;
1477
1482
  }
1478
1483
  </div>
1479
1484
  <form id="form_{id}" method="POST" action="/formsubmission" style="padding: 25px 0 20px">
1480
1485
  <div id="{id}"></div>
1481
1486
 
1482
- <div id="status_{id}"></div>
1487
+ <div id="status_{id}" class="collapsed"></div>
1483
1488
  </form>
1484
1489
 
1485
1490
  <script>
@@ -1502,11 +1507,7 @@ const renderQuickAdd = builder => {
1502
1507
  docReady(function() {
1503
1508
 
1504
1509
  var elm = document.getElementById('{id}');
1505
- var viewer = new FormViewer(elm, {
1506
- onChange: (json) => {
1507
- // console.log(json);
1508
- },
1509
- });
1510
+ var viewer = new FormViewer(elm);
1510
1511
 
1511
1512
  let json = {
1512
1513
  "title": "Register for the Tech Conference",
@@ -1560,67 +1561,53 @@ const renderQuickAdd = builder => {
1560
1561
  const initialFormData = JSON.stringify(json);
1561
1562
  viewer.view(initialFormData);
1562
1563
 
1563
- const form = document.querySelector('#form_{id}');
1564
-
1565
1564
  var statusInfo = document.querySelector('#status_{id}');
1566
1565
 
1567
- /*
1568
- form.addEventListener('submit', async (event) => {
1569
-
1570
- event.preventDefault();
1571
-
1572
- const form = event.target;
1573
- const formData = new FormData(form);
1574
-
1575
- fetch('/formsubmission', {
1576
- method: 'POST',
1577
- body: formData,
1578
- })
1579
- .then(response=>response.json())
1580
- .then(response=>{
1581
- console.log(response);
1582
- });
1583
- });
1584
- */
1585
-
1586
- var btnSend = form.querySelector('.btn-submitform');
1566
+ var form = document.querySelector('#form_{id}');
1587
1567
 
1588
1568
  async function handleSubmit(event) {
1589
1569
  event.preventDefault();
1590
1570
 
1571
+ var btnSend = form.querySelector('.btn-submitform');
1572
+
1591
1573
  btnSend.innerHTML = '<span class="loading-icon"><svg class="animate-spin" style="margin-right:7px;width:20px;height:20px" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"><circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle><path class="opacity-75" fill="currentColor" d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path></svg></span>Submit';
1592
1574
 
1593
1575
  var data = new FormData(form);
1576
+
1594
1577
  fetch(form.action, {
1595
1578
  method: form.method,
1596
1579
  body: data,
1597
1580
  headers: {
1598
1581
  'Accept': 'application/json'
1599
1582
  }
1600
- }).then(response => {
1601
- if (response.ok) {
1602
- statusInfo.innerHTML = '<div class="text-center pt-4"><i class="bi bi-send-check size-64"></i>' +
1603
- '</div><div class="leading-11 text-center size-38 pb-4">Thanks for your submission!</div>';
1583
+ })
1584
+ .then(response=>response.json())
1585
+ .then(data=>{
1586
+ if(!data.error) {
1587
+ statusInfo.innerHTML = '<div class="text-center pt-4 pb-4"><i class="bi bi-send-check size-64"></i>' +
1588
+ '</div><div class="leading-14 text-center size-38 pb-4">Thanks for your submission!</div>';
1604
1589
  form.reset();
1590
+
1591
+ elm.classList.add('collapsed');
1592
+ setTimeout(function(){
1593
+ statusInfo.classList.remove('collapsed');
1594
+ },300);
1595
+
1605
1596
  } else {
1606
- response.json().then(data => {
1607
- if (Object.hasOwn(data, 'errors')) {
1608
- statusInfo.innerHTML = data['errors'].map(error => error['message']).join(', ');
1609
- } else {
1610
- statusInfo.innerHTML = '<div class="leading-11 text-center size-38 pt-4 pb-4">Oops! There was a problem submitting your form.</div>';
1611
- }
1612
- });
1597
+ statusInfo.innerHTML = '<div class="leading-14 text-center size-38 pt-4 pb-4">Oops! There was a problem submitting your form.</div>';
1598
+
1599
+ // elm.classList.toggle('collapsed');
1600
+ setTimeout(function(){
1601
+ // statusInfo.innerHTML = data.error;
1602
+ statusInfo.classList.remove('collapsed');
1603
+ },300);
1613
1604
  }
1614
1605
 
1615
- btnSend.innerHTML = 'Submit';
1616
- }).catch(error => {
1617
- statusInfo.innerHTML = '<div class="leading-11 text-center size-38 pt-4 pb-4">Oops! There was a problem submitting your form.</div>';
1618
-
1619
1606
  btnSend.innerHTML = 'Submit';
1620
1607
  });
1621
1608
  }
1622
1609
 
1623
- viewer.settings.onSubmit = handleSubmit;
1610
+ form.addEventListener('submit', handleSubmit);
1624
1611
 
1625
1612
  });
1626
1613
  </script>
@@ -18011,26 +17998,26 @@ const renderSnippetPanel = (builder, snippetOpen) => {
18011
17998
  }
18012
17999
  });
18013
18000
  }
18001
+
18002
+ /*
18014
18003
  let snippetid;
18015
- if (isMobile && builder.isContentBox) {
18016
- const items = snippetlist.querySelectorAll('.snippet-item');
18017
- items.forEach(item => {
18018
- if (item.classList.contains('data-click')) return;
18019
- item.addEventListener('touchstart', () => {
18020
- snippetid = item.getAttribute('data-id');
18021
- }, {
18022
- passive: false
18004
+ if(isMobile && builder.isContentBox) {
18005
+ const items = snippetlist.querySelectorAll('.snippet-item');
18006
+ items.forEach(item=>{
18007
+ if(item.classList.contains('data-click')) return;
18008
+ item.addEventListener('touchstart', ()=>{
18009
+ snippetid = item.getAttribute('data-id');
18010
+ }, { passive: false });
18011
+ item.addEventListener('touchend', ()=>{
18012
+ builder.dropSnippet(snippetid);
18013
+ }, { passive: false });
18014
+ item.classList.add('data-click');
18023
18015
  });
18024
- item.addEventListener('touchend', () => {
18025
- builder.dropSnippet(snippetid);
18026
- }, {
18027
- passive: false
18028
- });
18029
- item.classList.add('data-click');
18030
- });
18031
18016
  }
18017
+ */
18032
18018
  }
18033
18019
  });
18020
+
18034
18021
  inpSnippet.setValue(defaultcatval + '');
18035
18022
  inpSnippet.closeOptions();
18036
18023
  if (builder.opts.snippetList === '#divSnippetList') {
@@ -18148,28 +18135,27 @@ const renderSnippetPanel = (builder, snippetOpen) => {
18148
18135
 
18149
18136
  let activeBuilderArea;
18150
18137
  let itemHeight;
18138
+
18139
+ /*
18151
18140
  const isMobile = dom.detectMobileOrTablet();
18152
- let snippetid;
18141
+ let snippetid;
18153
18142
  let useClick = false;
18154
- if (isMobile && builder.isContentBox) {
18155
- const items = snippetlist.querySelectorAll('.snippet-item');
18156
- items.forEach(item => {
18157
- if (item.classList.contains('data-click')) return;
18158
- item.addEventListener('touchstart', () => {
18159
- snippetid = item.getAttribute('data-id');
18160
- }, {
18161
- passive: false
18162
- });
18163
- item.addEventListener('touchend', () => {
18164
- builder.dropSnippet(snippetid);
18165
- }, {
18166
- passive: false
18167
- });
18168
- item.classList.add('data-click');
18169
- });
18170
- useClick = true;
18171
- }
18172
- if (!useClick) new Sortable(snippetlist, {
18143
+ if(isMobile && builder.isContentBox) {
18144
+ const items = snippetlist.querySelectorAll('.snippet-item');
18145
+ items.forEach(item=>{
18146
+ if(item.classList.contains('data-click')) return;
18147
+ item.addEventListener('touchstart', ()=>{
18148
+ snippetid = item.getAttribute('data-id');
18149
+ }, { passive: false });
18150
+ item.addEventListener('touchend', ()=>{
18151
+ builder.dropSnippet(snippetid);
18152
+ }, { passive: false });
18153
+ item.classList.add('data-click');
18154
+ });
18155
+ useClick=true;
18156
+ }
18157
+ if(!useClick) */
18158
+ new Sortable(snippetlist, {
18173
18159
  // forceFallback: safariAgent,
18174
18160
  group: {
18175
18161
  name: 'shared',
@@ -50061,6 +50047,17 @@ class Module {
50061
50047
  btn.style.display = '';
50062
50048
  }
50063
50049
  this.repositionModuleTool();
50050
+
50051
+ // Button clicks inside a module can perform tasks that affect column size.
50052
+ // This can cause the module tool or lockIndicator to have an incorrect position,
50053
+ // so we hide these tools.
50054
+ const activeElement = this.builder.doc.activeElement;
50055
+ if (activeElement.tagName.toLowerCase() === 'button') {
50056
+ if (this.moduleTool) this.moduleTool.style.display = '';
50057
+ setTimeout(() => {
50058
+ this.builder.colTool.lockIndicator.style.display = '';
50059
+ }, 0);
50060
+ }
50064
50061
  } else {
50065
50062
  this.builder.activeModule = null;
50066
50063
  if (this.moduleTool) this.moduleTool.style.display = '';