@innovastudio/contentbox 1.5.44 → 1.5.45

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.45",
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.4.32",
49
+ "@innovastudio/contentbuilder": "^1.4.33",
50
50
  "js-beautify": "^1.14.0"
51
51
  }
52
52
  }
@@ -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+PszB9FN8DuPaXKnKW4YcQn1Xk3HSIry5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URBVFgJ7dLBCcAwEANBx/337IQUsK/FcLD3FQgx9nO+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();
@@ -91894,20 +91925,26 @@ class LivePreview {
91894
91925
  let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
91895
91926
 
91896
91927
  if (iframeDocument) {
91897
- if (iframeDocument.body.innerHTML === '') {
91928
+ if (!iframeDocument.body) {
91898
91929
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91899
91930
  } 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 {
91931
+ if (iframeDocument.body.innerHTML === '') {
91908
91932
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91933
+ } else {
91934
+ // sync. html
91935
+ let html = this.builder.html();
91936
+ let container = iframeDocument.querySelector('.container');
91937
+ if (!container) container = iframeDocument.querySelector('.is-container');
91938
+
91939
+ if (container) {
91940
+ container.innerHTML = html;
91941
+ } else {
91942
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91943
+ }
91909
91944
  }
91910
91945
  }
91946
+ } else {
91947
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91911
91948
  }
91912
91949
  }
91913
91950
  } else {
@@ -91933,80 +91970,84 @@ class LivePreview {
91933
91970
  let iframeDocument = iframe.contentDocument || iframe.contentWindow.document;
91934
91971
 
91935
91972
  if (iframeDocument) {
91936
- if (iframeDocument.body.innerHTML === '') {
91973
+ if (!iframeDocument.body) {
91937
91974
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91938
91975
  } 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;
91976
+ if (iframeDocument.body.innerHTML === '') {
91977
+ iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);
91978
+ } else {
91979
+ // sync. html
91980
+ let html = localStorage.getItem('preview-html');
91981
+ let wrapper = iframeDocument.querySelector('.is-wrapper');
91982
+ wrapper.innerHTML = html; // sync. styles
91983
+ // let mainCss = localStorage.getItem('preview-maincss');
91984
+ // let sectionCss = localStorage.getItem('preview-sectioncss');
91985
+
91986
+ let elms = iframeDocument.querySelectorAll('link');
91987
+ let links = this.builder.doc.getElementsByTagName('link');
91988
+ Array.from(links).map(link => {
91989
+ let href = link.href.toLowerCase();
91990
+
91991
+ if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
91992
+ // check
91993
+ let exist = false;
91994
+ elms.forEach(elm => {
91995
+ let elmHref = elm.href.toLowerCase();
91996
+
91997
+ if (elmHref) {
91998
+ if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
91999
+ if (href === elmHref) {
92000
+ exist = true;
92001
+ }
91961
92002
  }
91962
92003
  }
91963
- }
91964
- });
92004
+ });
91965
92005
 
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
92006
+ if (!exist) {
92007
+ // clone is needed, otherwise, parent resource may dissapear when loading on iframe
92008
+ const clone = link.cloneNode(true);
92009
+ iframeDocument.head.appendChild(clone); // ADD
92010
+ }
91970
92011
  }
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;
92012
+ });
92013
+ elms.forEach(elm => {
92014
+ let href = elm.href.toLowerCase();
92015
+
92016
+ if (href.indexOf('/basetype-') !== -1 || href.indexOf('/type-') !== -1) {
92017
+ // check
92018
+ let exist = false;
92019
+ Array.from(links).map(link => {
92020
+ let elmHref = link.href.toLowerCase();
92021
+
92022
+ if (elmHref) {
92023
+ if (elmHref.indexOf('/basetype-') !== -1 || elmHref.indexOf('/type-') !== -1) {
92024
+ if (href === elmHref) {
92025
+ exist = true;
92026
+ }
91986
92027
  }
91987
92028
  }
91988
- }
91989
- });
92029
+ });
91990
92030
 
91991
- if (!exist) {
91992
- iframeDocument.head.removeChild(elm); // REMOVE
92031
+ if (!exist) {
92032
+ iframeDocument.head.removeChild(elm); // REMOVE
92033
+ }
91993
92034
  }
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);
92035
+ }); // reload box js
92036
+
92037
+ elms = iframeDocument.querySelectorAll('script');
92038
+ elms.forEach(elm => {
92039
+ let src = elm.getAttribute('src');
92040
+
92041
+ if (src) {
92042
+ if (src.indexOf('box-flex.js') !== -1 || src.indexOf('box.js') !== -1) {
92043
+ elm.parentElement.removeChild(elm);
92044
+ let scriptElm = document.createElement('script');
92045
+ scriptElm.setAttribute('src', src);
92046
+ iframeDocument.body.appendChild(scriptElm);
92047
+ }
92007
92048
  }
92008
- }
92009
- });
92049
+ });
92050
+ }
92010
92051
  }
92011
92052
  } else {
92012
92053
  iframe.src = this.builder.previewURL + '?' + Math.floor(Date.now() / 1000);