@innovastudio/contentbox 1.5.73 → 1.5.75
Sign up to get free protection for your applications and to get access to all the features.
@@ -11104,7 +11104,7 @@ class EditBox {
|
|
11104
11104
|
// '</div>';
|
11105
11105
|
|
11106
11106
|
html += `
|
11107
|
-
<form class="is-cover-upload-central" data-tooltip-top title="${out('Background
|
11107
|
+
<form class="is-cover-upload-central" data-tooltip-top title="${out('Change Background')}" data-title="${out('Change Background')}" style="opacity:1;position:absolute;width:40px;height:40px;" target="target-upload-cover" method="post" action="${this.builder.coverImageHandler}" enctype="multipart/form-data" style="position:relative;width:40px;height:40px;display:inline-block;float:left;background: rgb(90, 156, 38);">
|
11108
11108
|
<input type="file" tabindex="-1" class="input-file-cover-central" name="fileCover" accept="image/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;"/>
|
11109
11109
|
<input tabindex="-1" class="input-custom-value-central" name="hidcustomval" type="hidden" value="${this.builder.customval}" />
|
11110
11110
|
</form>
|
@@ -11134,7 +11134,7 @@ class EditBox {
|
|
11134
11134
|
html += '<div style="display:flex;flex-direction: row;">' + '<div style="display:flex;flex-direction: column;margin-right:25px">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Vertical Adjustment') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Decrease') + '" class="cmd-box-content-edge-y" data-value="-" style="width:40px;">-</button>' + '<button title="' + out('Increase') + '" class="cmd-box-content-edge-y" data-value="+" style="width:40px;border-left:none;">+</button>' + '<button title="' + out('Not Set') + '" class="cmd-box-content-edge-y" data-value="" style="display:none;width:40px;border-left:none;min-width:100px;">' + out('Not Set') + '</button>' + '</div>' + '</div>' + '<div style="display:flex;flex-direction: column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Horizontal Adjustment') + ':</div>' + '<div style="display:flex">' + '<button title="' + out('Decrease') + '" class="cmd-box-content-edge-x" data-value="-" style="width:40px;">-</button>' + '<button title="' + out('Increase') + '" class="cmd-box-content-edge-x" data-value="+" style="width:40px;border-left:none;">+</button>' + '<button title="' + out('Not Set') + '" class="cmd-box-content-edge-x" data-value="" style="display:none;width:40px;border-left:none;min-width:100px;">' + out('Not Set') + '</button>' + '</div>' + '</div>' + '</div>' + '<div style="display:none;flex-direction: column;">' + '<div style="padding-top:20px;padding-bottom: 3px;">' + out('Content Spacing') + ':</div>' + '<div style="display:flex">' + '<button title="0" class="cmd-box-content-spacing on" data-value="0" style="width:40px;">0</button>' + '<button title="10" class="cmd-box-content-spacing" data-value="10" style="width:40px;border-left:none;">10</button>' + '<button title="20" class="cmd-box-content-spacing" data-value="20" style="width:40px;border-left:none;">20</button>' + '<button title="30" class="cmd-box-content-spacing" data-value="30" style="width:40px;border-left:none;">30</button>' + '<button title="40" class="cmd-box-content-spacing" data-value="40" style="width:40px;border-left:none;">40</button>' + '<button title="50" class="cmd-box-content-spacing" data-value="50" style="width:40px;border-left:none;">50</button>' + '<button title="60" class="cmd-box-content-spacing" data-value="60" style="width:40px;border-left:none;">60</button>' + '<button title="80" class="cmd-box-content-spacing" data-value="80" style="width:40px;border-left:none;">80</button>' + '<button title="' + out('Not Set') + '" class="cmd-box-content-spacing" data-value="">' + out('Not Set') + '</button>' + '</div>' + '</div>' + '<div style="padding-top:20px;padding-bottom:0;">' + out('Content Spacing') + ':</div>' + '<div style="display:flex;flex-direction: column;">' + '<div style="padding-top:10px;padding-bottom: 3px;">' + out('Top') + ':</div>' + '<div style="display:flex">' + '<button title="0" class="cmd-box-content-topspacing on" data-value="0" style="width:40px">0</button>' + '<button title="10" class="cmd-box-content-topspacing" data-value="10" style="width:40px">10</button>' + '<button title="20" class="cmd-box-content-topspacing" data-value="20" style="width:40px">20</button>' + '<button title="30" class="cmd-box-content-topspacing" data-value="30" style="width:40px">30</button>' + '<button title="40" class="cmd-box-content-topspacing" data-value="40" style="width:40px">40</button>' + '<button title="50" class="cmd-box-content-topspacing" data-value="50" style="width:40px">50</button>' + '<button title="60" class="cmd-box-content-topspacing" data-value="60" style="width:40px">60</button>' + // '<button title="80" class="cmd-box-content-topspacing" data-value="80" style="width:40px">80</button>' +
|
11135
11135
|
'<button title="' + out('Not Set') + '" class="cmd-box-content-topspacing" data-value="" style="width:40px"><svg class="is-icon-flex" style="width:10px;height:10px;"><use xlink:href="#icon-clean"></use></svg></button>' + '</div>' + '</div>' + '<div style="display:flex;flex-direction: column;">' + '<div style="padding-top:10px;padding-bottom: 3px;">' + out('Bottom') + ':</div>' + '<div style="display:flex">' + '<button title="0" class="cmd-box-content-bottomspacing on" data-value="0" style="width:40px;">0</button>' + '<button title="10" class="cmd-box-content-bottomspacing" data-value="10" style="width:40px">10</button>' + '<button title="20" class="cmd-box-content-bottomspacing" data-value="20" style="width:40px">20</button>' + '<button title="30" class="cmd-box-content-bottomspacing" data-value="30" style="width:40px">30</button>' + '<button title="40" class="cmd-box-content-bottomspacing" data-value="40" style="width:40px">40</button>' + '<button title="50" class="cmd-box-content-bottomspacing" data-value="50" style="width:40px">50</button>' + '<button title="60" class="cmd-box-content-bottomspacing" data-value="60" style="width:40px">60</button>' + // '<button title="80" class="cmd-box-content-bottomspacing" data-value="80" style="width:40px">80</button>' +
|
11136
11136
|
'<button title="' + out('Not Set') + '" class="cmd-box-content-bottomspacing" data-value="" style="width:40px"><svg class="is-icon-flex" style="width:10px;height:10px;"><use xlink:href="#icon-clean"></use></svg></button>' + '</div>' + '</div>' + '</div>';
|
11137
|
-
html += '<div id="divBoxImage" class="is-tab-content" data-group="boxsettings" style="padding-top:0">' +
|
11137
|
+
html += '<div id="divBoxImage" class="is-tab-content" data-group="boxsettings" style="padding-top:0">' + '<div style="padding-top:20px;">' + '<label for="chkAnimateBg" style="margin:0;"><input id="chkAnimateBg" type="checkbox" /> ' + out('Ken Burns Effect') + '</label>' + '</div>' +
|
11138
11138
|
/*
|
11139
11139
|
'<label for="rdoKenBurns" style="display:flex;align-items:center;margin-bottom:10px;">' +
|
11140
11140
|
'<input type="radio" id="rdoKenBurns" name="boxbganim" value="1" style="margin: 0 10px 0 5px;">' +
|
@@ -12421,13 +12421,7 @@ class EditBox {
|
|
12421
12421
|
|
12422
12422
|
this.builder.settings.onChange();
|
12423
12423
|
});
|
12424
|
-
});
|
12425
|
-
|
12426
|
-
const btnBoxSelectAsset = modalEditBox.querySelector('.cmd-box-selectasset');
|
12427
|
-
if (btnBoxSelectAsset) btnBoxSelectAsset.addEventListener('click', () => {
|
12428
|
-
this.boxSelectAsset();
|
12429
|
-
}); //end of added by jack
|
12430
|
-
|
12424
|
+
});
|
12431
12425
|
const selBoxAnimate = modalEditBox.querySelector('.cmd-box-animate');
|
12432
12426
|
selBoxAnimate.addEventListener('change', () => {
|
12433
12427
|
const activeBox = this.builder.activeBox;
|
@@ -14294,6 +14288,8 @@ class EditBox {
|
|
14294
14288
|
activeBox.classList.remove('box-active');
|
14295
14289
|
}, 1000);
|
14296
14290
|
modalEditBox.style.display = 'flex';
|
14291
|
+
document.body.classList.add('box-modal-open'); // see .box-modal-open (gives outline to div.is-container when Box Settings is opened)
|
14292
|
+
|
14297
14293
|
/*
|
14298
14294
|
// Experimental
|
14299
14295
|
modalEditBox.style.display = 'flex';
|
@@ -14992,23 +14988,7 @@ class EditBox {
|
|
14992
14988
|
}
|
14993
14989
|
|
14994
14990
|
return false;
|
14995
|
-
}
|
14996
|
-
|
14997
|
-
|
14998
|
-
boxSelectAsset() {
|
14999
|
-
let activeBox = this.builder.activeBox;
|
15000
|
-
let overlay = activeBox.querySelector('.is-overlay');
|
15001
|
-
if (!overlay) return;
|
15002
|
-
let overlayBg = overlay.querySelector('.is-overlay-bg');
|
15003
|
-
if (!overlayBg) return;
|
15004
|
-
|
15005
|
-
if (this.builder.settings.onCoverImageSelectClick) {
|
15006
|
-
this.builder.settings.onCoverImageSelectClick(overlayBg);
|
15007
|
-
}
|
15008
|
-
|
15009
|
-
return false;
|
15010
|
-
} //end of added by jack
|
15011
|
-
|
14991
|
+
}
|
15012
14992
|
|
15013
14993
|
boxImage(url, err) {
|
15014
14994
|
// Remove Waiting Indicator
|
@@ -20691,13 +20671,13 @@ class Util$1 {
|
|
20691
20671
|
localStorage.removeItem('_dictation');
|
20692
20672
|
localStorage.removeItem('_mic');
|
20693
20673
|
localStorage.removeItem('_autosendcommand');
|
20694
|
-
localStorage.removeItem('_sampleshown');
|
20695
20674
|
localStorage.removeItem('_disclaimershown');
|
20696
20675
|
localStorage.removeItem('_temp');
|
20697
20676
|
localStorage.removeItem('_top_p');
|
20698
20677
|
localStorage.removeItem('_autosend_delay');
|
20699
20678
|
localStorage.removeItem('_auto_editblock');
|
20700
20679
|
localStorage.removeItem('_command_lang');
|
20680
|
+
localStorage.removeItem('_ai_panel_open');
|
20701
20681
|
|
20702
20682
|
//NOT USED
|
20703
20683
|
localStorage.removeItem('_scrollableeditor');
|
@@ -20708,6 +20688,7 @@ class Util$1 {
|
|
20708
20688
|
localStorage.removeItem('_advancedhtmleditor');
|
20709
20689
|
localStorage.removeItem('_hidecolhtmleditor');
|
20710
20690
|
localStorage.removeItem('_hiderowhtmleditor');
|
20691
|
+
localStorage.removeItem('_sampleshown');
|
20711
20692
|
}
|
20712
20693
|
|
20713
20694
|
// source: http://stackoverflow.com/questions/6690752/insert-html-at-caret-in-a-contenteditable-div */
|
@@ -29541,9 +29522,9 @@ class HtmlUtil {
|
|
29541
29522
|
</div>
|
29542
29523
|
|
29543
29524
|
<div class="is-modal viewhtmlmonaco" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
29544
|
-
<div class="is-modal-content" style="max-width
|
29525
|
+
<div class="is-modal-content" style="width:${this.builder.blockCodeEditorWidth};max-width:${this.builder.blockCodeEditorMaxWidth};padding:0">
|
29545
29526
|
<textarea style="position:absolute;display:none;"></textarea>
|
29546
|
-
<div class="input-code-editor" style="width:100%;height
|
29527
|
+
<div class="input-code-editor" style="width:100%;height:${this.builder.blockCodeEditorHeight};"></div>
|
29547
29528
|
<div class="is-modal-footer" style="display:flex;justify-content:flex-end;border-top:1px solid ${this.builder.styleSeparatorColor};">
|
29548
29529
|
<button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
|
29549
29530
|
<button title="${util.out('Ok')}" class="input-ok classic-primary">${util.out('Ok')}</button>
|
@@ -29552,8 +29533,8 @@ class HtmlUtil {
|
|
29552
29533
|
</div>
|
29553
29534
|
|
29554
29535
|
<div class="is-modal viewhtmlexternal" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
29555
|
-
<div class="is-modal-content" style="max-width
|
29556
|
-
<div class="input-code-editor" style="width:100%;height
|
29536
|
+
<div class="is-modal-content" style="width:${this.builder.codeEditorWidth};max-width:${this.builder.codeEditorMaxWidth};padding:0">
|
29537
|
+
<div class="input-code-editor" style="width:100%;height:${this.builder.codeEditorHeight};"></div>
|
29557
29538
|
<div class="is-modal-footer" style="display:flex;justify-content:flex-end;border-top:1px solid ${this.builder.styleSeparatorColor};">
|
29558
29539
|
<button title="${util.out('Cancel')}" class="input-cancel classic-secondary">${util.out('Cancel')}</button>
|
29559
29540
|
<button title="${util.out('Ok')}" class="input-ok classic-primary">${util.out('Ok')}</button>
|
@@ -29920,6 +29901,16 @@ class HtmlUtil {
|
|
29920
29901
|
this.builder.codeEditorArea = area;
|
29921
29902
|
let codeEditor = viewhtml.querySelector('.input-code-editor');
|
29922
29903
|
codeEditor.style.opacity = '';
|
29904
|
+
let modelContent = viewhtml.querySelector('.is-modal-content');
|
29905
|
+
if (mode === 'full') {
|
29906
|
+
modelContent.style.width = this.builder.codeEditorWidth;
|
29907
|
+
modelContent.style.maxWidth = this.builder.codeEditorMaxWidth;
|
29908
|
+
codeEditor.style.height = this.builder.codeEditorHeight;
|
29909
|
+
} else {
|
29910
|
+
modelContent.style.width = this.builder.blockCodeEditorWidth;
|
29911
|
+
modelContent.style.maxWidth = this.builder.blockCodeEditorMaxWidth;
|
29912
|
+
codeEditor.style.height = this.builder.blockCodeEditorHeight;
|
29913
|
+
}
|
29923
29914
|
}
|
29924
29915
|
fromViewToActual(html) {
|
29925
29916
|
for (var key in hash$1) {
|
@@ -31023,10 +31014,6 @@ const prepareSvgIcons = builder => {
|
|
31023
31014
|
<path d="M4 12h4"></path>
|
31024
31015
|
<path d="M4 18h4"></path>
|
31025
31016
|
</symbol>
|
31026
|
-
<symbol id="icon-folder" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
31027
|
-
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
31028
|
-
<path d="M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2"></path>
|
31029
|
-
</symbol>
|
31030
31017
|
<symbol id="icon-folder-media" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
31031
31018
|
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
31032
31019
|
<path d="M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2"></path>
|
@@ -31095,6 +31082,23 @@ const prepareSvgIcons = builder => {
|
|
31095
31082
|
<path d="M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"></path>
|
31096
31083
|
<path d="M20.2 20.2l1.8 1.8"></path>
|
31097
31084
|
</symbol>
|
31085
|
+
|
31086
|
+
<symbol id="icon-folder-old" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
31087
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
31088
|
+
<path d="M5 4h4l3 3h7a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2"></path>
|
31089
|
+
</symbol>
|
31090
|
+
<symbol id="icon-folder" viewBox="0 0 24 24" stroke-width="1" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
31091
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
31092
|
+
<path d="M11 19h-6a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v2.5"></path>
|
31093
|
+
<path d="M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"></path>
|
31094
|
+
<path d="M20.2 20.2l1.8 1.8"></path>
|
31095
|
+
</symbol>
|
31096
|
+
<symbol id="icon-folder2" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
|
31097
|
+
<path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
|
31098
|
+
<path d="M11 19h-6a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v2.5"></path>
|
31099
|
+
<path d="M18 18m-3 0a3 3 0 1 0 6 0a3 3 0 1 0 -6 0"></path>
|
31100
|
+
<path d="M20.2 20.2l1.8 1.8"></path>
|
31101
|
+
</symbol>
|
31098
31102
|
|
31099
31103
|
</defs>
|
31100
31104
|
</svg>`;
|
@@ -64688,6 +64692,7 @@ class Image$1 {
|
|
64688
64692
|
<input title="${util.out('Change Image')}" data-title="${util.out('Change Image')}" id="fileEmbedImage" type="file" accept="image/*" style="position:absolute;top:-20px;left:0;width:40px;height:60px;opacity: 0;cursor: pointer;"/>
|
64689
64693
|
</div>
|
64690
64694
|
<button tabindex="0" title="${util.out('Link')}" data-title="${util.out('Link')}" class="image-link" style="width:40px;height:40px;"><svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-link"></use></svg></button>
|
64695
|
+
<button tabindex="0" title="${util.out('Select')}" data-title="${util.out('Select')}" class="open-asset" style="display:none;width:40px;height:40px;"><svg class="is-icon-flex" style="width:17px;height:17px;color:#fff"><use xlink:href="#icon-folder2"></use></svg></button>
|
64691
64696
|
<button tabindex="0" title="${util.out('Edit')}" data-title="${util.out('Edit')}" class="image-edit" style="width:40px;height:40px;"><svg class="is-icon-flex" style="width:14px;height:14px;"><use xlink:href="#ion-android-create"></use></svg></button>
|
64692
64697
|
</div>
|
64693
64698
|
<div id="divImageProgress">
|
@@ -64775,13 +64780,13 @@ class Image$1 {
|
|
64775
64780
|
</div>
|
64776
64781
|
|
64777
64782
|
<div class="is-modal imageselect" style="z-index:10005" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
64778
|
-
<div style="max-width:${this.builder.
|
64783
|
+
<div style="width:${this.builder.imageSelectWidth};max-width:${this.builder.imageSelectMaxWidth};height:${this.builder.imageSelectHeight};padding:0;">
|
64779
64784
|
<iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
|
64780
64785
|
</div>
|
64781
64786
|
</div>
|
64782
64787
|
|
64783
64788
|
<div class="is-modal mediaselect" style="z-index:10005" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
64784
|
-
<div style="max-width:${this.builder.
|
64789
|
+
<div style="width:${this.builder.mediaSelectWidth};max-width:${this.builder.mediaSelectMaxWidth};height:${this.builder.mediaSelectHeight};padding:0;">
|
64785
64790
|
<iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
|
64786
64791
|
</div>
|
64787
64792
|
</div>
|
@@ -65204,6 +65209,37 @@ class Image$1 {
|
|
65204
65209
|
util.hideModal(modalImageLink);
|
65205
65210
|
this.builder.elmTool.refresh();
|
65206
65211
|
});
|
65212
|
+
const btnOpenAsset = imageTool.querySelector('.open-asset');
|
65213
|
+
if (this.builder.opts.onImageSelectClick || this.builder.opts.imageselect) {
|
65214
|
+
btnOpenAsset.style.display = 'block';
|
65215
|
+
dom.addEventListener(btnOpenAsset, 'click', () => {
|
65216
|
+
let img = this.builder.activeImage;
|
65217
|
+
let currentSrc = img ? img.getAttribute('src') : '';
|
65218
|
+
this.builder.openImageSelect(src => {
|
65219
|
+
this.builder.uo.saveForUndo();
|
65220
|
+
let img = this.builder.activeImage;
|
65221
|
+
img.setAttribute('src', src);
|
65222
|
+
setTimeout(() => {
|
65223
|
+
img.click();
|
65224
|
+
let divImageResizer = document.querySelector('#divImageResizer');
|
65225
|
+
if (divImageResizer) divImageResizer.click();
|
65226
|
+
setTimeout(() => {
|
65227
|
+
img.click();
|
65228
|
+
let divImageResizer = document.querySelector('#divImageResizer');
|
65229
|
+
if (divImageResizer) divImageResizer.click();
|
65230
|
+
}, 600);
|
65231
|
+
}, 10);
|
65232
|
+
|
65233
|
+
//Trigger Change event
|
65234
|
+
this.builder.opts.onChange();
|
65235
|
+
|
65236
|
+
//Trigger Render event
|
65237
|
+
this.builder.opts.onRender();
|
65238
|
+
}, currentSrc);
|
65239
|
+
});
|
65240
|
+
} else {
|
65241
|
+
btnOpenAsset.style.display = 'none';
|
65242
|
+
}
|
65207
65243
|
|
65208
65244
|
// Select image (opens Asset Manager plugin or custom dialog)
|
65209
65245
|
let divImageSrc = modalImageLink.querySelector('.image-src');
|
@@ -67825,12 +67861,12 @@ class Hyperlink {
|
|
67825
67861
|
</div>
|
67826
67862
|
|
67827
67863
|
<div class="is-modal fileselect" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
67828
|
-
<div class="is-modal-content" style="max-width:${this.builder.
|
67864
|
+
<div class="is-modal-content" style="width:${this.builder.fileSelectWidth};max-width:${this.builder.fileSelectMaxWidth};height:${this.builder.fileSelectHeight};padding:0;">
|
67829
67865
|
<iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
|
67830
67866
|
</div>
|
67831
67867
|
</div>
|
67832
67868
|
<div class="is-modal otherselect" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
67833
|
-
<div class="is-modal-content" style="max-width:${this.builder.
|
67869
|
+
<div class="is-modal-content" style="width:${this.builder.otherSelectWidth};max-width:${this.builder.otherSelectMaxWidth};height:${this.builder.otherSelectHeight};padding:0;">
|
67834
67870
|
<iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
|
67835
67871
|
</div>
|
67836
67872
|
</div>
|
@@ -69943,7 +69979,7 @@ class Video {
|
|
69943
69979
|
</div>
|
69944
69980
|
|
69945
69981
|
<div class="is-modal videoselect" style="z-index:10005" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
69946
|
-
<div style="max-width:${this.builder.
|
69982
|
+
<div style="width:${this.builder.videoSelectWidth};max-width:${this.builder.videoSelectMaxWidth};height:${this.builder.videoSelectHeight};padding:0;">
|
69947
69983
|
<iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
|
69948
69984
|
</div>
|
69949
69985
|
</div>
|
@@ -70154,7 +70190,7 @@ class Audio {
|
|
70154
70190
|
</div>
|
70155
70191
|
|
70156
70192
|
<div class="is-modal audioselect" style="z-index:10005" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
70157
|
-
<div style="max-width:${this.builder.
|
70193
|
+
<div style="width:${this.builder.audioSelectWidth};max-width:${this.builder.audioSelectMaxWidth};height:${this.builder.audioSelectHeight};padding:0;">
|
70158
70194
|
<iframe tabindex="0" style="width:100%;height:100%;border: none;display: block;" src="about:blank"></iframe>
|
70159
70195
|
</div>
|
70160
70196
|
</div>
|
@@ -75206,6 +75242,8 @@ class ColumnTool {
|
|
75206
75242
|
const inpSrc = this.cellSettings.querySelector('.input-src');
|
75207
75243
|
elm = this.divCellClick.querySelector('.input-select');
|
75208
75244
|
if (elm) dom.addEventListener(elm, 'click', () => {
|
75245
|
+
//TODO: Simplify using openAsset
|
75246
|
+
|
75209
75247
|
//---default
|
75210
75248
|
this.builder.targetInput = inpSrc; // used by selectAsset() (see contentbuilder.js)
|
75211
75249
|
this.builder.targetCallback = () => {
|
@@ -92882,6 +92920,7 @@ class Dictation {
|
|
92882
92920
|
<button class="scope-section on" title="${util.out('General')}" data-value="general" style="margin-right:5px">${util.out('General')}</button>
|
92883
92921
|
<button class="scope-others" title="${util.out('Ask Questions')}" data-value="others">${util.out('Ask Questions')}</button>
|
92884
92922
|
<button class="scope-block" title="${util.out('Edit Selected Block')}" data-value="block" style="">${util.out('Edit Selected Block')}</button>
|
92923
|
+
<button class="scope-image" title="${util.out('Image')}" data-value="image" style="display:none;margin-right:5px">${util.out('Image')}</button>
|
92885
92924
|
</div>
|
92886
92925
|
</div>
|
92887
92926
|
<textarea class="inp-command"></textarea>
|
@@ -93013,15 +93052,12 @@ class Dictation {
|
|
93013
93052
|
info += '</ul>';
|
93014
93053
|
divInfo.innerHTML = info;
|
93015
93054
|
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
93016
|
-
if (localStorage.getItem('_sampleshown') === null) {
|
93017
|
-
inpCommand.setAttribute('placeholder', this.builder.commandPlaceholderText);
|
93018
|
-
localStorage.setItem('_sampleshown', true);
|
93019
|
-
}
|
93020
93055
|
this.builder.commandText = '';
|
93021
93056
|
this.builder.autoSendCommand = false;
|
93022
93057
|
if (localStorage.getItem('_dictation') !== null) {
|
93023
93058
|
if (localStorage.getItem('_dictation') === '1') {
|
93024
93059
|
this.modalCommand.classList.add('active');
|
93060
|
+
this.doOpen();
|
93025
93061
|
if (localStorage.getItem('_mic') !== null) {
|
93026
93062
|
if (localStorage.getItem('_mic') === '1') {
|
93027
93063
|
this.startDictation();
|
@@ -93122,28 +93158,34 @@ class Dictation {
|
|
93122
93158
|
btnCommandList.addEventListener('click', () => {
|
93123
93159
|
let htmlList = '';
|
93124
93160
|
const commandInfo = this.builder.commandInfo;
|
93161
|
+
let bImageGeneration = false;
|
93162
|
+
if (this.builder.textToImageUrl) {
|
93163
|
+
bImageGeneration = true;
|
93164
|
+
}
|
93125
93165
|
for (const key in commandInfo) {
|
93126
93166
|
if (Object.prototype.hasOwnProperty.call(commandInfo, key)) {
|
93127
|
-
|
93128
|
-
|
93129
|
-
|
93130
|
-
|
93131
|
-
|
93132
|
-
|
93133
|
-
|
93134
|
-
if (
|
93135
|
-
|
93136
|
-
|
93167
|
+
if (key !== 'image' || key === 'image' && bImageGeneration) {
|
93168
|
+
const {
|
93169
|
+
title,
|
93170
|
+
description,
|
93171
|
+
list,
|
93172
|
+
width
|
93173
|
+
} = commandInfo[key];
|
93174
|
+
if (!this.builder.enableShortCommands) {
|
93175
|
+
if (description) {
|
93176
|
+
htmlList += `<h2>${title}</h2>`;
|
93177
|
+
htmlList += `<p>${description}</p>`;
|
93178
|
+
} else {
|
93179
|
+
htmlList += `<h2 style="margin-bottom:30px">${title}</h2>`;
|
93180
|
+
}
|
93181
|
+
for (const item of list) {
|
93182
|
+
if (width) htmlList += `<div role="button" tabindex="0" class="command-item" style="width:${width}">${item}</div>`;else htmlList += `<div role="button" tabindex="0" class="command-item">${item}</div>`;
|
93183
|
+
}
|
93137
93184
|
} else {
|
93138
|
-
htmlList += `<h2
|
93139
|
-
|
93140
|
-
|
93141
|
-
|
93142
|
-
}
|
93143
|
-
} else {
|
93144
|
-
htmlList += `<h2>${title}</h2>`;
|
93145
|
-
for (const item of list) {
|
93146
|
-
if (width) htmlList += `<div role="button" tabindex="0" class="command-item" style="width:${width}">${item}</div>`;else htmlList += `<div role="button" tabindex="0" class="command-item">${item}</div>`;
|
93185
|
+
htmlList += `<h2>${title}</h2>`;
|
93186
|
+
for (const item of list) {
|
93187
|
+
if (width) htmlList += `<div role="button" tabindex="0" class="command-item" style="width:${width}">${item}</div>`;else htmlList += `<div role="button" tabindex="0" class="command-item">${item}</div>`;
|
93188
|
+
}
|
93147
93189
|
}
|
93148
93190
|
}
|
93149
93191
|
}
|
@@ -93253,7 +93295,10 @@ class Dictation {
|
|
93253
93295
|
const btnScopeSection = this.modalCommand.querySelector('.scope-section');
|
93254
93296
|
const btnScopeBlock = this.modalCommand.querySelector('.scope-block');
|
93255
93297
|
const btnScopeOthers = this.modalCommand.querySelector('.scope-others');
|
93298
|
+
const btnScopeImage = this.modalCommand.querySelector('.scope-image');
|
93256
93299
|
btnScopeBlock.disabled = true;
|
93300
|
+
if (this.builder.textToImageUrl) btnScopeImage.style.display = ''; // show generate image button
|
93301
|
+
|
93257
93302
|
const assistModeBtns = modalCommand.querySelectorAll('.div-assistant-mode button');
|
93258
93303
|
assistModeBtns.forEach(btn => {
|
93259
93304
|
btn.addEventListener('click', () => {
|
@@ -93262,7 +93307,21 @@ class Dictation {
|
|
93262
93307
|
});
|
93263
93308
|
btn.classList.add('on');
|
93264
93309
|
const val = btn.getAttribute('data-value');
|
93265
|
-
this.builder.assistantMode = val; // general, block, others
|
93310
|
+
this.builder.assistantMode = val; // general, block, others, image
|
93311
|
+
|
93312
|
+
if (this.builder.hidePlaceholder) {
|
93313
|
+
inpCommand.setAttribute('placeholder', '');
|
93314
|
+
} else {
|
93315
|
+
if (val === 'general') {
|
93316
|
+
inpCommand.setAttribute('placeholder', this.builder.commandPlaceholders.general || '');
|
93317
|
+
} else if (val === 'block') {
|
93318
|
+
inpCommand.setAttribute('placeholder', this.builder.commandPlaceholders.edit_block || '');
|
93319
|
+
} else if (val === 'others') {
|
93320
|
+
inpCommand.setAttribute('placeholder', this.builder.commandPlaceholders.ask_questions || '');
|
93321
|
+
} else if (val === 'image') {
|
93322
|
+
inpCommand.setAttribute('placeholder', this.builder.commandPlaceholders.generate_image || '');
|
93323
|
+
}
|
93324
|
+
}
|
93266
93325
|
|
93267
93326
|
/*
|
93268
93327
|
// ContentBox
|
@@ -93293,17 +93352,20 @@ class Dictation {
|
|
93293
93352
|
btnScopeBlock.classList.add('on');
|
93294
93353
|
btnScopeSection.classList.remove('on');
|
93295
93354
|
btnScopeOthers.classList.remove('on');
|
93355
|
+
btnScopeImage.classList.remove('on');
|
93296
93356
|
}
|
93297
93357
|
btnScopeBlock.removeAttribute('disabled');
|
93298
93358
|
} else {
|
93299
93359
|
btnScopeBlock.disabled = true;
|
93300
93360
|
if (btnScopeOthers.classList.contains('on')) return;
|
93361
|
+
if (btnScopeImage.classList.contains('on')) return;
|
93301
93362
|
|
93302
93363
|
// change
|
93303
93364
|
this.builder.assistantMode = 'general';
|
93304
93365
|
btnScopeSection.classList.add('on');
|
93305
93366
|
btnScopeBlock.classList.remove('on');
|
93306
93367
|
btnScopeOthers.classList.remove('on');
|
93368
|
+
btnScopeImage.classList.remove('on');
|
93307
93369
|
}
|
93308
93370
|
};
|
93309
93371
|
this.initialStart = false; // for Safari
|
@@ -93378,7 +93440,32 @@ class Dictation {
|
|
93378
93440
|
return true;
|
93379
93441
|
}
|
93380
93442
|
}
|
93443
|
+
doOpen() {
|
93444
|
+
this.builder.hidePlaceholder = false;
|
93445
|
+
const numeOfOpenToHidePlaceholderText = 4;
|
93446
|
+
if (localStorage.getItem('_ai_panel_open') === null) {
|
93447
|
+
localStorage.setItem('_ai_panel_open', 1);
|
93448
|
+
} else {
|
93449
|
+
let count = parseInt(localStorage.getItem('_ai_panel_open'));
|
93450
|
+
if (count < numeOfOpenToHidePlaceholderText) {
|
93451
|
+
count++;
|
93452
|
+
localStorage.setItem('_ai_panel_open', count);
|
93453
|
+
}
|
93454
|
+
}
|
93455
|
+
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
93456
|
+
if (localStorage.getItem('_ai_panel_open') === `${numeOfOpenToHidePlaceholderText}`) {
|
93457
|
+
this.builder.hidePlaceholder = true;
|
93458
|
+
inpCommand.setAttribute('placeholder', '');
|
93459
|
+
} else {
|
93460
|
+
if (!this.builder.commandPlaceholders) {
|
93461
|
+
this.builder.commandPlaceholders = {};
|
93462
|
+
this.builder.commandPlaceholders.general = '';
|
93463
|
+
}
|
93464
|
+
inpCommand.setAttribute('placeholder', this.builder.commandPlaceholders.general || '');
|
93465
|
+
}
|
93466
|
+
}
|
93381
93467
|
openDictation() {
|
93468
|
+
this.doOpen();
|
93382
93469
|
const inpCommand = this.modalCommand.querySelector('.inp-command');
|
93383
93470
|
if (this.modalCommand.classList.contains('active')) {
|
93384
93471
|
setTimeout(() => {
|
@@ -94015,18 +94102,30 @@ class ContentBuilder {
|
|
94015
94102
|
otherSelectCaption: 'Select Document',
|
94016
94103
|
// otherSelectIcon: '<svg class="is-icon-flex"><use xlink:href="#ion-ios-folder-outline"></use></svg>',
|
94017
94104
|
otherSelectIcon: '<svg class="is-icon-flex" style="width:16px;height:16px;"><use xlink:href="#icon-list-search"></use></svg>',
|
94018
|
-
imageSelectWidth: '
|
94105
|
+
imageSelectWidth: '80vw',
|
94019
94106
|
imageSelectHeight: '80vh',
|
94020
|
-
fileSelectWidth: '
|
94107
|
+
fileSelectWidth: '80vw',
|
94021
94108
|
fileSelectHeight: '80vh',
|
94022
|
-
videoSelectWidth: '
|
94109
|
+
videoSelectWidth: '80vw',
|
94023
94110
|
videoSelectHeight: '80vh',
|
94024
|
-
audioSelectWidth: '
|
94111
|
+
audioSelectWidth: '80vw',
|
94025
94112
|
audioSelectHeight: '80vh',
|
94026
|
-
mediaSelectWidth: '
|
94113
|
+
mediaSelectWidth: '80vw',
|
94027
94114
|
mediaSelectHeight: '80vh',
|
94028
|
-
otherSelectWidth: '
|
94115
|
+
otherSelectWidth: '80vw',
|
94029
94116
|
otherSelectHeight: '80vh',
|
94117
|
+
imageSelectMaxWidth: '1600px',
|
94118
|
+
fileSelectMaxWidth: '1600px',
|
94119
|
+
videoSelectMaxWidth: '1600px',
|
94120
|
+
audioSelectMaxWidth: '1600px',
|
94121
|
+
mediaSelectMaxWidth: '1600px',
|
94122
|
+
otherSelectMaxWidth: '1600px',
|
94123
|
+
codeEditorWidth: '80vw',
|
94124
|
+
codeEditorHeight: '80vh',
|
94125
|
+
codeEditorMaxWidth: '1600px',
|
94126
|
+
blockCodeEditorWidth: '80vw',
|
94127
|
+
blockCodeEditorHeight: '45vh',
|
94128
|
+
blockCodeEditorMaxWidth: '960px',
|
94030
94129
|
assetRefresh: false,
|
94031
94130
|
// asset manager specified in imageSelect, fileSelect & videoSelect will always refreshed on click/open
|
94032
94131
|
customTags: [],
|
@@ -94462,7 +94561,6 @@ class ContentBuilder {
|
|
94462
94561
|
onlineDemo: false,
|
94463
94562
|
autoSendDelay: 4000,
|
94464
94563
|
autoEditBlock: false,
|
94465
|
-
commandPlaceholderText: '',
|
94466
94564
|
enableShortCommands: true,
|
94467
94565
|
speechRecognitionLang: 'en-US',
|
94468
94566
|
assistantMode: 'general',
|
@@ -95159,6 +95257,7 @@ class ContentBuilder {
|
|
95159
95257
|
window.selectAsset = this.selectAsset.bind(this);
|
95160
95258
|
window.assetType = this.assetType.bind(this);
|
95161
95259
|
window.hideModal = this.hideModal.bind(this);
|
95260
|
+
window.generateImage = this.generateImage.bind(this);
|
95162
95261
|
setTimeout(() => {
|
95163
95262
|
// Remember UI
|
95164
95263
|
if (localStorage.getItem('_livepreview') != null) {
|
@@ -95983,6 +96082,35 @@ class ContentBuilder {
|
|
95983
96082
|
return this.targetAssetType; // not used yet
|
95984
96083
|
}
|
95985
96084
|
|
96085
|
+
openImageSelect(callback, defaultValue) {
|
96086
|
+
const inpUrl = document.createElement('input');
|
96087
|
+
|
96088
|
+
// dummy button (for the openAsset() method, for the old Asset Manager. Not needed for the new.)
|
96089
|
+
const btn = document.createElement('button');
|
96090
|
+
this.openAsset(inpUrl, 'image', btn, defaultValue);
|
96091
|
+
let out = s => this.util.out(s);
|
96092
|
+
const desc = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
|
96093
|
+
Object.defineProperty(inpUrl, 'value', {
|
96094
|
+
get: desc.get,
|
96095
|
+
set: function (s) {
|
96096
|
+
// Additional protection if normal selectAsset() is not used in asset dialog.
|
96097
|
+
// This is used if onImageSelectClick or onFileSelectClick are used.
|
96098
|
+
const filename = s.substring(s.lastIndexOf('/') + 1);
|
96099
|
+
let extension = filename.split('.').pop();
|
96100
|
+
extension = extension.toLowerCase();
|
96101
|
+
let ok = false;
|
96102
|
+
if (extension === 'jpg' || extension === 'jpeg' || extension === 'png' || extension === 'gif' || extension === 'webm' || extension === 'webp') {
|
96103
|
+
ok = true;
|
96104
|
+
} else {
|
96105
|
+
alert(out('Please select an image file.'));
|
96106
|
+
}
|
96107
|
+
if (ok) {
|
96108
|
+
if (callback) callback(s);
|
96109
|
+
}
|
96110
|
+
desc.set.call(this, s);
|
96111
|
+
}
|
96112
|
+
});
|
96113
|
+
}
|
95986
96114
|
renderSelectAsset(btn, targetAssetType, callback) {
|
95987
96115
|
const _id = 'inp_' + this.util.makeId();
|
95988
96116
|
btn.insertAdjacentHTML('afterend', `<input type="hidden" id="${_id}">`);
|
@@ -96052,7 +96180,9 @@ class ContentBuilder {
|
|
96052
96180
|
this.targetAssetType = targetAssetType;
|
96053
96181
|
}
|
96054
96182
|
}
|
96055
|
-
openAsset(targetInput, targetAssetType, theTrigger) {
|
96183
|
+
openAsset(targetInput, targetAssetType, theTrigger, defaultValue) {
|
96184
|
+
let iframe;
|
96185
|
+
let modal;
|
96056
96186
|
if (targetAssetType === 'media' && (this.opts.onMediaSelectClick || this.opts.onImageSelectClick)) {
|
96057
96187
|
if (this.opts.onMediaSelectClick) {
|
96058
96188
|
this.opts.onMediaSelectClick({
|
@@ -96086,8 +96216,6 @@ class ContentBuilder {
|
|
96086
96216
|
theTrigger: theTrigger
|
96087
96217
|
});
|
96088
96218
|
} else {
|
96089
|
-
let iframe;
|
96090
|
-
let modal;
|
96091
96219
|
if (targetAssetType === 'media') {
|
96092
96220
|
modal = this.builderStuff.querySelector('.is-modal.mediaselect');
|
96093
96221
|
iframe = modal.querySelector('iframe');
|
@@ -96116,6 +96244,23 @@ class ContentBuilder {
|
|
96116
96244
|
this.targetCallback = null;
|
96117
96245
|
this.targetAssetType = targetAssetType;
|
96118
96246
|
}
|
96247
|
+
if (!defaultValue) defaultValue = '';
|
96248
|
+
if (targetInput && targetInput.value) {
|
96249
|
+
defaultValue = targetInput.value;
|
96250
|
+
}
|
96251
|
+
if (this.onAssetOpen) {
|
96252
|
+
if (iframe) {
|
96253
|
+
if (iframe.contentWindow.document.body.innerHTML !== '') {
|
96254
|
+
this.onAssetOpen(defaultValue, iframe.contentWindow);
|
96255
|
+
} else {
|
96256
|
+
iframe.addEventListener('load', () => {
|
96257
|
+
this.onAssetOpen(defaultValue, iframe.contentWindow);
|
96258
|
+
});
|
96259
|
+
}
|
96260
|
+
} else {
|
96261
|
+
this.onAssetOpen(defaultValue, iframe);
|
96262
|
+
}
|
96263
|
+
}
|
96119
96264
|
}
|
96120
96265
|
|
96121
96266
|
// Grid
|
@@ -96952,6 +97097,151 @@ class ContentBuilder {
|
|
96952
97097
|
}
|
96953
97098
|
}
|
96954
97099
|
}
|
97100
|
+
async generateImage(prompt, callback) {
|
97101
|
+
this.controller = new AbortController(); // Create a new AbortController
|
97102
|
+
this.signal = this.controller.signal; // Get a new signal object
|
97103
|
+
|
97104
|
+
let model = 'realistic-vision-v3';
|
97105
|
+
let negative_prompt = '';
|
97106
|
+
if (model.includes('realistic-vision')) {
|
97107
|
+
if (negative_prompt === '') negative_prompt = 'duplicate, (deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime:1.4), text, close up, cropped, out of frame, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, bad_prompt_version2, bad-hands-5, badhandv4, bad anatomy, deformed, mutated, amputated, missing finger, extra finger, fused fingers, missing leg, extra leg, fused legs, missing digit, extra digit, fused digits, missing hand, extra hand, fused hands, missing arm, extra arm, fused arms, missing limb, extra limb, fused limbs, fused bodies, merged bodies, extra bodies, dual bodies, extra navel, elongated body, missing joint, extra joint, fused joints, deformed hip, twisted limbs, twisted legs, twisted arms, missing head, extra head, double head, twins, missing ear, extra ear, deformed ear, black and white, monochrome, multiple views, blurry, text, signature, head out of frame, paintings, sketches, (worst quality:2), (low quality:2), (normal quality:2), lowres, grayscale, glans, bad hands, error, extra digit, fewer digits, cropped, jpeg artifacts, watermark, username, bad feet, poorly drawn hands, poorly drawn face, mutation, too many fingers, long neck, long body, long arms, cross-eyed, mutated hands, polar lowres, bad body, bad proportions, gross proportions, cropped head , bad eyes, extra breast, missing breast, fused breasts, unnatural proportions, necklace';
|
97108
|
+
}
|
97109
|
+
let width = 1024;
|
97110
|
+
let height = 1024;
|
97111
|
+
let steps = 25;
|
97112
|
+
let guidance = 7.5;
|
97113
|
+
let scheduler = 'dpmsolver++';
|
97114
|
+
let output_format = 'jpeg';
|
97115
|
+
const messages = {
|
97116
|
+
model: 'realistic-vision-v3',
|
97117
|
+
prompt: prompt,
|
97118
|
+
negative_prompt: negative_prompt,
|
97119
|
+
width: width,
|
97120
|
+
height: height,
|
97121
|
+
steps: steps,
|
97122
|
+
guidance: guidance,
|
97123
|
+
scheduler: scheduler,
|
97124
|
+
output_format: output_format,
|
97125
|
+
folder_path: ''
|
97126
|
+
};
|
97127
|
+
try {
|
97128
|
+
let url = this.textToImageUrl;
|
97129
|
+
const response = await fetch(url, {
|
97130
|
+
signal: this.signal,
|
97131
|
+
// Abort
|
97132
|
+
method: 'POST',
|
97133
|
+
headers: {
|
97134
|
+
'Content-Type': 'application/json'
|
97135
|
+
},
|
97136
|
+
body: JSON.stringify(messages)
|
97137
|
+
});
|
97138
|
+
const result = await response.json();
|
97139
|
+
if (result.error) {
|
97140
|
+
console.log('Error:\n' + result.error);
|
97141
|
+
return;
|
97142
|
+
}
|
97143
|
+
const imageUrl = result.url;
|
97144
|
+
callback([imageUrl]);
|
97145
|
+
} catch (error) {
|
97146
|
+
if (error.name === 'AbortError') ; else {
|
97147
|
+
// CORS or code errors goes here
|
97148
|
+
console.error('Error:', error);
|
97149
|
+
// console.log('Error:\n'+error);
|
97150
|
+
|
97151
|
+
this.dictation.finish(); // Must be called after finished
|
97152
|
+
}
|
97153
|
+
}
|
97154
|
+
}
|
97155
|
+
|
97156
|
+
/* OpenAI
|
97157
|
+
// Requires:
|
97158
|
+
// generateImageUrl: '/generateimage',
|
97159
|
+
// uploadBase64Url:'/uploadbase64',
|
97160
|
+
async generateImage(prompt, num, callback) {
|
97161
|
+
if(!(this.generateImageUrl && this.uploadBase64Url)) return;
|
97162
|
+
this.controller = new AbortController(); // Create a new AbortController
|
97163
|
+
this.signal = this.controller.signal; // Get a new signal object
|
97164
|
+
const messages = { prompt, num };
|
97165
|
+
try {
|
97166
|
+
const response = await fetch(this.generateImageUrl, {
|
97167
|
+
signal: this.signal, // Abort
|
97168
|
+
method: 'POST',
|
97169
|
+
headers: {
|
97170
|
+
'Content-Type': 'application/json',
|
97171
|
+
},
|
97172
|
+
body: JSON.stringify(messages),
|
97173
|
+
});
|
97174
|
+
|
97175
|
+
const result = await response.json();
|
97176
|
+
|
97177
|
+
if(result.error) {
|
97178
|
+
console.log('Error:\n'+result.error);
|
97179
|
+
return;
|
97180
|
+
}
|
97181
|
+
|
97182
|
+
const filename = result.filename;
|
97183
|
+
|
97184
|
+
let images = [];
|
97185
|
+
|
97186
|
+
const numOfImages = result.data.data.length;
|
97187
|
+
|
97188
|
+
const imageList = result.data.data;
|
97189
|
+
imageList.forEach(item=>{
|
97190
|
+
const base64 = item.b64_json;
|
97191
|
+
const src = `data:image/jpeg;base64,${base64}`;
|
97192
|
+
|
97193
|
+
var newWidth = 1024;
|
97194
|
+
var newHeight = 1024;
|
97195
|
+
var img = new Image();
|
97196
|
+
img.src = src;
|
97197
|
+
img.onload = () => {
|
97198
|
+
|
97199
|
+
var canvas = document.createElement('canvas');
|
97200
|
+
canvas.width = newWidth;
|
97201
|
+
canvas.height = newHeight;
|
97202
|
+
|
97203
|
+
var ctx = canvas.getContext('2d');
|
97204
|
+
ctx.drawImage(img, 0, 0, newWidth, newHeight);
|
97205
|
+
var resizedBase64 = canvas.toDataURL('image/jpeg');
|
97206
|
+
|
97207
|
+
let image = resizedBase64;
|
97208
|
+
image = image.replace(/^data:image\/(png|jpeg);base64,/, '');
|
97209
|
+
|
97210
|
+
const reqBody = { image: image, filename: filename };
|
97211
|
+
fetch(this.uploadBase64Url, {
|
97212
|
+
method:'POST',
|
97213
|
+
body: JSON.stringify(reqBody),
|
97214
|
+
headers: {
|
97215
|
+
'Content-Type': 'application/json',
|
97216
|
+
}
|
97217
|
+
})
|
97218
|
+
.then(response=>response.json())
|
97219
|
+
.then(response=>{
|
97220
|
+
if(!response.error) {
|
97221
|
+
const uploadedImageUrl = response.url;
|
97222
|
+
images.push(uploadedImageUrl);
|
97223
|
+
if(images.length===numOfImages) {
|
97224
|
+
callback(images);
|
97225
|
+
}
|
97226
|
+
}
|
97227
|
+
});
|
97228
|
+
};
|
97229
|
+
|
97230
|
+
});
|
97231
|
+
} catch (error) {
|
97232
|
+
if (error.name === 'AbortError') {
|
97233
|
+
// Do Nothing
|
97234
|
+
// console.log('Request aborted by user.');
|
97235
|
+
} else {
|
97236
|
+
// CORS or code errors goes here
|
97237
|
+
console.error('Error:', error);
|
97238
|
+
// console.log('Error:\n'+error);
|
97239
|
+
this.dictation.finish(); // Must be called after finished
|
97240
|
+
}
|
97241
|
+
}
|
97242
|
+
}
|
97243
|
+
*/
|
97244
|
+
|
96955
97245
|
lightboxOpen(col) {
|
96956
97246
|
// Open Lightbox
|
96957
97247
|
if (this.useLightbox) {
|
@@ -109518,6 +109808,11 @@ class Lib {
|
|
109518
109808
|
type: 'boolean',
|
109519
109809
|
description: 'User request an information to be added to the current content.'
|
109520
109810
|
},
|
109811
|
+
// Add new Column or Block (in General Mode)
|
109812
|
+
add_column_or_block: {
|
109813
|
+
type: 'boolean',
|
109814
|
+
description: 'User requests to add a column or a block.'
|
109815
|
+
},
|
109521
109816
|
|
109522
109817
|
/*
|
109523
109818
|
To make 2 columns not mixed with 2 boxes, each has to be identified separately
|
@@ -109644,6 +109939,23 @@ class Lib {
|
|
109644
109939
|
type: 'string',
|
109645
109940
|
description: 'User requests to align the whole text/content. Possible value: left, center or right'
|
109646
109941
|
},
|
109942
|
+
// Block Mode (in General Mode)
|
109943
|
+
block_task: {
|
109944
|
+
type: 'string',
|
109945
|
+
description: 'User requests to move, duplicate, or delete block/row. Possible values: move-up, move-down, duplicate, remove'
|
109946
|
+
},
|
109947
|
+
column_task: {
|
109948
|
+
type: 'string',
|
109949
|
+
description: 'User requests to duplicate column, or delete column. Possible values: duplicate, remove'
|
109950
|
+
},
|
109951
|
+
move_column: {
|
109952
|
+
type: 'string',
|
109953
|
+
description: 'User requests to move column. Possible values: move-up, move-down, move-left, move-right'
|
109954
|
+
},
|
109955
|
+
increase_decrease_column: {
|
109956
|
+
type: 'string',
|
109957
|
+
description: 'User requests to increase/enlarge or decrease/reduce column size/width. Possible values: increase, decrease'
|
109958
|
+
},
|
109647
109959
|
move_content_left: {
|
109648
109960
|
type: 'boolean',
|
109649
109961
|
description: 'Move content to the left'
|
@@ -110939,6 +111251,19 @@ Example: To create a block with a headline and a paragraph:
|
|
110939
111251
|
</div>
|
110940
111252
|
|
110941
111253
|
`;
|
111254
|
+
} else if (numberOfIntents === 1 && (args.new_column_onright || args.new_column_onleft)) {
|
111255
|
+
// single intent => no content details
|
111256
|
+
systemCmd = 'You will be asked to create a single HTML block/column and return the HTML without any additional explanation.';
|
111257
|
+
context = `To create a column, create single 'div.column' element and add a paragraph inside it.
|
111258
|
+
|
111259
|
+
Example:
|
111260
|
+
|
111261
|
+
<div class="column">
|
111262
|
+
<p>Paragraph here.</p>
|
111263
|
+
</div>
|
111264
|
+
|
111265
|
+
`;
|
111266
|
+
question = `${question}. No talk; just do. You must return only one 'div.column'.`;
|
110942
111267
|
} else if (args.new_column_onright || args.new_column_onleft) {
|
110943
111268
|
systemCmd = 'You will be asked to create content (in HTML) and return the HTML without any additional explanation.';
|
110944
111269
|
context = `To add a column that contains a content:
|
@@ -111050,6 +111375,43 @@ ${blockContent}
|
|
111050
111375
|
});
|
111051
111376
|
};
|
111052
111377
|
|
111378
|
+
const sendImageCommand = async prompt => {
|
111379
|
+
let activeBox = this.builder.activeBox;
|
111380
|
+
|
111381
|
+
if (!activeBox) {
|
111382
|
+
this.builder.showMessage(out('Please select a box.'));
|
111383
|
+
this.dictation.finish(); // Must be called after finished
|
111384
|
+
|
111385
|
+
return;
|
111386
|
+
}
|
111387
|
+
|
111388
|
+
this.dictation.startSending(); // Shows sending status & Abort button
|
111389
|
+
|
111390
|
+
const displayImage = src => {
|
111391
|
+
this.builder.editor.saveForUndo();
|
111392
|
+
let elm = this.builder.editor.activeElement;
|
111393
|
+
|
111394
|
+
if (elm && elm.tagName) {
|
111395
|
+
const tagName = elm.tagName.toLowerCase();
|
111396
|
+
|
111397
|
+
if (tagName === 'img') {
|
111398
|
+
this.builder.editor.saveForUndo();
|
111399
|
+
elm.setAttribute('src', src); //Trigger Change event
|
111400
|
+
|
111401
|
+
this.builder.onChange();
|
111402
|
+
} else {
|
111403
|
+
this.builder.boxImage(src);
|
111404
|
+
}
|
111405
|
+
} else {
|
111406
|
+
this.builder.boxImage(src);
|
111407
|
+
}
|
111408
|
+
|
111409
|
+
this.dictation.finish();
|
111410
|
+
};
|
111411
|
+
|
111412
|
+
this.builder.editor.generateImage(prompt, displayImage);
|
111413
|
+
};
|
111414
|
+
|
111053
111415
|
const sendOtherCommand = async question => {
|
111054
111416
|
let systemCmd = '';
|
111055
111417
|
let context = 'You are a helpful assistant. You don\'t need to answer \'Sure!\' or \'Certainly\'. You will just provide direct answers without a prologue. No talk; just do.';
|
@@ -111206,6 +111568,78 @@ ${answer}
|
|
111206
111568
|
this.sendCommand('assistant', question, context, systemCmd, [], callback);
|
111207
111569
|
};
|
111208
111570
|
|
111571
|
+
const numOfIntents = args => {
|
111572
|
+
let trueCount = 0;
|
111573
|
+
|
111574
|
+
for (const key in args) {
|
111575
|
+
if (args[key] === true) {
|
111576
|
+
trueCount++;
|
111577
|
+
}
|
111578
|
+
}
|
111579
|
+
|
111580
|
+
return trueCount;
|
111581
|
+
}; // Update Column or Block (in General Mode)
|
111582
|
+
|
111583
|
+
|
111584
|
+
const sendUpdateBlockCommand = async (question, args) => {
|
111585
|
+
let block = this.builder.editor.activeCol;
|
111586
|
+
|
111587
|
+
if (!block) {
|
111588
|
+
this.builder.showMessage(out('Please select a block or content.'));
|
111589
|
+
this.dictation.finish(); // Must be called after finished
|
111590
|
+
|
111591
|
+
return;
|
111592
|
+
}
|
111593
|
+
|
111594
|
+
let blockContent = block.innerHTML;
|
111595
|
+
const systemCmd = 'You will be asked to modify content (in HTML) and return only the modified HTML without any additional explanation.'; // Update prompt
|
111596
|
+
|
111597
|
+
question = `${question}. Modify my content according to this instruction and returns the modified content HTML.
|
111598
|
+
|
111599
|
+
This is my content:
|
111600
|
+
|
111601
|
+
${blockContent}
|
111602
|
+
`; // let context = this.lib.elementContext(context, args);
|
111603
|
+
|
111604
|
+
let context = this.lib.addElementContext('', args);
|
111605
|
+
|
111606
|
+
if (this.builder.consoleLog) {
|
111607
|
+
console.log(systemCmd);
|
111608
|
+
console.log(question);
|
111609
|
+
console.log(context);
|
111610
|
+
}
|
111611
|
+
|
111612
|
+
const callback = answer => {
|
111613
|
+
if (this.builder.consoleLog) console.log(answer);
|
111614
|
+
html = this.fixHtmlBlock(answer);
|
111615
|
+
|
111616
|
+
if (!html) {
|
111617
|
+
this.dictation.finish(true);
|
111618
|
+
return false;
|
111619
|
+
}
|
111620
|
+
|
111621
|
+
this.builder.editor.saveForUndo();
|
111622
|
+
block.innerHTML = html;
|
111623
|
+
let elmActive = block.querySelector('.elm-active');
|
111624
|
+
|
111625
|
+
if (elmActive) {
|
111626
|
+
this.builder.editor.activeElement = elmActive;
|
111627
|
+
elmActive.focus();
|
111628
|
+
} // See addContent() in ContentBuilder's util.js
|
111629
|
+
|
111630
|
+
|
111631
|
+
let builderActive = this.builder.doc.querySelector('.builder-active');
|
111632
|
+
if (builderActive) this.builder.editor.applyBehaviorOn(builderActive); //Trigger Change event
|
111633
|
+
|
111634
|
+
this.builder.settings.onChange(); //Trigger Render event
|
111635
|
+
|
111636
|
+
this.builder.settings.onRender();
|
111637
|
+
this.dictation.finish();
|
111638
|
+
};
|
111639
|
+
|
111640
|
+
this.sendCommand('assistant', question, context, systemCmd, [], callback);
|
111641
|
+
};
|
111642
|
+
|
111209
111643
|
const sendGeneralCommand = async question => {
|
111210
111644
|
// Get Selected
|
111211
111645
|
let activeBox = this.builder.activeBox;
|
@@ -111242,12 +111676,37 @@ ${answer}
|
|
111242
111676
|
if (this.builder.consoleLog) console.log('write_based_on_the_current_content');
|
111243
111677
|
sendRewriteCommand(question);
|
111244
111678
|
return;
|
111245
|
-
} //
|
111679
|
+
} // const numberOfIntents = Object.keys(args).length;
|
111246
111680
|
|
111247
111681
|
|
111248
|
-
const numberOfIntents =
|
111682
|
+
const numberOfIntents = numOfIntents(args); // SIMPLE (1 or 2) INTENTS
|
111683
|
+
|
111684
|
+
const activeCol = this.builder.editor.activeCol;
|
111685
|
+
|
111686
|
+
if (activeCol) {
|
111687
|
+
// && numberOfIntents<=2) {
|
111688
|
+
// Update Column or Block (in General Mode)
|
111689
|
+
if (args.align_individual_text || args.font_size_individual_text || args.line_height_individual_text) {
|
111690
|
+
sendUpdateBlockCommand(question, args);
|
111691
|
+
return;
|
111692
|
+
} // Add new Column or Block (in General Mode)
|
111693
|
+
|
111694
|
+
|
111695
|
+
if (args.add_column_or_block) {
|
111696
|
+
sendBlockCommand(question);
|
111697
|
+
return;
|
111698
|
+
}
|
111699
|
+
} // SIMPLE/SINGLE INTENT (like Short Commands)
|
111700
|
+
|
111249
111701
|
|
111250
111702
|
if (activeBox && numberOfIntents === 1) {
|
111703
|
+
// Block Mode (in General Mode)
|
111704
|
+
let result = this.blockAction(args);
|
111705
|
+
|
111706
|
+
if (result) {
|
111707
|
+
this.dictation.finish();
|
111708
|
+
return;
|
111709
|
+
}
|
111251
111710
|
/*
|
111252
111711
|
// If single intent creates new section:
|
111253
111712
|
if(activeBox && (args.move_content_left || args.move_content_center || args.move_content_right ||
|
@@ -111268,6 +111727,8 @@ ${answer}
|
|
111268
111727
|
return;
|
111269
111728
|
}
|
111270
111729
|
*/
|
111730
|
+
|
111731
|
+
|
111271
111732
|
const moveContent = this.lib.processContent(args, activeBox);
|
111272
111733
|
|
111273
111734
|
if (moveContent) {
|
@@ -111480,7 +111941,7 @@ ${answer}
|
|
111480
111941
|
}
|
111481
111942
|
}
|
111482
111943
|
|
111483
|
-
|
111944
|
+
result = this.quickAction(args);
|
111484
111945
|
|
111485
111946
|
if (result) {
|
111486
111947
|
this.dictation.finish();
|
@@ -111830,6 +112291,11 @@ ${currentHtml}
|
|
111830
112291
|
|
111831
112292
|
if (!activeBox) {
|
111832
112293
|
this.builder.selectSection();
|
112294
|
+
}
|
112295
|
+
|
112296
|
+
if (this.builder.editor.assistantMode === 'image') {
|
112297
|
+
sendImageCommand(question);
|
112298
|
+
return;
|
111833
112299
|
} // Local Process
|
111834
112300
|
|
111835
112301
|
|
@@ -111846,7 +112312,13 @@ ${currentHtml}
|
|
111846
112312
|
};
|
111847
112313
|
|
111848
112314
|
this.dictation.opts.abort = () => {
|
111849
|
-
this.controller.abort();
|
112315
|
+
if (this.controller) this.controller.abort();
|
112316
|
+
|
112317
|
+
if (this.builder.editor.controller) {
|
112318
|
+
// Abort for image
|
112319
|
+
this.builder.editor.controller.abort();
|
112320
|
+
}
|
112321
|
+
|
111850
112322
|
this.dictation.finish(true); // Must be called after finished (true = do not clear command text)
|
111851
112323
|
};
|
111852
112324
|
}
|
@@ -113848,6 +114320,16 @@ ${currentHtml}
|
|
113848
114320
|
imgs.forEach(img => {
|
113849
114321
|
img.setAttribute('src', imageUrl);
|
113850
114322
|
});
|
114323
|
+
const cols = doc.querySelectorAll('.column');
|
114324
|
+
cols.forEach(col => {
|
114325
|
+
// Add spacer in an empty column
|
114326
|
+
if (col.innerHTML.trim() === '') {
|
114327
|
+
const spacer = document.createElement('div');
|
114328
|
+
spacer.classList.add('spacer');
|
114329
|
+
spacer.classList.add('height-40');
|
114330
|
+
col.appendChild(spacer);
|
114331
|
+
}
|
114332
|
+
});
|
113851
114333
|
return doc.documentElement.innerHTML;
|
113852
114334
|
}
|
113853
114335
|
|
@@ -114867,22 +115349,35 @@ class ContentBox {
|
|
114867
115349
|
otherSelectCaption: 'Select Document',
|
114868
115350
|
// otherSelectIcon: '<svg class="is-icon-flex"><use xlink:href="#ion-ios-folder-outline"></use></svg>',
|
114869
115351
|
otherSelectIcon: '<svg class="is-icon-flex" style="width:16px;height:16px;"><use xlink:href="#icon-list-search"></use></svg>',
|
114870
|
-
imageSelectWidth: '
|
115352
|
+
imageSelectWidth: '80vw',
|
114871
115353
|
imageSelectHeight: '80vh',
|
114872
|
-
fileSelectWidth: '
|
115354
|
+
fileSelectWidth: '80vw',
|
114873
115355
|
fileSelectHeight: '80vh',
|
114874
|
-
videoSelectWidth: '
|
115356
|
+
videoSelectWidth: '80vw',
|
114875
115357
|
videoSelectHeight: '80vh',
|
114876
|
-
audioSelectWidth: '
|
115358
|
+
audioSelectWidth: '80vw',
|
114877
115359
|
audioSelectHeight: '80vh',
|
114878
|
-
mediaSelectWidth: '
|
115360
|
+
mediaSelectWidth: '80vw',
|
114879
115361
|
mediaSelectHeight: '80vh',
|
115362
|
+
otherSelectWidth: '80vw',
|
115363
|
+
otherSelectHeight: '80vh',
|
115364
|
+
imageSelectMaxWidth: '1600px',
|
115365
|
+
fileSelectMaxWidth: '1600px',
|
115366
|
+
videoSelectMaxWidth: '1600px',
|
115367
|
+
audioSelectMaxWidth: '1600px',
|
115368
|
+
mediaSelectMaxWidth: '1600px',
|
115369
|
+
otherSelectMaxWidth: '1600px',
|
115370
|
+
codeEditorWidth: '80vw',
|
115371
|
+
codeEditorHeight: '80vh',
|
115372
|
+
codeEditorMaxWidth: '1600px',
|
115373
|
+
blockCodeEditorWidth: '80vw',
|
115374
|
+
blockCodeEditorHeight: '45vh',
|
115375
|
+
blockCodeEditorMaxWidth: '960px',
|
114880
115376
|
assetRefresh: false,
|
114881
115377
|
slider: '',
|
114882
115378
|
navbar: false,
|
114883
115379
|
onRender: function () {},
|
114884
115380
|
onChange: function () {},
|
114885
|
-
onCoverImageSelectClick: null,
|
114886
115381
|
// onImageBrowseClick: function () { },
|
114887
115382
|
// onImageSettingClick: function () { },
|
114888
115383
|
// onImageSelectClick: function () { },
|
@@ -117279,6 +117774,19 @@ class ContentBox {
|
|
117279
117774
|
AIToolbar: true,
|
117280
117775
|
sendCommandUrl: '',
|
117281
117776
|
// http://localhost:8081/answer
|
117777
|
+
|
117778
|
+
/* To enable asset manager */
|
117779
|
+
// listFilesUrl: '',
|
117780
|
+
// listFoldersUrl: '',
|
117781
|
+
// deleteFilesUrl: '',
|
117782
|
+
// moveFilesUrl: '',
|
117783
|
+
// createFolderUrl: '',
|
117784
|
+
// uploadFilesUrl: '',
|
117785
|
+
// renameFileUrl: '',
|
117786
|
+
// getMmodelsUrl: '',
|
117787
|
+
// textToImageUrl: '', // To enable AI image generation
|
117788
|
+
// upscaleImageUrl: '',
|
117789
|
+
// controlNetUrl: '',
|
117282
117790
|
speechTranscribeUrl: '',
|
117283
117791
|
// http://localhost:8081
|
117284
117792
|
autoSendDelay: 4000,
|
@@ -117292,7 +117800,12 @@ class ContentBox {
|
|
117292
117800
|
useMediaRecorder: true,
|
117293
117801
|
// do not change
|
117294
117802
|
encoderPath: '',
|
117295
|
-
|
117803
|
+
commandPlaceholders: {
|
117804
|
+
general: 'Create a section containing a short article with ideas for outdoor activities.',
|
117805
|
+
ask_questions: 'Can you explain our galaxy in a beginner-friendly and interesting way?',
|
117806
|
+
edit_block: 'Align the headline to the center',
|
117807
|
+
generate_image: 'City view from the window, sunset, realistic photo'
|
117808
|
+
},
|
117296
117809
|
disclaimerAI: `The feature you're about to use utilizes AI in some of its processes.
|
117297
117810
|
It's important to understand that AI systems have limitations.
|
117298
117811
|
There may be instances where the results are not 100% accurate or may provide unexpected responses or information.
|
@@ -117530,9 +118043,15 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
117530
118043
|
block: {
|
117531
118044
|
title: 'Edit Selected Block',
|
117532
118045
|
description: 'Specifically target the selected block for editing, providing more precise results.',
|
117533
|
-
list: ['Enhance the content by including introductory paragraphs after the title.', 'Add a space between the title and the button.', 'Increase the space between the title and the paragraph.', 'Apply a gradient text color from red to orange horizontally to the title.', 'Paraphrase the title.',
|
118046
|
+
list: ['Enhance the content by including introductory paragraphs after the title.', 'Add a space between the title and the button.', 'Increase the space between the title and the paragraph.', 'Apply a gradient text color from red to orange horizontally to the title.', // 'Paraphrase the title.',
|
118047
|
+
'Rewrite the headline with alternative ideas', 'Reduce the title font size.', // 'Align the text to the center.',
|
117534
118048
|
'Add a link on the text \'Download\' that directs to: https://example.com/download', 'Add a new block containing a Google map showing local cafes in the Perth city area.']
|
117535
118049
|
},
|
118050
|
+
image: {
|
118051
|
+
title: 'Image',
|
118052
|
+
description: 'Generate image for the selected image or background',
|
118053
|
+
list: ['A small, minimalist wood cabin, situated atop a hill, seen from a distance']
|
118054
|
+
},
|
117536
118055
|
selection: {
|
117537
118056
|
title: 'Selection & Layout',
|
117538
118057
|
list: ['Select the headline', // 'Select the paragraph',
|
@@ -117817,10 +118336,21 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
117817
118336
|
enableShortCommands: this.settings.enableShortCommands,
|
117818
118337
|
shortCommandList: this.settings.shortCommandList,
|
117819
118338
|
commandInfo: this.settings.commandInfo,
|
117820
|
-
|
118339
|
+
commandPlaceholders: this.settings.commandPlaceholders,
|
117821
118340
|
similarityThreshold: this.settings.similarityThreshold,
|
117822
118341
|
useMediaRecorder: this.settings.useMediaRecorder,
|
117823
118342
|
encoderPath: this.settings.encoderPath,
|
118343
|
+
listFilesUrl: this.settings.listFilesUrl,
|
118344
|
+
listFoldersUrl: this.settings.listFoldersUrl,
|
118345
|
+
deleteFilesUrl: this.settings.deleteFilesUrl,
|
118346
|
+
moveFilesUrl: this.settings.moveFilesUrl,
|
118347
|
+
createFolderUrl: this.settings.createFolderUrl,
|
118348
|
+
uploadFilesUrl: this.settings.uploadFilesUrl,
|
118349
|
+
renameFileUrl: this.settings.renameFileUrl,
|
118350
|
+
getMmodelsUrl: this.settings.getMmodelsUrl,
|
118351
|
+
textToImageUrl: this.settings.textToImageUrl,
|
118352
|
+
upscaleImageUrl: this.settings.upscaleImageUrl,
|
118353
|
+
controlNetUrl: this.settings.controlNetUrl,
|
117824
118354
|
container: '.is-container',
|
117825
118355
|
page: '.is-wrapper',
|
117826
118356
|
deleteConfirm: this.settings.deleteConfirm,
|
@@ -118034,6 +118564,7 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
118034
118564
|
videoSelect: this.settings.videoSelect,
|
118035
118565
|
audioSelect: this.settings.audioSelect,
|
118036
118566
|
mediaSelect: this.settings.mediaSelect,
|
118567
|
+
onAssetOpen: this.settings.onAssetOpen,
|
118037
118568
|
selectIcon: this.settings.selectIcon,
|
118038
118569
|
otherSelect: this.settings.otherSelect,
|
118039
118570
|
otherSelectCaption: this.settings.otherSelectCaption,
|
@@ -118048,6 +118579,20 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
118048
118579
|
audioSelectHeight: this.settings.audioSelectHeight,
|
118049
118580
|
mediaSelectWidth: this.settings.mediaSelectWidth,
|
118050
118581
|
mediaSelectHeight: this.settings.mediaSelectHeight,
|
118582
|
+
otherSelectWidth: this.settings.otherSelectWidth,
|
118583
|
+
otherSelectHeight: this.settings.otherSelectHeight,
|
118584
|
+
imageSelectMaxWidth: this.settings.imageSelectMaxWidth,
|
118585
|
+
fileSelectMaxWidth: this.settings.fileSelectMaxWidth,
|
118586
|
+
videoSelectMaxWidth: this.settings.videoSelectMaxWidth,
|
118587
|
+
audioSelectMaxWidth: this.settings.audioSelectMaxWidth,
|
118588
|
+
mediaSelectMaxWidth: this.settings.mediaSelectMaxWidth,
|
118589
|
+
otherSelectMaxWidth: this.settings.otherSelectMaxWidth,
|
118590
|
+
codeEditorWidth: this.settings.codeEditorWidth,
|
118591
|
+
codeEditorHeight: this.settings.codeEditorHeight,
|
118592
|
+
codeEditorMaxWidth: this.settings.codeEditorMaxWidth,
|
118593
|
+
blockCodeEditorWidth: this.settings.blockCodeEditorWidth,
|
118594
|
+
blockCodeEditorHeight: this.settings.blockCodeEditorHeight,
|
118595
|
+
blockCodeEditorMaxWidth: this.settings.blockCodeEditorMaxWidth,
|
118051
118596
|
assetRefresh: this.settings.assetRefresh,
|
118052
118597
|
onContentClick: e => {
|
118053
118598
|
if (this.settings.onContentClick) this.settings.onContentClick(e);
|
@@ -118749,6 +119294,8 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
118749
119294
|
|
118750
119295
|
if (this.timeline.modalTimeline.classList.contains('active')) this.timeline.clearSettings();
|
118751
119296
|
}
|
119297
|
+
|
119298
|
+
document.body.classList.remove('box-modal-open'); // Remove added 'box-modal-open' by Box Settings open
|
118752
119299
|
} //---
|
118753
119300
|
|
118754
119301
|
|
@@ -119124,7 +119671,7 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
119124
119671
|
boxSetup(box) {
|
119125
119672
|
let tool = box.querySelector('.is-box-tool');
|
119126
119673
|
if (tool) tool.parentNode.removeChild(tool);
|
119127
|
-
dom.appendHtml(box, '<div class="is-box-tool" data-tool="1">' + '<div role="button" class="is-cover-upload" data-tooltip-top title="' + out('Background
|
119674
|
+
dom.appendHtml(box, '<div class="is-box-tool" data-tool="1">' + '<div role="button" class="is-cover-upload" data-tooltip-top title="' + out('Change Background') + '" data-title="' + out('Change Background') + '" target="target-upload-cover" method="post" action="' + this.coverImageHandler + '" enctype="multipart/form-data" style="position:relative;width:40px;height:40px;display:inline-block;float:left;background: rgb(90, 156, 38);background:rgb(78 170 57)">' + '<div style="width:40px;height:40px;overflow:hidden;">' + '<div style="position:absolute;width:100%;height:100%;"><svg class="is-icon-flex" style="position: absolute;top: 12px;left: 12px;fill:rgb(255,255,255);"><use xlink:href="#ion-image"></use></svg></div>' + '<input type="file" tabindex="-1" class="input-file-cover" name="fileCover" accept="image/*" style="position:absolute;top:-30px;left:0;width:100%;height:80px;opacity: 0;cursor: pointer;"/>' + '</div>' + '<input tabindex="-1" class="input-custom-value" name="hidcustomval" type="hidden" value="" />' + '</div>' + '<button type="button" class="is-select-image" tabindex="-1" data-tooltip-top data-title="' + out('Select') + '" title="' + out('Select') + '" style="background:rgb(251 173 27)"><svg class="is-icon-flex" style="color:#fff;width:17px;height:17px;"><use style="color: #fff;" xlink:href="#icon-folder2"></use></svg></button>' + '<button type="button" class="is-box-edit" tabindex="-1" data-tooltip-top data-title="' + out('Box Settings') + '" title="' + out('Box Settings') + '"><svg class="is-icon-flex"><use xlink:href="#ion-wrench"></use></svg></button>' + '<button type="button" class="is-module-edit" tabindex="-1" data-tooltip-top data-title="' + out('Module Settings') + '" title="' + out('Module Settings') + '" style="background:rgb(135 116 215)"><svg class="is-icon-flex"><use xlink:href="#ion-ios-gear"></use></svg></button>' + '</div>');
|
119128
119675
|
let info = box.querySelector('.is-box-info');
|
119129
119676
|
if (info) info.parentNode.removeChild(info);
|
119130
119677
|
|
@@ -119224,6 +119771,25 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
119224
119771
|
this.editsection.close();
|
119225
119772
|
this.editbox.edit();
|
119226
119773
|
});
|
119774
|
+
const btnSelectImage = box.querySelector('.is-select-image');
|
119775
|
+
if (btnSelectImage) btnSelectImage.addEventListener('click', () => {
|
119776
|
+
this.editsection.close();
|
119777
|
+
let currentImageUrl;
|
119778
|
+
const activeBox = this.activeBox;
|
119779
|
+
let overlay = activeBox.querySelector('.is-overlay');
|
119780
|
+
const overlayBg = overlay.querySelector('.is-overlay-bg');
|
119781
|
+
if (overlayBg) if (overlayBg.style.backgroundImage) {
|
119782
|
+
if (overlayBg.style.backgroundImage.indexOf('url(') !== -1) {
|
119783
|
+
currentImageUrl = overlayBg.style.backgroundImage.slice(4, -1).replace(/["']/g, '');
|
119784
|
+
}
|
119785
|
+
}
|
119786
|
+
this.editor.openImageSelect(src => {
|
119787
|
+
this.editor.saveForUndo();
|
119788
|
+
this.boxImage(src); //Trigger Change event
|
119789
|
+
|
119790
|
+
this.onChange();
|
119791
|
+
}, currentImageUrl);
|
119792
|
+
});
|
119227
119793
|
const btnModuleEdit = box.querySelector('.is-module-edit');
|
119228
119794
|
if (btnModuleEdit) btnModuleEdit.addEventListener('click', () => {
|
119229
119795
|
this.editbox.editModule();
|
@@ -119337,17 +119903,19 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
119337
119903
|
let contentClass = contentCss.replace('.css', '');
|
119338
119904
|
let contentStylePath = this.settings.contentStylePath; //Add contentCss
|
119339
119905
|
|
119340
|
-
|
119906
|
+
if (contentCss) {
|
119907
|
+
let exist = false;
|
119341
119908
|
|
119342
|
-
|
119909
|
+
let links = window.parent._cb.doc.getElementsByTagName('link');
|
119343
119910
|
|
119344
|
-
|
119345
|
-
|
119346
|
-
|
119347
|
-
|
119911
|
+
for (let i = 0; i < links.length; i++) {
|
119912
|
+
let src = links[i].href.toLowerCase();
|
119913
|
+
if (src.indexOf(contentCss.toLowerCase()) != -1) exist = true;
|
119914
|
+
}
|
119348
119915
|
|
119349
|
-
|
119350
|
-
|
119916
|
+
if (!exist) {
|
119917
|
+
this.wrapperEl.insertAdjacentHTML('beforeend', '<link data-name="contentstyle" data-class="' + contentClass + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
|
119918
|
+
}
|
119351
119919
|
}
|
119352
119920
|
|
119353
119921
|
return newSection;
|
@@ -119899,7 +120467,7 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
119899
120467
|
newSection.classList.add('section-select');
|
119900
120468
|
this.activeSection = newSection; // Select
|
119901
120469
|
|
119902
|
-
this.positionTool(
|
120470
|
+
this.positionTool(box);
|
119903
120471
|
}
|
119904
120472
|
}
|
119905
120473
|
|
@@ -120110,6 +120678,8 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
120110
120678
|
boxTool.style.transform = 'scale(' + 1 / zoom + ')';
|
120111
120679
|
boxTool.style.transformOrigin = 'center bottom'; // boxTool.style.marginTop = (-(boxTool.offsetHeight * 1/zoom)) + 'px';
|
120112
120680
|
|
120681
|
+
box.querySelector('.is-select-image').style.display = 'none';
|
120682
|
+
|
120113
120683
|
if (boxSlider) {
|
120114
120684
|
box.querySelector('.is-cover-upload').style.display = 'none';
|
120115
120685
|
box.querySelector('.is-box-edit').style.display = 'inline-block';
|
@@ -120128,12 +120698,31 @@ Add an image for each feature.`, 'Revise the headline, paragraph, and all the te
|
|
120128
120698
|
box.querySelector('.is-module-edit').style.display = 'inline-block';
|
120129
120699
|
boxTool.style.width = '120px';
|
120130
120700
|
boxTool.style.left = 'calc(50% - 60px)';
|
120701
|
+
|
120702
|
+
if (this.onImageSelectClick || this.imageselect) {
|
120703
|
+
boxTool.style.width = '160px';
|
120704
|
+
box.querySelector('.is-select-image').style.display = 'inline-block';
|
120705
|
+
boxTool.style.left = 'calc(50% - 80px)';
|
120706
|
+
}
|
120707
|
+
|
120708
|
+
if (box.querySelector('.is-overlay-content[data-module]').getAttribute('data-module') === 'video-bg') {
|
120709
|
+
box.querySelector('.is-cover-upload').style.display = 'none';
|
120710
|
+
box.querySelector('.is-select-image').style.display = 'none';
|
120711
|
+
boxTool.style.width = '80px';
|
120712
|
+
boxTool.style.left = 'calc(50% - 40px)';
|
120713
|
+
}
|
120131
120714
|
} else {
|
120132
120715
|
box.querySelector('.is-cover-upload').style.display = 'block';
|
120133
120716
|
box.querySelector('.is-box-edit').style.display = 'inline-block';
|
120134
120717
|
box.querySelector('.is-module-edit').style.display = 'none';
|
120135
120718
|
boxTool.style.width = '80px';
|
120136
120719
|
boxTool.style.left = 'calc(50% - 40px)';
|
120720
|
+
|
120721
|
+
if (this.onImageSelectClick || this.imageselect) {
|
120722
|
+
boxTool.style.width = '120px';
|
120723
|
+
box.querySelector('.is-select-image').style.display = 'inline-block';
|
120724
|
+
boxTool.style.left = 'calc(50% - 60px)';
|
120725
|
+
}
|
120137
120726
|
}
|
120138
120727
|
} // box info
|
120139
120728
|
|