@innovastudio/contentbuilder 1.5.111 → 1.5.112

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/index.d.ts CHANGED
@@ -24,6 +24,8 @@ interface ContentBuilderOptions {
24
24
  modulePath?: string;
25
25
  basePath?: string;
26
26
  snippetsFolder?: string;
27
+ assetManagerBasePath?: string;
28
+ assetAbsoluteBasePath?: string;
27
29
  assetPath?: string;
28
30
  fontAssetPath?: string;
29
31
  fontPath?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.5.111",
4
+ "version": "1.5.112",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "types": "index.d.ts",
@@ -51281,31 +51281,32 @@ class Video {
51281
51281
  } else {
51282
51282
  let modalVideoSelect = builderStuff.querySelector('.is-modal.videoselect');
51283
51283
  let iframe = modalVideoSelect.querySelector('iframe');
51284
- /*
51285
- if(this.builder.opts.assetRefresh) {
51284
+ if (this.builder.opts.assetManagerBasePath) {
51285
+ let src;
51286
+ if (this.builder.opts.assetRefresh) {
51287
+ src = this.builder.opts.videoSelect;
51288
+ }
51289
+ if (iframe.src === 'about:blank') {
51290
+ src = this.builder.opts.videoSelect;
51291
+ }
51292
+ let result = await fetch(src);
51293
+ result = await result.text();
51294
+ result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
51295
+
51296
+ // Add base href
51297
+ result = result.replace(/<head>/i, '<head><base href="' + this.builder.opts.assetManagerBasePath + '">');
51298
+
51299
+ // Replace assets path
51300
+ result = result.replace(/="assets\//g, '="' + this.builder.opts.assetPath);
51301
+ iframe.srcdoc = result;
51302
+ } else {
51303
+ if (this.builder.opts.assetRefresh) {
51286
51304
  iframe.src = this.builder.opts.videoSelect;
51287
- }
51288
- if(iframe.src === 'about:blank'){
51305
+ }
51306
+ if (iframe.src === 'about:blank') {
51289
51307
  iframe.src = this.builder.opts.videoSelect;
51308
+ }
51290
51309
  }
51291
- */
51292
- //--------
51293
- let src;
51294
- if (this.builder.opts.assetRefresh) {
51295
- src = this.builder.opts.videoSelect;
51296
- }
51297
- if (iframe.src === 'about:blank') {
51298
- src = this.builder.opts.videoSelect;
51299
- }
51300
- let result = await fetch(src);
51301
- result = await result.text();
51302
- result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
51303
-
51304
- // Replace assets path
51305
- result = result.replace(/="assets\//g, '="' + this.builder.settings.assetPath);
51306
- iframe.srcdoc = result;
51307
- //--------
51308
-
51309
51310
  util.showModal(modalVideoSelect, false, () => {
51310
51311
  inpSelectVideo.removeAttribute('data-focus');
51311
51312
  inpSelectVideo.focus();
@@ -51520,31 +51521,32 @@ class Audio {
51520
51521
  } else {
51521
51522
  let modalAudioSelect = builderStuff.querySelector('.is-modal.audioselect');
51522
51523
  let iframe = modalAudioSelect.querySelector('iframe');
51523
- /*
51524
- if(this.builder.opts.assetRefresh) {
51524
+ if (this.builder.opts.assetManagerBasePath) {
51525
+ let src;
51526
+ if (this.builder.opts.assetRefresh) {
51527
+ src = this.builder.opts.audioSelect;
51528
+ }
51529
+ if (iframe.src === 'about:blank') {
51530
+ src = this.builder.opts.audioSelect;
51531
+ }
51532
+ let result = await fetch(src);
51533
+ result = await result.text();
51534
+ result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
51535
+
51536
+ // Add base href
51537
+ result = result.replace(/<head>/i, '<head><base href="' + this.builder.opts.assetManagerBasePath + '">');
51538
+
51539
+ // Replace assets path
51540
+ result = result.replace(/="assets\//g, '="' + this.builder.opts.assetPath);
51541
+ iframe.srcdoc = result;
51542
+ } else {
51543
+ if (this.builder.opts.assetRefresh) {
51525
51544
  iframe.src = this.builder.opts.audioSelect;
51526
- }
51527
- if(iframe.src === 'about:blank'){
51545
+ }
51546
+ if (iframe.src === 'about:blank') {
51528
51547
  iframe.src = this.builder.opts.audioSelect;
51548
+ }
51529
51549
  }
51530
- */
51531
- //--------
51532
- let src;
51533
- if (this.builder.opts.assetRefresh) {
51534
- src = this.builder.opts.audioSelect;
51535
- }
51536
- if (iframe.src === 'about:blank') {
51537
- src = this.builder.opts.audioSelect;
51538
- }
51539
- let result = await fetch(src);
51540
- result = await result.text();
51541
- result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
51542
-
51543
- // Replace assets path
51544
- result = result.replace(/="assets\//g, '="' + this.builder.settings.assetPath);
51545
- iframe.srcdoc = result;
51546
- //--------
51547
-
51548
51550
  util.showModal(modalAudioSelect, false, () => {
51549
51551
  inpSelectAudio.removeAttribute('data-focus');
51550
51552
  inpSelectAudio.focus();
@@ -80572,66 +80574,66 @@ class MediaPicker {
80572
80574
  } else {
80573
80575
  let iframe;
80574
80576
  let modal;
80575
- /*
80576
- if(targetAssetType==='media') {
80577
+ if (this.builder.opts.assetManagerBasePath) {
80578
+ let src;
80579
+ if (targetAssetType === 'media') {
80577
80580
  modal = this.builder.builderStuff.querySelector('.is-modal.mediaselect');
80578
80581
  iframe = modal.querySelector('iframe');
80579
- if(iframe.src === 'about:blank') {
80580
- if(this.builder.opts.mediaSelect) iframe.src = this.builder.opts.mediaSelect;
80581
- else if(this.builder.opts.imageSelect) iframe.src = this.builder.opts.imageSelect;
80582
+ if (iframe.src === 'about:blank') {
80583
+ if (this.builder.opts.mediaSelect) src = this.builder.opts.mediaSelect;else if (this.builder.opts.imageSelect) src = this.builder.opts.imageSelect;
80582
80584
  }
80583
- } else if(targetAssetType==='video') {
80585
+ } else if (targetAssetType === 'video') {
80584
80586
  modal = this.builder.builderStuff.querySelector('.is-modal.videoselect');
80585
80587
  iframe = modal.querySelector('iframe');
80586
- if(iframe.src === 'about:blank') iframe.src = this.builder.opts.videoSelect;
80587
- } else if(targetAssetType==='image') {
80588
+ if (iframe.src === 'about:blank') src = this.builder.opts.videoSelect;
80589
+ } else if (targetAssetType === 'image') {
80588
80590
  modal = this.builder.builderStuff.querySelector('.is-modal.imageselect');
80589
80591
  iframe = modal.querySelector('iframe');
80590
- if(iframe.src === 'about:blank') iframe.src = this.builder.opts.imageSelect;
80591
- } else if(targetAssetType==='audio') {
80592
+ if (iframe.src === 'about:blank') src = this.builder.opts.imageSelect;
80593
+ } else if (targetAssetType === 'audio') {
80592
80594
  modal = this.builder.builderStuff.querySelector('.is-modal.audioselect');
80593
80595
  iframe = modal.querySelector('iframe');
80594
- if(iframe.src === 'about:blank') iframe.src = this.builder.opts.audioSelect;
80595
- } else if(targetAssetType==='all') {
80596
+ if (iframe.src === 'about:blank') src = this.builder.opts.audioSelect;
80597
+ } else if (targetAssetType === 'all') {
80596
80598
  modal = this.builder.builderStuff.querySelector('.is-modal.fileselect');
80597
80599
  iframe = modal.querySelector('iframe');
80598
- if(iframe.src === 'about:blank') iframe.src = this.builder.opts.fileSelect;
80599
- }
80600
- */
80600
+ if (iframe.src === 'about:blank') src = this.builder.opts.fileSelect;
80601
+ }
80602
+ let result = await fetch(src);
80603
+ result = await result.text();
80604
+ result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
80601
80605
 
80602
- //--------
80603
- let src;
80604
- if (targetAssetType === 'media') {
80605
- modal = this.builder.builderStuff.querySelector('.is-modal.mediaselect');
80606
- iframe = modal.querySelector('iframe');
80607
- if (iframe.src === 'about:blank') {
80608
- if (this.builder.opts.mediaSelect) src = this.builder.opts.mediaSelect;else if (this.builder.opts.imageSelect) src = this.builder.opts.imageSelect;
80606
+ // Add base href
80607
+ result = result.replace(/<head>/i, '<head><base href="' + this.builder.opts.assetManagerBasePath + '">');
80608
+
80609
+ // Replace assets path
80610
+ result = result.replace(/="assets\//g, '="' + this.builder.opts.assetPath);
80611
+ iframe.srcdoc = result;
80612
+ } else {
80613
+ if (targetAssetType === 'media') {
80614
+ modal = this.builder.builderStuff.querySelector('.is-modal.mediaselect');
80615
+ iframe = modal.querySelector('iframe');
80616
+ if (iframe.src === 'about:blank') {
80617
+ if (this.builder.opts.mediaSelect) iframe.src = this.builder.opts.mediaSelect;else if (this.builder.opts.imageSelect) iframe.src = this.builder.opts.imageSelect;
80618
+ }
80619
+ } else if (targetAssetType === 'video') {
80620
+ modal = this.builder.builderStuff.querySelector('.is-modal.videoselect');
80621
+ iframe = modal.querySelector('iframe');
80622
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.videoSelect;
80623
+ } else if (targetAssetType === 'image') {
80624
+ modal = this.builder.builderStuff.querySelector('.is-modal.imageselect');
80625
+ iframe = modal.querySelector('iframe');
80626
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.imageSelect;
80627
+ } else if (targetAssetType === 'audio') {
80628
+ modal = this.builder.builderStuff.querySelector('.is-modal.audioselect');
80629
+ iframe = modal.querySelector('iframe');
80630
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.audioSelect;
80631
+ } else if (targetAssetType === 'all') {
80632
+ modal = this.builder.builderStuff.querySelector('.is-modal.fileselect');
80633
+ iframe = modal.querySelector('iframe');
80634
+ if (iframe.src === 'about:blank') iframe.src = this.builder.opts.fileSelect;
80609
80635
  }
80610
- } else if (targetAssetType === 'video') {
80611
- modal = this.builder.builderStuff.querySelector('.is-modal.videoselect');
80612
- iframe = modal.querySelector('iframe');
80613
- if (iframe.src === 'about:blank') src = this.builder.opts.videoSelect;
80614
- } else if (targetAssetType === 'image') {
80615
- modal = this.builder.builderStuff.querySelector('.is-modal.imageselect');
80616
- iframe = modal.querySelector('iframe');
80617
- if (iframe.src === 'about:blank') src = this.builder.opts.imageSelect;
80618
- } else if (targetAssetType === 'audio') {
80619
- modal = this.builder.builderStuff.querySelector('.is-modal.audioselect');
80620
- iframe = modal.querySelector('iframe');
80621
- if (iframe.src === 'about:blank') src = this.builder.opts.audioSelect;
80622
- } else if (targetAssetType === 'all') {
80623
- modal = this.builder.builderStuff.querySelector('.is-modal.fileselect');
80624
- iframe = modal.querySelector('iframe');
80625
- if (iframe.src === 'about:blank') src = this.builder.opts.fileSelect;
80626
- }
80627
- let result = await fetch(src);
80628
- result = await result.text();
80629
- result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
80630
-
80631
- // Replace assets path
80632
- result = result.replace(/="assets\//g, '="' + this.builder.settings.assetPath);
80633
- iframe.srcdoc = result;
80634
- //--------
80636
+ }
80635
80637
 
80636
80638
  // this.builder.util.showModal(modal);
80637
80639
 
@@ -96530,6 +96532,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
96530
96532
  this.selectAsset(s);
96531
96533
  }
96532
96534
  selectAsset(s, f) {
96535
+ if (this.opts.assetAbsoluteBasePath) s = this.opts.assetAbsoluteBasePath + s;
96533
96536
  let extension = s.split('.').pop().split('?')[0].split('#')[0]; //
96534
96537
  extension = extension.toLowerCase();
96535
96538
  let ok = false;
@@ -96783,67 +96786,66 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
96783
96786
  theTrigger: theTrigger
96784
96787
  });
96785
96788
  } else {
96786
- /*
96787
- if(targetAssetType==='media') {
96789
+ if (this.opts.assetManagerBasePath) {
96790
+ let src;
96791
+ if (targetAssetType === 'media') {
96788
96792
  modal = this.builderStuff.querySelector('.is-modal.mediaselect');
96789
96793
  iframe = modal.querySelector('iframe');
96790
- if(iframe.src === 'about:blank') {
96791
- if(this.opts.mediaSelect) iframe.src = this.opts.mediaSelect;
96792
- else if(this.opts.imageSelect) iframe.src = this.opts.imageSelect;
96794
+ if (iframe.src === 'about:blank') {
96795
+ if (this.opts.mediaSelect) src = this.opts.mediaSelect;else if (this.opts.imageSelect) src = this.opts.imageSelect;
96793
96796
  }
96794
- } else if(targetAssetType==='video') {
96797
+ } else if (targetAssetType === 'video') {
96795
96798
  modal = this.builderStuff.querySelector('.is-modal.videoselect');
96796
96799
  iframe = modal.querySelector('iframe');
96797
- if(iframe.src === 'about:blank') iframe.src = this.opts.videoSelect;
96798
- } else if(targetAssetType==='image') {
96800
+ if (iframe.src === 'about:blank') src = this.opts.videoSelect;
96801
+ } else if (targetAssetType === 'image') {
96799
96802
  modal = this.builderStuff.querySelector('.is-modal.imageselect');
96800
96803
  iframe = modal.querySelector('iframe');
96801
- if(iframe.src === 'about:blank') iframe.src = this.opts.imageSelect;
96802
- } else if(targetAssetType==='audio') {
96804
+ if (iframe.src === 'about:blank') src = this.opts.imageSelect;
96805
+ } else if (targetAssetType === 'audio') {
96803
96806
  modal = this.builderStuff.querySelector('.is-modal.audioselect');
96804
96807
  iframe = modal.querySelector('iframe');
96805
- if(iframe.src === 'about:blank') iframe.src = this.opts.audioSelect;
96806
- } else if(targetAssetType==='all') {
96808
+ if (iframe.src === 'about:blank') src = this.opts.audioSelect;
96809
+ } else if (targetAssetType === 'all') {
96807
96810
  modal = this.builderStuff.querySelector('.is-modal.fileselect');
96808
96811
  iframe = modal.querySelector('iframe');
96809
- if(iframe.src === 'about:blank') iframe.src = this.opts.fileSelect;
96810
- }
96811
- */
96812
-
96813
- //--------
96814
- let src;
96815
- if (targetAssetType === 'media') {
96816
- modal = this.builderStuff.querySelector('.is-modal.mediaselect');
96817
- iframe = modal.querySelector('iframe');
96818
- if (iframe.src === 'about:blank') {
96819
- if (this.opts.mediaSelect) src = this.opts.mediaSelect;else if (this.opts.imageSelect) src = this.opts.imageSelect;
96820
- }
96821
- } else if (targetAssetType === 'video') {
96822
- modal = this.builderStuff.querySelector('.is-modal.videoselect');
96823
- iframe = modal.querySelector('iframe');
96824
- if (iframe.src === 'about:blank') src = this.opts.videoSelect;
96825
- } else if (targetAssetType === 'image') {
96826
- modal = this.builderStuff.querySelector('.is-modal.imageselect');
96827
- iframe = modal.querySelector('iframe');
96828
- if (iframe.src === 'about:blank') src = this.opts.imageSelect;
96829
- } else if (targetAssetType === 'audio') {
96830
- modal = this.builderStuff.querySelector('.is-modal.audioselect');
96831
- iframe = modal.querySelector('iframe');
96832
- if (iframe.src === 'about:blank') src = this.opts.audioSelect;
96833
- } else if (targetAssetType === 'all') {
96834
- modal = this.builderStuff.querySelector('.is-modal.fileselect');
96835
- iframe = modal.querySelector('iframe');
96836
- if (iframe.src === 'about:blank') src = this.opts.fileSelect;
96837
- }
96838
- let result = await fetch(src);
96839
- result = await result.text();
96840
- result = result.replace(/<script>/g, `${this.nonce ? `<script nonce="${this.nonce}">` : '<script>'}`);
96812
+ if (iframe.src === 'about:blank') src = this.opts.fileSelect;
96813
+ }
96814
+ let result = await fetch(src);
96815
+ result = await result.text();
96816
+ result = result.replace(/<script>/g, `${this.nonce ? `<script nonce="${this.nonce}">` : '<script>'}`);
96841
96817
 
96842
- // Replace assets path
96843
- result = result.replace(/="assets\//g, '="' + this.settings.assetPath);
96844
- iframe.srcdoc = result;
96845
- //--------
96818
+ // Add base href
96819
+ result = result.replace(/<head>/i, '<head><base href="' + this.opts.assetManagerBasePath + '">');
96846
96820
 
96821
+ // Replace assets path
96822
+ result = result.replace(/="assets\//g, '="' + this.opts.assetPath);
96823
+ iframe.srcdoc = result;
96824
+ } else {
96825
+ if (targetAssetType === 'media') {
96826
+ modal = this.builderStuff.querySelector('.is-modal.mediaselect');
96827
+ iframe = modal.querySelector('iframe');
96828
+ if (iframe.src === 'about:blank') {
96829
+ if (this.opts.mediaSelect) iframe.src = this.opts.mediaSelect;else if (this.opts.imageSelect) iframe.src = this.opts.imageSelect;
96830
+ }
96831
+ } else if (targetAssetType === 'video') {
96832
+ modal = this.builderStuff.querySelector('.is-modal.videoselect');
96833
+ iframe = modal.querySelector('iframe');
96834
+ if (iframe.src === 'about:blank') iframe.src = this.opts.videoSelect;
96835
+ } else if (targetAssetType === 'image') {
96836
+ modal = this.builderStuff.querySelector('.is-modal.imageselect');
96837
+ iframe = modal.querySelector('iframe');
96838
+ if (iframe.src === 'about:blank') iframe.src = this.opts.imageSelect;
96839
+ } else if (targetAssetType === 'audio') {
96840
+ modal = this.builderStuff.querySelector('.is-modal.audioselect');
96841
+ iframe = modal.querySelector('iframe');
96842
+ if (iframe.src === 'about:blank') iframe.src = this.opts.audioSelect;
96843
+ } else if (targetAssetType === 'all') {
96844
+ modal = this.builderStuff.querySelector('.is-modal.fileselect');
96845
+ iframe = modal.querySelector('iframe');
96846
+ if (iframe.src === 'about:blank') iframe.src = this.opts.fileSelect;
96847
+ }
96848
+ }
96847
96849
  this.util.showModal(modal, false, () => {
96848
96850
  theTrigger.removeAttribute('data-focus');
96849
96851
  theTrigger.focus();