@innovastudio/contentbox 1.4.15 → 1.4.17

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.4.15",
4
+ "version": "1.4.17",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -46,7 +46,7 @@
46
46
  "webpack-dev-server": "^4.0.0"
47
47
  },
48
48
  "dependencies": {
49
- "@innovastudio/contentbuilder": "^1.3.12",
49
+ "@innovastudio/contentbuilder": "^1.3.13",
50
50
  "js-beautify": "^1.14.0"
51
51
  }
52
52
  }
@@ -1143,10 +1143,15 @@ class SideBar {
1143
1143
  pathReplace: '${item.pathReplace}',
1144
1144
  },`;
1145
1145
  });
1146
+ let sDefaultCategory = `{
1147
+ id: ${this.builder.defaultCategory.id},
1148
+ designId: ${this.builder.defaultCategory.designId},
1149
+ }`;
1146
1150
  let sCategories = '';
1147
1151
  this.builder.featuredCategories.forEach(item => {
1148
1152
  sCategories += `{
1149
1153
  id: '${item.id}',
1154
+ designId: '${item.designId}',
1150
1155
  name: '${item.name}',
1151
1156
  },`;
1152
1157
  });
@@ -1451,7 +1456,7 @@ class SideBar {
1451
1456
  const featuredCategories = [
1452
1457
  ${sCategories}
1453
1458
  ];
1454
- const defaultCat = ${this.builder.defaultDesignCategory};
1459
+ const defaultCategory = ${sDefaultCategory};
1455
1460
  const navbar = ${this.builder.navbar ? 'true' : 'false'};
1456
1461
 
1457
1462
  const slider = '${this.builder.slider}';
@@ -1650,7 +1655,7 @@ class SideBar {
1650
1655
  });
1651
1656
  }
1652
1657
 
1653
- const showDesigns = (catId) => {
1658
+ const showDesigns = (catId, designId) => {
1654
1659
 
1655
1660
  if(template_list.length>0) {
1656
1661
  const wait = document.querySelector('.is-waiting');
@@ -1671,7 +1676,7 @@ class SideBar {
1671
1676
  let isSelected = false;
1672
1677
  let catSplit = item.category.split(',');
1673
1678
  for (let j = 0; j < catSplit.length; j++) {
1674
- if (parseInt(catSplit[j]) === parseInt(catId)) {
1679
+ if (parseInt(catSplit[j]) === parseInt(catId) && parseInt(gallery.designId) === parseInt(designId)) {
1675
1680
  isSelected = true;
1676
1681
  }
1677
1682
  }
@@ -1747,13 +1752,14 @@ class SideBar {
1747
1752
  // Set active Button
1748
1753
  const menu = document.querySelector('.mega-menu');
1749
1754
  menu.setAttribute('data-active-cat', catId);
1755
+ menu.setAttribute('data-active-design', designId);
1750
1756
  const featuredCat = document.querySelector('.featured-categories');
1751
1757
  const btnActive1 = menu.querySelector('button.on');
1752
1758
  const btnActive2 = featuredCat.querySelector('button.on');
1753
1759
  if(btnActive1) btnActive1.classList.remove('on');
1754
1760
  if(btnActive2) btnActive2.classList.remove('on');
1755
- const btn1 = menu.querySelector('[data-cat="' + catId + '"]');
1756
- const btn2 = featuredCat.querySelector('[data-cat="' + catId + '"]');
1761
+ const btn1 = menu.querySelector('.item-'+catId+'-'+designId);
1762
+ const btn2 = featuredCat.querySelector('.item-'+catId+'-'+designId);
1757
1763
  if(btn1) btn1.classList.add('on');
1758
1764
  if(btn2) btn2.classList.add('on');
1759
1765
  }
@@ -1775,13 +1781,15 @@ class SideBar {
1775
1781
  let html = '<h2>'+parent._cb.out(gallery.name)+'</h2><div class="cat' +catNum+ '"></div>';
1776
1782
  menuContent.insertAdjacentHTML('beforeend', html);
1777
1783
  const catList = menuContent.querySelector('.cat'+catNum);
1784
+
1778
1785
  categories.forEach(categoryItem=>{
1779
- let html= '<button data-cat="'+categoryItem.id+'">'+parent._cb.out(categoryItem.name)+'</button>';
1786
+ let html= '<button class="item-'+categoryItem.id+'-'+gallery.designId+'" data-cat="'+categoryItem.id+'" data-design="'+gallery.designId+'">'+parent._cb.out(categoryItem.name)+'</button>';
1780
1787
  catList.insertAdjacentHTML('beforeend', html);
1781
- const btn = catList.querySelector('[data-cat="'+categoryItem.id+'"]');
1788
+ const btn = catList.querySelector('.item-'+categoryItem.id+'-'+gallery.designId);
1782
1789
  btn.addEventListener('click', (e)=>{
1783
1790
  const catId = btn.getAttribute('data-cat');
1784
- showDesigns(catId);
1791
+ const designId = btn.getAttribute('data-design');
1792
+ showDesigns(catId, designId);
1785
1793
 
1786
1794
  closeMegaMenu();
1787
1795
  });
@@ -1792,10 +1800,11 @@ class SideBar {
1792
1800
 
1793
1801
  // Set active Button
1794
1802
  const catId = menu.getAttribute('data-active-cat');
1795
- if(catId) {
1803
+ const designId = menu.getAttribute('data-active-design');
1804
+ if(catId && designId) {
1796
1805
  const btnActive = menu.querySelector('button.on');
1797
1806
  if(btnActive) btnActive.classList.remove('on');
1798
- const btn = menu.querySelector('[data-cat="' + catId + '"]');
1807
+ const btn = menu.querySelector('.item-'+catId+'-'+designId);
1799
1808
  if(btn) btn.classList.add('on');
1800
1809
  }
1801
1810
  }
@@ -1872,7 +1881,7 @@ class SideBar {
1872
1881
  let html = '';
1873
1882
  const div = document.querySelector('.featured-categories');
1874
1883
  featuredCategories.forEach(item=>{
1875
- html += '<button data-cat="'+item.id+'">'+parent._cb.out(item.name)+'</button>';
1884
+ html += '<button class="item-'+item.id+'-'+item.designId+'" data-cat="'+item.id+'" data-design="'+item.designId+'">'+parent._cb.out(item.name)+'</button>';
1876
1885
  });
1877
1886
  html += '<button data-cat="0">'+parent._cb.out('All Categories')+'</button>';
1878
1887
  div.insertAdjacentHTML('beforeend', html);
@@ -1882,11 +1891,12 @@ class SideBar {
1882
1891
  btns.forEach(btn=>{
1883
1892
  btn.addEventListener('click', (e)=>{
1884
1893
  const catId = btn.getAttribute('data-cat');
1894
+ const designId = btn.getAttribute('data-design');
1885
1895
  if(catId==='0') {
1886
1896
  // Show All Categories' Mega Menu
1887
1897
  showMegaMenu();
1888
1898
  } else {
1889
- showDesigns(catId);
1899
+ showDesigns(catId, designId);
1890
1900
  }
1891
1901
  });
1892
1902
  });`;
@@ -1907,16 +1917,14 @@ class SideBar {
1907
1917
  wait.style.display = 'flex';
1908
1918
  const wait2 = document.querySelector('.is-waiting2');
1909
1919
  wait2.style.display = 'flex';
1910
-
1911
- renderMegaMenu();
1912
-
1913
- showDesigns(defaultCat); // If not ready (not loaded yet) will show empty
1914
1920
 
1921
+ let designId = 1;
1915
1922
  loadJsFiles(templateJSON, (template)=>{
1916
1923
  // console.log(template)
1917
1924
  const templateAdded = template_list[template_list.length-1];
1918
1925
  templateAdded.path = template.path;
1919
1926
  templateAdded.pathReplace = template.pathReplace;
1927
+ templateAdded.designId = designId;
1920
1928
  // console.log(templateAdded);
1921
1929
 
1922
1930
  renderMegaMenu();
@@ -1925,11 +1933,12 @@ class SideBar {
1925
1933
  if(designList.innerHTML.trim()==='') { // first load
1926
1934
  const cats = templateAdded.categories;
1927
1935
  cats.forEach(cat=>{
1928
- if(parseInt(cat.id)===defaultCat) {
1929
- showDesigns(defaultCat);
1936
+ if(parseInt(cat.id)===defaultCategory.id && designId===defaultCategory.designId) {
1937
+ showDesigns(defaultCategory.id, designId);
1930
1938
  }
1931
1939
  });
1932
1940
  }
1941
+ designId++;
1933
1942
  });
1934
1943
  })
1935
1944
 
@@ -79625,8 +79634,12 @@ class Rte {
79625
79634
  let col = this.builder.activeCol;
79626
79635
  let tool = this.builder.doc.querySelector('.is-column-tool');
79627
79636
  tool.style.display = '';
79628
- tool.style.top = col.getBoundingClientRect().top - 29 + window.pageYOffset + 'px';
79629
- tool.style.left = col.getBoundingClientRect().left - 1 + 'px';
79637
+
79638
+ if (col) {
79639
+ tool.style.top = col.getBoundingClientRect().top - 29 + window.pageYOffset + 'px';
79640
+ tool.style.left = col.getBoundingClientRect().left - 1 + 'px';
79641
+ }
79642
+
79630
79643
  let tools = this.builder.doc.querySelectorAll('.is-row-tool');
79631
79644
  tools.forEach(tool => {
79632
79645
  tool.style.display = '';
@@ -79703,8 +79716,12 @@ class Rte {
79703
79716
  let col = this.builder.activeCol;
79704
79717
  let tool = this.builder.doc.querySelector('.is-column-tool');
79705
79718
  tool.style.display = '';
79706
- tool.style.top = col.getBoundingClientRect().top - 29 + window.pageYOffset + 'px';
79707
- tool.style.left = col.getBoundingClientRect().left - 1 + 'px';
79719
+
79720
+ if (col) {
79721
+ tool.style.top = col.getBoundingClientRect().top - 29 + window.pageYOffset + 'px';
79722
+ tool.style.left = col.getBoundingClientRect().left - 1 + 'px';
79723
+ }
79724
+
79708
79725
  let tools = this.builder.doc.querySelectorAll('.is-row-tool');
79709
79726
  tools.forEach(tool => {
79710
79727
  tool.style.display = '';
@@ -91173,10 +91190,13 @@ class ContentBox {
91173
91190
  enableContentStyle: true,
91174
91191
  disableStaticSection: false,
91175
91192
  framework: '',
91193
+ // Old Template System:
91176
91194
  designUrl1: 'assets/designs/basic.js',
91177
91195
  designUrl2: 'assets/designs/examples.js',
91178
91196
  designPath: 'assets/designs/',
91179
91197
  designPathReplace: [],
91198
+ defaultDesignCategory: 5,
91199
+ // 101 for header
91180
91200
 
91181
91201
  /*
91182
91202
  Example:
@@ -91185,12 +91205,24 @@ class ContentBox {
91185
91205
  designPath: 'https://.../assets/designs/',
91186
91206
  designPathReplace: ['assets/', 'https://.../assets/'], // Only if needed
91187
91207
  */
91208
+ // New Template System: => this will replace the previous approach (designUrl1, designUrl2, designPath, designPathReplace & defaultDesignCategory)
91188
91209
  templates: [],
91189
91210
  // ver.5.3
91190
91211
 
91191
91212
  /*
91192
- Example: => this will replace the previous approach (designUrl1, designUrl2, designPath & designPathReplace)
91213
+ Example:
91193
91214
  templates: [
91215
+ {
91216
+ url: 'assets/simplestart/examples.js',
91217
+ path: 'assets/simplestart/',
91218
+ pathReplace: []
91219
+ },
91220
+ {
91221
+ url: 'assets/quickstart/examples.js',
91222
+ path: 'assets/quickstart/',
91223
+ pathReplace: []
91224
+ },
91225
+ // If you want to include old templates:
91194
91226
  {
91195
91227
  url: 'assets/designs/basic.js',
91196
91228
  path: 'assets/designs/',
@@ -91201,6 +91233,7 @@ class ContentBox {
91201
91233
  path: 'assets/designs/',
91202
91234
  pathReplace: []
91203
91235
  },
91236
+ // If you're using Writing Set collection:
91204
91237
  {
91205
91238
  url: 'assets/writing-set/basic.js',
91206
91239
  path: 'assets/writing-set/',
@@ -91209,25 +91242,31 @@ class ContentBox {
91209
91242
  ]
91210
91243
  */
91211
91244
  featuredCategories: [{
91212
- id: 5,
91213
- name: 'Random'
91214
- }, // If apos ' is used, use: \\\'
91215
- {
91216
91245
  id: 1,
91246
+ designId: 1,
91217
91247
  name: 'Basic'
91218
- }, {
91248
+ }, // If name has apos ' => use: \\\'
91249
+ {
91219
91250
  id: 2,
91251
+ designId: 1,
91220
91252
  name: 'Slider'
91221
91253
  }, {
91222
- id: 101,
91254
+ id: 1,
91255
+ designId: 2,
91223
91256
  name: 'Header'
91224
91257
  }, {
91225
- id: 118,
91258
+ id: 2,
91259
+ designId: 2,
91226
91260
  name: 'Article'
91227
91261
  }, {
91228
- id: 102,
91262
+ id: 3,
91263
+ designId: 2,
91229
91264
  name: 'Photos'
91230
91265
  }],
91266
+ defaultCategory: {
91267
+ id: 1,
91268
+ designId: 1
91269
+ },
91231
91270
  templateThumbnailSize: '',
91232
91271
  //small, medium, large or '' (empty => dynamic)
91233
91272
  // ContentBuilder
@@ -91332,8 +91371,6 @@ class ContentBox {
91332
91371
  animatedSorting: false,
91333
91372
  dragWithoutHandle: false,
91334
91373
  addButtonPlacement: '',
91335
- defaultDesignCategory: 5,
91336
- // 101 for header
91337
91374
  snippetCategories: [[120, 'Basic'], [118, 'Article'], [101, 'Headline'], [119, 'Buttons'], [102, 'Photos'], [103, 'Profile'], [116, 'Contact'], [104, 'Products'], [105, 'Features'], [106, 'Process'], [107, 'Pricing'], [108, 'Skills'], [109, 'Achievements'], [110, 'Quotes'], [111, 'Partners'], [112, 'As Featured On'], [113, 'Page Not Found'], [114, 'Coming Soon'], [115, 'Help, FAQ']],
91338
91375
  defaultSnippetCategory: 101,
91339
91376
  outlineMode: '',