@innovastudio/contentbox 1.6.98 → 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.98",
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.94",
57
+ "@innovastudio/contentbuilder": "^1.5.96",
58
58
  "js-beautify": "^1.14.0",
59
59
  "sortablejs": "^1.15.2"
60
60
  }
@@ -27885,22 +27885,27 @@ 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
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>
27908
+ <div id="status_{id}" class="collapsed"></div>
27904
27909
  </form>
27905
27910
 
27906
27911
  <script>
@@ -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",
@@ -27981,67 +27982,53 @@ const renderQuickAdd = builder => {
27981
27982
  const initialFormData = JSON.stringify(json);
27982
27983
  viewer.view(initialFormData);
27983
27984
 
27984
- const form = document.querySelector('#form_{id}');
27985
-
27986
27985
  var statusInfo = document.querySelector('#status_{id}');
27987
27986
 
27988
- /*
27989
- form.addEventListener('submit', async (event) => {
27990
-
27991
- event.preventDefault();
27992
-
27993
- const form = event.target;
27994
- const formData = new FormData(form);
27995
-
27996
- fetch('/formsubmission', {
27997
- method: 'POST',
27998
- body: formData,
27999
- })
28000
- .then(response=>response.json())
28001
- .then(response=>{
28002
- console.log(response);
28003
- });
28004
- });
28005
- */
28006
-
28007
- var btnSend = form.querySelector('.btn-submitform');
27987
+ var form = document.querySelector('#form_{id}');
28008
27988
 
28009
27989
  async function handleSubmit(event) {
28010
27990
  event.preventDefault();
28011
27991
 
27992
+ var btnSend = form.querySelector('.btn-submitform');
27993
+
28012
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';
28013
27995
 
28014
27996
  var data = new FormData(form);
27997
+
28015
27998
  fetch(form.action, {
28016
27999
  method: form.method,
28017
28000
  body: data,
28018
28001
  headers: {
28019
28002
  'Accept': 'application/json'
28020
28003
  }
28021
- }).then(response => {
28022
- if (response.ok) {
28023
- statusInfo.innerHTML = '<div class="text-center pt-4"><i class="bi bi-send-check size-64"></i>' +
28024
- '</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>';
28025
28010
  form.reset();
28011
+
28012
+ elm.classList.add('collapsed');
28013
+ setTimeout(function(){
28014
+ statusInfo.classList.remove('collapsed');
28015
+ },300);
28016
+
28026
28017
  } else {
28027
- response.json().then(data => {
28028
- if (Object.hasOwn(data, 'errors')) {
28029
- statusInfo.innerHTML = data['errors'].map(error => error['message']).join(', ');
28030
- } else {
28031
- statusInfo.innerHTML = '<div class="leading-11 text-center size-38 pt-4 pb-4">Oops! There was a problem submitting your form.</div>';
28032
- }
28033
- });
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);
28034
28025
  }
28035
28026
 
28036
- btnSend.innerHTML = 'Submit';
28037
- }).catch(error => {
28038
- statusInfo.innerHTML = '<div class="leading-11 text-center size-38 pt-4 pb-4">Oops! There was a problem submitting your form.</div>';
28039
-
28040
28027
  btnSend.innerHTML = 'Submit';
28041
28028
  });
28042
28029
  }
28043
28030
 
28044
- viewer.settings.onSubmit = handleSubmit;
28031
+ form.addEventListener('submit', handleSubmit);
28045
28032
 
28046
28033
  });
28047
28034
  </script>
@@ -44432,26 +44419,26 @@ const renderSnippetPanel = (builder, snippetOpen) => {
44432
44419
  }
44433
44420
  });
44434
44421
  }
44422
+
44423
+ /*
44435
44424
  let snippetid;
44436
- if (isMobile && builder.isContentBox) {
44437
- const items = snippetlist.querySelectorAll('.snippet-item');
44438
- items.forEach(item => {
44439
- if (item.classList.contains('data-click')) return;
44440
- item.addEventListener('touchstart', () => {
44441
- snippetid = item.getAttribute('data-id');
44442
- }, {
44443
- passive: false
44444
- });
44445
- item.addEventListener('touchend', () => {
44446
- builder.dropSnippet(snippetid);
44447
- }, {
44448
- 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');
44449
44436
  });
44450
- item.classList.add('data-click');
44451
- });
44452
44437
  }
44438
+ */
44453
44439
  }
44454
44440
  });
44441
+
44455
44442
  inpSnippet.setValue(defaultcatval + '');
44456
44443
  inpSnippet.closeOptions();
44457
44444
  if (builder.opts.snippetList === '#divSnippetList') {
@@ -44569,28 +44556,27 @@ const renderSnippetPanel = (builder, snippetOpen) => {
44569
44556
 
44570
44557
  let activeBuilderArea;
44571
44558
  let itemHeight;
44559
+
44560
+ /*
44572
44561
  const isMobile = dom.detectMobileOrTablet();
44573
- let snippetid;
44562
+ let snippetid;
44574
44563
  let useClick = false;
44575
- if (isMobile && builder.isContentBox) {
44576
- const items = snippetlist.querySelectorAll('.snippet-item');
44577
- items.forEach(item => {
44578
- if (item.classList.contains('data-click')) return;
44579
- item.addEventListener('touchstart', () => {
44580
- snippetid = item.getAttribute('data-id');
44581
- }, {
44582
- passive: false
44583
- });
44584
- item.addEventListener('touchend', () => {
44585
- builder.dropSnippet(snippetid);
44586
- }, {
44587
- passive: false
44588
- });
44589
- item.classList.add('data-click');
44590
- });
44591
- useClick = true;
44592
- }
44593
- 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, {
44594
44580
  // forceFallback: safariAgent,
44595
44581
  group: {
44596
44582
  name: 'shared',
@@ -76482,6 +76468,17 @@ class Module {
76482
76468
  btn.style.display = '';
76483
76469
  }
76484
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
+ }
76485
76482
  } else {
76486
76483
  this.builder.activeModule = null;
76487
76484
  if (this.moduleTool) this.moduleTool.style.display = '';