@innovastudio/contentbuilder 1.5.111 → 1.5.113
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
package/package.json
CHANGED
@@ -51183,6 +51183,12 @@ class Video {
|
|
51183
51183
|
let source = video.querySelector('source');
|
51184
51184
|
let url = '';
|
51185
51185
|
if (source) url = source.getAttribute('src');
|
51186
|
+
|
51187
|
+
// base64 handling: save the value and display "[Image Data]"
|
51188
|
+
if (url.startsWith('data:')) {
|
51189
|
+
this.builder.base64Data = url;
|
51190
|
+
url = '[Image Data]';
|
51191
|
+
}
|
51186
51192
|
videoModal.querySelector('.input-url').value = url;
|
51187
51193
|
const inpShowControls = videoModal.querySelector('.input-video-controls');
|
51188
51194
|
if (video.hasAttribute('controls')) {
|
@@ -51281,31 +51287,32 @@ class Video {
|
|
51281
51287
|
} else {
|
51282
51288
|
let modalVideoSelect = builderStuff.querySelector('.is-modal.videoselect');
|
51283
51289
|
let iframe = modalVideoSelect.querySelector('iframe');
|
51284
|
-
|
51285
|
-
|
51290
|
+
if (this.builder.opts.assetManagerBasePath) {
|
51291
|
+
let src;
|
51292
|
+
if (this.builder.opts.assetRefresh) {
|
51293
|
+
src = this.builder.opts.videoSelect;
|
51294
|
+
}
|
51295
|
+
if (iframe.src === 'about:blank') {
|
51296
|
+
src = this.builder.opts.videoSelect;
|
51297
|
+
}
|
51298
|
+
let result = await fetch(src);
|
51299
|
+
result = await result.text();
|
51300
|
+
result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
|
51301
|
+
|
51302
|
+
// Add base href
|
51303
|
+
result = result.replace(/<head>/i, '<head><base href="' + this.builder.opts.assetManagerBasePath + '">');
|
51304
|
+
|
51305
|
+
// Replace assets path
|
51306
|
+
result = result.replace(/="assets\//g, '="' + this.builder.opts.assetPath);
|
51307
|
+
iframe.srcdoc = result;
|
51308
|
+
} else {
|
51309
|
+
if (this.builder.opts.assetRefresh) {
|
51286
51310
|
iframe.src = this.builder.opts.videoSelect;
|
51287
|
-
|
51288
|
-
|
51311
|
+
}
|
51312
|
+
if (iframe.src === 'about:blank') {
|
51289
51313
|
iframe.src = this.builder.opts.videoSelect;
|
51314
|
+
}
|
51290
51315
|
}
|
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
51316
|
util.showModal(modalVideoSelect, false, () => {
|
51310
51317
|
inpSelectVideo.removeAttribute('data-focus');
|
51311
51318
|
inpSelectVideo.focus();
|
@@ -51358,6 +51365,12 @@ class Video {
|
|
51358
51365
|
}
|
51359
51366
|
if (videoModal.querySelector('.input-url').value !== '') {
|
51360
51367
|
let url = videoModal.querySelector('.input-url').value;
|
51368
|
+
|
51369
|
+
// base64 handling: Apply base64 data
|
51370
|
+
if (url === '[Image Data]') {
|
51371
|
+
url = this.builder.base64Data;
|
51372
|
+
this.builder.base64Data = '';
|
51373
|
+
}
|
51361
51374
|
let source = video.querySelector('source');
|
51362
51375
|
if (url !== source.getAttribute('src')) {
|
51363
51376
|
if (source) source.setAttribute('src', url);
|
@@ -51375,6 +51388,8 @@ class Video {
|
|
51375
51388
|
});
|
51376
51389
|
let btnCancel = videoModal.querySelector('.input-cancel');
|
51377
51390
|
dom.addEventListener(btnCancel, 'click', () => {
|
51391
|
+
// base64 handling: Clear previously saved base64 data
|
51392
|
+
this.builder.base64Data = '';
|
51378
51393
|
this.builder.hideModal(videoModal);
|
51379
51394
|
});
|
51380
51395
|
}
|
@@ -51459,6 +51474,12 @@ class Audio {
|
|
51459
51474
|
if (source) url = source.getAttribute('src');
|
51460
51475
|
this.renderPanel();
|
51461
51476
|
const audioModal = this.audioModal;
|
51477
|
+
|
51478
|
+
// base64 handling: save the value and display "[Image Data]"
|
51479
|
+
if (url.startsWith('data:')) {
|
51480
|
+
this.builder.base64Data = url;
|
51481
|
+
url = '[Image Data]';
|
51482
|
+
}
|
51462
51483
|
audioModal.querySelector('.input-url').value = url;
|
51463
51484
|
util.showModal(audioModal, true, () => {
|
51464
51485
|
btn.removeAttribute('data-focus');
|
@@ -51487,7 +51508,7 @@ class Audio {
|
|
51487
51508
|
<form class="form-upload-larger" target="frameTargetAudioUpload" method="post" action="${this.builder.opts.audioHandler}" enctype="multipart/form-data" style="position:absolute;top:0;left:0;display:flex;justify-content:center;align-items:center;width:100%;height:100%;">
|
51488
51509
|
<input id="hidRefAudio" name="hidRefId" type="hidden" value="" />
|
51489
51510
|
<svg style="width:16px;height:16px;"><use xlink:href="#icon-upload"></use></svg>
|
51490
|
-
<input title="${util.out('Select')}" id="fileAudio1" name="fileImage" type="file" accept="audio
|
51511
|
+
<input title="${util.out('Select')}" id="fileAudio1" name="fileImage" type="file" accept="audio/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;">
|
51491
51512
|
</form>
|
51492
51513
|
|
51493
51514
|
<iframe tabindex="0" id="frameTargetAudioUpload" name="frameTargetAudioUpload" tabIndex="-1" src="about:blank" style="width:1px;height:1px;position:absolute;top:0;right:-100000px"></iframe>
|
@@ -51520,31 +51541,32 @@ class Audio {
|
|
51520
51541
|
} else {
|
51521
51542
|
let modalAudioSelect = builderStuff.querySelector('.is-modal.audioselect');
|
51522
51543
|
let iframe = modalAudioSelect.querySelector('iframe');
|
51523
|
-
|
51524
|
-
|
51544
|
+
if (this.builder.opts.assetManagerBasePath) {
|
51545
|
+
let src;
|
51546
|
+
if (this.builder.opts.assetRefresh) {
|
51547
|
+
src = this.builder.opts.audioSelect;
|
51548
|
+
}
|
51549
|
+
if (iframe.src === 'about:blank') {
|
51550
|
+
src = this.builder.opts.audioSelect;
|
51551
|
+
}
|
51552
|
+
let result = await fetch(src);
|
51553
|
+
result = await result.text();
|
51554
|
+
result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
|
51555
|
+
|
51556
|
+
// Add base href
|
51557
|
+
result = result.replace(/<head>/i, '<head><base href="' + this.builder.opts.assetManagerBasePath + '">');
|
51558
|
+
|
51559
|
+
// Replace assets path
|
51560
|
+
result = result.replace(/="assets\//g, '="' + this.builder.opts.assetPath);
|
51561
|
+
iframe.srcdoc = result;
|
51562
|
+
} else {
|
51563
|
+
if (this.builder.opts.assetRefresh) {
|
51525
51564
|
iframe.src = this.builder.opts.audioSelect;
|
51526
|
-
|
51527
|
-
|
51565
|
+
}
|
51566
|
+
if (iframe.src === 'about:blank') {
|
51528
51567
|
iframe.src = this.builder.opts.audioSelect;
|
51568
|
+
}
|
51529
51569
|
}
|
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
51570
|
util.showModal(modalAudioSelect, false, () => {
|
51549
51571
|
inpSelectAudio.removeAttribute('data-focus');
|
51550
51572
|
inpSelectAudio.focus();
|
@@ -51579,6 +51601,12 @@ class Audio {
|
|
51579
51601
|
if (audioModal.querySelector('.input-url').value !== '') {
|
51580
51602
|
let url = audioModal.querySelector('.input-url').value;
|
51581
51603
|
|
51604
|
+
// base64 handling: Apply base64 data
|
51605
|
+
if (url === '[Image Data]') {
|
51606
|
+
url = this.builder.base64Data;
|
51607
|
+
this.builder.base64Data = '';
|
51608
|
+
}
|
51609
|
+
|
51582
51610
|
//Render
|
51583
51611
|
let source = audio.querySelector('source');
|
51584
51612
|
if (url !== source.getAttribute('src')) {
|
@@ -51598,6 +51626,8 @@ class Audio {
|
|
51598
51626
|
});
|
51599
51627
|
let btnCancel = audioModal.querySelector('.input-cancel');
|
51600
51628
|
dom.addEventListener(btnCancel, 'click', () => {
|
51629
|
+
// base64 handling: Clear previously saved base64 data
|
51630
|
+
this.builder.base64Data = '';
|
51601
51631
|
this.builder.hideModal(audioModal);
|
51602
51632
|
});
|
51603
51633
|
}
|
@@ -80572,66 +80602,66 @@ class MediaPicker {
|
|
80572
80602
|
} else {
|
80573
80603
|
let iframe;
|
80574
80604
|
let modal;
|
80575
|
-
|
80576
|
-
|
80605
|
+
if (this.builder.opts.assetManagerBasePath) {
|
80606
|
+
let src;
|
80607
|
+
if (targetAssetType === 'media') {
|
80577
80608
|
modal = this.builder.builderStuff.querySelector('.is-modal.mediaselect');
|
80578
80609
|
iframe = modal.querySelector('iframe');
|
80579
|
-
if(iframe.src === 'about:blank') {
|
80580
|
-
|
80581
|
-
else if(this.builder.opts.imageSelect) iframe.src = this.builder.opts.imageSelect;
|
80610
|
+
if (iframe.src === 'about:blank') {
|
80611
|
+
if (this.builder.opts.mediaSelect) src = this.builder.opts.mediaSelect;else if (this.builder.opts.imageSelect) src = this.builder.opts.imageSelect;
|
80582
80612
|
}
|
80583
|
-
|
80613
|
+
} else if (targetAssetType === 'video') {
|
80584
80614
|
modal = this.builder.builderStuff.querySelector('.is-modal.videoselect');
|
80585
80615
|
iframe = modal.querySelector('iframe');
|
80586
|
-
if(iframe.src === 'about:blank')
|
80587
|
-
|
80616
|
+
if (iframe.src === 'about:blank') src = this.builder.opts.videoSelect;
|
80617
|
+
} else if (targetAssetType === 'image') {
|
80588
80618
|
modal = this.builder.builderStuff.querySelector('.is-modal.imageselect');
|
80589
80619
|
iframe = modal.querySelector('iframe');
|
80590
|
-
if(iframe.src === 'about:blank')
|
80591
|
-
|
80620
|
+
if (iframe.src === 'about:blank') src = this.builder.opts.imageSelect;
|
80621
|
+
} else if (targetAssetType === 'audio') {
|
80592
80622
|
modal = this.builder.builderStuff.querySelector('.is-modal.audioselect');
|
80593
80623
|
iframe = modal.querySelector('iframe');
|
80594
|
-
if(iframe.src === 'about:blank')
|
80595
|
-
|
80624
|
+
if (iframe.src === 'about:blank') src = this.builder.opts.audioSelect;
|
80625
|
+
} else if (targetAssetType === 'all') {
|
80596
80626
|
modal = this.builder.builderStuff.querySelector('.is-modal.fileselect');
|
80597
80627
|
iframe = modal.querySelector('iframe');
|
80598
|
-
if(iframe.src === 'about:blank')
|
80599
|
-
|
80600
|
-
|
80628
|
+
if (iframe.src === 'about:blank') src = this.builder.opts.fileSelect;
|
80629
|
+
}
|
80630
|
+
let result = await fetch(src);
|
80631
|
+
result = await result.text();
|
80632
|
+
result = result.replace(/<script>/g, `${this.builder.nonce ? `<script nonce="${this.builder.nonce}">` : '<script>'}`);
|
80601
80633
|
|
80602
|
-
|
80603
|
-
|
80604
|
-
|
80605
|
-
|
80606
|
-
|
80607
|
-
|
80608
|
-
|
80634
|
+
// Add base href
|
80635
|
+
result = result.replace(/<head>/i, '<head><base href="' + this.builder.opts.assetManagerBasePath + '">');
|
80636
|
+
|
80637
|
+
// Replace assets path
|
80638
|
+
result = result.replace(/="assets\//g, '="' + this.builder.opts.assetPath);
|
80639
|
+
iframe.srcdoc = result;
|
80640
|
+
} else {
|
80641
|
+
if (targetAssetType === 'media') {
|
80642
|
+
modal = this.builder.builderStuff.querySelector('.is-modal.mediaselect');
|
80643
|
+
iframe = modal.querySelector('iframe');
|
80644
|
+
if (iframe.src === 'about:blank') {
|
80645
|
+
if (this.builder.opts.mediaSelect) iframe.src = this.builder.opts.mediaSelect;else if (this.builder.opts.imageSelect) iframe.src = this.builder.opts.imageSelect;
|
80646
|
+
}
|
80647
|
+
} else if (targetAssetType === 'video') {
|
80648
|
+
modal = this.builder.builderStuff.querySelector('.is-modal.videoselect');
|
80649
|
+
iframe = modal.querySelector('iframe');
|
80650
|
+
if (iframe.src === 'about:blank') iframe.src = this.builder.opts.videoSelect;
|
80651
|
+
} else if (targetAssetType === 'image') {
|
80652
|
+
modal = this.builder.builderStuff.querySelector('.is-modal.imageselect');
|
80653
|
+
iframe = modal.querySelector('iframe');
|
80654
|
+
if (iframe.src === 'about:blank') iframe.src = this.builder.opts.imageSelect;
|
80655
|
+
} else if (targetAssetType === 'audio') {
|
80656
|
+
modal = this.builder.builderStuff.querySelector('.is-modal.audioselect');
|
80657
|
+
iframe = modal.querySelector('iframe');
|
80658
|
+
if (iframe.src === 'about:blank') iframe.src = this.builder.opts.audioSelect;
|
80659
|
+
} else if (targetAssetType === 'all') {
|
80660
|
+
modal = this.builder.builderStuff.querySelector('.is-modal.fileselect');
|
80661
|
+
iframe = modal.querySelector('iframe');
|
80662
|
+
if (iframe.src === 'about:blank') iframe.src = this.builder.opts.fileSelect;
|
80609
80663
|
}
|
80610
|
-
}
|
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
|
-
//--------
|
80664
|
+
}
|
80635
80665
|
|
80636
80666
|
// this.builder.util.showModal(modal);
|
80637
80667
|
|
@@ -80762,12 +80792,20 @@ class MediaPicker {
|
|
80762
80792
|
const btnImageOk = modalMediaSelect.querySelector('.input-ok');
|
80763
80793
|
dom.addEventListener(btnImageOk, 'click', () => {
|
80764
80794
|
const inpSrc = modalMediaSelect.querySelector('.input-src');
|
80765
|
-
|
80795
|
+
let url = inpSrc.value;
|
80796
|
+
|
80797
|
+
// base64 handling: Apply base64 data
|
80798
|
+
if (url === '[Image Data]') {
|
80799
|
+
url = this.builder.base64Data;
|
80800
|
+
this.builder.base64Data = '';
|
80801
|
+
}
|
80766
80802
|
if (this.builder.mediaSelectedCallback) this.builder.mediaSelectedCallback(url);
|
80767
80803
|
this.builder.hideModal(modalMediaSelect);
|
80768
80804
|
});
|
80769
80805
|
const btnImageCancel = modalMediaSelect.querySelector('.input-cancel');
|
80770
80806
|
dom.addEventListener(btnImageCancel, 'click', () => {
|
80807
|
+
// base64 handling: Clear previously saved base64 data
|
80808
|
+
this.builder.base64Data = '';
|
80771
80809
|
this.builder.hideModal(modalMediaSelect);
|
80772
80810
|
});
|
80773
80811
|
}
|
@@ -96489,7 +96527,14 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
96489
96527
|
Array.prototype.forEach.call(forms, formUpload => {
|
96490
96528
|
if (this.dom.hasClass(formUpload, 'please-wait')) {
|
96491
96529
|
this.dom.removeClass(formUpload, 'please-wait');
|
96492
|
-
if (s)
|
96530
|
+
if (s) {
|
96531
|
+
// base64 handling: save the value and display "[Image Data]"
|
96532
|
+
if (s.startsWith('data:')) {
|
96533
|
+
this.base64Data = s;
|
96534
|
+
s = '[Image Data]';
|
96535
|
+
}
|
96536
|
+
formUpload.parentNode.parentNode.querySelector('input[type="text"]').value = s;
|
96537
|
+
}
|
96493
96538
|
formUpload.parentNode.parentNode.querySelector('input[type="file"]').value = '';
|
96494
96539
|
}
|
96495
96540
|
});
|
@@ -96530,6 +96575,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
96530
96575
|
this.selectAsset(s);
|
96531
96576
|
}
|
96532
96577
|
selectAsset(s, f) {
|
96578
|
+
if (this.opts.assetAbsoluteBasePath) s = this.opts.assetAbsoluteBasePath + s;
|
96533
96579
|
let extension = s.split('.').pop().split('?')[0].split('#')[0]; //
|
96534
96580
|
extension = extension.toLowerCase();
|
96535
96581
|
let ok = false;
|
@@ -96554,7 +96600,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
96554
96600
|
alert(this.util.out('Please select an mp4 file.'));
|
96555
96601
|
}
|
96556
96602
|
} else if (this.targetAssetType === 'audio') {
|
96557
|
-
if (extension === 'mp3') {
|
96603
|
+
if (extension === 'mp3' || extension === 'wav') {
|
96558
96604
|
ok = true;
|
96559
96605
|
} else {
|
96560
96606
|
alert(this.util.out('Please select an mp3 file.'));
|
@@ -96644,7 +96690,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
96644
96690
|
ok = true;
|
96645
96691
|
} else if (targetAssetType === 'video' && ext === 'mp4') {
|
96646
96692
|
ok = true;
|
96647
|
-
} else if (targetAssetType === 'audio' && ext === 'mp3') {
|
96693
|
+
} else if (targetAssetType === 'audio' && (ext === 'mp3' || ext === 'wav')) {
|
96648
96694
|
ok = true;
|
96649
96695
|
} else if (targetAssetType === 'media' && (s.includes('base64') || ext === 'mp4' || ext === 'jpg' || ext === 'jpeg' || ext === 'png' || ext === 'gif' || ext === 'webm' || ext === 'webp')) {
|
96650
96696
|
ok = true;
|
@@ -96708,7 +96754,7 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
96708
96754
|
alert(out('Please select an image file.'));
|
96709
96755
|
}
|
96710
96756
|
} else if (targetAssetType === 'audio') {
|
96711
|
-
if (extension === 'mp3') {
|
96757
|
+
if (extension === 'mp3' || extension === 'wav') {
|
96712
96758
|
ok = true;
|
96713
96759
|
} else {
|
96714
96760
|
alert(out('Please select an mp3 file.'));
|
@@ -96783,67 +96829,66 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
96783
96829
|
theTrigger: theTrigger
|
96784
96830
|
});
|
96785
96831
|
} else {
|
96786
|
-
|
96787
|
-
|
96832
|
+
if (this.opts.assetManagerBasePath) {
|
96833
|
+
let src;
|
96834
|
+
if (targetAssetType === 'media') {
|
96788
96835
|
modal = this.builderStuff.querySelector('.is-modal.mediaselect');
|
96789
96836
|
iframe = modal.querySelector('iframe');
|
96790
|
-
if(iframe.src === 'about:blank') {
|
96791
|
-
|
96792
|
-
else if(this.opts.imageSelect) iframe.src = this.opts.imageSelect;
|
96837
|
+
if (iframe.src === 'about:blank') {
|
96838
|
+
if (this.opts.mediaSelect) src = this.opts.mediaSelect;else if (this.opts.imageSelect) src = this.opts.imageSelect;
|
96793
96839
|
}
|
96794
|
-
|
96840
|
+
} else if (targetAssetType === 'video') {
|
96795
96841
|
modal = this.builderStuff.querySelector('.is-modal.videoselect');
|
96796
96842
|
iframe = modal.querySelector('iframe');
|
96797
|
-
if(iframe.src === 'about:blank')
|
96798
|
-
|
96843
|
+
if (iframe.src === 'about:blank') src = this.opts.videoSelect;
|
96844
|
+
} else if (targetAssetType === 'image') {
|
96799
96845
|
modal = this.builderStuff.querySelector('.is-modal.imageselect');
|
96800
96846
|
iframe = modal.querySelector('iframe');
|
96801
|
-
if(iframe.src === 'about:blank')
|
96802
|
-
|
96847
|
+
if (iframe.src === 'about:blank') src = this.opts.imageSelect;
|
96848
|
+
} else if (targetAssetType === 'audio') {
|
96803
96849
|
modal = this.builderStuff.querySelector('.is-modal.audioselect');
|
96804
96850
|
iframe = modal.querySelector('iframe');
|
96805
|
-
if(iframe.src === 'about:blank')
|
96806
|
-
|
96851
|
+
if (iframe.src === 'about:blank') src = this.opts.audioSelect;
|
96852
|
+
} else if (targetAssetType === 'all') {
|
96807
96853
|
modal = this.builderStuff.querySelector('.is-modal.fileselect');
|
96808
96854
|
iframe = modal.querySelector('iframe');
|
96809
|
-
if(iframe.src === 'about:blank')
|
96810
|
-
|
96811
|
-
|
96855
|
+
if (iframe.src === 'about:blank') src = this.opts.fileSelect;
|
96856
|
+
}
|
96857
|
+
let result = await fetch(src);
|
96858
|
+
result = await result.text();
|
96859
|
+
result = result.replace(/<script>/g, `${this.nonce ? `<script nonce="${this.nonce}">` : '<script>'}`);
|
96812
96860
|
|
96813
|
-
|
96814
|
-
|
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>'}`);
|
96841
|
-
|
96842
|
-
// Replace assets path
|
96843
|
-
result = result.replace(/="assets\//g, '="' + this.settings.assetPath);
|
96844
|
-
iframe.srcdoc = result;
|
96845
|
-
//--------
|
96861
|
+
// Add base href
|
96862
|
+
result = result.replace(/<head>/i, '<head><base href="' + this.opts.assetManagerBasePath + '">');
|
96846
96863
|
|
96864
|
+
// Replace assets path
|
96865
|
+
result = result.replace(/="assets\//g, '="' + this.opts.assetPath);
|
96866
|
+
iframe.srcdoc = result;
|
96867
|
+
} else {
|
96868
|
+
if (targetAssetType === 'media') {
|
96869
|
+
modal = this.builderStuff.querySelector('.is-modal.mediaselect');
|
96870
|
+
iframe = modal.querySelector('iframe');
|
96871
|
+
if (iframe.src === 'about:blank') {
|
96872
|
+
if (this.opts.mediaSelect) iframe.src = this.opts.mediaSelect;else if (this.opts.imageSelect) iframe.src = this.opts.imageSelect;
|
96873
|
+
}
|
96874
|
+
} else if (targetAssetType === 'video') {
|
96875
|
+
modal = this.builderStuff.querySelector('.is-modal.videoselect');
|
96876
|
+
iframe = modal.querySelector('iframe');
|
96877
|
+
if (iframe.src === 'about:blank') iframe.src = this.opts.videoSelect;
|
96878
|
+
} else if (targetAssetType === 'image') {
|
96879
|
+
modal = this.builderStuff.querySelector('.is-modal.imageselect');
|
96880
|
+
iframe = modal.querySelector('iframe');
|
96881
|
+
if (iframe.src === 'about:blank') iframe.src = this.opts.imageSelect;
|
96882
|
+
} else if (targetAssetType === 'audio') {
|
96883
|
+
modal = this.builderStuff.querySelector('.is-modal.audioselect');
|
96884
|
+
iframe = modal.querySelector('iframe');
|
96885
|
+
if (iframe.src === 'about:blank') iframe.src = this.opts.audioSelect;
|
96886
|
+
} else if (targetAssetType === 'all') {
|
96887
|
+
modal = this.builderStuff.querySelector('.is-modal.fileselect');
|
96888
|
+
iframe = modal.querySelector('iframe');
|
96889
|
+
if (iframe.src === 'about:blank') iframe.src = this.opts.fileSelect;
|
96890
|
+
}
|
96891
|
+
}
|
96847
96892
|
this.util.showModal(modal, false, () => {
|
96848
96893
|
theTrigger.removeAttribute('data-focus');
|
96849
96894
|
theTrigger.focus();
|