@innovastudio/contentbox 1.6.92 → 1.6.93
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +2 -2
- package/public/contentbox/contentbox.esm.js +328 -31
- package/public/contentbox/contentbox.min.js +3 -3
- package/readme.txt +1 -1
- package/public/contentbox/contentbox.js +0 -162211
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "@innovastudio/contentbox",
|
3
3
|
"type": "module",
|
4
|
-
"version": "1.6.
|
4
|
+
"version": "1.6.93",
|
5
5
|
"description": "",
|
6
6
|
"main": "public/contentbox/contentbox.esm.js",
|
7
7
|
"types": "index.d.ts",
|
@@ -54,7 +54,7 @@
|
|
54
54
|
"ws": "^8.13.0"
|
55
55
|
},
|
56
56
|
"dependencies": {
|
57
|
-
"@innovastudio/contentbuilder": "^1.5.
|
57
|
+
"@innovastudio/contentbuilder": "^1.5.81",
|
58
58
|
"js-beautify": "^1.14.0",
|
59
59
|
"sortablejs": "^1.15.2"
|
60
60
|
}
|
@@ -72811,28 +72811,33 @@ class Image$1 {
|
|
72811
72811
|
if (this.builder.moveable) this.builder.moveable.updateRect();
|
72812
72812
|
const movControlBox = document.querySelector('.moveable-control-box');
|
72813
72813
|
if (movControlBox && !this.builder.hideImageResizer) movControlBox.style.display = 'block';
|
72814
|
-
|
72815
|
-
|
72816
|
-
|
72817
|
-
|
72818
|
-
|
72819
|
-
|
72820
|
-
|
72821
|
-
|
72822
|
-
|
72823
|
-
|
72824
|
-
|
72814
|
+
|
72815
|
+
/*
|
72816
|
+
const handleImageToolClickOut = e =>{
|
72817
|
+
let elm = e.target;
|
72818
|
+
if(!elm) return;
|
72819
|
+
if(!elm.closest('#divImageResizer') && !elm.closest('#divImageTool') &&
|
72820
|
+
!elm.closest('.is-modal') && !elm.closest('.keep-selection') &&
|
72821
|
+
!elm.closest('.sl-wrapper') && !elm.closest('.sl-overlay') && !elm.closest('.sl-close') &&
|
72822
|
+
!elm.closest('img')) { // click outside
|
72823
|
+
|
72824
|
+
// hide
|
72825
|
+
this.hideImageTool();
|
72826
|
+
document.removeEventListener('click', handleImageToolClickOut);
|
72827
|
+
if(this.builder.iframeDocument) {
|
72828
|
+
this.builder.doc.removeEventListener('click', handleImageToolClickOut);
|
72829
|
+
}
|
72830
|
+
this.builder.handleImageToolClickOut_=false;
|
72825
72831
|
}
|
72826
|
-
this.builder.handleImageToolClickOut_ = false;
|
72827
|
-
}
|
72828
72832
|
};
|
72829
|
-
if
|
72830
|
-
|
72831
|
-
|
72832
|
-
|
72833
|
-
|
72834
|
-
|
72833
|
+
if(!this.builder.handleImageToolClickOut_) {
|
72834
|
+
document.addEventListener('click', handleImageToolClickOut);
|
72835
|
+
if(this.builder.iframeDocument) {
|
72836
|
+
this.builder.doc.addEventListener('click', handleImageToolClickOut);
|
72837
|
+
}
|
72838
|
+
this.builder.handleImageToolClickOut_=true;
|
72835
72839
|
}
|
72840
|
+
*/
|
72836
72841
|
} else {
|
72837
72842
|
let imageResizer = this.imageResizer;
|
72838
72843
|
imageResizer.style.display = 'none';
|
@@ -72846,6 +72851,28 @@ class Image$1 {
|
|
72846
72851
|
const movControlBox = document.querySelector('.moveable-control-box');
|
72847
72852
|
if (movControlBox) movControlBox.style.display = 'none';
|
72848
72853
|
}
|
72854
|
+
const handleImageToolClickOut = e => {
|
72855
|
+
let elm = e.target;
|
72856
|
+
if (!elm) return;
|
72857
|
+
if (!elm.closest('#divImageResizer') && !elm.closest('#divImageTool') && !elm.closest('.is-modal') && !elm.closest('.keep-selection') && !elm.closest('.sl-wrapper') && !elm.closest('.sl-overlay') && !elm.closest('.sl-close') && !elm.closest('img')) {
|
72858
|
+
// click outside
|
72859
|
+
|
72860
|
+
// hide
|
72861
|
+
this.hideImageTool();
|
72862
|
+
document.removeEventListener('click', handleImageToolClickOut);
|
72863
|
+
if (this.builder.iframeDocument) {
|
72864
|
+
this.builder.doc.removeEventListener('click', handleImageToolClickOut);
|
72865
|
+
}
|
72866
|
+
this.builder.handleImageToolClickOut_ = false;
|
72867
|
+
}
|
72868
|
+
};
|
72869
|
+
if (!this.builder.handleImageToolClickOut_) {
|
72870
|
+
document.addEventListener('click', handleImageToolClickOut);
|
72871
|
+
if (this.builder.iframeDocument) {
|
72872
|
+
this.builder.doc.addEventListener('click', handleImageToolClickOut);
|
72873
|
+
}
|
72874
|
+
this.builder.handleImageToolClickOut_ = true;
|
72875
|
+
}
|
72849
72876
|
if (this.builder.canvas) ; else {
|
72850
72877
|
let prog = false;
|
72851
72878
|
if (e.screenX && e.screenX !== 0 && e.screenY && e.screenY !== 0) ; else {
|
@@ -77771,8 +77798,8 @@ class RowTool {
|
|
77771
77798
|
const builderStuff = this.builder.builderStuff;
|
77772
77799
|
let rowtool = row.querySelector('.is-row-tool');
|
77773
77800
|
if (!rowtool) {
|
77774
|
-
let html = `<div class="is-tool is-row-tool">
|
77775
|
-
<div title="${util.out('Move')}" role="button" tabindex="-1" class="row-handle" style="width:100%;cursor:move;text-align:center;"><svg class="is-icon-flex"><use xlink:href="#ion-move"></use></svg></div>
|
77801
|
+
let html = `<div class="is-tool is-row-tool" style="${!this.builder.rowTool && this.builder.rowTool !== '' ? 'display:none;' : ''}">
|
77802
|
+
<div title="${util.out('Move')}" role="button" tabindex="-1" class="row-handle" style="${this.builder.rowHandle ? '' : 'display:none;'}width:100%;cursor:move;text-align:center;"><svg class="is-icon-flex"><use xlink:href="#ion-move"></use></svg></div>
|
77776
77803
|
<button type="button" tabindex="-1" title="${util.out('More')}" class="row-more"><svg class="is-icon-flex"><use xlink:href="#ion-more"></use></svg></button>
|
77777
77804
|
<button type="button" tabindex="-1" title="${util.out('Grid Editor')}" class="row-grideditor"><svg class="is-icon-flex"><use xlink:href="#ion-grid"></use></svg></button>
|
77778
77805
|
<button type="button" tabindex="-1" title="${util.out('Delete')}" class="row-remove"><svg class="is-icon-flex"><use xlink:href="#ion-ios-close-empty"></use></svg></button>
|
@@ -89945,6 +89972,10 @@ class ColorPicker {
|
|
89945
89972
|
const poppicker = builderStuff.querySelector('.pop-picker');
|
89946
89973
|
poppicker.style.display = 'flex';
|
89947
89974
|
poppicker.style.opacity = 0;
|
89975
|
+
if (this.opts.colors.length <= 21) poppicker.style.height = '360px'; // 3 lines
|
89976
|
+
else if (this.opts.colors.length > 21 && this.opts.colors.length <= 28) poppicker.style.height = '390px'; // 4 lines
|
89977
|
+
else if (this.opts.colors.length > 28) poppicker.style.height = '420px'; // 5 lines
|
89978
|
+
|
89948
89979
|
const pickr = Pickr.create({
|
89949
89980
|
el: '._pop-colpick',
|
89950
89981
|
theme: 'nano',
|
@@ -93833,6 +93864,10 @@ class Rte {
|
|
93833
93864
|
btnRteColor.forEach(btn => {
|
93834
93865
|
btn.addEventListener('click', () => {
|
93835
93866
|
const pop = this.rteColorPicker;
|
93867
|
+
const numOfColors = this.builder.colors.length;
|
93868
|
+
if (numOfColors > 21 && numOfColors <= 28) pop.classList.add('_4lines'); // 4 lines
|
93869
|
+
else if (numOfColors > 28) pop.classList.add('_5lines'); // 5 lines
|
93870
|
+
|
93836
93871
|
if (!dom.hasClass(pop, 'active')) {
|
93837
93872
|
this.util.showRtePop(pop, () => {
|
93838
93873
|
const top = btn.getBoundingClientRect().top;
|
@@ -108513,8 +108548,6 @@ Important: Do not change the 'div.is-container' element!
|
|
108513
108548
|
}
|
108514
108549
|
}
|
108515
108550
|
|
108516
|
-
// import RecordRTC from 'recordrtc';
|
108517
|
-
// import Recorder from 'opus-recorder'; // Using Recorder
|
108518
108551
|
const dom$i = new Dom();
|
108519
108552
|
class Dictation {
|
108520
108553
|
constructor(opts = {}, builder) {
|
@@ -108862,6 +108895,9 @@ class Dictation {
|
|
108862
108895
|
dom$i.appendHtml(builderStuff, html);
|
108863
108896
|
const modalCommand = builderStuff.querySelector('.page-command');
|
108864
108897
|
this.modalCommand = modalCommand;
|
108898
|
+
new Draggable$2({
|
108899
|
+
selector: '.is-modal.page-command .is-draggable'
|
108900
|
+
});
|
108865
108901
|
const modalCommandList = builderStuff.querySelector('.commandlist');
|
108866
108902
|
this.modalCommandList = modalCommandList;
|
108867
108903
|
const modalConfig = builderStuff.querySelector('.commandconfig');
|
@@ -115343,6 +115379,8 @@ class Editable {
|
|
115343
115379
|
this.handleEditStart = this.handleEditStart.bind(this);
|
115344
115380
|
this.handleMouseClick = this.handleMouseClick.bind(this);
|
115345
115381
|
this.handleTouchStart = this.handleTouchStart.bind(this);
|
115382
|
+
this.handleMouseDown = this.handleMouseDown.bind(this);
|
115383
|
+
this.handleMouseUp = this.handleMouseUp.bind(this);
|
115346
115384
|
this.setup();
|
115347
115385
|
}
|
115348
115386
|
setup() {
|
@@ -115351,6 +115389,7 @@ class Editable {
|
|
115351
115389
|
element.addEventListener('touchstart', this.handleTouchStart, {
|
115352
115390
|
passive: false
|
115353
115391
|
});
|
115392
|
+
element.addEventListener('mousedown', this.handleMouseDown);
|
115354
115393
|
});
|
115355
115394
|
}
|
115356
115395
|
refresh() {
|
@@ -115358,23 +115397,49 @@ class Editable {
|
|
115358
115397
|
this.elements.forEach(element => {
|
115359
115398
|
element.removeEventListener('dblclick', this.handleEditStart);
|
115360
115399
|
element.removeEventListener('touchstart', this.handleTouchStart);
|
115400
|
+
element.removeEventListener('mousedown', this.handleMouseDown);
|
115361
115401
|
});
|
115362
115402
|
this.elements.forEach(element => {
|
115363
115403
|
element.addEventListener('dblclick', this.handleEditStart);
|
115364
115404
|
element.addEventListener('touchstart', this.handleTouchStart, {
|
115365
115405
|
passive: false
|
115366
115406
|
});
|
115407
|
+
element.addEventListener('mousedown', this.handleMouseDown);
|
115367
115408
|
});
|
115368
115409
|
}
|
115410
|
+
handleMouseDown(event) {
|
115411
|
+
const currentTarget = event.currentTarget;
|
115412
|
+
this.lastClickTime = false;
|
115413
|
+
if (!currentTarget.classList.contains('active')) return;
|
115414
|
+
if (currentTarget.classList.contains('editable')) return;
|
115415
|
+
currentTarget.addEventListener('mouseup', this.handleMouseUp);
|
115416
|
+
const now = new Date().getTime();
|
115417
|
+
this.lastClickTime = now;
|
115418
|
+
}
|
115419
|
+
handleMouseUp(event) {
|
115420
|
+
if (!this.lastClickTime) return;
|
115421
|
+
const currentTarget = event.currentTarget;
|
115422
|
+
currentTarget.removeEventListener('mouseup', this.handleMouseUp);
|
115423
|
+
const now = new Date().getTime();
|
115424
|
+
const lastClickTime = this.lastClickTime || now;
|
115425
|
+
const timeDiff = now - lastClickTime;
|
115426
|
+
if (timeDiff < 300 && timeDiff > 0) {
|
115427
|
+
// Less than 300ms since the last touch, enable editing
|
115428
|
+
this.handleEditStart(event);
|
115429
|
+
}
|
115430
|
+
this.lastClickTime = now;
|
115431
|
+
}
|
115369
115432
|
destroy(element) {
|
115370
115433
|
if (element) {
|
115371
115434
|
element.removeEventListener('dblclick', this.handleEditStart);
|
115372
115435
|
element.removeEventListener('touchstart', this.handleTouchStart);
|
115436
|
+
element.removeEventListener('mousedown', this.handleMouseDown);
|
115373
115437
|
} else {
|
115374
115438
|
this.elements = this.doc.querySelectorAll(this.selector);
|
115375
115439
|
this.elements.forEach(element => {
|
115376
115440
|
element.removeEventListener('dblclick', this.handleEditStart);
|
115377
115441
|
element.removeEventListener('touchstart', this.handleTouchStart);
|
115442
|
+
element.removeEventListener('mousedown', this.handleMouseDown);
|
115378
115443
|
});
|
115379
115444
|
}
|
115380
115445
|
}
|
@@ -115687,6 +115752,8 @@ class EditableBlocks {
|
|
115687
115752
|
target.style.zIndex = newZIndex;
|
115688
115753
|
}
|
115689
115754
|
selectStart(block) {
|
115755
|
+
if (block.classList.contains('editable')) return; // do not proceed if in editing mode
|
115756
|
+
|
115690
115757
|
if (block.classList.contains('is-shape')) return; // do not clone if block is shape
|
115691
115758
|
|
115692
115759
|
if (!this.clone) return;
|
@@ -117898,6 +117965,7 @@ class ContentBuilder {
|
|
117898
117965
|
outlineMode: '',
|
117899
117966
|
toolStyle: '',
|
117900
117967
|
outlineStyle: '',
|
117968
|
+
rowHandle: true,
|
117901
117969
|
snippetAddTool: true,
|
117902
117970
|
elementTool: true,
|
117903
117971
|
elementHighlight: true,
|
@@ -120671,7 +120739,118 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
120671
120739
|
// let outlineStyle = localStorage.getItem('_outlinestyle');
|
120672
120740
|
// this.preferences.setOutlineStyle(outlineStyle);
|
120673
120741
|
// }
|
120674
|
-
if (this.preferences) this.preferences.initBuilder(builder);
|
120742
|
+
if (this.preferences) this.preferences.initBuilder(builder);else {
|
120743
|
+
const setColumnTool = hidecolumntool => {
|
120744
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120745
|
+
if (hidecolumntool) {
|
120746
|
+
Array.prototype.forEach.call(builders, builder => {
|
120747
|
+
builder.setAttribute('hidecolumntool', '');
|
120748
|
+
});
|
120749
|
+
} else {
|
120750
|
+
Array.prototype.forEach.call(builders, builder => {
|
120751
|
+
builder.removeAttribute('hidecolumntool');
|
120752
|
+
});
|
120753
|
+
}
|
120754
|
+
};
|
120755
|
+
setColumnTool(!this.columnTool);
|
120756
|
+
const setElementTool = hideelementtool => {
|
120757
|
+
const builderStuff = this.builderStuff;
|
120758
|
+
if (hideelementtool) {
|
120759
|
+
builderStuff.setAttribute('hideelementtool', '');
|
120760
|
+
} else {
|
120761
|
+
builderStuff.removeAttribute('hideelementtool', '');
|
120762
|
+
}
|
120763
|
+
if (this.iframe) {
|
120764
|
+
const contentStuff = this.contentStuff;
|
120765
|
+
if (hideelementtool) {
|
120766
|
+
contentStuff.setAttribute('hideelementtool', '');
|
120767
|
+
} else {
|
120768
|
+
contentStuff.removeAttribute('hideelementtool', '');
|
120769
|
+
}
|
120770
|
+
}
|
120771
|
+
};
|
120772
|
+
setElementTool(!this.elementTool);
|
120773
|
+
const setOutline = hideoutline => {
|
120774
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120775
|
+
Array.prototype.forEach.call(builders, builder => {
|
120776
|
+
if (hideoutline) {
|
120777
|
+
builder.setAttribute('hideoutline', '');
|
120778
|
+
} else {
|
120779
|
+
builder.removeAttribute('hideoutline');
|
120780
|
+
}
|
120781
|
+
});
|
120782
|
+
};
|
120783
|
+
setOutline(!this.rowcolOutline);
|
120784
|
+
const setOutlineStyle = outlineStyle => {
|
120785
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120786
|
+
Array.prototype.forEach.call(builders, builder => {
|
120787
|
+
if (outlineStyle === 'grayoutline') {
|
120788
|
+
builder.setAttribute('grayoutline', '');
|
120789
|
+
} else {
|
120790
|
+
builder.removeAttribute('grayoutline');
|
120791
|
+
}
|
120792
|
+
});
|
120793
|
+
};
|
120794
|
+
setOutlineStyle(this.outlineStyle);
|
120795
|
+
const setElementHighlight = hideelementhighlight => {
|
120796
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120797
|
+
Array.prototype.forEach.call(builders, builder => {
|
120798
|
+
if (hideelementhighlight) {
|
120799
|
+
builder.setAttribute('hideelementhighlight', '');
|
120800
|
+
} else {
|
120801
|
+
builder.removeAttribute('hideelementhighlight', '');
|
120802
|
+
}
|
120803
|
+
});
|
120804
|
+
};
|
120805
|
+
setElementHighlight(!this.elementHighlight);
|
120806
|
+
const setToolStyle = toolStyle => {
|
120807
|
+
const builderStuff = this.builderStuff;
|
120808
|
+
if (toolStyle === 'gray') {
|
120809
|
+
builderStuff.setAttribute('gray', '');
|
120810
|
+
} else {
|
120811
|
+
builderStuff.removeAttribute('gray', '');
|
120812
|
+
}
|
120813
|
+
if (this.iframe) {
|
120814
|
+
const contentStuff = this.contentStuff;
|
120815
|
+
if (toolStyle === 'gray') {
|
120816
|
+
contentStuff.setAttribute('gray', '');
|
120817
|
+
} else {
|
120818
|
+
contentStuff.removeAttribute('gray', '');
|
120819
|
+
}
|
120820
|
+
}
|
120821
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120822
|
+
Array.prototype.forEach.call(builders, builder => {
|
120823
|
+
if (toolStyle === 'gray') {
|
120824
|
+
builder.setAttribute('gray', '');
|
120825
|
+
} else {
|
120826
|
+
builder.removeAttribute('gray');
|
120827
|
+
}
|
120828
|
+
});
|
120829
|
+
};
|
120830
|
+
setToolStyle(this.toolStyle);
|
120831
|
+
const setSnippetAddTool = hidesnippetaddtool => {
|
120832
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120833
|
+
Array.prototype.forEach.call(builders, builder => {
|
120834
|
+
if (hidesnippetaddtool) {
|
120835
|
+
builder.setAttribute('hidesnippetaddtool', '');
|
120836
|
+
} else {
|
120837
|
+
builder.removeAttribute('hidesnippetaddtool', '');
|
120838
|
+
}
|
120839
|
+
});
|
120840
|
+
};
|
120841
|
+
setSnippetAddTool(!this.snippetAddTool);
|
120842
|
+
const setRowToolPosition = rowTool => {
|
120843
|
+
const builders = this.doc.querySelectorAll(this.opts.container);
|
120844
|
+
Array.prototype.forEach.call(builders, builder => {
|
120845
|
+
if (rowTool === 'right') {
|
120846
|
+
builder.removeAttribute('leftrowtool');
|
120847
|
+
} else {
|
120848
|
+
builder.setAttribute('leftrowtool', '');
|
120849
|
+
}
|
120850
|
+
});
|
120851
|
+
};
|
120852
|
+
setRowToolPosition(this.rowTool);
|
120853
|
+
}
|
120675
120854
|
|
120676
120855
|
// Apply behavior on each row
|
120677
120856
|
const rows = this.dom.elementChildren(builder);
|
@@ -122940,8 +123119,8 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
122940
123119
|
*/
|
122941
123120
|
src = this.viewFileUrl + '?url=' + src;
|
122942
123121
|
}
|
122943
|
-
const width =
|
122944
|
-
const height = 512;
|
123122
|
+
const width = this.ai_width; //768;
|
123123
|
+
const height = this.ai_height; //512;
|
122945
123124
|
const img = new Image();
|
122946
123125
|
img.src = src;
|
122947
123126
|
img.crossOrigin = 'anonymous';
|
@@ -122973,6 +123152,47 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
122973
123152
|
callback(result.url);
|
122974
123153
|
};
|
122975
123154
|
}
|
123155
|
+
getOrientation(width, height) {
|
123156
|
+
const aspectRatio = width / height;
|
123157
|
+
const predefinedRatios = [{
|
123158
|
+
ratio: '1:1',
|
123159
|
+
value: 1 / 1
|
123160
|
+
}, {
|
123161
|
+
ratio: '4:5',
|
123162
|
+
value: 4 / 5
|
123163
|
+
}, {
|
123164
|
+
ratio: '2:3',
|
123165
|
+
value: 2 / 3
|
123166
|
+
}, {
|
123167
|
+
ratio: '9:16',
|
123168
|
+
value: 9 / 16
|
123169
|
+
}, {
|
123170
|
+
ratio: '4:7',
|
123171
|
+
value: 4 / 7
|
123172
|
+
}, {
|
123173
|
+
ratio: '5:4',
|
123174
|
+
value: 5 / 4
|
123175
|
+
}, {
|
123176
|
+
ratio: '3:2',
|
123177
|
+
value: 3 / 2
|
123178
|
+
}, {
|
123179
|
+
ratio: '16:9',
|
123180
|
+
value: 16 / 9
|
123181
|
+
}, {
|
123182
|
+
ratio: '7:4',
|
123183
|
+
value: 7 / 4
|
123184
|
+
}];
|
123185
|
+
let closestRatio = predefinedRatios[0].ratio;
|
123186
|
+
let smallestDifference = Math.abs(aspectRatio - predefinedRatios[0].value);
|
123187
|
+
for (let i = 1; i < predefinedRatios.length; i++) {
|
123188
|
+
const difference = Math.abs(aspectRatio - predefinedRatios[i].value);
|
123189
|
+
if (difference < smallestDifference) {
|
123190
|
+
smallestDifference = difference;
|
123191
|
+
closestRatio = predefinedRatios[i].ratio;
|
123192
|
+
}
|
123193
|
+
}
|
123194
|
+
return closestRatio;
|
123195
|
+
}
|
122976
123196
|
async generateImage(prompt, callback) {
|
122977
123197
|
this.controller = new AbortController(); // Create a new AbortController
|
122978
123198
|
this.signal = this.controller.signal; // Get a new signal object
|
@@ -122982,12 +123202,82 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
122982
123202
|
let steps = this.imageSteps || 25;
|
122983
123203
|
let guidance = this.imageGuidance || 7.5;
|
122984
123204
|
let scheduler = this.imageScheduler || 'dpmsolver++';
|
123205
|
+
let width = 768;
|
123206
|
+
let height = 512;
|
123207
|
+
if (this.activeImage) {
|
123208
|
+
// check selected image dimension
|
123209
|
+
const activeImage = this.activeImage;
|
123210
|
+
const w = activeImage.offsetWidth;
|
123211
|
+
const h = activeImage.offsetHeight;
|
123212
|
+
const ratio = this.getOrientation(w, h);
|
123213
|
+
if (model === 'flux-schnell') {
|
123214
|
+
if (ratio === '1:1') {
|
123215
|
+
width = 1024;
|
123216
|
+
height = 1024;
|
123217
|
+
} else if (ratio === '4:5') {
|
123218
|
+
width = 768;
|
123219
|
+
height = 960;
|
123220
|
+
} else if (ratio === '2:3') {
|
123221
|
+
width = 768;
|
123222
|
+
height = 1152;
|
123223
|
+
} else if (ratio === '9:16') {
|
123224
|
+
width = 720;
|
123225
|
+
height = 1280;
|
123226
|
+
} else if (ratio === '4:7') {
|
123227
|
+
width = 512;
|
123228
|
+
height = 896;
|
123229
|
+
} else if (ratio === '5:4') {
|
123230
|
+
width = 960;
|
123231
|
+
height = 768;
|
123232
|
+
} else if (ratio === '3:2') {
|
123233
|
+
width = 1152;
|
123234
|
+
height = 768;
|
123235
|
+
} else if (ratio === '16:9') {
|
123236
|
+
width = 1280;
|
123237
|
+
height = 720;
|
123238
|
+
} else if (ratio === '7:4') {
|
123239
|
+
width = 896;
|
123240
|
+
height = 512;
|
123241
|
+
}
|
123242
|
+
} else {
|
123243
|
+
if (ratio === '1:1') {
|
123244
|
+
width = 512;
|
123245
|
+
height = 512;
|
123246
|
+
} else if (ratio === '4:5') {
|
123247
|
+
width = 512;
|
123248
|
+
height = 640;
|
123249
|
+
} else if (ratio === '2:3') {
|
123250
|
+
width = 512;
|
123251
|
+
height = 768;
|
123252
|
+
} else if (ratio === '9:16') {
|
123253
|
+
width = 576;
|
123254
|
+
height = 1024;
|
123255
|
+
} else if (ratio === '4:7') {
|
123256
|
+
width = 512;
|
123257
|
+
height = 896;
|
123258
|
+
} else if (ratio === '5:4') {
|
123259
|
+
width = 640;
|
123260
|
+
height = 512;
|
123261
|
+
} else if (ratio === '3:2') {
|
123262
|
+
width = 768;
|
123263
|
+
height = 512;
|
123264
|
+
} else if (ratio === '16:9') {
|
123265
|
+
width = 1024;
|
123266
|
+
height = 576;
|
123267
|
+
} else if (ratio === '7:4') {
|
123268
|
+
width = 896;
|
123269
|
+
height = 512;
|
123270
|
+
}
|
123271
|
+
}
|
123272
|
+
}
|
123273
|
+
this.ai_width = width;
|
123274
|
+
this.ai_height = height;
|
122985
123275
|
const messages = {
|
122986
123276
|
model,
|
122987
123277
|
prompt: prompt,
|
122988
123278
|
negative_prompt,
|
122989
|
-
width:
|
122990
|
-
height:
|
123279
|
+
width: this.ai_width,
|
123280
|
+
height: this.ai_height,
|
122991
123281
|
steps,
|
122992
123282
|
guidance,
|
122993
123283
|
scheduler,
|
@@ -123013,10 +123303,15 @@ Add an image for each feature.`, 'Create a new content showcasing a photo galler
|
|
123013
123303
|
return;
|
123014
123304
|
}
|
123015
123305
|
const imageUrl = result.url;
|
123016
|
-
if (this.
|
123017
|
-
|
123018
|
-
} else {
|
123306
|
+
if (this.activeImage) {
|
123307
|
+
// selectable image on content doesn't need tp be upscaled
|
123019
123308
|
callback(imageUrl);
|
123309
|
+
} else {
|
123310
|
+
if (this.imageAutoUpscale) {
|
123311
|
+
this.upscaleImage(imageUrl, callback);
|
123312
|
+
} else {
|
123313
|
+
callback(imageUrl);
|
123314
|
+
}
|
123020
123315
|
}
|
123021
123316
|
} catch (error) {
|
123022
123317
|
if (error.name === 'AbortError') ; else {
|
@@ -155041,6 +155336,7 @@ class ContentBox {
|
|
155041
155336
|
rowTool: 'right',
|
155042
155337
|
toolStyle: '',
|
155043
155338
|
outlineStyle: '',
|
155339
|
+
rowHandle: true,
|
155044
155340
|
snippetAddTool: true,
|
155045
155341
|
mobileSimpleEdit: false,
|
155046
155342
|
clearPreferences: false,
|
@@ -158597,6 +158893,7 @@ Add an image for each feature.`, 'Create a new block showcasing a photo gallery
|
|
158597
158893
|
rowTool: this.settings.rowTool,
|
158598
158894
|
toolStyle: this.settings.toolStyle,
|
158599
158895
|
outlineStyle: this.settings.outlineStyle,
|
158896
|
+
rowHandle: this.settings.rowHandle,
|
158600
158897
|
snippetAddTool: this.settings.snippetAddTool,
|
158601
158898
|
mobileSimpleEdit: this.settings.mobileSimpleEdit,
|
158602
158899
|
clearPreferences: this.settings.clearPreferences,
|