@innovastudio/contentbox 1.5.44 → 1.5.46

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.5.44",
4
+ "version": "1.5.46",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -46,7 +46,6 @@
46
46
  "webpack-dev-server": "^4.0.0"
47
47
  },
48
48
  "dependencies": {
49
- "@innovastudio/contentbuilder": "^1.4.32",
50
49
  "js-beautify": "^1.14.0"
51
50
  }
52
51
  }
@@ -1396,6 +1396,8 @@ class SideBar {
1396
1396
  url: '${item.url}',
1397
1397
  path: '${item.path}',
1398
1398
  pathReplace: '${item.pathReplace}',
1399
+ ${Object.prototype.hasOwnProperty.call(item, 'numbering') ? `numbering: ${item.numbering},` : 'numbering:false,'}
1400
+ ${Object.prototype.hasOwnProperty.call(item, 'showNumberOnHover') ? `showNumberOnHover: ${item.showNumberOnHover},` : 'showNumberOnHover:false,'}
1399
1401
  },`;
1400
1402
  });
1401
1403
  let sTemplates = '';
@@ -1404,6 +1406,8 @@ class SideBar {
1404
1406
  url: '${item.url}',
1405
1407
  path: '${item.path}',
1406
1408
  pathReplace: '${item.pathReplace}',
1409
+ ${Object.prototype.hasOwnProperty.call(item, 'numbering') ? `numbering: ${item.numbering},` : 'numbering:false,'}
1410
+ ${Object.prototype.hasOwnProperty.call(item, 'showNumberOnHover') ? `showNumberOnHover: ${item.showNumberOnHover},` : 'showNumberOnHover:false,'}
1407
1411
  },`;
1408
1412
  });
1409
1413
  let sDefaultCategory = `{
@@ -1684,6 +1688,23 @@ class SideBar {
1684
1688
  }
1685
1689
  }
1686
1690
 
1691
+ .is-number {
1692
+ opacity: 0;
1693
+ position: absolute;
1694
+ top: 3px;
1695
+ right: 3px;
1696
+ color: #444;
1697
+ padding: 3px 6px;
1698
+ background: rgb(255 255 255);
1699
+ border-radius: 500px;
1700
+ transition: all 0.3s ease;
1701
+ }
1702
+ .is-number.show {
1703
+ opacity: 1;
1704
+ }
1705
+ .is-design-list > button:hover .is-number {
1706
+ opacity: 1;
1707
+ }
1687
1708
 
1688
1709
 
1689
1710
 
@@ -2069,6 +2090,11 @@ class SideBar {
2069
2090
 
2070
2091
  template_list.forEach(gallery=>{
2071
2092
  let designs = gallery.designs;
2093
+
2094
+ let numbering = gallery.numbering;
2095
+ let showNumberOnHover = gallery.showNumberOnHover;
2096
+ let numberCount = 0;
2097
+
2072
2098
  designs.forEach(item=>{
2073
2099
  let isSelected = false;
2074
2100
  let catSplit = item.category.split(',');
@@ -2081,10 +2107,13 @@ class SideBar {
2081
2107
  item.id = nIndex; //Give id
2082
2108
 
2083
2109
  if (isSelected) {
2084
-
2110
+
2111
+ numberCount++;
2112
+
2085
2113
  let html = '<button tabindex="0" class="active" data-id="' + item.id + '" data-cat=""' + item.category + '">' +
2086
2114
  '<img class="lzy-img" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC0AAAAaCAYAAAAjZdWPAAAEDmlDQ1BrQ0dDb2xvclNwYWNlR2VuZXJpY1JHQgAAOI2NVV1oHFUUPpu5syskzoPUpqaSDv41lLRsUtGE2uj+ZbNt3CyTbLRBkMns3Z1pJjPj/KRpKT4UQRDBqOCT4P9bwSchaqvtiy2itFCiBIMo+ND6R6HSFwnruTOzu5O4a73L3PnmnO9+595z7t4LkLgsW5beJQIsGq4t5dPis8fmxMQ6dMF90A190C0rjpUqlSYBG+PCv9rt7yDG3tf2t/f/Z+uuUEcBiN2F2Kw4yiLiZQD+FcWyXYAEQfvICddi+AnEO2ycIOISw7UAVxieD/Cyz5mRMohfRSwoqoz+xNuIB+cj9loEB3Pw2448NaitKSLLRck2q5pOI9O9g/t/tkXda8Tbg0+PszB9FN8DuPaXKnKW4YcQn1Xk3HSIry5ps8UQ/2W5aQnxIwBdu7yFcgrxPs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cLD3FQgx9nO+W8NuD9v7z230rVdLOmkQ6HsAjholrXJCWdKAo0ZJq5xQljTgqFHSKieUJQ04apS0ygllSQOOGo2UfgEpPQQwSb0YngAAAABJRU5ErkJggg==" data-src="' + gallery.path + item.thumbnail + '">' +
2087
2115
  '<span class="is-overlay"></span>' +
2116
+ (numbering? (showNumberOnHover?'<div class="is-number">'+(numberCount+'').padStart(3, '0')+'</div>':'<div class="is-number show">'+(numberCount+'').padStart(3, '0')+'</div>') :'') +
2088
2117
  '</button>';
2089
2118
 
2090
2119
  if(item.type === 'glide' || item.type === 'slick') {
@@ -2379,6 +2408,8 @@ class SideBar {
2379
2408
  templateAdded.path = template.path;
2380
2409
  templateAdded.pathReplace = template.pathReplace;
2381
2410
  templateAdded.designId = designId;
2411
+ templateAdded.numbering = template.numbering;
2412
+ templateAdded.showNumberOnHover = template.showNumberOnHover;
2382
2413
  // console.log(templateAdded);
2383
2414
 
2384
2415
  renderMegaMenu();
@@ -67218,6 +67249,11 @@ class ButtonEditor {
67218
67249
  }
67219
67250
 
67220
67251
  activeButton.classList.remove('active');
67252
+
67253
+ if (activeButton.tagName.toLowerCase() === 'a') {
67254
+ activeButton.setAttribute('role', 'button');
67255
+ }
67256
+
67221
67257
  this.realtime();
67222
67258
  this.builder.opts.onChange();
67223
67259
  e.preventDefault();
@@ -67283,6 +67319,11 @@ class ButtonEditor {
67283
67319
  }
67284
67320
 
67285
67321
  activeButton.classList.remove('active');
67322
+
67323
+ if (activeButton.tagName.toLowerCase() === 'a') {
67324
+ activeButton.setAttribute('role', 'button');
67325
+ }
67326
+
67286
67327
  this.builder.opts.onChange();
67287
67328
  this.realtime();
67288
67329
  e.preventDefault();
@@ -67355,6 +67396,10 @@ class ButtonEditor {
67355
67396
  link.removeAttribute('data-hover-color');
67356
67397
  link.removeAttribute('data-hover-bordercolor');
67357
67398
  dom.addClass(link, 'whitespace-nowrap');
67399
+
67400
+ if (link.tagName.toLowerCase() === 'a') {
67401
+ link.setAttribute('role', 'button');
67402
+ }
67358
67403
  }
67359
67404
 
67360
67405
  cleanupOldClasses(link) {
@@ -91894,20 +91939,26 @@ class LivePreview {
91894
91939
  let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
91895
91940
 
91896
91941
  if (iframeDocument) {
91897
- if (iframeDocument.body.innerHTML === '') {
91942
+ if (!iframeDocument.body) {
91898
91943
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91899
91944
  } else {
91900
- // sync. html
91901
- let html = this.builder.html();
91902
- let container = iframeDocument.querySelector('.container');
91903
- if (!container) container = iframeDocument.querySelector('.is-container');
91904
-
91905
- if (container) {
91906
- container.innerHTML = html;
91907
- } else {
91945
+ if (iframeDocument.body.innerHTML === '') {
91908
91946
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91947
+ } else {
91948
+ // sync. html
91949
+ let html = this.builder.html();
91950
+ let container = iframeDocument.querySelector('.container');
91951
+ if (!container) container = iframeDocument.querySelector('.is-container');
91952
+
91953
+ if (container) {
91954
+ container.innerHTML = html;
91955
+ } else {
91956
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91957
+ }
91909
91958
  }
91910
91959
  }
91960
+ } else {
91961
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91911
91962
  }
91912
91963
  }
91913
91964
  } else {
@@ -91933,80 +91984,84 @@ class LivePreview {
91933
91984
  let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
91934
91985
 
91935
91986
  if (iframeDocument) {
91936
- if (iframeDocument.body.innerHTML === '') {
91987
+ if (!iframeDocument.body) {
91937
91988
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91938
91989
  } else {
91939
- // sync. html
91940
- let html = localStorage.getItem('preview-html');
91941
- let wrapper = iframeDocument.querySelector('.is-wrapper');
91942
- wrapper.innerHTML = html; // sync. styles
91943
- // let mainCss = localStorage.getItem('preview-maincss');
91944
- // let sectionCss = localStorage.getItem('preview-sectioncss');
91945
-
91946
- let elms = iframeDocument.querySelectorAll('link');
91947
- let links = this.builder.doc.getElementsByTagName('link');
91948
- Array.from(links).map(link => {
91949
- let href = link.href.toLowerCase();
91950
-
91951
- if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
91952
- // check
91953
- let exist = false;
91954
- elms.forEach(elm => {
91955
- let elmHref = elm.href.toLowerCase();
91956
-
91957
- if (elmHref) {
91958
- if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
91959
- if (href === elmHref) {
91960
- exist = true;
91990
+ if (iframeDocument.body.innerHTML === '') {
91991
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91992
+ } else {
91993
+ // sync. html
91994
+ let html = localStorage.getItem('preview-html');
91995
+ let wrapper = iframeDocument.querySelector('.is-wrapper');
91996
+ wrapper.innerHTML = html; // sync. styles
91997
+ // let mainCss = localStorage.getItem('preview-maincss');
91998
+ // let sectionCss = localStorage.getItem('preview-sectioncss');
91999
+
92000
+ let elms = iframeDocument.querySelectorAll('link');
92001
+ let links = this.builder.doc.getElementsByTagName('link');
92002
+ Array.from(links).map(link => {
92003
+ let href = link.href.toLowerCase();
92004
+
92005
+ if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
92006
+ // check
92007
+ let exist = false;
92008
+ elms.forEach(elm => {
92009
+ let elmHref = elm.href.toLowerCase();
92010
+
92011
+ if (elmHref) {
92012
+ if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
92013
+ if (href === elmHref) {
92014
+ exist = true;
92015
+ }
91961
92016
  }
91962
92017
  }
91963
- }
91964
- });
92018
+ });
91965
92019
 
91966
- if (!exist) {
91967
- // clone is needed, otherwise, parent resource may dissapear when loading on iframe
91968
- const clone = link.cloneNode(true);
91969
- iframeDocument.head.appendChild(clone); // ADD
92020
+ if (!exist) {
92021
+ // clone is needed, otherwise, parent resource may dissapear when loading on iframe
92022
+ const clone = link.cloneNode(true);
92023
+ iframeDocument.head.appendChild(clone); // ADD
92024
+ }
91970
92025
  }
91971
- }
91972
- });
91973
- elms.forEach(elm => {
91974
- let href = elm.href.toLowerCase();
91975
-
91976
- if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
91977
- // check
91978
- let exist = false;
91979
- Array.from(links).map(link => {
91980
- let elmHref = link.href.toLowerCase();
91981
-
91982
- if (elmHref) {
91983
- if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
91984
- if (href === elmHref) {
91985
- exist = true;
92026
+ });
92027
+ elms.forEach(elm => {
92028
+ let href = elm.href.toLowerCase();
92029
+
92030
+ if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
92031
+ // check
92032
+ let exist = false;
92033
+ Array.from(links).map(link => {
92034
+ let elmHref = link.href.toLowerCase();
92035
+
92036
+ if (elmHref) {
92037
+ if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
92038
+ if (href === elmHref) {
92039
+ exist = true;
92040
+ }
91986
92041
  }
91987
92042
  }
91988
- }
91989
- });
92043
+ });
91990
92044
 
91991
- if (!exist) {
91992
- iframeDocument.head.removeChild(elm); // REMOVE
92045
+ if (!exist) {
92046
+ iframeDocument.head.removeChild(elm); // REMOVE
92047
+ }
91993
92048
  }
91994
- }
91995
- }); // reload box js
91996
-
91997
- elms = iframeDocument.querySelectorAll('script');
91998
- elms.forEach(elm => {
91999
- let src = elm.getAttribute('src');
92000
-
92001
- if (src) {
92002
- if (src.indexOf('box-flex.js') !== -1 || src.indexOf('box.js') !== -1) {
92003
- elm.parentElement.removeChild(elm);
92004
- let scriptElm = document.createElement('script');
92005
- scriptElm.setAttribute('src', src);
92006
- iframeDocument.body.appendChild(scriptElm);
92049
+ }); // reload box js
92050
+
92051
+ elms = iframeDocument.querySelectorAll('script');
92052
+ elms.forEach(elm => {
92053
+ let src = elm.getAttribute('src');
92054
+
92055
+ if (src) {
92056
+ if (src.indexOf('box-flex.js') !== -1 || src.indexOf('box.js') !== -1) {
92057
+ elm.parentElement.removeChild(elm);
92058
+ let scriptElm = document.createElement('script');
92059
+ scriptElm.setAttribute('src', src);
92060
+ iframeDocument.body.appendChild(scriptElm);
92061
+ }
92007
92062
  }
92008
- }
92009
- });
92063
+ });
92064
+ }
92010
92065
  }
92011
92066
  } else {
92012
92067
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);