@innovastudio/contentbox 1.4.16 → 1.4.18

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.16",
4
+ "version": "1.4.18",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -70,7 +70,7 @@
70
70
  position: fixed;
71
71
  top: 0;
72
72
  left: 0;
73
- width: 50px;
73
+ width: 60px;
74
74
  height: 100vh;
75
75
  background: rgba(255, 255, 255, 0.97) !important;
76
76
  color: rgba(0, 0, 0, 0.8);
@@ -163,18 +163,19 @@
163
163
  #divSidebarSource
164
164
  */
165
165
  #divSidebarSnippets {
166
- max-width: 316px;
166
+ max-width: 290px !important;
167
+ border-left: 60px solid transparent !important;
167
168
  }
168
169
 
169
170
  #divSidebarTypography {
170
- max-width: 300px;
171
+ max-width: 320px;
171
172
  }
172
173
 
173
174
  #divSidebarSnippets > div:first-child {
174
175
  width: 100%;
175
176
  height: 40px;
176
177
  position: absolute;
177
- padding: 0 0 0 50px;
178
+ padding: 0 0 0 60px;
178
179
  box-sizing: border-box;
179
180
  }
180
181
 
@@ -187,17 +188,17 @@
187
188
 
188
189
  #divSidebarSections > div,
189
190
  .sidebar-sections > div {
190
- padding: 0 0 0 50px;
191
+ padding: 0 0 0 60px;
191
192
  box-sizing: border-box;
192
193
  }
193
194
 
194
195
  #divSidebarSource > div {
195
- padding: 0 0 0 50px;
196
+ padding: 0 0 0 60px;
196
197
  box-sizing: border-box;
197
198
  }
198
199
 
199
200
  #divSidebarTypography > div {
200
- padding: 0 0 0 50px;
201
+ padding: 0 0 0 60px;
201
202
  box-sizing: border-box;
202
203
  }
203
204
 
@@ -277,7 +278,7 @@
277
278
  right: 0;
278
279
  width: 100%;
279
280
  z-index: 2;
280
- padding: 0 0 0 50px;
281
+ padding: 0 0 0 60px;
281
282
  box-sizing: border-box;
282
283
  }
283
284
 
@@ -288,8 +289,8 @@
288
289
  overflow-y: auto;
289
290
  overflow-x: hidden;
290
291
  top: 110px;
291
- left: 50px;
292
- width: calc(100% - 50px);
292
+ left: 60px;
293
+ width: calc(100% - 60px);
293
294
  height: calc(100% - 110px);
294
295
  position: absolute;
295
296
  }
@@ -474,7 +475,7 @@
474
475
  opacity: 0.01;
475
476
  /* setting display=none makes initial script may not work properly */
476
477
  transform-origin: top;
477
- padding-left: 50px;
478
+ padding-left: 60px;
478
479
  }
479
480
 
480
481
  #_cbhtml {
@@ -638,10 +639,7 @@
638
639
  outline: none !important;
639
640
  }
640
641
 
641
- .is-section.is-section-navbar .is-section-tool {
642
- right: 50px;
643
- }
644
-
645
- .is-section.is-section-navbar .is-box-tool {
646
- left: calc(50% - 70px) !important;
642
+ .is-section.is-section-navbar,
643
+ .is-section.is-section-navbar .is-topbar {
644
+ width: calc(100% - 60px);
647
645
  }
@@ -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,19 +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
1920
 
1913
- // showDesigns(defaultCat); // If not ready (not loaded yet) will show empty
1914
-
1915
- let designId = 0;
1921
+ let designId = 1;
1916
1922
  loadJsFiles(templateJSON, (template)=>{
1917
1923
  // console.log(template)
1918
1924
  const templateAdded = template_list[template_list.length-1];
1919
1925
  templateAdded.path = template.path;
1920
1926
  templateAdded.pathReplace = template.pathReplace;
1921
1927
  templateAdded.designId = designId;
1922
- designId++;
1923
1928
  // console.log(templateAdded);
1924
1929
 
1925
1930
  renderMegaMenu();
@@ -1928,11 +1933,12 @@ class SideBar {
1928
1933
  if(designList.innerHTML.trim()==='') { // first load
1929
1934
  const cats = templateAdded.categories;
1930
1935
  cats.forEach(cat=>{
1931
- if(parseInt(cat.id)===defaultCat) {
1932
- showDesigns(defaultCat);
1936
+ if(parseInt(cat.id)===defaultCategory.id && designId===defaultCategory.designId) {
1937
+ showDesigns(defaultCategory.id, designId);
1933
1938
  }
1934
1939
  });
1935
1940
  }
1941
+ designId++;
1936
1942
  });
1937
1943
  })
1938
1944
 
@@ -3641,7 +3647,8 @@ class EditSection {
3641
3647
  activeSection.parentNode.removeChild(activeSection); //Trigger Render event
3642
3648
 
3643
3649
  this.builder.settings.onRender();
3644
- this.builder.editor.util.hideModal(modalDelConfirm); //Trigger Change event
3650
+ this.builder.editor.util.hideModal(modalDelConfirm);
3651
+ this.builder.editor.util.clearControls(); //Trigger Change event
3645
3652
 
3646
3653
  this.builder.settings.onChange(); // //Hide box tool
3647
3654
  // let boxTool = document.querySelector('#divBoxTool');
@@ -3821,6 +3828,9 @@ class EditSection {
3821
3828
  section.style.backgroundImage = ''; //remove gradient
3822
3829
 
3823
3830
  btnSectionBgColor.style.backgroundColor = s; // preview
3831
+ //Trigger Change event
3832
+
3833
+ this.builder.onChange();
3824
3834
  }, bgcolor);
3825
3835
  }); // Section Background Gradient
3826
3836
 
@@ -3830,7 +3840,10 @@ class EditSection {
3830
3840
 
3831
3841
  const section = this.builder.activeSection;
3832
3842
  let gradientPicker = this.builder.editor.gradientpicker();
3833
- gradientPicker.open(section);
3843
+ gradientPicker.open(section, () => {
3844
+ //Trigger Change event
3845
+ this.builder.onChange();
3846
+ });
3834
3847
  });
3835
3848
  }
3836
3849
 
@@ -11065,7 +11078,10 @@ class EditBox {
11065
11078
  if (overlay.style.filter) {
11066
11079
  overlay.style.filter = overlay.style.filter.replace('grayscale(1)', '');
11067
11080
  }
11068
- }
11081
+ } //Trigger Change event
11082
+
11083
+
11084
+ this.builder.onChange();
11069
11085
  });
11070
11086
  const chkBoxAddText = modalEditBox.querySelector('.cmd-box-addtext');
11071
11087
  chkBoxAddText.addEventListener('click', () => {
@@ -11121,6 +11137,9 @@ class EditBox {
11121
11137
  overlay.style.backgroundImage = ''; //remove gradient
11122
11138
 
11123
11139
  btnBoxBgColor.style.backgroundColor = s; // preview
11140
+ //Trigger Change event
11141
+
11142
+ this.builder.onChange();
11124
11143
  }, bgcolor);
11125
11144
  }); // Box Background Gradient
11126
11145
 
@@ -11135,6 +11154,9 @@ class EditBox {
11135
11154
  activeBox.style.backgroundColor = ''; // clean old
11136
11155
 
11137
11156
  activeBox.style.backgroundImage = ''; // clean old
11157
+ //Trigger Change event
11158
+
11159
+ this.builder.onChange();
11138
11160
  });
11139
11161
  }); // Box Overlay Color
11140
11162
 
@@ -11188,7 +11210,9 @@ class EditBox {
11188
11210
  }
11189
11211
 
11190
11212
  btnBoxOverlayColor.style.backgroundColor = s; // preview
11213
+ //Trigger Change event
11191
11214
 
11215
+ this.builder.onChange();
11192
11216
  return false;
11193
11217
  }, color); //Note: if color empty, colorpicker will stay with its previous color
11194
11218
  }); // Click to Open Media Select Dialog
@@ -89898,11 +89922,13 @@ var pace = {exports: {}};
89898
89922
  checkInterval: 100,
89899
89923
  selectors: ['body']
89900
89924
  },
89901
- eventLag: {
89902
- minSamples: 10,
89903
- sampleCount: 3,
89904
- lagThreshold: 3
89905
- },
89925
+ eventLag: false,
89926
+ // https://github.com/CodeByZach/pace/issues/510
89927
+ // eventLag: {
89928
+ // minSamples: 10,
89929
+ // sampleCount: 3,
89930
+ // lagThreshold: 50,//3
89931
+ // },
89906
89932
  ajax: {
89907
89933
  trackMethods: ['GET'],
89908
89934
  trackWebSockets: true,
@@ -91123,11 +91149,12 @@ class ContentStuff {
91123
91149
  left: 1px;
91124
91150
  right: 1px;
91125
91151
  }
91126
-
91152
+ /*
91127
91153
  .content-edit .is-section-tool,
91128
91154
  .content-edit .is-box-tool {
91129
91155
  display: none !important;
91130
91156
  }
91157
+ */
91131
91158
  .content-edit .box-hover {
91132
91159
  outline: none !important;
91133
91160
  }
@@ -91184,10 +91211,13 @@ class ContentBox {
91184
91211
  enableContentStyle: true,
91185
91212
  disableStaticSection: false,
91186
91213
  framework: '',
91214
+ // Old Template System:
91187
91215
  designUrl1: 'assets/designs/basic.js',
91188
91216
  designUrl2: 'assets/designs/examples.js',
91189
91217
  designPath: 'assets/designs/',
91190
91218
  designPathReplace: [],
91219
+ defaultDesignCategory: 5,
91220
+ // 101 for header
91191
91221
 
91192
91222
  /*
91193
91223
  Example:
@@ -91196,12 +91226,24 @@ class ContentBox {
91196
91226
  designPath: 'https://.../assets/designs/',
91197
91227
  designPathReplace: ['assets/', 'https://.../assets/'], // Only if needed
91198
91228
  */
91229
+ // New Template System: => this will replace the previous approach (designUrl1, designUrl2, designPath, designPathReplace & defaultDesignCategory)
91199
91230
  templates: [],
91200
91231
  // ver.5.3
91201
91232
 
91202
91233
  /*
91203
- Example: => this will replace the previous approach (designUrl1, designUrl2, designPath & designPathReplace)
91234
+ Example:
91204
91235
  templates: [
91236
+ {
91237
+ url: 'assets/simplestart/examples.js',
91238
+ path: 'assets/simplestart/',
91239
+ pathReplace: []
91240
+ },
91241
+ {
91242
+ url: 'assets/quickstart/examples.js',
91243
+ path: 'assets/quickstart/',
91244
+ pathReplace: []
91245
+ },
91246
+ // If you want to include old templates:
91205
91247
  {
91206
91248
  url: 'assets/designs/basic.js',
91207
91249
  path: 'assets/designs/',
@@ -91212,6 +91254,7 @@ class ContentBox {
91212
91254
  path: 'assets/designs/',
91213
91255
  pathReplace: []
91214
91256
  },
91257
+ // If you're using Writing Set collection:
91215
91258
  {
91216
91259
  url: 'assets/writing-set/basic.js',
91217
91260
  path: 'assets/writing-set/',
@@ -91219,26 +91262,33 @@ class ContentBox {
91219
91262
  }
91220
91263
  ]
91221
91264
  */
91222
- featuredCategories: [{
91223
- id: 5,
91224
- name: 'Random'
91225
- }, // If apos ' is used, use: \\\'
91265
+ featuredCategories: [// to configure your own, please see the template's JSON file (eg. templates.js)
91226
91266
  {
91227
91267
  id: 1,
91268
+ designId: 1,
91228
91269
  name: 'Basic'
91229
- }, {
91270
+ }, // If name has apos ' => use: \\\'
91271
+ {
91230
91272
  id: 2,
91273
+ designId: 1,
91231
91274
  name: 'Slider'
91232
91275
  }, {
91233
- id: 101,
91276
+ id: 1,
91277
+ designId: 2,
91234
91278
  name: 'Header'
91235
91279
  }, {
91236
- id: 118,
91280
+ id: 2,
91281
+ designId: 2,
91237
91282
  name: 'Article'
91238
91283
  }, {
91239
- id: 102,
91284
+ id: 3,
91285
+ designId: 2,
91240
91286
  name: 'Photos'
91241
91287
  }],
91288
+ defaultCategory: {
91289
+ id: 1,
91290
+ designId: 1
91291
+ },
91242
91292
  templateThumbnailSize: '',
91243
91293
  //small, medium, large or '' (empty => dynamic)
91244
91294
  // ContentBuilder
@@ -91343,8 +91393,6 @@ class ContentBox {
91343
91393
  animatedSorting: false,
91344
91394
  dragWithoutHandle: false,
91345
91395
  addButtonPlacement: '',
91346
- defaultDesignCategory: 5,
91347
- // 101 for header
91348
91396
  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']],
91349
91397
  defaultSnippetCategory: 101,
91350
91398
  outlineMode: '',
@@ -94064,7 +94112,7 @@ class ContentBox {
94064
94112
  const EXPIRE_DATE = JSON.parse(localStorage.getItem(NAMESPACE)).expiresOn;
94065
94113
 
94066
94114
  if (Date.now() > EXPIRE_DATE) {
94067
- console.log('session expired');
94115
+ // console.log('session expired');
94068
94116
  showProgress = true; // reset
94069
94117
 
94070
94118
  localStorage.setItem(NAMESPACE, JSON.stringify({
@@ -94288,8 +94336,8 @@ class ContentBox {
94288
94336
  let url = link.getAttribute('href');
94289
94337
 
94290
94338
  if (url) {
94291
- // Will go to the link
94292
94339
  if (url.indexOf('#') === 0) {
94340
+ // Will go to bookmark
94293
94341
  if (url.indexOf('#section') === 0) {
94294
94342
  let num = url.replace('#section', '');
94295
94343
 
@@ -94324,12 +94372,17 @@ class ContentBox {
94324
94372
  } catch (e) {// Do Nothing
94325
94373
  }
94326
94374
  }
94375
+ } else {
94376
+ // Prevent to go to the link
94377
+ e.preventDefault();
94378
+ e.stopImmediatePropagation();
94327
94379
  }
94328
- } // if(link.closest('.is-menu-search')) return;
94329
- // if(link.closest('.is-menu-toggle')) return;
94330
- // e.preventDefault();
94331
- // e.stopImmediatePropagation();
94332
-
94380
+ } else {
94381
+ if (link.closest('.is-menu-search')) ; else {
94382
+ e.preventDefault();
94383
+ e.stopImmediatePropagation();
94384
+ }
94385
+ }
94333
94386
  });
94334
94387
  });
94335
94388
  }