@innovastudio/contentbox 1.6.99 → 1.6.100

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/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.99",
4
+ "version": "1.6.100",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "types": "index.d.ts",
@@ -54,7 +54,7 @@
54
54
  "ws": "^8.13.0"
55
55
  },
56
56
  "dependencies": {
57
- "@innovastudio/contentbuilder": "^1.5.95",
57
+ "@innovastudio/contentbuilder": "^1.5.96",
58
58
  "js-beautify": "^1.14.0",
59
59
  "sortablejs": "^1.15.2"
60
60
  }
@@ -27885,23 +27885,28 @@ const renderQuickAdd = builder => {
27885
27885
 
27886
27886
  ${encodeURIComponent(`
27887
27887
  <div id="_style_{id}" style="display:none">
27888
- .animate-spin {
27889
- animation: spin 1s linear infinite;
27888
+ #{id} {
27889
+ transition: all 0.3s ease-out;
27890
+ height: auto;
27890
27891
  }
27891
- @keyframes spin {
27892
- from {
27893
- transform: rotate(0deg);
27894
- }
27895
- to {
27896
- transform: rotate(360deg);
27897
- }
27892
+ #{id}.collapsed {
27893
+ overflow: hidden;
27894
+ height: 0;
27895
+ }
27896
+ #status_{id} {
27897
+ transition: all 0.3s ease-out;
27898
+ height: auto;
27899
+ }
27900
+ #status_{id}.collapsed {
27901
+ overflow: hidden;
27902
+ height: 0;
27898
27903
  }
27899
27904
  </div>
27900
- <div id="form_{id}" style="padding: 25px 0 20px">
27905
+ <form id="form_{id}" method="POST" action="/formsubmission" style="padding: 25px 0 20px">
27901
27906
  <div id="{id}"></div>
27902
27907
 
27903
- <div id="status_{id}"></div>
27904
- </div>
27908
+ <div id="status_{id}" class="collapsed"></div>
27909
+ </form>
27905
27910
 
27906
27911
  <script>
27907
27912
  var css = document.querySelector('#_style_{id}').innerHTML;
@@ -27923,11 +27928,7 @@ const renderQuickAdd = builder => {
27923
27928
  docReady(function() {
27924
27929
 
27925
27930
  var elm = document.getElementById('{id}');
27926
- var viewer = new FormViewer(elm, {
27927
- onChange: (json) => {
27928
- // console.log(json);
27929
- },
27930
- });
27931
+ var viewer = new FormViewer(elm);
27931
27932
 
27932
27933
  let json = {
27933
27934
  "title": "Register for the Tech Conference",
@@ -27983,68 +27984,51 @@ const renderQuickAdd = builder => {
27983
27984
 
27984
27985
  var statusInfo = document.querySelector('#status_{id}');
27985
27986
 
27986
- /*
27987
- form.addEventListener('submit', async (event) => {
27988
-
27989
- event.preventDefault();
27990
-
27991
- const form = event.target;
27992
- const formData = new FormData(form);
27993
-
27994
- fetch('/formsubmission', {
27995
- method: 'POST',
27996
- body: formData,
27997
- })
27998
- .then(response=>response.json())
27999
- .then(response=>{
28000
- console.log(response);
28001
- });
28002
- });
28003
- */
28004
-
27987
+ var form = document.querySelector('#form_{id}');
28005
27988
 
28006
27989
  async function handleSubmit(event) {
28007
27990
  event.preventDefault();
28008
-
28009
- var form = event.target;
28010
- form.action = '/formsubmission';
28011
- form.method = 'POST';
28012
27991
 
28013
27992
  var btnSend = form.querySelector('.btn-submitform');
28014
27993
 
28015
27994
  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';
28016
27995
 
28017
27996
  var data = new FormData(form);
27997
+
28018
27998
  fetch(form.action, {
28019
27999
  method: form.method,
28020
28000
  body: data,
28021
28001
  headers: {
28022
28002
  'Accept': 'application/json'
28023
28003
  }
28024
- }).then(response => {
28025
- if (response.ok) {
28026
- statusInfo.innerHTML = '<div class="text-center pt-4"><i class="bi bi-send-check size-64"></i>' +
28027
- '</div><div class="leading-11 text-center size-38 pb-4">Thanks for your submission!</div>';
28004
+ })
28005
+ .then(response=>response.json())
28006
+ .then(data=>{
28007
+ if(!data.error) {
28008
+ statusInfo.innerHTML = '<div class="text-center pt-4 pb-4"><i class="bi bi-send-check size-64"></i>' +
28009
+ '</div><div class="leading-14 text-center size-38 pb-4">Thanks for your submission!</div>';
28028
28010
  form.reset();
28011
+
28012
+ elm.classList.add('collapsed');
28013
+ setTimeout(function(){
28014
+ statusInfo.classList.remove('collapsed');
28015
+ },300);
28016
+
28029
28017
  } else {
28030
- response.json().then(data => {
28031
- if (Object.hasOwn(data, 'errors')) {
28032
- statusInfo.innerHTML = data['errors'].map(error => error['message']).join(', ');
28033
- } else {
28034
- statusInfo.innerHTML = '<div class="leading-11 text-center size-38 pt-4 pb-4">Oops! There was a problem submitting your form.</div>';
28035
- }
28036
- });
28018
+ statusInfo.innerHTML = '<div class="leading-14 text-center size-38 pt-4 pb-4">Oops! There was a problem submitting your form.</div>';
28019
+
28020
+ // elm.classList.toggle('collapsed');
28021
+ setTimeout(function(){
28022
+ // statusInfo.innerHTML = data.error;
28023
+ statusInfo.classList.remove('collapsed');
28024
+ },300);
28037
28025
  }
28038
28026
 
28039
- btnSend.innerHTML = 'Submit';
28040
- }).catch(error => {
28041
- statusInfo.innerHTML = '<div class="leading-11 text-center size-38 pt-4 pb-4">Oops! There was a problem submitting your form.</div>';
28042
-
28043
28027
  btnSend.innerHTML = 'Submit';
28044
28028
  });
28045
28029
  }
28046
28030
 
28047
- viewer.settings.onSubmit = handleSubmit;
28031
+ form.addEventListener('submit', handleSubmit);
28048
28032
 
28049
28033
  });
28050
28034
  </script>
@@ -44435,26 +44419,26 @@ const renderSnippetPanel = (builder, snippetOpen) => {
44435
44419
  }
44436
44420
  });
44437
44421
  }
44422
+
44423
+ /*
44438
44424
  let snippetid;
44439
- if (isMobile && builder.isContentBox) {
44440
- const items = snippetlist.querySelectorAll('.snippet-item');
44441
- items.forEach(item => {
44442
- if (item.classList.contains('data-click')) return;
44443
- item.addEventListener('touchstart', () => {
44444
- snippetid = item.getAttribute('data-id');
44445
- }, {
44446
- passive: false
44425
+ if(isMobile && builder.isContentBox) {
44426
+ const items = snippetlist.querySelectorAll('.snippet-item');
44427
+ items.forEach(item=>{
44428
+ if(item.classList.contains('data-click')) return;
44429
+ item.addEventListener('touchstart', ()=>{
44430
+ snippetid = item.getAttribute('data-id');
44431
+ }, { passive: false });
44432
+ item.addEventListener('touchend', ()=>{
44433
+ builder.dropSnippet(snippetid);
44434
+ }, { passive: false });
44435
+ item.classList.add('data-click');
44447
44436
  });
44448
- item.addEventListener('touchend', () => {
44449
- builder.dropSnippet(snippetid);
44450
- }, {
44451
- passive: false
44452
- });
44453
- item.classList.add('data-click');
44454
- });
44455
44437
  }
44438
+ */
44456
44439
  }
44457
44440
  });
44441
+
44458
44442
  inpSnippet.setValue(defaultcatval + '');
44459
44443
  inpSnippet.closeOptions();
44460
44444
  if (builder.opts.snippetList === '#divSnippetList') {
@@ -44572,28 +44556,27 @@ const renderSnippetPanel = (builder, snippetOpen) => {
44572
44556
 
44573
44557
  let activeBuilderArea;
44574
44558
  let itemHeight;
44559
+
44560
+ /*
44575
44561
  const isMobile = dom.detectMobileOrTablet();
44576
- let snippetid;
44562
+ let snippetid;
44577
44563
  let useClick = false;
44578
- if (isMobile && builder.isContentBox) {
44579
- const items = snippetlist.querySelectorAll('.snippet-item');
44580
- items.forEach(item => {
44581
- if (item.classList.contains('data-click')) return;
44582
- item.addEventListener('touchstart', () => {
44583
- snippetid = item.getAttribute('data-id');
44584
- }, {
44585
- passive: false
44586
- });
44587
- item.addEventListener('touchend', () => {
44588
- builder.dropSnippet(snippetid);
44589
- }, {
44590
- passive: false
44591
- });
44592
- item.classList.add('data-click');
44593
- });
44594
- useClick = true;
44595
- }
44596
- if (!useClick) new Sortable$1(snippetlist, {
44564
+ if(isMobile && builder.isContentBox) {
44565
+ const items = snippetlist.querySelectorAll('.snippet-item');
44566
+ items.forEach(item=>{
44567
+ if(item.classList.contains('data-click')) return;
44568
+ item.addEventListener('touchstart', ()=>{
44569
+ snippetid = item.getAttribute('data-id');
44570
+ }, { passive: false });
44571
+ item.addEventListener('touchend', ()=>{
44572
+ builder.dropSnippet(snippetid);
44573
+ }, { passive: false });
44574
+ item.classList.add('data-click');
44575
+ });
44576
+ useClick=true;
44577
+ }
44578
+ if(!useClick) */
44579
+ new Sortable$1(snippetlist, {
44597
44580
  // forceFallback: safariAgent,
44598
44581
  group: {
44599
44582
  name: 'shared',
@@ -76485,6 +76468,17 @@ class Module {
76485
76468
  btn.style.display = '';
76486
76469
  }
76487
76470
  this.repositionModuleTool();
76471
+
76472
+ // Button clicks inside a module can perform tasks that affect column size.
76473
+ // This can cause the module tool or lockIndicator to have an incorrect position,
76474
+ // so we hide these tools.
76475
+ const activeElement = this.builder.doc.activeElement;
76476
+ if (activeElement.tagName.toLowerCase() === 'button') {
76477
+ if (this.moduleTool) this.moduleTool.style.display = '';
76478
+ setTimeout(() => {
76479
+ this.builder.colTool.lockIndicator.style.display = '';
76480
+ }, 0);
76481
+ }
76488
76482
  } else {
76489
76483
  this.builder.activeModule = null;
76490
76484
  if (this.moduleTool) this.moduleTool.style.display = '';