@innovastudio/contentbuilder 1.3.22 → 1.3.24

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.22",
4
+ "version": "1.3.24",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -70555,7 +70555,7 @@ class Rte {
70555
70555
 
70556
70556
  if (count < 3) {
70557
70557
  //not used
70558
- var attr = links[i].getAttribute('data-protect');
70558
+ let attr = links[i].getAttribute('data-protect');
70559
70559
 
70560
70560
  if (!attr) {
70561
70561
  links[i].setAttribute('data-rel', '_del');
@@ -70702,7 +70702,15 @@ class Rte {
70702
70702
  element = element.parentNode;
70703
70703
  }
70704
70704
 
70705
- dom.appendHtml(element, '<link href="//fonts.googleapis.com/css?family=' + fontname + d + o + '" rel="stylesheet" property="stylesheet" type="text/css">');
70705
+ let cssUrl = '';
70706
+
70707
+ if (this.builder.fontPath) {
70708
+ const cssFileName = fontfamily.split(',')[0].toLowerCase().replace(/\s/g, '-') + '.css';
70709
+ cssUrl = this.builder.fontPath + cssFileName;
70710
+ dom.appendHtml(element, `<link data-name="fontfamily" href="${cssUrl}" rel="stylesheet" property="stylesheet" type="text/css">`);
70711
+ } else {
70712
+ dom.appendHtml(element, '<link href="//fonts.googleapis.com/css?family=' + fontname + d + o + '" rel="stylesheet" property="stylesheet" type="text/css">');
70713
+ }
70706
70714
  }
70707
70715
  }
70708
70716
 
@@ -70773,7 +70781,7 @@ class Rte {
70773
70781
 
70774
70782
  if (!used) {
70775
70783
  //not used
70776
- var attr = links[i].getAttribute('data-protect');
70784
+ let attr = links[i].getAttribute('data-protect');
70777
70785
 
70778
70786
  if (!attr) {
70779
70787
  links[i].setAttribute('data-rel', '_del');
@@ -70781,12 +70789,30 @@ class Rte {
70781
70789
  } // var count = tmp.split(fontname).length;
70782
70790
  // if(count<3){
70783
70791
  // //not used
70784
- // var attr = links[i].getAttribute('data-protect');
70792
+ // let attr = links[i].getAttribute('data-protect');
70785
70793
  // if (!attr) {
70786
70794
  // links[i].setAttribute('data-rel','_del');
70787
70795
  // }
70788
70796
  // }
70789
70797
 
70798
+ } else if (links[i].getAttribute('data-name') === 'fontfamily') {
70799
+ let used = false;
70800
+ fonts.forEach(item => {
70801
+ const cssFileName = item.split(',')[0].replace(/"/g, '').replace(/\s/g, '').toLowerCase() + '.css';
70802
+
70803
+ if (sSrc.toLowerCase().indexOf('/' + cssFileName) === -1) ; else {
70804
+ used = true;
70805
+ }
70806
+ });
70807
+
70808
+ if (!used) {
70809
+ //not used
70810
+ let attr = links[i].getAttribute('data-protect');
70811
+
70812
+ if (!attr) {
70813
+ links[i].setAttribute('data-rel', '_del');
70814
+ }
70815
+ }
70790
70816
  }
70791
70817
  }
70792
70818
 
@@ -73890,6 +73916,8 @@ class ContentBuilder {
73890
73916
  assetPath: 'assets/',
73891
73917
  // Used for the location of ionicons/ (see rte.js 2788) & scripts/ (see plugins/preview/plugin.js 237)
73892
73918
  fontAssetPath: 'assets/fonts/',
73919
+ // Option for self-hosted fonts:
73920
+ // fontPath: 'assets/googlefonts/', // If set, will be used
73893
73921
  snippetData: 'assets/minimalist-blocks/snippetlist.html',
73894
73922
  // Deprecated
73895
73923
  snippetUrl: 'assets/minimalist-blocks/content.js',