@innovastudio/contentbuilder 1.3.24 → 1.3.26

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/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.3.24",
4
+ "version": "1.3.26",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -5178,3 +5178,9 @@ button:focus-visible {
5178
5178
  .is-builder > div > div[data-module=slider-builder].cell-active {
5179
5179
  z-index: 1 !important;
5180
5180
  }
5181
+
5182
+ /* Row Lock will hide row tool */
5183
+ .row-lock .is-row-tool,
5184
+ .row-lock .is-rowadd-tool {
5185
+ display: none !important;
5186
+ }
@@ -59439,6 +59439,24 @@ class ColumnTool {
59439
59439
  this.columnTool.querySelector('.cell-remove').style.display = '';
59440
59440
  this.columnTool.querySelector('.cell-more').style.display = '';
59441
59441
  }
59442
+ } // Column Lock will hide Add & Remove column
59443
+
59444
+
59445
+ if (col.classList.contains('column-lock')) {
59446
+ this.columnTool.querySelector('.cell-add').style.display = 'none';
59447
+ this.columnTool.querySelector('.cell-remove').style.display = 'none';
59448
+ this.columnMore.querySelector('.cell-prev').style.display = 'none';
59449
+ this.columnMore.querySelector('.cell-next').style.display = 'none';
59450
+ this.columnMore.querySelector('.cell-up').style.display = 'none';
59451
+ this.columnMore.querySelector('.cell-down').style.display = 'none';
59452
+ this.columnMore.querySelector('.cell-increase').style.display = 'none';
59453
+ this.columnMore.querySelector('.cell-decrease').style.display = 'none';
59454
+ this.columnMore.querySelector('.cell-duplicate').style.display = 'none';
59455
+ this.columnMore.querySelector('.is-separator').style.display = 'none';
59456
+ this.columnMore.querySelector('.cell-locking').style.display = 'none';
59457
+ } else {
59458
+ this.columnMore.querySelector('.is-separator').style.display = '';
59459
+ this.columnMore.querySelector('.cell-locking').style.display = '';
59442
59460
  }
59443
59461
  }
59444
59462
 
@@ -70686,17 +70704,11 @@ class Rte {
70686
70704
  fontname = fontname.replace(/'/g, ''); // NEW 4.0.5 (replace quotes in font family)
70687
70705
 
70688
70706
  if (provider === 'google') {
70689
- var bExist = false;
70690
- var links = this.builder.doc.getElementsByTagName('link');
70691
-
70692
- for (i = 0; i < links.length; i++) {
70693
- var sSrc = links[i].href.toLowerCase();
70694
- sSrc = sSrc.replace(/\+/g, ' ').replace(/%20/g, ' ');
70695
- if (sSrc.indexOf(fontname.toLowerCase()) !== -1) bExist = true;
70696
- }
70707
+ let bExist = false;
70708
+ bExist = this.checkIfFontCssLinkExists(fontfamily);
70697
70709
 
70698
70710
  if (!bExist) {
70699
- var element = elm;
70711
+ let element = elm;
70700
70712
 
70701
70713
  while (!dom.hasClass(element, 'is-builder')) {
70702
70714
  element = element.parentNode;
@@ -70705,7 +70717,7 @@ class Rte {
70705
70717
  let cssUrl = '';
70706
70718
 
70707
70719
  if (this.builder.fontPath) {
70708
- const cssFileName = fontfamily.split(',')[0].toLowerCase().replace(/\s/g, '-') + '.css';
70720
+ const cssFileName = fontfamily.split(',')[0].toLowerCase().replace(/'/g, '').replace(/"/g, '').replace(/\s/g, '-') + '.css';
70709
70721
  cssUrl = this.builder.fontPath + cssFileName;
70710
70722
  dom.appendHtml(element, `<link data-name="fontfamily" href="${cssUrl}" rel="stylesheet" property="stylesheet" type="text/css">`);
70711
70723
  } else {
@@ -70714,6 +70726,27 @@ class Rte {
70714
70726
  }
70715
70727
  }
70716
70728
 
70729
+ if (provider === 'others') {
70730
+ let bExist = false;
70731
+ bExist = this.checkIfFontCssLinkExists(fontfamily);
70732
+
70733
+ if (!bExist) {
70734
+ let element = elm;
70735
+
70736
+ while (!dom.hasClass(element, 'is-builder')) {
70737
+ element = element.parentNode;
70738
+ }
70739
+
70740
+ let cssUrl = '';
70741
+
70742
+ if (this.builder.fontPath) {
70743
+ const cssFileName = fontfamily.split(',')[0].toLowerCase().replace(/'/g, '').replace(/"/g, '').replace(/\s/g, '-') + '.css';
70744
+ cssUrl = this.builder.fontPath + cssFileName;
70745
+ dom.appendHtml(element, `<link data-name="fontfamily" href="${cssUrl}" rel="stylesheet" property="stylesheet" type="text/css">`);
70746
+ }
70747
+ }
70748
+ }
70749
+
70717
70750
  if (!this.builder.inspectedElement) {
70718
70751
  //save selection
70719
70752
  this.util.saveSelection(); //Needed because after format, a tag is added (ex. <span>), so, make selection again.
@@ -70728,9 +70761,12 @@ class Rte {
70728
70761
  } //Trigger Change event
70729
70762
 
70730
70763
 
70731
- this.builder.opts.onChange(); //LATER: make function
70732
- //Cleanup Google font css link
70764
+ this.builder.opts.onChange(); //Cleanup Google font css link
70765
+
70766
+ this.cleanupFontCssLink();
70767
+ }
70733
70768
 
70769
+ cleanupFontCssLink() {
70734
70770
  const fonts = [];
70735
70771
 
70736
70772
  if (this.builder.opts.page !== '') {
@@ -70747,34 +70783,34 @@ class Rte {
70747
70783
  if (fonts.indexOf(fontFamily) === -1) fonts.push(fontFamily);
70748
70784
  });
70749
70785
  });
70750
- }
70786
+ } // Cleanup
70751
70787
 
70752
- links = this.builder.doc.getElementsByTagName('link');
70753
70788
 
70754
- for (i = 0; i < links.length; i++) {
70755
- sSrc = links[i].href.toLowerCase();
70789
+ let links = this.builder.doc.getElementsByTagName('link');
70790
+
70791
+ for (let i = 0; i < links.length; i++) {
70792
+ let sSrc = links[i].href.toLowerCase();
70756
70793
 
70757
70794
  if (sSrc.indexOf('googleapis') !== -1) {
70758
70795
  //get fontname
70759
70796
  sSrc = sSrc.replace(/\+/g, ' ').replace(/%20/g, ' ');
70760
- fontname = sSrc.substr(sSrc.indexOf('family=') + 7);
70797
+ let linkFontName = sSrc.substr(sSrc.indexOf('family=') + 7);
70761
70798
 
70762
- if (fontname.indexOf(':') !== -1) {
70763
- fontname = fontname.split(':')[0];
70799
+ if (linkFontName.indexOf(':') !== -1) {
70800
+ linkFontName = linkFontName.split(':')[0];
70764
70801
  }
70765
70802
 
70766
- if (fontname.indexOf('|') !== -1) {
70767
- fontname = fontname.split('|')[0];
70803
+ if (linkFontName.indexOf('|') !== -1) {
70804
+ linkFontName = linkFontName.split('|')[0];
70768
70805
  }
70769
70806
 
70770
- fontname = fontname.replace('&display=swap', ''); // NEW 4.0.5
70771
- //console.log(fontname);
70772
- //check if fontname used in content
70773
- // let tmp = this.builder.doc.body.innerHTML.toLowerCase();
70807
+ linkFontName = linkFontName.replace('&display=swap', ''); // NEW 4.0.5
70808
+ // console.log(linkFontName);
70809
+ // check if fontname used in content
70774
70810
 
70775
70811
  let used = false;
70776
70812
  fonts.forEach(item => {
70777
- if (item.toLowerCase().indexOf(fontname) === -1) ; else {
70813
+ if (item.toLowerCase().indexOf(linkFontName.toLowerCase()) === -1) ; else {
70778
70814
  used = true;
70779
70815
  }
70780
70816
  });
@@ -70786,19 +70822,11 @@ class Rte {
70786
70822
  if (!attr) {
70787
70823
  links[i].setAttribute('data-rel', '_del');
70788
70824
  }
70789
- } // var count = tmp.split(fontname).length;
70790
- // if(count<3){
70791
- // //not used
70792
- // let attr = links[i].getAttribute('data-protect');
70793
- // if (!attr) {
70794
- // links[i].setAttribute('data-rel','_del');
70795
- // }
70796
- // }
70797
-
70825
+ }
70798
70826
  } else if (links[i].getAttribute('data-name') === 'fontfamily') {
70799
70827
  let used = false;
70800
70828
  fonts.forEach(item => {
70801
- const cssFileName = item.split(',')[0].replace(/"/g, '').replace(/\s/g, '').toLowerCase() + '.css';
70829
+ const cssFileName = item.split(',')[0].replace(/'/g, '').replace(/"/g, '').replace(/\s/g, '-').toLowerCase() + '.css';
70802
70830
 
70803
70831
  if (sSrc.toLowerCase().indexOf('/' + cssFileName) === -1) ; else {
70804
70832
  used = true;
@@ -70821,6 +70849,54 @@ class Rte {
70821
70849
  });
70822
70850
  }
70823
70851
 
70852
+ checkIfFontCssLinkExists(fontfamily) {
70853
+ let bExist = false;
70854
+ let fontname = fontfamily.split(',')[0];
70855
+ fontname = fontname.replace(/'/g, '');
70856
+ fontname = fontname.replace(/"/g, ''); // (replace double quotes in font family)
70857
+
70858
+ fontname = fontname.toLowerCase();
70859
+ let links = this.builder.doc.getElementsByTagName('link');
70860
+
70861
+ for (let i = 0; i < links.length; i++) {
70862
+ let sSrc = links[i].href.toLowerCase();
70863
+
70864
+ if (sSrc.indexOf('googleapis') !== -1) {
70865
+ if (!this.builder.fontPath) {
70866
+ //get fontname
70867
+ sSrc = sSrc.replace(/\+/g, ' ').replace(/%20/g, ' ');
70868
+ let linkFontName = sSrc.substr(sSrc.indexOf('family=') + 7);
70869
+
70870
+ if (linkFontName.indexOf(':') !== -1) {
70871
+ linkFontName = linkFontName.split(':')[0];
70872
+ }
70873
+
70874
+ if (linkFontName.indexOf('|') !== -1) {
70875
+ linkFontName = linkFontName.split('|')[0];
70876
+ }
70877
+
70878
+ linkFontName = linkFontName.replace('&display=swap', ''); // NEW 4.0.5
70879
+ //check if fontname used in content
70880
+ // let tmp = this.builder.doc.body.innerHTML.toLowerCase();
70881
+
70882
+ if (linkFontName === fontname.toLowerCase()) {
70883
+ bExist = true; // console.log(fontname.toLowerCase() + '-' +linkFontName);
70884
+ }
70885
+ }
70886
+ } else if (links[i].getAttribute('data-name') === 'fontfamily') {
70887
+ if (this.builder.fontPath) {
70888
+ let cssFile = fontname.replace(/\s/g, '-').toLowerCase() + '.css';
70889
+
70890
+ if (sSrc.toLowerCase().indexOf('/' + cssFile) !== -1) {
70891
+ bExist = true;
70892
+ }
70893
+ }
70894
+ }
70895
+ }
70896
+
70897
+ return bExist;
70898
+ }
70899
+
70824
70900
  positionToolbar() {
70825
70901
  const viewportWidth = document.body.clientWidth; //window.innerWidth;
70826
70902
 
@@ -73917,7 +73993,7 @@ class ContentBuilder {
73917
73993
  // Used for the location of ionicons/ (see rte.js 2788) & scripts/ (see plugins/preview/plugin.js 237)
73918
73994
  fontAssetPath: 'assets/fonts/',
73919
73995
  // Option for self-hosted fonts:
73920
- // fontPath: 'assets/googlefonts/', // If set, will be used
73996
+ // fontPath: 'assets/cssfonts/', // If set, will be used
73921
73997
  snippetData: 'assets/minimalist-blocks/snippetlist.html',
73922
73998
  // Deprecated
73923
73999
  snippetUrl: 'assets/minimalist-blocks/content.js',