@innovastudio/contentbox 1.5.67 → 1.5.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -14057,10 +14057,10 @@ class EditBox {
|
|
|
14057
14057
|
<div data-glide-el="track" class="glide__track">
|
|
14058
14058
|
<ul class="glide__slides">
|
|
14059
14059
|
<li class="glide__slide">
|
|
14060
|
-
<div><img src="${imageList[0]}" alt=""></div>
|
|
14060
|
+
<div><img src="${this.builder.mediaPath + imageList[0]}" alt=""></div>
|
|
14061
14061
|
</li>
|
|
14062
14062
|
<li class="glide__slide">
|
|
14063
|
-
<div><img src="${imageList[1]}" alt=""></div>
|
|
14063
|
+
<div><img src="${this.builder.mediaPath + imageList[1]}" alt=""></div>
|
|
14064
14064
|
</li>
|
|
14065
14065
|
</ul>
|
|
14066
14066
|
</div>
|
|
@@ -14156,11 +14156,11 @@ class EditBox {
|
|
|
14156
14156
|
"images":
|
|
14157
14157
|
[
|
|
14158
14158
|
{
|
|
14159
|
-
"src": "${imageList[0]}",
|
|
14159
|
+
"src": "${this.builder.mediaPath + imageList[0]}",
|
|
14160
14160
|
"caption": "", "style": ""
|
|
14161
14161
|
},
|
|
14162
14162
|
{
|
|
14163
|
-
"src": "${imageList[1]}",
|
|
14163
|
+
"src": "${this.builder.mediaPath + imageList[1]}",
|
|
14164
14164
|
"caption": "", "style": ""
|
|
14165
14165
|
}
|
|
14166
14166
|
]
|
|
@@ -73942,6 +73942,33 @@ class ColumnTool {
|
|
|
73942
73942
|
util.clearControls();
|
|
73943
73943
|
});
|
|
73944
73944
|
|
|
73945
|
+
/*
|
|
73946
|
+
const fixLayout = (row) => {
|
|
73947
|
+
let hasFixed = false;
|
|
73948
|
+
let elm = row.firstElementChild;
|
|
73949
|
+
let cols = this.builder.cols;
|
|
73950
|
+
cols.forEach(item=>{
|
|
73951
|
+
let elmClass = elm.getAttribute('class');
|
|
73952
|
+
if(elmClass) {
|
|
73953
|
+
// console.log(elmClass, item);
|
|
73954
|
+
if(elmClass.indexOf(item)!==-1) {
|
|
73955
|
+
hasFixed=true;
|
|
73956
|
+
}
|
|
73957
|
+
}
|
|
73958
|
+
});
|
|
73959
|
+
// console.log('result:' + hasFixed);
|
|
73960
|
+
if(!hasFixed) {
|
|
73961
|
+
if(this.builder.framework==='foundation') Array.from(row.children).map((item) => {
|
|
73962
|
+
if(item.classList.contains('is-row-tool')) return;
|
|
73963
|
+
if(item.classList.contains('is-col-tool')) return;
|
|
73964
|
+
if(item.classList.contains('is-rowadd-tool')) return;
|
|
73965
|
+
item.classList.remove('column');
|
|
73966
|
+
});
|
|
73967
|
+
util.fixLayout(row);
|
|
73968
|
+
}
|
|
73969
|
+
};
|
|
73970
|
+
*/
|
|
73971
|
+
|
|
73945
73972
|
// Increase
|
|
73946
73973
|
elm = columnMore.querySelector('.cell-increase');
|
|
73947
73974
|
dom.addEventListener(elm, 'click', () => {
|
|
@@ -73969,7 +73996,10 @@ class ColumnTool {
|
|
|
73969
73996
|
});
|
|
73970
73997
|
util.fixLayout(row);
|
|
73971
73998
|
}
|
|
73999
|
+
|
|
74000
|
+
// fixLayout(row);
|
|
73972
74001
|
}
|
|
74002
|
+
|
|
73973
74003
|
this.grid.increaseColumn();
|
|
73974
74004
|
|
|
73975
74005
|
// Refresh Module
|
|
@@ -74013,7 +74043,10 @@ class ColumnTool {
|
|
|
74013
74043
|
});
|
|
74014
74044
|
util.fixLayout(row);
|
|
74015
74045
|
}
|
|
74046
|
+
|
|
74047
|
+
// fixLayout(row);
|
|
74016
74048
|
}
|
|
74049
|
+
|
|
74017
74050
|
this.grid.decreaseColumn();
|
|
74018
74051
|
|
|
74019
74052
|
// Refresh Module
|
|
@@ -92721,6 +92754,9 @@ class Dictation {
|
|
|
92721
92754
|
transform: rotate(450deg);
|
|
92722
92755
|
}
|
|
92723
92756
|
}
|
|
92757
|
+
.inp-command::placeholder {
|
|
92758
|
+
color: #aaa;
|
|
92759
|
+
}
|
|
92724
92760
|
</style>
|
|
92725
92761
|
<div class="is-overlay page-command-overlay">
|
|
92726
92762
|
<svg class="spinner" width="40px" height="40px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -93118,14 +93154,15 @@ class Dictation {
|
|
|
93118
93154
|
if (transcript && message.data.is_final) {
|
|
93119
93155
|
finalTranscripts += ' ' + transcript;
|
|
93120
93156
|
}
|
|
93157
|
+
|
|
93158
|
+
// Format
|
|
93159
|
+
finalTranscripts = finalTranscripts.charAt(0).toUpperCase() + finalTranscripts.slice(1);
|
|
93160
|
+
finalTranscripts = finalTranscripts.trim();
|
|
93121
93161
|
inpCommand.value = finalTranscripts;
|
|
93122
93162
|
clearTimeout(speechTimeout);
|
|
93123
|
-
|
|
93124
|
-
// console.log('Writing..');
|
|
93125
|
-
|
|
93163
|
+
console.log('Writing..');
|
|
93126
93164
|
speechTimeout = setTimeout(() => {
|
|
93127
|
-
|
|
93128
|
-
|
|
93165
|
+
console.log('Clear');
|
|
93129
93166
|
this.builder.commandText = '';
|
|
93130
93167
|
finalTranscripts = '';
|
|
93131
93168
|
if (this.builder.autoSendCommand) {
|
|
@@ -107116,7 +107153,6 @@ Example result:
|
|
|
107116
107153
|
`,
|
|
107117
107154
|
redesign_layout2: [`To redesign the provided section:
|
|
107118
107155
|
- Decide the best placement of each content element (title, paragraph, images, etc) and change the position based on the template below.
|
|
107119
|
-
- You must update the title class with 'leading-09 size-116 font-extrabold'.
|
|
107120
107156
|
|
|
107121
107157
|
This is the template:
|
|
107122
107158
|
|
|
@@ -107128,7 +107164,7 @@ This is the template:
|
|
|
107128
107164
|
<div class="spacer height-60"></div>
|
|
107129
107165
|
</div>
|
|
107130
107166
|
<div class="column" style="width: 60%; flex: 0 0 auto;">
|
|
107131
|
-
<h1 class="leading-09 size-116 font-extrabold">{{
|
|
107167
|
+
<h1 class="leading-09 size-116 font-extrabold">{{TITLE}}</h1>
|
|
107132
107168
|
</div>
|
|
107133
107169
|
</div>
|
|
107134
107170
|
<div class="row">
|
|
@@ -107160,8 +107196,6 @@ This is the template:
|
|
|
107160
107196
|
</div>
|
|
107161
107197
|
</div>
|
|
107162
107198
|
|
|
107163
|
-
Important: include all images from the original section in the returned result!
|
|
107164
|
-
|
|
107165
107199
|
`, `To redesign the provided section:
|
|
107166
107200
|
- Decide the best placement of each content element (title, paragraph, images, etc) and change the position based on the template below.
|
|
107167
107201
|
- You must update the title class with 'tracking-tight leading-09 size-120 font-normal'.
|
|
@@ -109725,6 +109759,19 @@ class Command {
|
|
|
109725
109759
|
}
|
|
109726
109760
|
|
|
109727
109761
|
this.builder.editor.lib.updateBackgroundImage(activeBox, chosenImage);
|
|
109762
|
+
|
|
109763
|
+
if (activeBox.classList.contains('is-section')) {
|
|
109764
|
+
const overlay = activeBox.querySelector('div.is-overlay');
|
|
109765
|
+
|
|
109766
|
+
if (overlay && overlay.querySelector('.is-overlay-bg')) {
|
|
109767
|
+
let box = overlay.closest('.is-box');
|
|
109768
|
+
if (box) if (box.querySelector('.is-container')) {
|
|
109769
|
+
box.classList.add('m-overlay-stack');
|
|
109770
|
+
box.classList.add('m-dark-text');
|
|
109771
|
+
}
|
|
109772
|
+
}
|
|
109773
|
+
}
|
|
109774
|
+
|
|
109728
109775
|
this.builder.settings.onChange();
|
|
109729
109776
|
this.dictation.finish();
|
|
109730
109777
|
return false;
|
|
@@ -109958,11 +110005,7 @@ class Command {
|
|
|
109958
110005
|
question = `Add a new section containing your response on this user request: ${question}`;
|
|
109959
110006
|
} else if (args.new_section || args.new_section_two_boxes || args.new_section_three_boxes || args.new_section_four_boxes) {
|
|
109960
110007
|
if (args.new_section === 'new-section' || args.new_section === 'new-section-2-columns' || args.new_section === 'new-section-3-columns' || args.new_section === 'new-section-3-columns' || args.new_section === 'new-section-4-columns') {
|
|
109961
|
-
if (args.
|
|
109962
|
-
context = this.chooseContext(cl.new_section);
|
|
109963
|
-
} else if ((args.add_headline || args.add_paragraph) && args.add_image === 'image') {
|
|
109964
|
-
context = cl.new_section_with_image;
|
|
109965
|
-
} else if (args.add_image === 'gallery') {
|
|
110008
|
+
if (args.add_image === 'gallery') {
|
|
109966
110009
|
context = cl.new_section_with_gallery;
|
|
109967
110010
|
} else if (args.add_list_with_image) {
|
|
109968
110011
|
context = cl.new_section_with_list_images;
|
|
@@ -109976,6 +110019,10 @@ class Command {
|
|
|
109976
110019
|
context = this.chooseContext(cl.new_section_article_with_image);
|
|
109977
110020
|
} else if (args.add_article) {
|
|
109978
110021
|
context = this.chooseContext(cl.new_section_article);
|
|
110022
|
+
} else if (args.section_background && args.section_background === 'image') {
|
|
110023
|
+
context = this.chooseContext(cl.new_section);
|
|
110024
|
+
} else if ((args.add_headline || args.add_paragraph) && args.add_image === 'image') {
|
|
110025
|
+
context = cl.new_section_with_image;
|
|
109979
110026
|
} else {
|
|
109980
110027
|
context = cl.new_section_others;
|
|
109981
110028
|
}
|
|
@@ -110170,6 +110217,11 @@ ${currentHtml}
|
|
|
110170
110217
|
|
|
110171
110218
|
if (args.section_background && args.section_background === 'video') {
|
|
110172
110219
|
html = this.setBgVideo(html);
|
|
110220
|
+
} // Apply bg stack
|
|
110221
|
+
|
|
110222
|
+
|
|
110223
|
+
if (args.section_background && args.section_background === 'image') {
|
|
110224
|
+
html = this.applyBgStack(html);
|
|
110173
110225
|
} // Render
|
|
110174
110226
|
|
|
110175
110227
|
|
|
@@ -110190,8 +110242,10 @@ ${currentHtml}
|
|
|
110190
110242
|
|
|
110191
110243
|
if (args.section_background && args.section_background === 'video') {
|
|
110192
110244
|
html = this.setBgVideo(html);
|
|
110193
|
-
} //
|
|
110245
|
+
} // Apply bg stack
|
|
110246
|
+
|
|
110194
110247
|
|
|
110248
|
+
html = this.applyBgStack(html); // Render
|
|
110195
110249
|
|
|
110196
110250
|
this.renderResult_NewSection(html);
|
|
110197
110251
|
}
|
|
@@ -110432,7 +110486,9 @@ ${currentHtml}`;
|
|
|
110432
110486
|
} else {
|
|
110433
110487
|
context = this.chooseContext(cl.change_layout_of_box, val);
|
|
110434
110488
|
}
|
|
110435
|
-
}
|
|
110489
|
+
} // Experiment
|
|
110490
|
+
// context = cl.redesign_layout2[0];
|
|
110491
|
+
|
|
110436
110492
|
|
|
110437
110493
|
if (useSavedSection) {
|
|
110438
110494
|
let con = this.lib.getPreviousSectionStyleContext();
|
|
@@ -110442,7 +110498,15 @@ ${currentHtml}`;
|
|
|
110442
110498
|
} else {
|
|
110443
110499
|
context = con.boxContext;
|
|
110444
110500
|
}
|
|
110445
|
-
}
|
|
110501
|
+
} // get content width
|
|
110502
|
+
// let contentWidth = '';
|
|
110503
|
+
// const container = activeBox.querySelector('.is-container');
|
|
110504
|
+
// if(container) container.classList.forEach(item=>{
|
|
110505
|
+
// if(item.indexOf('is-content-')!==-1 && item !=='is-content-left' && item !== 'is-content-right') {
|
|
110506
|
+
// contentWidth=item;
|
|
110507
|
+
// }
|
|
110508
|
+
// });
|
|
110509
|
+
|
|
110446
110510
|
|
|
110447
110511
|
if (this.builder.consoleLog) console.log(context); // get typo class.
|
|
110448
110512
|
|
|
@@ -110477,7 +110541,9 @@ ${currentHtml}`;
|
|
|
110477
110541
|
console.log('Unable to proceed. Error: mergeContent.');
|
|
110478
110542
|
this.dictation.finish(true);
|
|
110479
110543
|
return;
|
|
110480
|
-
}
|
|
110544
|
+
} // mergedHtml = this.applyBgStack(mergedHtml);
|
|
110545
|
+
// this.renderResult(mergedHtml, typeClass, contentWidth); // To apply original content width
|
|
110546
|
+
|
|
110481
110547
|
|
|
110482
110548
|
this.renderResult(mergedHtml, typeClass);
|
|
110483
110549
|
this.dictation.finish(); // Must be called after finished
|
|
@@ -110619,8 +110685,7 @@ ${currentHtml}`;
|
|
|
110619
110685
|
|
|
110620
110686
|
|
|
110621
110687
|
const adjustIntentForContentAlignment = (intent, question) => {
|
|
110622
|
-
if (intent === 'move_content_left' || intent === 'move_content_center' || intent === 'move_content_right' || intent === 'move_content_top' || intent === '
|
|
110623
|
-
intent === 'align_content_top_left' || intent === 'align_content_top_center' || intent === 'align_content_top_right' || intent === 'align_content_middle_left' || intent === 'align_content_middle_center' || intent === 'align_content_middle_right' || intent === 'align_content_bottom_left' || intent === 'align_content_bottom_center' || intent === 'align_content_bottom_right') {
|
|
110688
|
+
if (intent === 'move_content_left' || intent === 'move_content_center' || intent === 'move_content_right' || intent === 'move_content_top' || intent === 'move_content_bottom' || intent === 'align_content_top_left' || intent === 'align_content_top_right' || intent === 'align_content_bottom_left' || intent === 'align_content_bottom_right') {
|
|
110624
110689
|
let direct = false;
|
|
110625
110690
|
|
|
110626
110691
|
if (question.indexOf('top left') !== -1 || question.indexOf('left top') !== -1 || question.indexOf('top center') !== -1 || question.indexOf('center top') !== -1 || question.indexOf('top right') !== -1 || question.indexOf('right top') !== -1 || question.indexOf('middle left') !== -1 || question.indexOf('left middle') !== -1 || question.indexOf('middle center') !== -1 || question.indexOf('center middle') !== -1 || question.indexOf('middle right') !== -1 || question.indexOf('right middle') !== -1 || question.indexOf('bottom left') !== -1 || question.indexOf('left bottom') !== -1 || question.indexOf('bottom center') !== -1 || question.indexOf('center bottom') !== -1 || question.indexOf('bottom right') !== -1 || question.indexOf('right bottom') !== -1) {
|
|
@@ -110630,14 +110695,12 @@ ${currentHtml}`;
|
|
|
110630
110695
|
if (!direct) {
|
|
110631
110696
|
if (question.indexOf('top') !== -1) {
|
|
110632
110697
|
intent = 'move_content_top';
|
|
110633
|
-
} else if (question.indexOf('middle') !== -1) {
|
|
110634
|
-
intent = 'move_content_middle';
|
|
110635
110698
|
} else if (question.indexOf('bottom') !== -1) {
|
|
110636
110699
|
intent = 'move_content_bottom';
|
|
110637
110700
|
} else if (question.indexOf('left') !== -1) {
|
|
110638
110701
|
intent = 'move_content_left';
|
|
110639
110702
|
} else if (question.indexOf('center') !== -1) {
|
|
110640
|
-
|
|
110703
|
+
intent = 'move_content_center';
|
|
110641
110704
|
} else if (question.indexOf('right') !== -1) {
|
|
110642
110705
|
intent = 'move_content_right';
|
|
110643
110706
|
}
|
|
@@ -110666,31 +110729,16 @@ ${currentHtml}`;
|
|
|
110666
110729
|
this.builder.animateScroll.applyPresetBasic('is-fadeIn', 100);
|
|
110667
110730
|
this.builder.settings.onChange();
|
|
110668
110731
|
return false;
|
|
110669
|
-
} else if (intent == 'fade_in_slow') {
|
|
110670
|
-
this.builder.editor.saveForUndo();
|
|
110671
|
-
this.builder.animateScroll.applyPresetBasic('is-fadeIn', 300);
|
|
110672
|
-
this.builder.settings.onChange();
|
|
110673
|
-
return false;
|
|
110674
110732
|
} else if (intent == 'fade_in_up') {
|
|
110675
110733
|
this.builder.editor.saveForUndo();
|
|
110676
110734
|
this.builder.animateScroll.applyPresetBasic('is-fadeInUp', 100);
|
|
110677
110735
|
this.builder.settings.onChange();
|
|
110678
110736
|
return false;
|
|
110679
|
-
} else if (intent == 'fade_in_up_slow') {
|
|
110680
|
-
this.builder.editor.saveForUndo();
|
|
110681
|
-
this.builder.animateScroll.applyPresetBasic('is-fadeInUp', 300);
|
|
110682
|
-
this.builder.settings.onChange();
|
|
110683
|
-
return false;
|
|
110684
110737
|
} else if (intent == 'slide_up') {
|
|
110685
110738
|
this.builder.editor.saveForUndo();
|
|
110686
110739
|
this.builder.animateScroll.applyPresetBasic('is-slideInUp', 100);
|
|
110687
110740
|
this.builder.settings.onChange();
|
|
110688
110741
|
return false;
|
|
110689
|
-
} else if (intent == 'slide_up_slow') {
|
|
110690
|
-
this.builder.editor.saveForUndo();
|
|
110691
|
-
this.builder.animateScroll.applyPresetBasic('is-slideInUp', 300);
|
|
110692
|
-
this.builder.settings.onChange();
|
|
110693
|
-
return false;
|
|
110694
110742
|
} else if (intent == 'zoom_in') {
|
|
110695
110743
|
this.builder.editor.saveForUndo();
|
|
110696
110744
|
this.builder.animateScroll.applyPresetBasic('is-zoomIn', 300);
|
|
@@ -110860,6 +110908,19 @@ ${currentHtml}`;
|
|
|
110860
110908
|
|
|
110861
110909
|
let chosenImage = this.chooseBgImage(activeBox);
|
|
110862
110910
|
this.builder.editor.lib.updateBackgroundImage(activeBox, chosenImage);
|
|
110911
|
+
|
|
110912
|
+
if (activeBox.classList.contains('is-section')) {
|
|
110913
|
+
const overlay = activeBox.querySelector('div.is-overlay');
|
|
110914
|
+
|
|
110915
|
+
if (overlay && overlay.querySelector('.is-overlay-bg')) {
|
|
110916
|
+
let box = overlay.closest('.is-box');
|
|
110917
|
+
if (box) if (box.querySelector('.is-container')) {
|
|
110918
|
+
box.classList.add('m-overlay-stack');
|
|
110919
|
+
box.classList.add('m-dark-text');
|
|
110920
|
+
}
|
|
110921
|
+
}
|
|
110922
|
+
}
|
|
110923
|
+
|
|
110863
110924
|
this.builder.settings.onChange();
|
|
110864
110925
|
return false;
|
|
110865
110926
|
} else if (intent === 'change_bg_image') {
|
|
@@ -110878,6 +110939,19 @@ ${currentHtml}`;
|
|
|
110878
110939
|
}
|
|
110879
110940
|
|
|
110880
110941
|
this.builder.editor.lib.updateBackgroundImage(activeBox, chosenImage);
|
|
110942
|
+
|
|
110943
|
+
if (activeBox.classList.contains('is-section')) {
|
|
110944
|
+
const overlay = activeBox.querySelector('div.is-overlay');
|
|
110945
|
+
|
|
110946
|
+
if (overlay && overlay.querySelector('.is-overlay-bg')) {
|
|
110947
|
+
let box = overlay.closest('.is-box');
|
|
110948
|
+
if (box) if (box.querySelector('.is-container')) {
|
|
110949
|
+
box.classList.add('m-overlay-stack');
|
|
110950
|
+
box.classList.add('m-dark-text');
|
|
110951
|
+
}
|
|
110952
|
+
}
|
|
110953
|
+
}
|
|
110954
|
+
|
|
110881
110955
|
this.builder.settings.onChange();
|
|
110882
110956
|
return false;
|
|
110883
110957
|
} else if (intent === 'remove_bg_color') {
|
|
@@ -111274,132 +111348,61 @@ ${currentHtml}`;
|
|
|
111274
111348
|
|
|
111275
111349
|
this.builder.settings.onChange();
|
|
111276
111350
|
return false;
|
|
111277
|
-
}
|
|
111278
|
-
/*else if(intent==='move_content_left') {
|
|
111279
|
-
|
|
111280
|
-
this.builder.editor.saveForUndo();
|
|
111281
|
-
this.builder.editor.lib.moveContent(activeBox, 'left');
|
|
111282
|
-
this.builder.settings.onChange();
|
|
111283
|
-
return false;
|
|
111284
|
-
|
|
111285
|
-
} else if(intent==='move_content_center') {
|
|
111286
|
-
|
|
111287
|
-
this.builder.editor.saveForUndo();
|
|
111288
|
-
this.builder.editor.lib.moveContent(activeBox, 'center');
|
|
111289
|
-
// this.builder.editor.lib.moveContent(activeBox, 'middle');
|
|
111290
|
-
this.builder.settings.onChange();
|
|
111291
|
-
return false;
|
|
111292
|
-
|
|
111293
|
-
} else if(intent==='move_content_right') {
|
|
111294
|
-
|
|
111295
|
-
this.builder.editor.saveForUndo();
|
|
111296
|
-
this.builder.editor.lib.moveContent(activeBox, 'right');
|
|
111297
|
-
this.builder.settings.onChange();
|
|
111298
|
-
return false;
|
|
111299
|
-
|
|
111300
|
-
} else if(intent==='move_content_top') {
|
|
111301
|
-
|
|
111351
|
+
} else if (intent === 'move_content_left') {
|
|
111302
111352
|
this.builder.editor.saveForUndo();
|
|
111303
|
-
|
|
111304
|
-
|
|
111305
|
-
|
|
111306
|
-
|
|
111307
|
-
} else if(intent==='move_content_middle') {
|
|
111308
|
-
|
|
111309
|
-
this.builder.editor.saveForUndo();
|
|
111310
|
-
this.builder.editor.lib.moveContent(activeBox, 'middle');
|
|
111311
|
-
this.builder.settings.onChange();
|
|
111312
|
-
return false;
|
|
111313
|
-
|
|
111314
|
-
} else if(intent==='move_content_bottom') {
|
|
111315
|
-
|
|
111316
|
-
this.builder.editor.saveForUndo();
|
|
111317
|
-
this.builder.editor.lib.moveContent(activeBox, 'bottom');
|
|
111318
|
-
this.builder.settings.onChange();
|
|
111353
|
+
this.builder.editor.lib.moveContent(activeBox, 'left');
|
|
111354
|
+
this.builder.editor.lib.moveContent(activeBox, 'middle');
|
|
111355
|
+
this.builder.settings.onChange();
|
|
111319
111356
|
return false;
|
|
111320
|
-
|
|
111321
|
-
} else if(intent==='make_content_center') { // This
|
|
111322
|
-
|
|
111357
|
+
} else if (intent === 'move_content_center') {
|
|
111323
111358
|
this.builder.editor.saveForUndo();
|
|
111324
|
-
|
|
111359
|
+
this.builder.editor.lib.moveContent(activeBox, 'center');
|
|
111325
111360
|
this.builder.editor.lib.moveContent(activeBox, 'middle');
|
|
111326
|
-
|
|
111361
|
+
this.builder.settings.onChange();
|
|
111327
111362
|
return false;
|
|
111328
|
-
|
|
111329
|
-
} else if(intent==='align_content_top_left') {
|
|
111330
|
-
|
|
111363
|
+
} else if (intent === 'move_content_right') {
|
|
111331
111364
|
this.builder.editor.saveForUndo();
|
|
111332
|
-
|
|
111333
|
-
this.builder.editor.lib.moveContent(activeBox, '
|
|
111334
|
-
|
|
111365
|
+
this.builder.editor.lib.moveContent(activeBox, 'right');
|
|
111366
|
+
this.builder.editor.lib.moveContent(activeBox, 'middle');
|
|
111367
|
+
this.builder.settings.onChange();
|
|
111335
111368
|
return false;
|
|
111336
|
-
|
|
111337
|
-
} else if(intent==='align_content_top_center') {
|
|
111338
|
-
|
|
111369
|
+
} else if (intent === 'move_content_top') {
|
|
111339
111370
|
this.builder.editor.saveForUndo();
|
|
111340
|
-
this.builder.editor.lib.moveContent(activeBox, 'top');
|
|
111341
111371
|
this.builder.editor.lib.moveContent(activeBox, 'center');
|
|
111342
|
-
|
|
111372
|
+
this.builder.editor.lib.moveContent(activeBox, 'top');
|
|
111373
|
+
this.builder.settings.onChange();
|
|
111343
111374
|
return false;
|
|
111344
|
-
|
|
111345
|
-
} else if(intent==='align_content_top_right') {
|
|
111346
|
-
|
|
111375
|
+
} else if (intent === 'move_content_bottom') {
|
|
111347
111376
|
this.builder.editor.saveForUndo();
|
|
111348
|
-
|
|
111349
|
-
this.builder.editor.lib.moveContent(activeBox, '
|
|
111350
|
-
|
|
111377
|
+
this.builder.editor.lib.moveContent(activeBox, 'center');
|
|
111378
|
+
this.builder.editor.lib.moveContent(activeBox, 'bottom');
|
|
111379
|
+
this.builder.settings.onChange();
|
|
111351
111380
|
return false;
|
|
111352
|
-
|
|
111353
|
-
} else if(intent==='align_content_middle_left') {
|
|
111354
|
-
|
|
111381
|
+
} else if (intent === 'align_content_top_left') {
|
|
111355
111382
|
this.builder.editor.saveForUndo();
|
|
111356
|
-
|
|
111383
|
+
this.builder.editor.lib.moveContent(activeBox, 'top');
|
|
111357
111384
|
this.builder.editor.lib.moveContent(activeBox, 'left');
|
|
111358
|
-
|
|
111359
|
-
return false;
|
|
111360
|
-
|
|
111361
|
-
} else if(intent==='align_content_middle_center') {
|
|
111362
|
-
|
|
111363
|
-
this.builder.editor.saveForUndo();
|
|
111364
|
-
this.builder.editor.lib.moveContent(activeBox, 'middle');
|
|
111365
|
-
this.builder.editor.lib.moveContent(activeBox, 'center');
|
|
111366
|
-
this.builder.settings.onChange();
|
|
111385
|
+
this.builder.settings.onChange();
|
|
111367
111386
|
return false;
|
|
111368
|
-
|
|
111369
|
-
} else if(intent==='align_content_middle_right') {
|
|
111370
|
-
|
|
111387
|
+
} else if (intent === 'align_content_top_right') {
|
|
111371
111388
|
this.builder.editor.saveForUndo();
|
|
111372
|
-
|
|
111389
|
+
this.builder.editor.lib.moveContent(activeBox, 'top');
|
|
111373
111390
|
this.builder.editor.lib.moveContent(activeBox, 'right');
|
|
111374
|
-
|
|
111391
|
+
this.builder.settings.onChange();
|
|
111375
111392
|
return false;
|
|
111376
|
-
|
|
111377
|
-
} else if(intent==='align_content_bottom_left') {
|
|
111378
|
-
|
|
111393
|
+
} else if (intent === 'align_content_bottom_left') {
|
|
111379
111394
|
this.builder.editor.saveForUndo();
|
|
111380
|
-
|
|
111395
|
+
this.builder.editor.lib.moveContent(activeBox, 'bottom');
|
|
111381
111396
|
this.builder.editor.lib.moveContent(activeBox, 'left');
|
|
111382
|
-
|
|
111383
|
-
return false;
|
|
111384
|
-
|
|
111385
|
-
} else if(intent==='align_content_bottom_center') {
|
|
111386
|
-
|
|
111387
|
-
this.builder.editor.saveForUndo();
|
|
111388
|
-
this.builder.editor.lib.moveContent(activeBox, 'bottom');
|
|
111389
|
-
this.builder.editor.lib.moveContent(activeBox, 'center');
|
|
111390
|
-
this.builder.settings.onChange();
|
|
111397
|
+
this.builder.settings.onChange();
|
|
111391
111398
|
return false;
|
|
111392
|
-
|
|
111393
|
-
} else if(intent==='align_content_bottom_right') {
|
|
111394
|
-
|
|
111399
|
+
} else if (intent === 'align_content_bottom_right') {
|
|
111395
111400
|
this.builder.editor.saveForUndo();
|
|
111396
|
-
|
|
111401
|
+
this.builder.editor.lib.moveContent(activeBox, 'bottom');
|
|
111397
111402
|
this.builder.editor.lib.moveContent(activeBox, 'right');
|
|
111398
|
-
|
|
111403
|
+
this.builder.settings.onChange();
|
|
111399
111404
|
return false;
|
|
111400
|
-
|
|
111401
|
-
} */
|
|
111402
|
-
else if (intent === 'increase_space') {
|
|
111405
|
+
} else if (intent === 'increase_space') {
|
|
111403
111406
|
let elm = this.builder.editor.activeElement;
|
|
111404
111407
|
|
|
111405
111408
|
if (elm) {
|
|
@@ -111847,6 +111850,22 @@ ${currentHtml}`;
|
|
|
111847
111850
|
return doc.documentElement.innerHTML;
|
|
111848
111851
|
}
|
|
111849
111852
|
|
|
111853
|
+
applyBgStack(html) {
|
|
111854
|
+
const parser = new DOMParser();
|
|
111855
|
+
let doc = parser.parseFromString(html, 'text/html');
|
|
111856
|
+
const overlay = doc.querySelector('div.is-overlay');
|
|
111857
|
+
|
|
111858
|
+
if (overlay && overlay.querySelector('.is-overlay-bg')) {
|
|
111859
|
+
let box = overlay.closest('.is-box');
|
|
111860
|
+
if (box) if (box.querySelector('.is-container')) {
|
|
111861
|
+
box.classList.add('m-overlay-stack');
|
|
111862
|
+
box.classList.add('m-dark-text');
|
|
111863
|
+
}
|
|
111864
|
+
}
|
|
111865
|
+
|
|
111866
|
+
return doc.documentElement.innerHTML;
|
|
111867
|
+
}
|
|
111868
|
+
|
|
111850
111869
|
fixCommon(html) {
|
|
111851
111870
|
html = html.replaceAll('{{CONTENT}}', '');
|
|
111852
111871
|
const parser = new DOMParser();
|
|
@@ -111873,6 +111892,34 @@ ${currentHtml}`;
|
|
|
111873
111892
|
col.style.width = '';
|
|
111874
111893
|
col.style.flex = '';
|
|
111875
111894
|
}
|
|
111895
|
+
}); // Fix grid (width)
|
|
111896
|
+
|
|
111897
|
+
const rows = container.querySelectorAll('.row');
|
|
111898
|
+
rows.forEach(row => {
|
|
111899
|
+
let totalWidth = 0;
|
|
111900
|
+
let hasAutoWidthCol = false;
|
|
111901
|
+
let lastCol;
|
|
111902
|
+
const cols = row.querySelectorAll('.column');
|
|
111903
|
+
cols.forEach(col => {
|
|
111904
|
+
if (col.style.width && col.style.width.includes('%')) {
|
|
111905
|
+
totalWidth += parseFloat(col.style.width);
|
|
111906
|
+
} else {
|
|
111907
|
+
hasAutoWidthCol = true;
|
|
111908
|
+
}
|
|
111909
|
+
|
|
111910
|
+
lastCol = col;
|
|
111911
|
+
});
|
|
111912
|
+
|
|
111913
|
+
if (totalWidth > 100) {
|
|
111914
|
+
console.log('FIX: clear width. Total: ' + totalWidth);
|
|
111915
|
+
cols.forEach(col => {
|
|
111916
|
+
col.style.width = '';
|
|
111917
|
+
col.style.flex = '';
|
|
111918
|
+
});
|
|
111919
|
+
} else if (totalWidth < 100 && !hasAutoWidthCol) {
|
|
111920
|
+
console.log('FIX: add col. Total: ' + totalWidth);
|
|
111921
|
+
if (lastCol) lastCol.insertAdjacentHTML('afterend', '<div class="column"><div class="spacer height-60"></div></div>');
|
|
111922
|
+
}
|
|
111876
111923
|
}); // Replace element style with class
|
|
111877
111924
|
|
|
111878
111925
|
const elements = doc.querySelectorAll('*');
|
|
@@ -111968,17 +112015,6 @@ ${currentHtml}`;
|
|
|
111968
112015
|
|
|
111969
112016
|
doc = parser.parseFromString(docBox.body.innerHTML, 'text/html');
|
|
111970
112017
|
}
|
|
111971
|
-
} // Apply bg stacking
|
|
111972
|
-
|
|
111973
|
-
|
|
111974
|
-
const overlay = doc.querySelector('div.is-overlay');
|
|
111975
|
-
|
|
111976
|
-
if (overlay && overlay.querySelector('.is-overlay-bg')) {
|
|
111977
|
-
let box = overlay.closest('.is-box');
|
|
111978
|
-
if (box) if (box.querySelector('.is-container')) {
|
|
111979
|
-
box.classList.add('m-overlay-stack');
|
|
111980
|
-
box.classList.add('m-dark-text');
|
|
111981
|
-
}
|
|
111982
112018
|
}
|
|
111983
112019
|
|
|
111984
112020
|
if (container) {
|
|
@@ -112354,7 +112390,7 @@ ${currentHtml}`;
|
|
|
112354
112390
|
this.dictation.finish(); // Must be called after finished
|
|
112355
112391
|
}
|
|
112356
112392
|
|
|
112357
|
-
renderResult(html, typeClass) {
|
|
112393
|
+
renderResult(html, typeClass, contentWidth) {
|
|
112358
112394
|
const activeBox = this.builder.activeBox;
|
|
112359
112395
|
const activeSection = this.builder.activeSection;
|
|
112360
112396
|
let sectionBox = false;
|
|
@@ -112367,7 +112403,7 @@ ${currentHtml}`;
|
|
|
112367
112403
|
|
|
112368
112404
|
if (sectionBox) {
|
|
112369
112405
|
// section
|
|
112370
|
-
// Replace class
|
|
112406
|
+
// Replace type class
|
|
112371
112407
|
const parser = new DOMParser();
|
|
112372
112408
|
const htmlDocument = parser.parseFromString(html, 'text/html');
|
|
112373
112409
|
|
|
@@ -112378,6 +112414,21 @@ ${currentHtml}`;
|
|
|
112378
112414
|
section.classList.remove(...Array.from(section.classList).filter(className => className.startsWith('type-')));
|
|
112379
112415
|
section.classList.add(typeClass);
|
|
112380
112416
|
}
|
|
112417
|
+
} // Replace content width
|
|
112418
|
+
|
|
112419
|
+
|
|
112420
|
+
if (contentWidth) {
|
|
112421
|
+
const container = htmlDocument.querySelector('.is-container');
|
|
112422
|
+
|
|
112423
|
+
if (container) {
|
|
112424
|
+
container.classList.forEach(item => {
|
|
112425
|
+
if (item.indexOf('is-content-') !== -1 && item !== 'is-content-left' && item !== 'is-content-right') {
|
|
112426
|
+
container.classList.remove(item);
|
|
112427
|
+
container.classList.add(contentWidth);
|
|
112428
|
+
}
|
|
112429
|
+
});
|
|
112430
|
+
container.classList.add(contentWidth);
|
|
112431
|
+
}
|
|
112381
112432
|
}
|
|
112382
112433
|
|
|
112383
112434
|
html = htmlDocument.body.innerHTML; // const typeClass = this.lib.getTypographyClass(html);
|
|
@@ -112412,6 +112463,7 @@ ${currentHtml}`;
|
|
|
112412
112463
|
const replacementElement = tempContainer.firstChild; // replacementElement.setAttribute('class', savedClasses);
|
|
112413
112464
|
|
|
112414
112465
|
if (savedClass) replacementElement.classList.add(savedClass); // const typeClass = this.lib.getTypographyClass(html);
|
|
112466
|
+
// Replace type class
|
|
112415
112467
|
|
|
112416
112468
|
if (typeClass) {
|
|
112417
112469
|
const section = htmlDocument.querySelector('div.is-section');
|
|
@@ -112420,6 +112472,20 @@ ${currentHtml}`;
|
|
|
112420
112472
|
section.classList.remove(...Array.from(section.classList).filter(className => className.startsWith('type-')));
|
|
112421
112473
|
section.classList.add(typeClass);
|
|
112422
112474
|
}
|
|
112475
|
+
} // Replace content width
|
|
112476
|
+
|
|
112477
|
+
|
|
112478
|
+
if (contentWidth) {
|
|
112479
|
+
const container = replacementElement.querySelector('.is-container');
|
|
112480
|
+
|
|
112481
|
+
if (container) {
|
|
112482
|
+
container.classList.forEach(item => {
|
|
112483
|
+
if (item.indexOf('is-content-') !== -1 && item !== 'is-content-left' && item !== 'is-content-right') {
|
|
112484
|
+
container.classList.remove(item);
|
|
112485
|
+
}
|
|
112486
|
+
});
|
|
112487
|
+
container.classList.add(contentWidth);
|
|
112488
|
+
}
|
|
112423
112489
|
} // Replace
|
|
112424
112490
|
|
|
112425
112491
|
|
|
@@ -115127,7 +115193,7 @@ class ContentBox {
|
|
|
115127
115193
|
speechRecognitionLang: 'en-US',
|
|
115128
115194
|
similarityThreshold: 0.65,
|
|
115129
115195
|
// for commandList similarity checking
|
|
115130
|
-
headlineList: ['We\'re [CompanyName]. Full stack development with a spark of creativity.'
|
|
115196
|
+
headlineList: ['We\'re [CompanyName]. Full stack development with a spark of creativity.'],
|
|
115131
115197
|
mediaPath: 'assets/gallery/',
|
|
115132
115198
|
media: {
|
|
115133
115199
|
slider: ['slide-01.jpg', 'slide-02.jpg'],
|
|
@@ -115199,11 +115265,8 @@ class ContentBox {
|
|
|
115199
115265
|
select_image: ['select image'],
|
|
115200
115266
|
change_font: ['change font', 'change typography', 'change style'],
|
|
115201
115267
|
fade_in: ['fade in'],
|
|
115202
|
-
fade_in_slow: ['fade in slow'],
|
|
115203
115268
|
fade_in_up: ['fade in up'],
|
|
115204
|
-
fade_in_up_slow: ['fade in up slow'],
|
|
115205
115269
|
slide_up: ['slide up'],
|
|
115206
|
-
slide_up_slow: ['slide up slow'],
|
|
115207
115270
|
zoom_in: ['zoom in'],
|
|
115208
115271
|
zoom_out: ['zoom out'],
|
|
115209
115272
|
animate_once: ['animate once'],
|
|
@@ -115272,22 +115335,14 @@ class ContentBox {
|
|
|
115272
115335
|
align_right: ['align right', 'align text right', 'right aligned'],
|
|
115273
115336
|
align_full: ['align full', 'align justify', 'justify', 'justify text', 'justify full'],
|
|
115274
115337
|
clear_alignment: ['clear alignment', 'remove alignment', 'clear text alignment', 'remove text alignment'],
|
|
115275
|
-
make_content_center: ['make content center'],
|
|
115276
|
-
// middle center
|
|
115277
115338
|
move_content_left: ['move content left', 'align content left'],
|
|
115278
115339
|
move_content_center: ['move content center', 'align content center'],
|
|
115279
115340
|
move_content_right: ['move content right', 'align content right'],
|
|
115280
115341
|
move_content_top: ['move content top', 'align content top'],
|
|
115281
|
-
move_content_middle: ['move content middle', 'align content middle'],
|
|
115282
115342
|
move_content_bottom: ['move content bottom', 'align content bottom'],
|
|
115283
115343
|
align_content_top_left: ['move content top left', 'align content top left'],
|
|
115284
|
-
align_content_top_center: ['move content top center', 'align content top center'],
|
|
115285
115344
|
align_content_top_right: ['move content top right', 'align content top right'],
|
|
115286
|
-
align_content_middle_left: ['move content middle left', 'align content middle left'],
|
|
115287
|
-
align_content_middle_center: ['move content middle center', 'align content middle center'],
|
|
115288
|
-
align_content_middle_right: ['move content middle right', 'align content middle right'],
|
|
115289
115345
|
align_content_bottom_left: ['move content bottom left', 'align content bottom left'],
|
|
115290
|
-
align_content_bottom_center: ['move content bottom center', 'align content bottom center'],
|
|
115291
115346
|
align_content_bottom_right: ['move content bottom right', 'align content bottom right'],
|
|
115292
115347
|
increase_space: ['more space', 'increase space', 'enlarge space'],
|
|
115293
115348
|
decrease_space: ['less space', 'decrease space', 'reduce space'],
|
|
@@ -115340,7 +115395,7 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
|
|
|
115340
115395
|
|
|
115341
115396
|
},
|
|
115342
115397
|
selection: {
|
|
115343
|
-
title: 'Selection',
|
|
115398
|
+
title: 'Selection & Layout',
|
|
115344
115399
|
list: ['Select the headline', // 'Select the paragraph',
|
|
115345
115400
|
// 'Select the button',
|
|
115346
115401
|
// 'Select the space',
|
|
@@ -115361,7 +115416,7 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
|
|
|
115361
115416
|
list: [// 'Set the background color to light green',
|
|
115362
115417
|
// 'Change the background color to light yellow',
|
|
115363
115418
|
'Add a background image', 'Change the background image', 'Add a background slider', 'Add a background video', 'Clear background', // 'Adjust the section height to 50%',
|
|
115364
|
-
'Adjust the section height to 70%', '
|
|
115419
|
+
'Adjust the section height to 70%', 'Change the section height to 100%', 'Set the section height to auto']
|
|
115365
115420
|
},
|
|
115366
115421
|
typography: {
|
|
115367
115422
|
title: 'Typography',
|
|
@@ -115371,21 +115426,25 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
|
|
|
115371
115426
|
title: 'Content',
|
|
115372
115427
|
list: ['Set the content color to white', 'Set the content color to black', 'Increase the width of the content', 'Reduce the width of the content', 'Increase the default font size', // 'Decrease the default font size',
|
|
115373
115428
|
'Increase the default line height', // 'Decrease the default line height',
|
|
115374
|
-
'Clear the content', 'Add new content', // '
|
|
115429
|
+
'Clear the content', 'Add new content', // 'Align the content to the center',
|
|
115430
|
+
// 'Align the content to the left',
|
|
115375
115431
|
// 'Align the content to the center',
|
|
115376
|
-
'Align the content to the left', // 'Align the content to the center',
|
|
115377
115432
|
// 'Align the content to the right',
|
|
115378
|
-
|
|
115379
|
-
'
|
|
115433
|
+
// 'Align the content to the top',
|
|
115434
|
+
// 'Align the content to the middle',
|
|
115435
|
+
// 'Align the content to the bottom',
|
|
115436
|
+
// 'Make the content centered'
|
|
115437
|
+
'Move the content to the left', 'Move the content to the center', 'Move the content to the right', 'Move the content to the top']
|
|
115380
115438
|
},
|
|
115381
115439
|
element: {
|
|
115382
115440
|
title: 'Element',
|
|
115383
|
-
list: ['Add a paragraph', 'Add an image', 'Add a Youtube video', // 'Add a table',
|
|
115441
|
+
list: ['Add a headline', 'Add a paragraph', 'Add an image', 'Add a Youtube video', // 'Add a table',
|
|
115384
115442
|
// 'Add audio',
|
|
115385
115443
|
// 'Add map',
|
|
115386
115444
|
// 'Add an icon',
|
|
115387
115445
|
// 'Add social links',
|
|
115388
|
-
'Add a button', 'Add two buttons', 'Add a space', 'Increase the space'
|
|
115446
|
+
'Add a button', 'Add two buttons', 'Add a space', 'Increase the space' // 'Reduce the space',
|
|
115447
|
+
]
|
|
115389
115448
|
},
|
|
115390
115449
|
text: {
|
|
115391
115450
|
title: 'Text Formatting',
|
|
@@ -115401,7 +115460,7 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
|
|
|
115401
115460
|
},
|
|
115402
115461
|
animation: {
|
|
115403
115462
|
title: 'Animation',
|
|
115404
|
-
list: ['Add a fade in animation', 'Add fade in
|
|
115463
|
+
list: ['Add a fade in animation', 'Add fade in up animation', 'Add slide up animation', 'Add zoom in animation', 'Add zoom out animation', 'Clear the animation', 'Animate once', 'Always animate']
|
|
115405
115464
|
}
|
|
115406
115465
|
},
|
|
115407
115466
|
|
|
@@ -117304,6 +117363,8 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
|
|
|
117304
117363
|
|
|
117305
117364
|
addIdea(newArea) {
|
|
117306
117365
|
this.editor.saveForUndo();
|
|
117366
|
+
const d = new Date();
|
|
117367
|
+
newArea = newArea.replace('[%YEAR%]', d.getFullYear());
|
|
117307
117368
|
let newSection;
|
|
117308
117369
|
let arrSections = [];
|
|
117309
117370
|
|
|
@@ -117529,7 +117590,114 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
|
|
|
117529
117590
|
return false;
|
|
117530
117591
|
});
|
|
117531
117592
|
});
|
|
117532
|
-
this.sectionStack();
|
|
117593
|
+
this.sectionStack();
|
|
117594
|
+
|
|
117595
|
+
const addMultiClass = (col, multiClass) => {
|
|
117596
|
+
let current = col.getAttribute('class');
|
|
117597
|
+
col.setAttribute('class', current + ' ' + multiClass);
|
|
117598
|
+
};
|
|
117599
|
+
|
|
117600
|
+
const applyClass = (col, w) => {
|
|
117601
|
+
//['col-md-1', 'col-md-2', 'col-md-3', 'col-md-4', 'col-md-5', 'col-md-6', 'col-md-7', 'col-md-8', 'col-md-9', 'col-md-10', 'col-md-11', 'col-md-12'];
|
|
117602
|
+
if (94 <= w && w <= 100) {
|
|
117603
|
+
//col-md-11 = 91.666667%
|
|
117604
|
+
addMultiClass(col, this.editor.cols[11]);
|
|
117605
|
+
}
|
|
117606
|
+
|
|
117607
|
+
if (86 <= w && w < 94) {
|
|
117608
|
+
//col-md-11 = 91.666667%
|
|
117609
|
+
addMultiClass(col, this.editor.cols[10]);
|
|
117610
|
+
}
|
|
117611
|
+
|
|
117612
|
+
if (78 <= w && w < 86) {
|
|
117613
|
+
//col-md-10 = 83.333333%
|
|
117614
|
+
addMultiClass(col, this.editor.cols[9]);
|
|
117615
|
+
}
|
|
117616
|
+
|
|
117617
|
+
if (70 <= w && w < 78) {
|
|
117618
|
+
//col-md-9 = 75%
|
|
117619
|
+
addMultiClass(col, this.editor.cols[8]);
|
|
117620
|
+
}
|
|
117621
|
+
|
|
117622
|
+
if (62 <= w && w < 70) {
|
|
117623
|
+
//col-md-8 = 66.666667%
|
|
117624
|
+
addMultiClass(col, this.editor.cols[7]);
|
|
117625
|
+
}
|
|
117626
|
+
|
|
117627
|
+
if (54 <= w && w < 62) {
|
|
117628
|
+
//col-md-7 = 58.333333%
|
|
117629
|
+
addMultiClass(col, this.editor.cols[6]);
|
|
117630
|
+
}
|
|
117631
|
+
|
|
117632
|
+
if (46 <= w && w < 54) {
|
|
117633
|
+
//col-md-6 = 50%
|
|
117634
|
+
addMultiClass(col, this.editor.cols[5]);
|
|
117635
|
+
}
|
|
117636
|
+
|
|
117637
|
+
if (37 <= w && w < 46) {
|
|
117638
|
+
//col-md-5 = 41.666667%
|
|
117639
|
+
addMultiClass(col, this.editor.cols[4]);
|
|
117640
|
+
}
|
|
117641
|
+
|
|
117642
|
+
if (29 <= w && w < 37) {
|
|
117643
|
+
//col-md-4 = 33%
|
|
117644
|
+
addMultiClass(col, this.editor.cols[3]);
|
|
117645
|
+
}
|
|
117646
|
+
|
|
117647
|
+
if (21 <= w && w < 29) {
|
|
117648
|
+
//col-md-3 = 25%
|
|
117649
|
+
addMultiClass(col, this.editor.cols[2]);
|
|
117650
|
+
}
|
|
117651
|
+
|
|
117652
|
+
if (13 <= w && w < 21) {
|
|
117653
|
+
//col-md-2 = 16.666667%%
|
|
117654
|
+
addMultiClass(col, this.editor.cols[1]);
|
|
117655
|
+
}
|
|
117656
|
+
|
|
117657
|
+
if (5 <= w && w < 13) {
|
|
117658
|
+
//col-md-1 = 8.333333%%%
|
|
117659
|
+
addMultiClass(col, this.editor.cols[0]);
|
|
117660
|
+
}
|
|
117661
|
+
};
|
|
117662
|
+
|
|
117663
|
+
if (!this.editor.useDefaultGrid) {
|
|
117664
|
+
let rows = newSection.querySelectorAll('.is-container > div');
|
|
117665
|
+
rows.forEach(row => {
|
|
117666
|
+
let cols = this.editor.util.getAllColumns(row);
|
|
117667
|
+
cols.forEach(col => {
|
|
117668
|
+
if (col.style.width && col.style.width.includes('%')) {
|
|
117669
|
+
let w = parseFloat(col.style.width);
|
|
117670
|
+
col.setAttribute('data-temp-w', w);
|
|
117671
|
+
} else {
|
|
117672
|
+
let colWidth = Number(window.getComputedStyle(col).getPropertyValue('width').match(/\d+/)[0]);
|
|
117673
|
+
let rowWidth = Number(window.getComputedStyle(row).getPropertyValue('width').match(/\d+/)[0]);
|
|
117674
|
+
let w = colWidth / rowWidth * 100;
|
|
117675
|
+
col.setAttribute('data-temp-w', w);
|
|
117676
|
+
}
|
|
117677
|
+
});
|
|
117678
|
+
});
|
|
117679
|
+
rows = newSection.querySelectorAll('.is-container > div');
|
|
117680
|
+
rows.forEach(row => {
|
|
117681
|
+
let cols = this.editor.util.getAllColumns(row);
|
|
117682
|
+
cols.forEach(col => {
|
|
117683
|
+
let w = col.getAttribute('data-temp-w');
|
|
117684
|
+
applyClass(col, parseFloat(w));
|
|
117685
|
+
col.removeAttribute('data-temp-w');
|
|
117686
|
+
let classes = this.editor.cols[0].split(' ');
|
|
117687
|
+
if (!classes.includes('column')) col.classList.remove('column');else {
|
|
117688
|
+
const classNames = col.className.split(' ');
|
|
117689
|
+
const uniqueClassNames = [...new Set(classNames)]; // Using Set to remove duplicates
|
|
117690
|
+
|
|
117691
|
+
col.className = uniqueClassNames.join(' ');
|
|
117692
|
+
}
|
|
117693
|
+
col.style.width = '';
|
|
117694
|
+
col.style.flex = '';
|
|
117695
|
+
}); // this.editor.util.fixLayout(row);
|
|
117696
|
+
});
|
|
117697
|
+
}
|
|
117698
|
+
|
|
117699
|
+
this.clearSelection();
|
|
117700
|
+
this.selectNewSection(newSection); //Trigger Change event
|
|
117533
117701
|
|
|
117534
117702
|
this.onChange();
|
|
117535
117703
|
dom.removeElement(document.querySelector('.is-sidebar-overlay'));
|
|
@@ -117545,6 +117713,48 @@ Provide an engaging headline.`, 'Create a new section showcasing a photo gallery
|
|
|
117545
117713
|
} // addIdea
|
|
117546
117714
|
|
|
117547
117715
|
|
|
117716
|
+
clearSelection() {
|
|
117717
|
+
const prevBox = this.doc.querySelector('.box-select');
|
|
117718
|
+
if (prevBox) prevBox.classList.remove('box-select');
|
|
117719
|
+
const prevSection = this.doc.querySelector('.section-select');
|
|
117720
|
+
if (prevSection) prevSection.classList.remove('section-select');
|
|
117721
|
+
this.editor.util.clearActiveCell();
|
|
117722
|
+
this.editor.util.clearAfterUndoRedo();
|
|
117723
|
+
}
|
|
117724
|
+
|
|
117725
|
+
selectNewSection(newSection) {
|
|
117726
|
+
let sectionBox = false;
|
|
117727
|
+
if (newSection.classList.contains('is-box')) sectionBox = true;
|
|
117728
|
+
|
|
117729
|
+
if (sectionBox) {
|
|
117730
|
+
// section
|
|
117731
|
+
// select box
|
|
117732
|
+
newSection.classList.add('box-select');
|
|
117733
|
+
this.activeBox = newSection;
|
|
117734
|
+
this.wrapperEl.classList.add('hard-select'); // select section
|
|
117735
|
+
|
|
117736
|
+
newSection.classList.add('section-select');
|
|
117737
|
+
this.activeSection = newSection; // Select
|
|
117738
|
+
|
|
117739
|
+
this.positionTool(newSection);
|
|
117740
|
+
} else {
|
|
117741
|
+
// select box
|
|
117742
|
+
let box = newSection.querySelector('.is-box');
|
|
117743
|
+
|
|
117744
|
+
if (box) {
|
|
117745
|
+
box.classList.add('box-select');
|
|
117746
|
+
this.activeBox = box;
|
|
117747
|
+
}
|
|
117748
|
+
|
|
117749
|
+
this.wrapperEl.classList.add('hard-select'); // select section
|
|
117750
|
+
|
|
117751
|
+
newSection.classList.add('section-select');
|
|
117752
|
+
this.activeSection = newSection; // Select
|
|
117753
|
+
|
|
117754
|
+
this.positionTool(newSection);
|
|
117755
|
+
}
|
|
117756
|
+
}
|
|
117757
|
+
|
|
117548
117758
|
refreshUIStyle() {
|
|
117549
117759
|
// -------
|
|
117550
117760
|
|