@innovastudio/contentbuilder 1.4.55 → 1.4.57
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.
|
@@ -5444,6 +5444,9 @@ class Util {
|
|
|
5444
5444
|
localStorage.removeItem('_htmlview');
|
|
5445
5445
|
localStorage.removeItem('_pasteresult'); //DON'T HAVE PROP
|
|
5446
5446
|
localStorage.removeItem('_livepreview');
|
|
5447
|
+
localStorage.removeItem('_dictation');
|
|
5448
|
+
localStorage.removeItem('_mic');
|
|
5449
|
+
localStorage.removeItem('_autosendcommand');
|
|
5447
5450
|
|
|
5448
5451
|
//NOT USED
|
|
5449
5452
|
localStorage.removeItem('_scrollableeditor');
|
|
@@ -8437,7 +8440,7 @@ class Dom {
|
|
|
8437
8440
|
|
|
8438
8441
|
var js$1 = {exports: {}};
|
|
8439
8442
|
|
|
8440
|
-
var src = {};
|
|
8443
|
+
var src$1 = {};
|
|
8441
8444
|
|
|
8442
8445
|
var javascript = {exports: {}};
|
|
8443
8446
|
|
|
@@ -13576,9 +13579,9 @@ function style_html(html_source, options, js, css) {
|
|
|
13576
13579
|
}
|
|
13577
13580
|
style_html.defaultOptions = html_beautify.defaultOptions;
|
|
13578
13581
|
|
|
13579
|
-
src.js = js_beautify;
|
|
13580
|
-
src.css = css_beautify;
|
|
13581
|
-
src.html = style_html;
|
|
13582
|
+
src$1.js = js_beautify;
|
|
13583
|
+
src$1.css = css_beautify;
|
|
13584
|
+
src$1.html = style_html;
|
|
13582
13585
|
|
|
13583
13586
|
/*jshint node:true */
|
|
13584
13587
|
|
|
@@ -13621,7 +13624,7 @@ function get_beautify(js_beautify, css_beautify, html_beautify) {
|
|
|
13621
13624
|
|
|
13622
13625
|
{
|
|
13623
13626
|
(function(mod) {
|
|
13624
|
-
var beautifier = src;
|
|
13627
|
+
var beautifier = src$1;
|
|
13625
13628
|
beautifier.js_beautify = beautifier.js;
|
|
13626
13629
|
beautifier.css_beautify = beautifier.css;
|
|
13627
13630
|
beautifier.html_beautify = beautifier.html;
|
|
@@ -14261,7 +14264,7 @@ var loader = {
|
|
|
14261
14264
|
__getMonacoInstance: __getMonacoInstance
|
|
14262
14265
|
};
|
|
14263
14266
|
|
|
14264
|
-
const dom$
|
|
14267
|
+
const dom$k = new Dom();
|
|
14265
14268
|
let hash$1 = {};
|
|
14266
14269
|
class HtmlUtil {
|
|
14267
14270
|
constructor(builder) {
|
|
@@ -14308,28 +14311,28 @@ class HtmlUtil {
|
|
|
14308
14311
|
</div>
|
|
14309
14312
|
|
|
14310
14313
|
`;
|
|
14311
|
-
dom$
|
|
14314
|
+
dom$k.appendHtml(builderStuff, html);
|
|
14312
14315
|
viewhtml = builderStuff.querySelector('.viewhtml');
|
|
14313
14316
|
let viewhtmlmonaco = builderStuff.querySelector('.viewhtmlmonaco');
|
|
14314
14317
|
let viewhtmlexternal = builderStuff.querySelector('.viewhtmlexternal');
|
|
14315
14318
|
let elm = viewhtml.querySelector('.input-ok');
|
|
14316
|
-
dom$
|
|
14319
|
+
dom$k.addEventListener(elm, 'click', () => {
|
|
14317
14320
|
this.applyHtml(viewhtml);
|
|
14318
14321
|
});
|
|
14319
14322
|
elm = viewhtml.querySelector('.input-cancel');
|
|
14320
|
-
dom$
|
|
14323
|
+
dom$k.addEventListener(elm, 'click', () => {
|
|
14321
14324
|
this.builder.hideModal(viewhtml);
|
|
14322
14325
|
});
|
|
14323
14326
|
elm = viewhtmlmonaco.querySelector('.input-ok');
|
|
14324
|
-
dom$
|
|
14327
|
+
dom$k.addEventListener(elm, 'click', () => {
|
|
14325
14328
|
this.applyHtml(viewhtmlmonaco);
|
|
14326
14329
|
});
|
|
14327
14330
|
elm = viewhtmlmonaco.querySelector('.input-cancel');
|
|
14328
|
-
dom$
|
|
14331
|
+
dom$k.addEventListener(elm, 'click', () => {
|
|
14329
14332
|
this.builder.hideModal(viewhtmlmonaco);
|
|
14330
14333
|
});
|
|
14331
14334
|
elm = viewhtmlexternal.querySelector('.input-ok');
|
|
14332
|
-
dom$
|
|
14335
|
+
dom$k.addEventListener(elm, 'click', () => {
|
|
14333
14336
|
const source = document.querySelector('textarea[data-source-active]');
|
|
14334
14337
|
const selectorOk = source.getAttribute('data-source-ok');
|
|
14335
14338
|
source.removeAttribute('data-source-active');
|
|
@@ -14339,7 +14342,7 @@ class HtmlUtil {
|
|
|
14339
14342
|
this.builder.hideModal(viewhtmlexternal);
|
|
14340
14343
|
});
|
|
14341
14344
|
elm = viewhtmlexternal.querySelector('.input-cancel');
|
|
14342
|
-
dom$
|
|
14345
|
+
dom$k.addEventListener(elm, 'click', () => {
|
|
14343
14346
|
const source = document.querySelector('textarea[data-source-active]');
|
|
14344
14347
|
const selectorCancel = source.getAttribute('data-source-cancel');
|
|
14345
14348
|
source.removeAttribute('data-source-active');
|
|
@@ -14611,7 +14614,7 @@ class HtmlUtil {
|
|
|
14611
14614
|
this.builder.cleanHtmlFormatting = false;
|
|
14612
14615
|
|
|
14613
14616
|
//Change to row selection
|
|
14614
|
-
dom$
|
|
14617
|
+
dom$k.removeClass(row, 'row-outline');
|
|
14615
14618
|
}
|
|
14616
14619
|
if (mode === 'full') {
|
|
14617
14620
|
//
|
|
@@ -14845,10 +14848,10 @@ class HtmlUtil {
|
|
|
14845
14848
|
_builder.style.WebkitTransform = '';
|
|
14846
14849
|
_builder.style.MozTransform = '';
|
|
14847
14850
|
_builder.removeAttribute('data-sort');
|
|
14848
|
-
dom$
|
|
14849
|
-
const rows = dom$
|
|
14851
|
+
dom$k.removeClass(_builder, 'builder-active');
|
|
14852
|
+
const rows = dom$k.elementChildren(_builder);
|
|
14850
14853
|
rows.forEach(row => {
|
|
14851
|
-
const cols = dom$
|
|
14854
|
+
const cols = dom$k.elementChildren(row);
|
|
14852
14855
|
cols.forEach(col => {
|
|
14853
14856
|
col.style.cursor = '';
|
|
14854
14857
|
});
|
|
@@ -14856,95 +14859,95 @@ class HtmlUtil {
|
|
|
14856
14859
|
});
|
|
14857
14860
|
|
|
14858
14861
|
// cleanup cursor from drag to resize columns
|
|
14859
|
-
const rows = dom$
|
|
14862
|
+
const rows = dom$k.elementChildren(tmp);
|
|
14860
14863
|
rows.forEach(row => {
|
|
14861
14864
|
row.style.cursor = ''; //if tmp is row html, then this is a column
|
|
14862
|
-
const cols = dom$
|
|
14865
|
+
const cols = dom$k.elementChildren(row);
|
|
14863
14866
|
cols.forEach(col => {
|
|
14864
14867
|
col.style.cursor = '';
|
|
14865
14868
|
});
|
|
14866
14869
|
});
|
|
14867
14870
|
let elms = tmp.querySelectorAll('.sortable-chosen');
|
|
14868
|
-
dom$
|
|
14871
|
+
dom$k.removeClasses(elms, 'sortable-chosen');
|
|
14869
14872
|
elms = tmp.querySelectorAll('.sortable-ghost');
|
|
14870
|
-
dom$
|
|
14873
|
+
dom$k.removeClasses(elms, 'sortable-ghost');
|
|
14871
14874
|
elms = tmp.querySelectorAll('.elm-active');
|
|
14872
|
-
dom$
|
|
14875
|
+
dom$k.removeClasses(elms, 'elm-active');
|
|
14873
14876
|
elms = tmp.querySelectorAll('.elm-inspected');
|
|
14874
|
-
dom$
|
|
14877
|
+
dom$k.removeClasses(elms, 'elm-inspected');
|
|
14875
14878
|
elms = tmp.querySelectorAll('.cell-active');
|
|
14876
|
-
dom$
|
|
14879
|
+
dom$k.removeClasses(elms, 'cell-active');
|
|
14877
14880
|
elms = tmp.querySelectorAll('.row-active');
|
|
14878
|
-
dom$
|
|
14881
|
+
dom$k.removeClasses(elms, 'row-active');
|
|
14879
14882
|
elms = tmp.querySelectorAll('.row-outline');
|
|
14880
|
-
dom$
|
|
14883
|
+
dom$k.removeClasses(elms, 'row-outline');
|
|
14881
14884
|
elms = tmp.querySelectorAll('.is-builder');
|
|
14882
|
-
dom$
|
|
14885
|
+
dom$k.removeClasses(elms, 'is-builder');
|
|
14883
14886
|
elms = tmp.querySelectorAll('.row-outline');
|
|
14884
|
-
dom$
|
|
14887
|
+
dom$k.removeClasses(elms, 'row-outline');
|
|
14885
14888
|
elms = tmp.querySelectorAll('[data-click]');
|
|
14886
|
-
dom$
|
|
14889
|
+
dom$k.removeAttributes(elms, 'data-click');
|
|
14887
14890
|
elms = tmp.querySelectorAll('[contenteditable]');
|
|
14888
|
-
dom$
|
|
14891
|
+
dom$k.removeAttributes(elms, 'contenteditable');
|
|
14889
14892
|
elms = tmp.querySelectorAll('[draggridoutline]');
|
|
14890
|
-
dom$
|
|
14893
|
+
dom$k.removeAttributes(elms, 'draggridoutline');
|
|
14891
14894
|
elms = tmp.querySelectorAll('[between-blocks-left]');
|
|
14892
|
-
dom$
|
|
14895
|
+
dom$k.removeAttributes(elms, 'between-blocks-left');
|
|
14893
14896
|
elms = tmp.querySelectorAll('[between-blocks-center]');
|
|
14894
|
-
dom$
|
|
14897
|
+
dom$k.removeAttributes(elms, 'between-blocks-center');
|
|
14895
14898
|
elms = tmp.querySelectorAll('[hideelementhighlight]');
|
|
14896
|
-
dom$
|
|
14899
|
+
dom$k.removeAttributes(elms, 'hideelementhighlight');
|
|
14897
14900
|
elms = tmp.querySelectorAll('[data-module-active]');
|
|
14898
|
-
dom$
|
|
14901
|
+
dom$k.removeAttributes(elms, 'data-module-active');
|
|
14899
14902
|
elms = tmp.querySelectorAll('[draggable]');
|
|
14900
|
-
dom$
|
|
14903
|
+
dom$k.removeAttributes(elms, 'draggable');
|
|
14901
14904
|
elms = tmp.querySelectorAll('[data-animated]');
|
|
14902
|
-
dom$
|
|
14905
|
+
dom$k.removeAttributes(elms, 'data-animated');
|
|
14903
14906
|
elms = tmp.querySelectorAll('[data-saveforundo]');
|
|
14904
|
-
dom$
|
|
14907
|
+
dom$k.removeAttributes(elms, 'data-saveforundo');
|
|
14905
14908
|
elms = tmp.querySelectorAll('[hidesnippetaddtool]');
|
|
14906
|
-
dom$
|
|
14909
|
+
dom$k.removeAttributes(elms, 'hidesnippetaddtool');
|
|
14907
14910
|
elms = tmp.querySelectorAll('[gray]');
|
|
14908
|
-
dom$
|
|
14911
|
+
dom$k.removeAttributes(elms, 'gray');
|
|
14909
14912
|
elms = tmp.querySelectorAll('[rowoutline]');
|
|
14910
|
-
dom$
|
|
14913
|
+
dom$k.removeAttributes(elms, 'rowoutline');
|
|
14911
14914
|
elms = tmp.querySelectorAll('[hidecolumntool]');
|
|
14912
|
-
dom$
|
|
14915
|
+
dom$k.removeAttributes(elms, 'hidecolumntool');
|
|
14913
14916
|
elms = tmp.querySelectorAll('[grayoutline]');
|
|
14914
|
-
dom$
|
|
14917
|
+
dom$k.removeAttributes(elms, 'grayoutline');
|
|
14915
14918
|
elms = tmp.querySelectorAll('[hideoutline]');
|
|
14916
|
-
dom$
|
|
14919
|
+
dom$k.removeAttributes(elms, 'hideoutline');
|
|
14917
14920
|
elms = tmp.querySelectorAll('[leftrowtool]');
|
|
14918
|
-
dom$
|
|
14921
|
+
dom$k.removeAttributes(elms, 'leftrowtool');
|
|
14919
14922
|
elms = tmp.querySelectorAll('[minimal]');
|
|
14920
|
-
dom$
|
|
14923
|
+
dom$k.removeAttributes(elms, 'minimal');
|
|
14921
14924
|
elms = tmp.querySelectorAll('[clean]');
|
|
14922
|
-
dom$
|
|
14925
|
+
dom$k.removeAttributes(elms, 'clean');
|
|
14923
14926
|
elms = tmp.querySelectorAll('[grideditor]');
|
|
14924
|
-
dom$
|
|
14927
|
+
dom$k.removeAttributes(elms, 'grideditor');
|
|
14925
14928
|
elms = tmp.querySelectorAll('[gridoutline]');
|
|
14926
|
-
dom$
|
|
14927
|
-
dom$
|
|
14928
|
-
dom$
|
|
14929
|
-
dom$
|
|
14930
|
-
dom$
|
|
14931
|
-
dom$
|
|
14929
|
+
dom$k.removeAttributes(elms, 'gridoutline');
|
|
14930
|
+
dom$k.removeElements(tmp.querySelectorAll('.is-row-tool'));
|
|
14931
|
+
dom$k.removeElements(tmp.querySelectorAll('.is-col-tool'));
|
|
14932
|
+
dom$k.removeElements(tmp.querySelectorAll('.is-rowadd-tool'));
|
|
14933
|
+
dom$k.removeElements(tmp.querySelectorAll('.ovl'));
|
|
14934
|
+
dom$k.removeElements(tmp.querySelectorAll('.row-add-initial'));
|
|
14932
14935
|
|
|
14933
14936
|
//Extra cleaning
|
|
14934
14937
|
elms = tmp.querySelectorAll('.aos-init');
|
|
14935
|
-
dom$
|
|
14938
|
+
dom$k.removeClasses(elms, 'aos-init');
|
|
14936
14939
|
elms = tmp.querySelectorAll('.aos-animate');
|
|
14937
|
-
dom$
|
|
14940
|
+
dom$k.removeClasses(elms, 'aos-animate');
|
|
14938
14941
|
elms = tmp.querySelectorAll('.skrollable');
|
|
14939
|
-
dom$
|
|
14942
|
+
dom$k.removeClasses(elms, 'skrollable');
|
|
14940
14943
|
elms = tmp.querySelectorAll('.skrollable-after');
|
|
14941
|
-
dom$
|
|
14944
|
+
dom$k.removeClasses(elms, 'skrollable-after');
|
|
14942
14945
|
elms = tmp.querySelectorAll('.skrollable-before');
|
|
14943
|
-
dom$
|
|
14946
|
+
dom$k.removeClasses(elms, 'skrollable-before');
|
|
14944
14947
|
elms = tmp.querySelectorAll('.skrollable-between');
|
|
14945
|
-
dom$
|
|
14948
|
+
dom$k.removeClasses(elms, 'skrollable-between');
|
|
14946
14949
|
elms = tmp.querySelectorAll('.is-inview');
|
|
14947
|
-
dom$
|
|
14950
|
+
dom$k.removeClasses(elms, 'is-inview');
|
|
14948
14951
|
let emptyclasses = tmp.querySelectorAll('[class=""]');
|
|
14949
14952
|
Array.prototype.forEach.call(emptyclasses, emptyclass => {
|
|
14950
14953
|
emptyclass.removeAttribute('class');
|
|
@@ -14953,9 +14956,9 @@ class HtmlUtil {
|
|
|
14953
14956
|
Array.prototype.forEach.call(unusedOverlays, unusedOverlay => {
|
|
14954
14957
|
if (!unusedOverlay.hasAttribute('style')) unusedOverlay.parentNode.removeChild(unusedOverlay);
|
|
14955
14958
|
});
|
|
14956
|
-
dom$
|
|
14959
|
+
dom$k.removeEmptyStyle(tmp);
|
|
14957
14960
|
elms = tmp.querySelectorAll('[data-keep]');
|
|
14958
|
-
dom$
|
|
14961
|
+
dom$k.removeAttributes(elms, 'data-keep');
|
|
14959
14962
|
|
|
14960
14963
|
//Backward compatible: cleanup button <span contenteditable="false"><a contenteditable="true">button</a></span>
|
|
14961
14964
|
let links = tmp.querySelectorAll('a');
|
|
@@ -14972,76 +14975,76 @@ class HtmlUtil {
|
|
|
14972
14975
|
|
|
14973
14976
|
// Remove dummy DIV after last section
|
|
14974
14977
|
let elms = tmp.querySelectorAll('.is-dummy');
|
|
14975
|
-
dom$
|
|
14978
|
+
dom$k.removeElements(elms);
|
|
14976
14979
|
elms = tmp.querySelectorAll('[data-scroll]');
|
|
14977
|
-
dom$
|
|
14980
|
+
dom$k.removeAttributes(elms, 'data-scroll');
|
|
14978
14981
|
elms = tmp.querySelectorAll('[data-scroll-once]');
|
|
14979
|
-
dom$
|
|
14982
|
+
dom$k.removeAttributes(elms, 'data-scroll-once');
|
|
14980
14983
|
if (this.builder.shortenOutput) {
|
|
14981
14984
|
elms = tmp.querySelectorAll('[data-noedit]');
|
|
14982
|
-
dom$
|
|
14985
|
+
dom$k.removeAttributes(elms, 'data-noedit');
|
|
14983
14986
|
elms = tmp.querySelectorAll('[data-module]');
|
|
14984
|
-
dom$
|
|
14987
|
+
dom$k.removeAttributes(elms, 'data-module');
|
|
14985
14988
|
elms = tmp.querySelectorAll('[data-module-desc]');
|
|
14986
|
-
dom$
|
|
14989
|
+
dom$k.removeAttributes(elms, 'data-module-desc');
|
|
14987
14990
|
elms = tmp.querySelectorAll('[data-dialog-width]');
|
|
14988
|
-
dom$
|
|
14991
|
+
dom$k.removeAttributes(elms, 'data-dialog-width');
|
|
14989
14992
|
elms = tmp.querySelectorAll('[data-dialog-height]');
|
|
14990
|
-
dom$
|
|
14993
|
+
dom$k.removeAttributes(elms, 'data-dialog-height');
|
|
14991
14994
|
elms = tmp.querySelectorAll('[data-html]');
|
|
14992
|
-
dom$
|
|
14995
|
+
dom$k.removeAttributes(elms, 'data-html');
|
|
14993
14996
|
elms = tmp.querySelectorAll('[data-settings]');
|
|
14994
|
-
dom$
|
|
14997
|
+
dom$k.removeAttributes(elms, 'data-settings');
|
|
14995
14998
|
elms = tmp.querySelectorAll('[data-html-1]');
|
|
14996
|
-
dom$
|
|
14999
|
+
dom$k.removeAttributes(elms, 'data-html-1');
|
|
14997
15000
|
elms = tmp.querySelectorAll('[data-html-2]');
|
|
14998
|
-
dom$
|
|
15001
|
+
dom$k.removeAttributes(elms, 'data-html-2');
|
|
14999
15002
|
elms = tmp.querySelectorAll('[data-html-3]');
|
|
15000
|
-
dom$
|
|
15003
|
+
dom$k.removeAttributes(elms, 'data-html-3');
|
|
15001
15004
|
elms = tmp.querySelectorAll('[data-html-4]');
|
|
15002
|
-
dom$
|
|
15005
|
+
dom$k.removeAttributes(elms, 'data-html-4');
|
|
15003
15006
|
elms = tmp.querySelectorAll('[data-html-5]');
|
|
15004
|
-
dom$
|
|
15007
|
+
dom$k.removeAttributes(elms, 'data-html-5');
|
|
15005
15008
|
elms = tmp.querySelectorAll('[data-html-6]');
|
|
15006
|
-
dom$
|
|
15009
|
+
dom$k.removeAttributes(elms, 'data-html-6');
|
|
15007
15010
|
elms = tmp.querySelectorAll('[data-html-7]');
|
|
15008
|
-
dom$
|
|
15011
|
+
dom$k.removeAttributes(elms, 'data-html-7');
|
|
15009
15012
|
elms = tmp.querySelectorAll('[data-html-8]');
|
|
15010
|
-
dom$
|
|
15013
|
+
dom$k.removeAttributes(elms, 'data-html-8');
|
|
15011
15014
|
elms = tmp.querySelectorAll('[data-html-9]');
|
|
15012
|
-
dom$
|
|
15015
|
+
dom$k.removeAttributes(elms, 'data-html-9');
|
|
15013
15016
|
elms = tmp.querySelectorAll('[data-html-10]');
|
|
15014
|
-
dom$
|
|
15017
|
+
dom$k.removeAttributes(elms, 'data-html-10');
|
|
15015
15018
|
elms = tmp.querySelectorAll('[data-html-12]');
|
|
15016
|
-
dom$
|
|
15019
|
+
dom$k.removeAttributes(elms, 'data-html-12');
|
|
15017
15020
|
elms = tmp.querySelectorAll('[data-html-13]');
|
|
15018
|
-
dom$
|
|
15021
|
+
dom$k.removeAttributes(elms, 'data-html-13');
|
|
15019
15022
|
elms = tmp.querySelectorAll('[data-html-14]');
|
|
15020
|
-
dom$
|
|
15023
|
+
dom$k.removeAttributes(elms, 'data-html-14');
|
|
15021
15024
|
elms = tmp.querySelectorAll('[data-html-15]');
|
|
15022
|
-
dom$
|
|
15025
|
+
dom$k.removeAttributes(elms, 'data-html-15');
|
|
15023
15026
|
elms = tmp.querySelectorAll('[data-html-16]');
|
|
15024
|
-
dom$
|
|
15027
|
+
dom$k.removeAttributes(elms, 'data-html-16');
|
|
15025
15028
|
elms = tmp.querySelectorAll('[data-html-17]');
|
|
15026
|
-
dom$
|
|
15029
|
+
dom$k.removeAttributes(elms, 'data-html-17');
|
|
15027
15030
|
elms = tmp.querySelectorAll('[data-html-18]');
|
|
15028
|
-
dom$
|
|
15031
|
+
dom$k.removeAttributes(elms, 'data-html-18');
|
|
15029
15032
|
elms = tmp.querySelectorAll('[data-html-19]');
|
|
15030
|
-
dom$
|
|
15033
|
+
dom$k.removeAttributes(elms, 'data-html-19');
|
|
15031
15034
|
elms = tmp.querySelectorAll('[data-html-20]');
|
|
15032
|
-
dom$
|
|
15035
|
+
dom$k.removeAttributes(elms, 'data-html-20');
|
|
15033
15036
|
elms = tmp.querySelectorAll('[data-html-21]');
|
|
15034
|
-
dom$
|
|
15037
|
+
dom$k.removeAttributes(elms, 'data-html-21');
|
|
15035
15038
|
elms = tmp.querySelectorAll('[data-html-21]');
|
|
15036
|
-
dom$
|
|
15039
|
+
dom$k.removeAttributes(elms, 'data-html-21');
|
|
15037
15040
|
elms = tmp.querySelectorAll('[data-html-22]');
|
|
15038
|
-
dom$
|
|
15041
|
+
dom$k.removeAttributes(elms, 'data-html-22');
|
|
15039
15042
|
elms = tmp.querySelectorAll('[data-html-23]');
|
|
15040
|
-
dom$
|
|
15043
|
+
dom$k.removeAttributes(elms, 'data-html-23');
|
|
15041
15044
|
elms = tmp.querySelectorAll('[data-html-24]');
|
|
15042
|
-
dom$
|
|
15045
|
+
dom$k.removeAttributes(elms, 'data-html-24');
|
|
15043
15046
|
elms = tmp.querySelectorAll('[data-html-25]');
|
|
15044
|
-
dom$
|
|
15047
|
+
dom$k.removeAttributes(elms, 'data-html-25');
|
|
15045
15048
|
}
|
|
15046
15049
|
|
|
15047
15050
|
// cleaning
|
|
@@ -15057,22 +15060,22 @@ class HtmlUtil {
|
|
|
15057
15060
|
});
|
|
15058
15061
|
elms = tmp.querySelectorAll('.is-animated');
|
|
15059
15062
|
Array.prototype.forEach.call(elms, elm => {
|
|
15060
|
-
dom$
|
|
15061
|
-
dom$
|
|
15062
|
-
dom$
|
|
15063
|
-
dom$
|
|
15064
|
-
dom$
|
|
15065
|
-
dom$
|
|
15066
|
-
dom$
|
|
15067
|
-
dom$
|
|
15068
|
-
dom$
|
|
15069
|
-
dom$
|
|
15070
|
-
dom$
|
|
15071
|
-
dom$
|
|
15072
|
-
dom$
|
|
15073
|
-
dom$
|
|
15074
|
-
dom$
|
|
15075
|
-
dom$
|
|
15063
|
+
dom$k.removeClass(elm, 'animated');
|
|
15064
|
+
dom$k.removeClass(elm, 'pulse');
|
|
15065
|
+
dom$k.removeClass(elm, 'bounceIn');
|
|
15066
|
+
dom$k.removeClass(elm, 'fadeIn');
|
|
15067
|
+
dom$k.removeClass(elm, 'fadeOut'); //new
|
|
15068
|
+
dom$k.removeClass(elm, 'fadeInDown');
|
|
15069
|
+
dom$k.removeClass(elm, 'fadeInLeft');
|
|
15070
|
+
dom$k.removeClass(elm, 'fadeInRight');
|
|
15071
|
+
dom$k.removeClass(elm, 'fadeInUp');
|
|
15072
|
+
dom$k.removeClass(elm, 'flipInX');
|
|
15073
|
+
dom$k.removeClass(elm, 'flipInY');
|
|
15074
|
+
dom$k.removeClass(elm, 'slideInUp');
|
|
15075
|
+
dom$k.removeClass(elm, 'slideInDown');
|
|
15076
|
+
dom$k.removeClass(elm, 'slideInLeft');
|
|
15077
|
+
dom$k.removeClass(elm, 'slideInRight');
|
|
15078
|
+
dom$k.removeClass(elm, 'zoomIn');
|
|
15076
15079
|
elm.style.animationDelay = '';
|
|
15077
15080
|
elm.style.transitionDelay = '';
|
|
15078
15081
|
elm.style.transitionDuration = '';
|
|
@@ -15087,39 +15090,39 @@ class HtmlUtil {
|
|
|
15087
15090
|
//Cleanup utils
|
|
15088
15091
|
elms = tmp.querySelectorAll('.is-appeared');
|
|
15089
15092
|
Array.prototype.forEach.call(elms, elm => {
|
|
15090
|
-
dom$
|
|
15093
|
+
dom$k.removeClass(elm, 'is-appeared');
|
|
15091
15094
|
});
|
|
15092
15095
|
elms = tmp.querySelectorAll('.box-active');
|
|
15093
15096
|
Array.prototype.forEach.call(elms, elm => {
|
|
15094
|
-
dom$
|
|
15097
|
+
dom$k.removeClass(elm, 'box-active');
|
|
15095
15098
|
});
|
|
15096
15099
|
elms = tmp.querySelectorAll('.section-active');
|
|
15097
15100
|
Array.prototype.forEach.call(elms, elm => {
|
|
15098
|
-
dom$
|
|
15101
|
+
dom$k.removeClass(elm, 'section-active');
|
|
15099
15102
|
});
|
|
15100
15103
|
elms = tmp.querySelectorAll('.section-select');
|
|
15101
15104
|
Array.prototype.forEach.call(elms, elm => {
|
|
15102
|
-
dom$
|
|
15105
|
+
dom$k.removeClass(elm, 'section-select');
|
|
15103
15106
|
});
|
|
15104
15107
|
elms = tmp.querySelectorAll('.box-select');
|
|
15105
15108
|
Array.prototype.forEach.call(elms, elm => {
|
|
15106
|
-
dom$
|
|
15109
|
+
dom$k.removeClass(elm, 'box-select');
|
|
15107
15110
|
});
|
|
15108
15111
|
elms = tmp.querySelectorAll('.is-section-tool');
|
|
15109
|
-
dom$
|
|
15112
|
+
dom$k.removeElements(elms);
|
|
15110
15113
|
elms = tmp.querySelectorAll('.is-box-tool');
|
|
15111
|
-
dom$
|
|
15114
|
+
dom$k.removeElements(elms);
|
|
15112
15115
|
elms = tmp.querySelectorAll('.is-section-info');
|
|
15113
|
-
dom$
|
|
15116
|
+
dom$k.removeElements(elms);
|
|
15114
15117
|
var html_content = '';
|
|
15115
15118
|
var html_footer = '';
|
|
15116
15119
|
var html_others = '';
|
|
15117
15120
|
|
|
15118
15121
|
// Apply behavior on each row
|
|
15119
|
-
const sections = dom$
|
|
15122
|
+
const sections = dom$k.elementChildren(tmp);
|
|
15120
15123
|
sections.forEach(section => {
|
|
15121
15124
|
let currentSection = section;
|
|
15122
|
-
if (dom$
|
|
15125
|
+
if (dom$k.hasClass(currentSection, 'is-section')) {
|
|
15123
15126
|
var secclass = '';
|
|
15124
15127
|
// var secstyle = '';
|
|
15125
15128
|
if (currentSection.getAttribute('class')) secclass = ' class="' + currentSection.getAttribute('class') + '"';
|
|
@@ -15163,69 +15166,69 @@ class HtmlUtil {
|
|
|
15163
15166
|
});
|
|
15164
15167
|
if (this.builder.shortenOutput) {
|
|
15165
15168
|
elms = tmp.querySelectorAll('[data-noedit]');
|
|
15166
|
-
dom$
|
|
15169
|
+
dom$k.removeAttributes(elms, 'data-noedit');
|
|
15167
15170
|
elms = tmp.querySelectorAll('[data-module]');
|
|
15168
|
-
dom$
|
|
15171
|
+
dom$k.removeAttributes(elms, 'data-module');
|
|
15169
15172
|
elms = tmp.querySelectorAll('[data-module-desc]');
|
|
15170
|
-
dom$
|
|
15173
|
+
dom$k.removeAttributes(elms, 'data-module-desc');
|
|
15171
15174
|
elms = tmp.querySelectorAll('[data-dialog-width]');
|
|
15172
|
-
dom$
|
|
15175
|
+
dom$k.removeAttributes(elms, 'data-dialog-width');
|
|
15173
15176
|
elms = tmp.querySelectorAll('[data-dialog-height]');
|
|
15174
|
-
dom$
|
|
15177
|
+
dom$k.removeAttributes(elms, 'data-dialog-height');
|
|
15175
15178
|
elms = tmp.querySelectorAll('[data-html]');
|
|
15176
|
-
dom$
|
|
15179
|
+
dom$k.removeAttributes(elms, 'data-html');
|
|
15177
15180
|
elms = tmp.querySelectorAll('[data-settings]');
|
|
15178
|
-
dom$
|
|
15181
|
+
dom$k.removeAttributes(elms, 'data-settings');
|
|
15179
15182
|
elms = tmp.querySelectorAll('[data-html-1]');
|
|
15180
|
-
dom$
|
|
15183
|
+
dom$k.removeAttributes(elms, 'data-html-1');
|
|
15181
15184
|
elms = tmp.querySelectorAll('[data-html-2]');
|
|
15182
|
-
dom$
|
|
15185
|
+
dom$k.removeAttributes(elms, 'data-html-2');
|
|
15183
15186
|
elms = tmp.querySelectorAll('[data-html-3]');
|
|
15184
|
-
dom$
|
|
15187
|
+
dom$k.removeAttributes(elms, 'data-html-3');
|
|
15185
15188
|
elms = tmp.querySelectorAll('[data-html-4]');
|
|
15186
|
-
dom$
|
|
15189
|
+
dom$k.removeAttributes(elms, 'data-html-4');
|
|
15187
15190
|
elms = tmp.querySelectorAll('[data-html-5]');
|
|
15188
|
-
dom$
|
|
15191
|
+
dom$k.removeAttributes(elms, 'data-html-5');
|
|
15189
15192
|
elms = tmp.querySelectorAll('[data-html-6]');
|
|
15190
|
-
dom$
|
|
15193
|
+
dom$k.removeAttributes(elms, 'data-html-6');
|
|
15191
15194
|
elms = tmp.querySelectorAll('[data-html-7]');
|
|
15192
|
-
dom$
|
|
15195
|
+
dom$k.removeAttributes(elms, 'data-html-7');
|
|
15193
15196
|
elms = tmp.querySelectorAll('[data-html-8]');
|
|
15194
|
-
dom$
|
|
15197
|
+
dom$k.removeAttributes(elms, 'data-html-8');
|
|
15195
15198
|
elms = tmp.querySelectorAll('[data-html-9]');
|
|
15196
|
-
dom$
|
|
15199
|
+
dom$k.removeAttributes(elms, 'data-html-9');
|
|
15197
15200
|
elms = tmp.querySelectorAll('[data-html-10]');
|
|
15198
|
-
dom$
|
|
15201
|
+
dom$k.removeAttributes(elms, 'data-html-10');
|
|
15199
15202
|
elms = tmp.querySelectorAll('[data-html-12]');
|
|
15200
|
-
dom$
|
|
15203
|
+
dom$k.removeAttributes(elms, 'data-html-12');
|
|
15201
15204
|
elms = tmp.querySelectorAll('[data-html-13]');
|
|
15202
|
-
dom$
|
|
15205
|
+
dom$k.removeAttributes(elms, 'data-html-13');
|
|
15203
15206
|
elms = tmp.querySelectorAll('[data-html-14]');
|
|
15204
|
-
dom$
|
|
15207
|
+
dom$k.removeAttributes(elms, 'data-html-14');
|
|
15205
15208
|
elms = tmp.querySelectorAll('[data-html-15]');
|
|
15206
|
-
dom$
|
|
15209
|
+
dom$k.removeAttributes(elms, 'data-html-15');
|
|
15207
15210
|
elms = tmp.querySelectorAll('[data-html-16]');
|
|
15208
|
-
dom$
|
|
15211
|
+
dom$k.removeAttributes(elms, 'data-html-16');
|
|
15209
15212
|
elms = tmp.querySelectorAll('[data-html-17]');
|
|
15210
|
-
dom$
|
|
15213
|
+
dom$k.removeAttributes(elms, 'data-html-17');
|
|
15211
15214
|
elms = tmp.querySelectorAll('[data-html-18]');
|
|
15212
|
-
dom$
|
|
15215
|
+
dom$k.removeAttributes(elms, 'data-html-18');
|
|
15213
15216
|
elms = tmp.querySelectorAll('[data-html-19]');
|
|
15214
|
-
dom$
|
|
15217
|
+
dom$k.removeAttributes(elms, 'data-html-19');
|
|
15215
15218
|
elms = tmp.querySelectorAll('[data-html-20]');
|
|
15216
|
-
dom$
|
|
15219
|
+
dom$k.removeAttributes(elms, 'data-html-20');
|
|
15217
15220
|
elms = tmp.querySelectorAll('[data-html-21]');
|
|
15218
|
-
dom$
|
|
15221
|
+
dom$k.removeAttributes(elms, 'data-html-21');
|
|
15219
15222
|
elms = tmp.querySelectorAll('[data-html-21]');
|
|
15220
|
-
dom$
|
|
15223
|
+
dom$k.removeAttributes(elms, 'data-html-21');
|
|
15221
15224
|
elms = tmp.querySelectorAll('[data-html-22]');
|
|
15222
|
-
dom$
|
|
15225
|
+
dom$k.removeAttributes(elms, 'data-html-22');
|
|
15223
15226
|
elms = tmp.querySelectorAll('[data-html-23]');
|
|
15224
|
-
dom$
|
|
15227
|
+
dom$k.removeAttributes(elms, 'data-html-23');
|
|
15225
15228
|
elms = tmp.querySelectorAll('[data-html-24]');
|
|
15226
|
-
dom$
|
|
15229
|
+
dom$k.removeAttributes(elms, 'data-html-24');
|
|
15227
15230
|
elms = tmp.querySelectorAll('[data-html-25]');
|
|
15228
|
-
dom$
|
|
15231
|
+
dom$k.removeAttributes(elms, 'data-html-25');
|
|
15229
15232
|
}
|
|
15230
15233
|
html = tmp.innerHTML.trim();
|
|
15231
15234
|
html = html.replace(/<font/g, '<span').replace(/<\/font/g, '</span');
|
|
@@ -21768,7 +21771,7 @@ _extends(Remove, {
|
|
|
21768
21771
|
Sortable.mount(new AutoScrollPlugin());
|
|
21769
21772
|
Sortable.mount(Remove, Revert);
|
|
21770
21773
|
|
|
21771
|
-
const dom$
|
|
21774
|
+
const dom$j = new Dom();
|
|
21772
21775
|
class Select {
|
|
21773
21776
|
constructor(dropDown) {
|
|
21774
21777
|
const [toggler, menu] = dropDown.children;
|
|
@@ -21789,13 +21792,13 @@ class Select {
|
|
|
21789
21792
|
this.toggle(false);
|
|
21790
21793
|
dropDown.dispatchEvent(new Event('change'));
|
|
21791
21794
|
toggler.focus();
|
|
21792
|
-
let elms = dom$
|
|
21795
|
+
let elms = dom$j.elementChildren(menu);
|
|
21793
21796
|
elms.forEach(elm => {
|
|
21794
|
-
dom$
|
|
21797
|
+
dom$j.removeClass(elm, 'selected');
|
|
21795
21798
|
});
|
|
21796
21799
|
let optionselected = menu.querySelector('[data-value="' + val + '"]');
|
|
21797
21800
|
if (optionselected) {
|
|
21798
|
-
dom$
|
|
21801
|
+
dom$j.addClass(optionselected, 'selected');
|
|
21799
21802
|
}
|
|
21800
21803
|
};
|
|
21801
21804
|
const handleItemKeyDown = e => {
|
|
@@ -21845,7 +21848,7 @@ class Select {
|
|
|
21845
21848
|
// menu.children[0].focus();
|
|
21846
21849
|
let optionselected = menu.querySelector('[data-value="' + this.value + '"]');
|
|
21847
21850
|
if (optionselected) {
|
|
21848
|
-
dom$
|
|
21851
|
+
dom$j.addClass(optionselected, 'selected');
|
|
21849
21852
|
optionselected.focus();
|
|
21850
21853
|
}
|
|
21851
21854
|
document.addEventListener('click', handleClickOut);
|
|
@@ -60982,7 +60985,7 @@ class ColumnTool {
|
|
|
60982
60985
|
}
|
|
60983
60986
|
}
|
|
60984
60987
|
|
|
60985
|
-
const dom$
|
|
60988
|
+
const dom$i = new Dom();
|
|
60986
60989
|
class ELementStyleEditor {
|
|
60987
60990
|
constructor(builder) {
|
|
60988
60991
|
this.builder = builder;
|
|
@@ -61013,20 +61016,20 @@ class ELementStyleEditor {
|
|
|
61013
61016
|
</div>
|
|
61014
61017
|
</div>
|
|
61015
61018
|
`;
|
|
61016
|
-
dom$
|
|
61019
|
+
dom$i.appendHtml(builderStuff, html);
|
|
61017
61020
|
modalStyles = builderStuff.querySelector('.editstyles');
|
|
61018
61021
|
let btn = modalStyles.querySelector('.is-modal-close');
|
|
61019
|
-
dom$
|
|
61020
|
-
dom$
|
|
61022
|
+
dom$i.addEventListener(btn, 'click', () => {
|
|
61023
|
+
dom$i.removeClass(modalStyles, 'active');
|
|
61021
61024
|
var panel = this.builderStuff.querySelector('.is-side.elementstyles'); // if all close
|
|
61022
|
-
if (!dom$
|
|
61025
|
+
if (!dom$i.hasClass(panel, 'active')) {
|
|
61023
61026
|
let elms = document.querySelectorAll('[data-saveforundo]');
|
|
61024
61027
|
Array.prototype.forEach.call(elms, elm => {
|
|
61025
61028
|
elm.removeAttribute('data-saveforundo');
|
|
61026
61029
|
});
|
|
61027
61030
|
elms = document.querySelectorAll('.elm-inspected');
|
|
61028
61031
|
Array.prototype.forEach.call(elms, elm => {
|
|
61029
|
-
dom$
|
|
61032
|
+
dom$i.removeClass(elm, 'elm-inspected');
|
|
61030
61033
|
});
|
|
61031
61034
|
}
|
|
61032
61035
|
});
|
|
@@ -61037,24 +61040,24 @@ class ELementStyleEditor {
|
|
|
61037
61040
|
|
|
61038
61041
|
//builder classes
|
|
61039
61042
|
let bElmActive = false;
|
|
61040
|
-
if (dom$
|
|
61043
|
+
if (dom$i.hasClass(elm, 'elm-active')) {
|
|
61041
61044
|
bElmActive = true;
|
|
61042
61045
|
}
|
|
61043
61046
|
let bCellActive = false;
|
|
61044
|
-
if (dom$
|
|
61047
|
+
if (dom$i.hasClass(elm, 'elm-active')) {
|
|
61045
61048
|
bCellActive = true;
|
|
61046
61049
|
}
|
|
61047
61050
|
let bRowActive = false;
|
|
61048
|
-
if (dom$
|
|
61051
|
+
if (dom$i.hasClass(elm, 'row-active')) {
|
|
61049
61052
|
bRowActive = true;
|
|
61050
61053
|
}
|
|
61051
61054
|
elm.setAttribute('class', val); //update
|
|
61052
61055
|
|
|
61053
61056
|
//builder classes
|
|
61054
|
-
if (bElmActive) dom$
|
|
61055
|
-
if (bCellActive) dom$
|
|
61056
|
-
if (bRowActive) dom$
|
|
61057
|
-
dom$
|
|
61057
|
+
if (bElmActive) dom$i.addClass(elm, 'elm-active');
|
|
61058
|
+
if (bCellActive) dom$i.addClass(elm, 'cell-active');
|
|
61059
|
+
if (bRowActive) dom$i.addClass(elm, 'row-active');
|
|
61060
|
+
dom$i.addClass(elm, 'elm-inspected');
|
|
61058
61061
|
|
|
61059
61062
|
//Trigger Change event
|
|
61060
61063
|
this.builder.opts.onChange();
|
|
@@ -61070,10 +61073,10 @@ class ELementStyleEditor {
|
|
|
61070
61073
|
this.modalStyles = modalStyles;
|
|
61071
61074
|
}
|
|
61072
61075
|
toggleStyleEditor() {
|
|
61073
|
-
if (!dom$
|
|
61074
|
-
dom$
|
|
61076
|
+
if (!dom$i.hasClass(this.modalStyles, 'active')) {
|
|
61077
|
+
dom$i.addClass(this.modalStyles, 'active');
|
|
61075
61078
|
} else {
|
|
61076
|
-
dom$
|
|
61079
|
+
dom$i.removeClass(this.modalStyles, 'active');
|
|
61077
61080
|
}
|
|
61078
61081
|
}
|
|
61079
61082
|
refresh() {
|
|
@@ -61090,7 +61093,7 @@ class ELementStyleEditor {
|
|
|
61090
61093
|
}
|
|
61091
61094
|
}
|
|
61092
61095
|
|
|
61093
|
-
const dom$
|
|
61096
|
+
const dom$h = new Dom();
|
|
61094
61097
|
class ElementGeneralStyles {
|
|
61095
61098
|
constructor(builder) {
|
|
61096
61099
|
this.builder = builder;
|
|
@@ -61166,7 +61169,7 @@ class ElementGeneralStyles {
|
|
|
61166
61169
|
|
|
61167
61170
|
|
|
61168
61171
|
`;
|
|
61169
|
-
dom$
|
|
61172
|
+
dom$h.appendHtml(panelStuff, html);
|
|
61170
61173
|
|
|
61171
61174
|
// Background color
|
|
61172
61175
|
let btnElmBgColor = panelStuff.querySelector('.input-elm-bgcolor');
|
|
@@ -61216,7 +61219,7 @@ class ElementGeneralStyles {
|
|
|
61216
61219
|
|
|
61217
61220
|
// Elm Background Image
|
|
61218
61221
|
const btnElmBgImage = panelStuff.querySelector('.input-elm-bgimage');
|
|
61219
|
-
if (btnElmBgImage) dom$
|
|
61222
|
+
if (btnElmBgImage) dom$h.addEventListener(btnElmBgImage, 'click', () => {
|
|
61220
61223
|
const elm = this.builder.inspectedElement;
|
|
61221
61224
|
|
|
61222
61225
|
//Get current value
|
|
@@ -61254,12 +61257,12 @@ class ElementGeneralStyles {
|
|
|
61254
61257
|
|
|
61255
61258
|
// Elm Background Image Adjust
|
|
61256
61259
|
const btnImageAdjust = panelStuff.querySelector('.input-elm-bgimageadjust');
|
|
61257
|
-
if (btnImageAdjust) dom$
|
|
61260
|
+
if (btnImageAdjust) dom$h.addEventListener(btnImageAdjust, 'click', () => {
|
|
61258
61261
|
const elm = this.builder.inspectedElement;
|
|
61259
61262
|
this.builder.colTool.openImageAdjust(elm, btnImageAdjust);
|
|
61260
61263
|
});
|
|
61261
61264
|
const btnImageRemove = panelStuff.querySelector('.input-elm-bgremove');
|
|
61262
|
-
if (btnImageRemove) dom$
|
|
61265
|
+
if (btnImageRemove) dom$h.addEventListener(btnImageRemove, 'click', () => {
|
|
61263
61266
|
const elm = this.builder.inspectedElement;
|
|
61264
61267
|
this.builder.uo.saveForUndo();
|
|
61265
61268
|
elm.style.backgroundImage = '';
|
|
@@ -61460,7 +61463,7 @@ class ElementGeneralStyles {
|
|
|
61460
61463
|
}
|
|
61461
61464
|
}
|
|
61462
61465
|
|
|
61463
|
-
const dom$
|
|
61466
|
+
const dom$g = new Dom();
|
|
61464
61467
|
class ElementBoxStyles {
|
|
61465
61468
|
constructor(builder) {
|
|
61466
61469
|
this.builder = builder;
|
|
@@ -61572,7 +61575,7 @@ class ElementBoxStyles {
|
|
|
61572
61575
|
</div>
|
|
61573
61576
|
</div>
|
|
61574
61577
|
`;
|
|
61575
|
-
dom$
|
|
61578
|
+
dom$g.appendHtml(panelStuff, html);
|
|
61576
61579
|
|
|
61577
61580
|
// Others
|
|
61578
61581
|
let inpElmMaxWidth = panelStuff.querySelector('#inpElmMaxWidth');
|
|
@@ -61913,7 +61916,7 @@ class ElementBoxStyles {
|
|
|
61913
61916
|
}
|
|
61914
61917
|
}
|
|
61915
61918
|
|
|
61916
|
-
const dom$
|
|
61919
|
+
const dom$f = new Dom();
|
|
61917
61920
|
class ElementSpacingStyles {
|
|
61918
61921
|
constructor(builder) {
|
|
61919
61922
|
this.builder = builder;
|
|
@@ -62054,7 +62057,7 @@ class ElementSpacingStyles {
|
|
|
62054
62057
|
</div>
|
|
62055
62058
|
</div>
|
|
62056
62059
|
`;
|
|
62057
|
-
dom$
|
|
62060
|
+
dom$f.appendHtml(panelStuff, html);
|
|
62058
62061
|
|
|
62059
62062
|
// Margin
|
|
62060
62063
|
let inpElmMarginLeft = panelStuff.querySelector('#inpElmMarginLeft');
|
|
@@ -62354,9 +62357,9 @@ class ElementSpacingStyles {
|
|
|
62354
62357
|
this.builder.uo.saveForUndo();
|
|
62355
62358
|
let elm = this.builder.inspectedElement;
|
|
62356
62359
|
if (chkResetMarginLeft.checked) {
|
|
62357
|
-
dom$
|
|
62360
|
+
dom$f.addClass(elm, 'margin-left-1024-reset');
|
|
62358
62361
|
} else {
|
|
62359
|
-
dom$
|
|
62362
|
+
dom$f.removeClass(elm, 'margin-left-1024-reset');
|
|
62360
62363
|
}
|
|
62361
62364
|
elementStyleEditor.refresh();
|
|
62362
62365
|
|
|
@@ -62368,9 +62371,9 @@ class ElementSpacingStyles {
|
|
|
62368
62371
|
this.builder.uo.saveForUndo();
|
|
62369
62372
|
let elm = this.builder.inspectedElement;
|
|
62370
62373
|
if (chkResetMarginRight.checked) {
|
|
62371
|
-
dom$
|
|
62374
|
+
dom$f.addClass(elm, 'margin-right-1024-reset');
|
|
62372
62375
|
} else {
|
|
62373
|
-
dom$
|
|
62376
|
+
dom$f.removeClass(elm, 'margin-right-1024-reset');
|
|
62374
62377
|
}
|
|
62375
62378
|
elementStyleEditor.refresh();
|
|
62376
62379
|
|
|
@@ -62519,12 +62522,12 @@ class ElementSpacingStyles {
|
|
|
62519
62522
|
}
|
|
62520
62523
|
|
|
62521
62524
|
// Responsive Positioning
|
|
62522
|
-
if (dom$
|
|
62525
|
+
if (dom$f.hasClass(elm, 'margin-left-1024-reset')) {
|
|
62523
62526
|
panelStuff.querySelector('#chkResetMarginLeft').checked = true;
|
|
62524
62527
|
} else {
|
|
62525
62528
|
panelStuff.querySelector('#chkResetMarginLeft').checked = false;
|
|
62526
62529
|
}
|
|
62527
|
-
if (dom$
|
|
62530
|
+
if (dom$f.hasClass(elm, 'margin-right-1024-reset')) {
|
|
62528
62531
|
panelStuff.querySelector('#chkResetMarginRight').checked = true;
|
|
62529
62532
|
} else {
|
|
62530
62533
|
panelStuff.querySelector('#chkResetMarginRight').checked = false;
|
|
@@ -62532,7 +62535,7 @@ class ElementSpacingStyles {
|
|
|
62532
62535
|
}
|
|
62533
62536
|
}
|
|
62534
62537
|
|
|
62535
|
-
const dom$
|
|
62538
|
+
const dom$e = new Dom();
|
|
62536
62539
|
class ElementBorderStyles {
|
|
62537
62540
|
constructor(builder) {
|
|
62538
62541
|
this.builder = builder;
|
|
@@ -62652,7 +62655,7 @@ class ElementBorderStyles {
|
|
|
62652
62655
|
</div>
|
|
62653
62656
|
</div>
|
|
62654
62657
|
`;
|
|
62655
|
-
dom$
|
|
62658
|
+
dom$e.appendHtml(panelStuff, html);
|
|
62656
62659
|
|
|
62657
62660
|
// Border color
|
|
62658
62661
|
let btnElmBorderColor = panelStuff.querySelector('.input-elm-bordercolor');
|
|
@@ -63232,7 +63235,7 @@ class ElementBorderStyles {
|
|
|
63232
63235
|
}
|
|
63233
63236
|
}
|
|
63234
63237
|
|
|
63235
|
-
const dom$
|
|
63238
|
+
const dom$d = new Dom();
|
|
63236
63239
|
class ElementTextStyles {
|
|
63237
63240
|
constructor(builder) {
|
|
63238
63241
|
this.builder = builder;
|
|
@@ -63373,7 +63376,7 @@ class ElementTextStyles {
|
|
|
63373
63376
|
</div>
|
|
63374
63377
|
</div>
|
|
63375
63378
|
`;
|
|
63376
|
-
dom$
|
|
63379
|
+
dom$d.appendHtml(panelStuff, html);
|
|
63377
63380
|
const htmlmodal = `
|
|
63378
63381
|
<div class="is-modal pickfontfamily" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
|
63379
63382
|
<div class="is-modal-content">
|
|
@@ -63384,7 +63387,7 @@ class ElementTextStyles {
|
|
|
63384
63387
|
</div>
|
|
63385
63388
|
</div>
|
|
63386
63389
|
`;
|
|
63387
|
-
dom$
|
|
63390
|
+
dom$d.appendHtml(builderStuff, htmlmodal);
|
|
63388
63391
|
const fontModal = builderStuff.querySelector('.is-modal.pickfontfamily');
|
|
63389
63392
|
|
|
63390
63393
|
// Text color
|
|
@@ -63493,8 +63496,8 @@ class ElementTextStyles {
|
|
|
63493
63496
|
// Get current class size & remove all class size from the element
|
|
63494
63497
|
const arrSizes = this.builder.opts.fontSizeClassValues;
|
|
63495
63498
|
for (var i = 0; i <= arrSizes.length - 1; i++) {
|
|
63496
|
-
if (dom$
|
|
63497
|
-
dom$
|
|
63499
|
+
if (dom$d.hasClass(elm, 'size-' + arrSizes[i])) {
|
|
63500
|
+
dom$d.removeClass(elm, 'size-' + arrSizes[i]);
|
|
63498
63501
|
}
|
|
63499
63502
|
}
|
|
63500
63503
|
elementStyleEditor.refresh();
|
|
@@ -63636,9 +63639,9 @@ class ElementTextStyles {
|
|
|
63636
63639
|
f = f.split(',')[0];
|
|
63637
63640
|
f = f.trim().toLowerCase();
|
|
63638
63641
|
if (f === fontname && f !== '') {
|
|
63639
|
-
dom$
|
|
63642
|
+
dom$d.addClass(e, 'on');
|
|
63640
63643
|
} else {
|
|
63641
|
-
dom$
|
|
63644
|
+
dom$d.removeClass(e, 'on');
|
|
63642
63645
|
}
|
|
63643
63646
|
});
|
|
63644
63647
|
|
|
@@ -63653,7 +63656,7 @@ class ElementTextStyles {
|
|
|
63653
63656
|
} else {
|
|
63654
63657
|
if (iframeDocument) {
|
|
63655
63658
|
[].forEach.call(iframeDocument.querySelectorAll('#divFontList > li'), e => {
|
|
63656
|
-
dom$
|
|
63659
|
+
dom$d.removeClass(e, 'on');
|
|
63657
63660
|
});
|
|
63658
63661
|
}
|
|
63659
63662
|
}
|
|
@@ -63752,7 +63755,7 @@ class ElementTextStyles {
|
|
|
63752
63755
|
}
|
|
63753
63756
|
}
|
|
63754
63757
|
|
|
63755
|
-
const dom$
|
|
63758
|
+
const dom$c = new Dom();
|
|
63756
63759
|
class ElementCornerStyles {
|
|
63757
63760
|
constructor(builder) {
|
|
63758
63761
|
this.builder = builder;
|
|
@@ -63803,7 +63806,7 @@ class ElementCornerStyles {
|
|
|
63803
63806
|
</div>
|
|
63804
63807
|
</div>
|
|
63805
63808
|
`;
|
|
63806
|
-
dom$
|
|
63809
|
+
dom$c.appendHtml(panelStuff, html);
|
|
63807
63810
|
const inpElmBorderRadius = panelStuff.querySelector('#inpElmBorderRadius');
|
|
63808
63811
|
inpElmBorderRadius.addEventListener('click', () => {
|
|
63809
63812
|
this.builder.uo.saveForUndo();
|
|
@@ -63930,7 +63933,7 @@ class ElementCornerStyles {
|
|
|
63930
63933
|
}
|
|
63931
63934
|
}
|
|
63932
63935
|
|
|
63933
|
-
const dom$
|
|
63936
|
+
const dom$b = new Dom();
|
|
63934
63937
|
class ElementShadowStyles {
|
|
63935
63938
|
constructor(builder) {
|
|
63936
63939
|
this.builder = builder;
|
|
@@ -64005,7 +64008,7 @@ class ElementShadowStyles {
|
|
|
64005
64008
|
</div>
|
|
64006
64009
|
</div>
|
|
64007
64010
|
`;
|
|
64008
|
-
dom$
|
|
64011
|
+
dom$b.appendHtml(panelStuff, html);
|
|
64009
64012
|
|
|
64010
64013
|
// Shadow color
|
|
64011
64014
|
let btnElmShadowColor = panelStuff.querySelector('.input-elm-shadowcolor');
|
|
@@ -64177,7 +64180,7 @@ class ElementShadowStyles {
|
|
|
64177
64180
|
}
|
|
64178
64181
|
}
|
|
64179
64182
|
|
|
64180
|
-
const dom$
|
|
64183
|
+
const dom$a = new Dom();
|
|
64181
64184
|
class ElementDisplayStyles {
|
|
64182
64185
|
constructor(builder) {
|
|
64183
64186
|
this.builder = builder;
|
|
@@ -64274,7 +64277,7 @@ class ElementDisplayStyles {
|
|
|
64274
64277
|
</div>
|
|
64275
64278
|
</div>
|
|
64276
64279
|
`;
|
|
64277
|
-
dom$
|
|
64280
|
+
dom$a.appendHtml(panelStuff, html);
|
|
64278
64281
|
const inpElmDisplay = panelStuff.querySelector('#inpElmDisplay');
|
|
64279
64282
|
inpElmDisplay.addEventListener('change', () => {
|
|
64280
64283
|
this.builder.uo.saveForUndo();
|
|
@@ -64371,7 +64374,7 @@ class ElementDisplayStyles {
|
|
|
64371
64374
|
}
|
|
64372
64375
|
}
|
|
64373
64376
|
|
|
64374
|
-
const dom$
|
|
64377
|
+
const dom$9 = new Dom();
|
|
64375
64378
|
class ElementPositionStyles {
|
|
64376
64379
|
constructor(builder) {
|
|
64377
64380
|
this.builder = builder;
|
|
@@ -64465,7 +64468,7 @@ class ElementPositionStyles {
|
|
|
64465
64468
|
</div>
|
|
64466
64469
|
</div>
|
|
64467
64470
|
`;
|
|
64468
|
-
dom$
|
|
64471
|
+
dom$9.appendHtml(panelStuff, html);
|
|
64469
64472
|
const inpElmPosition = panelStuff.querySelector('#inpElmPosition');
|
|
64470
64473
|
inpElmPosition.addEventListener('change', () => {
|
|
64471
64474
|
this.builder.uo.saveForUndo();
|
|
@@ -64694,7 +64697,7 @@ class ElementPositionStyles {
|
|
|
64694
64697
|
}
|
|
64695
64698
|
}
|
|
64696
64699
|
|
|
64697
|
-
const dom$
|
|
64700
|
+
const dom$8 = new Dom();
|
|
64698
64701
|
class ElementEffectStyles {
|
|
64699
64702
|
constructor(builder) {
|
|
64700
64703
|
this.builder = builder;
|
|
@@ -64773,7 +64776,7 @@ class ElementEffectStyles {
|
|
|
64773
64776
|
</div>
|
|
64774
64777
|
</div>
|
|
64775
64778
|
`;
|
|
64776
|
-
dom$
|
|
64779
|
+
dom$8.appendHtml(panelStuff, html);
|
|
64777
64780
|
const inpElmOpacity = panelStuff.querySelector('#inpElmOpacity');
|
|
64778
64781
|
inpElmOpacity.addEventListener('click', () => {
|
|
64779
64782
|
this.builder.uo.saveForUndo();
|
|
@@ -65191,7 +65194,7 @@ class ElementEffectStyles {
|
|
|
65191
65194
|
}
|
|
65192
65195
|
}
|
|
65193
65196
|
|
|
65194
|
-
const dom$
|
|
65197
|
+
const dom$7 = new Dom();
|
|
65195
65198
|
class ElementAttributeStyles {
|
|
65196
65199
|
constructor(builder) {
|
|
65197
65200
|
this.builder = builder;
|
|
@@ -65266,7 +65269,7 @@ class ElementAttributeStyles {
|
|
|
65266
65269
|
</div>
|
|
65267
65270
|
</div>
|
|
65268
65271
|
`;
|
|
65269
|
-
dom$
|
|
65272
|
+
dom$7.appendHtml(panelStuff, html);
|
|
65270
65273
|
let inps = panelStuff.querySelectorAll('#inpElmAttr1,#inpElmAttr2,#inpElmAttr3,#inpElmAttr4,#inpElmAttr5,#inpElmAttrVal1,#inpElmAttrVal2,#inpElmAttrVal3,#inpElmAttrVal4,#inpElmAttrVal5');
|
|
65271
65274
|
Array.prototype.forEach.call(inps, inp => {
|
|
65272
65275
|
inp.addEventListener('click', () => {
|
|
@@ -65331,7 +65334,7 @@ class ElementAttributeStyles {
|
|
|
65331
65334
|
}
|
|
65332
65335
|
}
|
|
65333
65336
|
|
|
65334
|
-
const dom$
|
|
65337
|
+
const dom$6 = new Dom();
|
|
65335
65338
|
class ElementMoreStyles {
|
|
65336
65339
|
constructor(builder) {
|
|
65337
65340
|
this.builder = builder;
|
|
@@ -65358,7 +65361,7 @@ class ElementMoreStyles {
|
|
|
65358
65361
|
</div>
|
|
65359
65362
|
|
|
65360
65363
|
`;
|
|
65361
|
-
dom$
|
|
65364
|
+
dom$6.appendHtml(panelStuff, html);
|
|
65362
65365
|
const inpElmId = panelStuff.querySelector('#inpElmId');
|
|
65363
65366
|
inpElmId.addEventListener('change', () => {
|
|
65364
65367
|
let elm = this.builder.inspectedElement;
|
|
@@ -65414,7 +65417,7 @@ class ElementMoreStyles {
|
|
|
65414
65417
|
}
|
|
65415
65418
|
}
|
|
65416
65419
|
|
|
65417
|
-
const dom$
|
|
65420
|
+
const dom$5 = new Dom();
|
|
65418
65421
|
class ElementAnimationStyles {
|
|
65419
65422
|
constructor(builder) {
|
|
65420
65423
|
this.builder = builder;
|
|
@@ -65554,7 +65557,7 @@ class ElementAnimationStyles {
|
|
|
65554
65557
|
</div>
|
|
65555
65558
|
</div>
|
|
65556
65559
|
`;
|
|
65557
|
-
dom$
|
|
65560
|
+
dom$5.appendHtml(panelStuff, html);
|
|
65558
65561
|
let inp = panelStuff.querySelector('#selElmAnim');
|
|
65559
65562
|
inp.addEventListener('change', () => {
|
|
65560
65563
|
this.builder.uo.saveForUndo();
|
|
@@ -65621,8 +65624,8 @@ class ElementAnimationStyles {
|
|
|
65621
65624
|
if (window.AOS) window.AOS.init({
|
|
65622
65625
|
duration: 1
|
|
65623
65626
|
});
|
|
65624
|
-
dom$
|
|
65625
|
-
dom$
|
|
65627
|
+
dom$5.removeClass(elm, 'aos-init');
|
|
65628
|
+
dom$5.removeClass(elm, 'aos-animate');
|
|
65626
65629
|
setTimeout(function () {
|
|
65627
65630
|
elm.style.visibility = '';
|
|
65628
65631
|
if (window.AOS) window.AOS.init({
|
|
@@ -65654,7 +65657,7 @@ class ElementAnimationStyles {
|
|
|
65654
65657
|
}
|
|
65655
65658
|
}
|
|
65656
65659
|
|
|
65657
|
-
const dom$
|
|
65660
|
+
const dom$4 = new Dom();
|
|
65658
65661
|
let arrElms = [];
|
|
65659
65662
|
class ElementPanel {
|
|
65660
65663
|
constructor(builder) {
|
|
@@ -65738,15 +65741,15 @@ class ElementPanel {
|
|
|
65738
65741
|
</div>
|
|
65739
65742
|
</div>
|
|
65740
65743
|
`;
|
|
65741
|
-
dom$
|
|
65744
|
+
dom$4.appendHtml(builderStuff, html);
|
|
65742
65745
|
this.elementStyleEditor = new ELementStyleEditor(builder);
|
|
65743
65746
|
panel = builderStuff.querySelector('.elementstyles');
|
|
65744
65747
|
let btn = panel.querySelector('.is-side-close');
|
|
65745
|
-
dom$
|
|
65748
|
+
dom$4.addEventListener(btn, 'click', () => {
|
|
65746
65749
|
this.hidePanel();
|
|
65747
65750
|
});
|
|
65748
65751
|
btn = panel.querySelector('.elm-editstyle');
|
|
65749
|
-
dom$
|
|
65752
|
+
dom$4.addEventListener(btn, 'click', () => {
|
|
65750
65753
|
this.elementStyleEditor.toggleStyleEditor();
|
|
65751
65754
|
});
|
|
65752
65755
|
}
|
|
@@ -65779,7 +65782,7 @@ class ElementPanel {
|
|
|
65779
65782
|
this.elementAnimationStyles = elementAnimationStyles;
|
|
65780
65783
|
}
|
|
65781
65784
|
click() {
|
|
65782
|
-
if (dom$
|
|
65785
|
+
if (dom$4.hasClass(this.panel, 'active') || dom$4.hasClass(this.elementStyleEditor.modalStyles, 'active')) {
|
|
65783
65786
|
this.inspect(this.builder.inspectedElement);
|
|
65784
65787
|
}
|
|
65785
65788
|
}
|
|
@@ -65805,16 +65808,16 @@ class ElementPanel {
|
|
|
65805
65808
|
elm.setAttribute('data-saveforundo', '');
|
|
65806
65809
|
elms = this.builder.doc.querySelectorAll('.elm-inspected');
|
|
65807
65810
|
Array.prototype.forEach.call(elms, elm => {
|
|
65808
|
-
dom$
|
|
65811
|
+
dom$4.removeClass(elm, 'elm-inspected');
|
|
65809
65812
|
});
|
|
65810
65813
|
setTimeout(() => {
|
|
65811
|
-
dom$
|
|
65814
|
+
dom$4.addClass(elm, 'elm-inspected');
|
|
65812
65815
|
}, 10);
|
|
65813
65816
|
panel.querySelector('.elm-list').innerHTML = '';
|
|
65814
65817
|
let element = elm;
|
|
65815
65818
|
let i = 0;
|
|
65816
65819
|
arrElms = [];
|
|
65817
|
-
while (!dom$
|
|
65820
|
+
while (!dom$4.hasClass(element, 'is-builder')) {
|
|
65818
65821
|
arrElms.push(element);
|
|
65819
65822
|
if (!element) {
|
|
65820
65823
|
// This should not happen. But on quick user click (ex. undo then redo quickly), an element can lost, so checking is needed
|
|
@@ -65824,13 +65827,13 @@ class ElementPanel {
|
|
|
65824
65827
|
break;
|
|
65825
65828
|
}
|
|
65826
65829
|
var tagName = element.tagName.toLowerCase();
|
|
65827
|
-
var a = dom$
|
|
65830
|
+
var a = dom$4.createElement('a');
|
|
65828
65831
|
a.setAttribute('data-index', i);
|
|
65829
65832
|
i++;
|
|
65830
65833
|
a.setAttribute('href', '#');
|
|
65831
65834
|
a.innerHTML = tagName;
|
|
65832
65835
|
if (panel.querySelector('.elm-list').innerHTML === '') {
|
|
65833
|
-
dom$
|
|
65836
|
+
dom$4.addClass(a, 'active');
|
|
65834
65837
|
panel.querySelector('.elm-list').insertAdjacentHTML('afterbegin', a.outerHTML);
|
|
65835
65838
|
} else {
|
|
65836
65839
|
panel.querySelector('.elm-list').insertAdjacentHTML('afterbegin', ' > ');
|
|
@@ -65840,7 +65843,7 @@ class ElementPanel {
|
|
|
65840
65843
|
}
|
|
65841
65844
|
const links = panel.querySelectorAll('.elm-list a');
|
|
65842
65845
|
Array.prototype.forEach.call(links, link => {
|
|
65843
|
-
dom$
|
|
65846
|
+
dom$4.addEventListener(link, 'click', e => {
|
|
65844
65847
|
let index = link.getAttribute('data-index');
|
|
65845
65848
|
this.builder.inspectedElement = arrElms[index];
|
|
65846
65849
|
this.inspect(arrElms[index]);
|
|
@@ -65861,10 +65864,10 @@ class ElementPanel {
|
|
|
65861
65864
|
|
|
65862
65865
|
let panels = this.builderStuff.querySelectorAll('.is-side');
|
|
65863
65866
|
Array.prototype.forEach.call(panels, panel => {
|
|
65864
|
-
dom$
|
|
65867
|
+
dom$4.removeClass(panel, 'active');
|
|
65865
65868
|
});
|
|
65866
65869
|
setTimeout(() => {
|
|
65867
|
-
dom$
|
|
65870
|
+
dom$4.addClass(panel, 'active'); // add 10ms delay after display is set 'block' for visible animation
|
|
65868
65871
|
|
|
65869
65872
|
// Focus
|
|
65870
65873
|
let content = panel.querySelector('.is-tab-content.active');
|
|
@@ -65882,14 +65885,14 @@ class ElementPanel {
|
|
|
65882
65885
|
}
|
|
65883
65886
|
hidePanel() {
|
|
65884
65887
|
var panel = this.builderStuff.querySelector('.is-side.elementstyles');
|
|
65885
|
-
dom$
|
|
65888
|
+
dom$4.removeClass(panel, 'active');
|
|
65886
65889
|
let elms = this.builder.doc.querySelectorAll('[data-saveforundo]');
|
|
65887
65890
|
Array.prototype.forEach.call(elms, elm => {
|
|
65888
65891
|
elm.removeAttribute('data-saveforundo');
|
|
65889
65892
|
});
|
|
65890
65893
|
elms = this.builder.doc.querySelectorAll('.elm-inspected');
|
|
65891
65894
|
Array.prototype.forEach.call(elms, elm => {
|
|
65892
|
-
dom$
|
|
65895
|
+
dom$4.removeClass(elm, 'elm-inspected');
|
|
65893
65896
|
});
|
|
65894
65897
|
}
|
|
65895
65898
|
}
|
|
@@ -67292,7 +67295,7 @@ class Preferences {
|
|
|
67292
67295
|
}
|
|
67293
67296
|
}
|
|
67294
67297
|
|
|
67295
|
-
const dom$
|
|
67298
|
+
const dom$3 = new Dom();
|
|
67296
67299
|
class ColorClassPicker {
|
|
67297
67300
|
constructor(opts = {}, mode) {
|
|
67298
67301
|
let defaults = {
|
|
@@ -67425,7 +67428,7 @@ class ColorClassPicker {
|
|
|
67425
67428
|
this.showColorGradient('gray');
|
|
67426
67429
|
let btns = document.querySelectorAll('.base-color');
|
|
67427
67430
|
Array.prototype.forEach.call(btns, btn => {
|
|
67428
|
-
dom$
|
|
67431
|
+
dom$3.addEventListener(btn, 'click', () => {
|
|
67429
67432
|
const base = btn.getAttribute('data-base');
|
|
67430
67433
|
this.showColorGradient(base);
|
|
67431
67434
|
let val = btn.getAttribute('data-value');
|
|
@@ -67435,7 +67438,7 @@ class ColorClassPicker {
|
|
|
67435
67438
|
});
|
|
67436
67439
|
btns = document.querySelectorAll('.quick-color');
|
|
67437
67440
|
Array.prototype.forEach.call(btns, btn => {
|
|
67438
|
-
dom$
|
|
67441
|
+
dom$3.addEventListener(btn, 'click', e => {
|
|
67439
67442
|
e.preventDefault();
|
|
67440
67443
|
let val = btn.getAttribute('data-value');
|
|
67441
67444
|
if (this.mode === 'text') val = val.replace('bg-', 'text-');
|
|
@@ -67456,7 +67459,7 @@ class ColorClassPicker {
|
|
|
67456
67459
|
divDetails.innerHTML = s;
|
|
67457
67460
|
const btns = document.querySelectorAll('.detail-color');
|
|
67458
67461
|
Array.prototype.forEach.call(btns, btn => {
|
|
67459
|
-
dom$
|
|
67462
|
+
dom$3.addEventListener(btn, 'click', () => {
|
|
67460
67463
|
let val = btn.getAttribute('data-value');
|
|
67461
67464
|
if (this.mode === 'text') val = val.replace('bg-', 'text-');
|
|
67462
67465
|
this.opts.onPick(val);
|
|
@@ -72858,7 +72861,7 @@ class SaveImages {
|
|
|
72858
72861
|
}
|
|
72859
72862
|
}
|
|
72860
72863
|
|
|
72861
|
-
const dom$
|
|
72864
|
+
const dom$2 = new Dom();
|
|
72862
72865
|
class Tooltip {
|
|
72863
72866
|
constructor(builder) {
|
|
72864
72867
|
this.builder = builder;
|
|
@@ -72869,7 +72872,7 @@ class Tooltip {
|
|
|
72869
72872
|
let tooltip = builderStuff.querySelector('.is-tooltip');
|
|
72870
72873
|
if (!tooltip) {
|
|
72871
72874
|
let html = '<div class="is-tooltip"></div>';
|
|
72872
|
-
dom$
|
|
72875
|
+
dom$2.appendHtml(builderStuff, html);
|
|
72873
72876
|
tooltip = builderStuff.querySelector('.is-tooltip');
|
|
72874
72877
|
}
|
|
72875
72878
|
this.tooltip = tooltip;
|
|
@@ -73797,7 +73800,7 @@ class ShortcutInfo {
|
|
|
73797
73800
|
}
|
|
73798
73801
|
}
|
|
73799
73802
|
|
|
73800
|
-
const dom = new Dom();
|
|
73803
|
+
const dom$1 = new Dom();
|
|
73801
73804
|
class Tabs {
|
|
73802
73805
|
constructor() {
|
|
73803
73806
|
// Close all dropdown
|
|
@@ -73832,7 +73835,7 @@ class Tabs {
|
|
|
73832
73835
|
}
|
|
73833
73836
|
return false;
|
|
73834
73837
|
}
|
|
73835
|
-
if (dom.hasClass(tab, 'active')) {
|
|
73838
|
+
if (dom$1.hasClass(tab, 'active')) {
|
|
73836
73839
|
return false;
|
|
73837
73840
|
}
|
|
73838
73841
|
const id = tab.getAttribute('data-content');
|
|
@@ -73843,21 +73846,21 @@ class Tabs {
|
|
|
73843
73846
|
// Highlight selected
|
|
73844
73847
|
let samegrouptabs = document.querySelectorAll('.is-tabs[data-group="' + group + '"] > a');
|
|
73845
73848
|
Array.prototype.forEach.call(samegrouptabs, samegrouptab => {
|
|
73846
|
-
dom.removeClass(samegrouptab, 'active');
|
|
73849
|
+
dom$1.removeClass(samegrouptab, 'active');
|
|
73847
73850
|
});
|
|
73848
73851
|
samegrouptabs = document.querySelectorAll('.is-tabs-more[data-group="' + group + '"] > li');
|
|
73849
73852
|
Array.prototype.forEach.call(samegrouptabs, samegrouptab => {
|
|
73850
|
-
dom.removeClass(samegrouptab, 'active');
|
|
73853
|
+
dom$1.removeClass(samegrouptab, 'active');
|
|
73851
73854
|
});
|
|
73852
|
-
dom.addClass(tab, 'active');
|
|
73855
|
+
dom$1.addClass(tab, 'active');
|
|
73853
73856
|
let samegroupcontents = document.querySelectorAll('.is-tab-content[data-group="' + group + '"]');
|
|
73854
73857
|
Array.prototype.forEach.call(samegroupcontents, samegroupcontent => {
|
|
73855
73858
|
samegroupcontent.style.display = 'none';
|
|
73856
|
-
dom.removeClass(samegroupcontent, 'active');
|
|
73859
|
+
dom$1.removeClass(samegroupcontent, 'active');
|
|
73857
73860
|
});
|
|
73858
73861
|
const content = document.querySelector('#' + id);
|
|
73859
73862
|
content.style.display = 'flex';
|
|
73860
|
-
dom.addClass(content, 'active');
|
|
73863
|
+
dom$1.addClass(content, 'active');
|
|
73861
73864
|
document.querySelector('.is-tabs-more').style.display = 'none';
|
|
73862
73865
|
|
|
73863
73866
|
// Close all dropdown
|
|
@@ -76346,6 +76349,1579 @@ class LivePreview {
|
|
|
76346
76349
|
}
|
|
76347
76350
|
}
|
|
76348
76351
|
|
|
76352
|
+
// Collection of common editing functions
|
|
76353
|
+
|
|
76354
|
+
class Lib {
|
|
76355
|
+
constructor(builder) {
|
|
76356
|
+
this.builder = builder;
|
|
76357
|
+
}
|
|
76358
|
+
|
|
76359
|
+
// Get complete/outer HTML of an element;
|
|
76360
|
+
getHtml(element) {
|
|
76361
|
+
const combineStrings = (outer, inner) => {
|
|
76362
|
+
// Find the opening tag of the first/parent element
|
|
76363
|
+
const openingTagRegex = /<([a-zA-Z]+\b[^>]*)>/;
|
|
76364
|
+
const openingTagMatch = outer.match(openingTagRegex);
|
|
76365
|
+
const openingTag = openingTagMatch[1];
|
|
76366
|
+
const combinedResult = `<${openingTag}>${inner}</div>`;
|
|
76367
|
+
return combinedResult;
|
|
76368
|
+
};
|
|
76369
|
+
let html = combineStrings(element.outerHTML, this.builder.readHtml(element, false, true));
|
|
76370
|
+
return html;
|
|
76371
|
+
}
|
|
76372
|
+
|
|
76373
|
+
// Run functions based on short command
|
|
76374
|
+
processShortCommand(command) {
|
|
76375
|
+
let shortCommandList = {
|
|
76376
|
+
undo: ['undo'],
|
|
76377
|
+
redo: ['undo'],
|
|
76378
|
+
increase: ['increase', 'bigger', 'larger', 'enlarge'],
|
|
76379
|
+
decrease: ['decrease', 'smaller'],
|
|
76380
|
+
bold: ['bold'],
|
|
76381
|
+
italic: ['italic'],
|
|
76382
|
+
underline: ['underline'],
|
|
76383
|
+
strikethrough: ['strikethrough'],
|
|
76384
|
+
superscript: ['superscript'],
|
|
76385
|
+
subscript: ['subscript'],
|
|
76386
|
+
uppercase: ['uppercase'],
|
|
76387
|
+
lowercase: ['lowercase'],
|
|
76388
|
+
capitalize: ['capitalize'],
|
|
76389
|
+
clean: ['clean']
|
|
76390
|
+
};
|
|
76391
|
+
if (this.builder.shortCommandList) shortCommandList = this.builder.shortCommandList;
|
|
76392
|
+
const getMatchingCommand = command => {
|
|
76393
|
+
for (const key in shortCommandList) {
|
|
76394
|
+
if (shortCommandList[key].includes(command)) {
|
|
76395
|
+
return key;
|
|
76396
|
+
}
|
|
76397
|
+
}
|
|
76398
|
+
return false;
|
|
76399
|
+
};
|
|
76400
|
+
const intent = getMatchingCommand(command);
|
|
76401
|
+
|
|
76402
|
+
// Undo/Redo
|
|
76403
|
+
if (intent === 'undo') {
|
|
76404
|
+
this.builder.undo();
|
|
76405
|
+
return false;
|
|
76406
|
+
}
|
|
76407
|
+
if (intent === 'redo') {
|
|
76408
|
+
this.builder.redo();
|
|
76409
|
+
return false;
|
|
76410
|
+
}
|
|
76411
|
+
|
|
76412
|
+
// The process below needs active element
|
|
76413
|
+
let elm = this.builder.activeElement;
|
|
76414
|
+
if (!elm) return command;
|
|
76415
|
+
|
|
76416
|
+
// Size
|
|
76417
|
+
const isTextBlockElement = element => {
|
|
76418
|
+
const textBlockTags = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6', 'P', 'PRE'];
|
|
76419
|
+
const tagName = element.tagName.toUpperCase();
|
|
76420
|
+
return textBlockTags.includes(tagName);
|
|
76421
|
+
};
|
|
76422
|
+
if (intent === 'increase') {
|
|
76423
|
+
if (elm.classList.contains('spacer')) {
|
|
76424
|
+
this.builder.saveForUndo();
|
|
76425
|
+
this.builder.lib.increaseElementHeight(elm);
|
|
76426
|
+
return false;
|
|
76427
|
+
} else if (isTextBlockElement(elm)) {
|
|
76428
|
+
this.builder.saveForUndo();
|
|
76429
|
+
this.builder.lib.increaseFontSize(elm);
|
|
76430
|
+
return false;
|
|
76431
|
+
}
|
|
76432
|
+
}
|
|
76433
|
+
if (intent === 'decrease') {
|
|
76434
|
+
if (elm.classList.contains('spacer')) {
|
|
76435
|
+
this.builder.saveForUndo();
|
|
76436
|
+
this.builder.lib.decreaseElementHeight(elm);
|
|
76437
|
+
return false;
|
|
76438
|
+
} else if (isTextBlockElement(elm)) {
|
|
76439
|
+
this.builder.saveForUndo();
|
|
76440
|
+
this.builder.lib.decreaseFontSize(elm);
|
|
76441
|
+
return false;
|
|
76442
|
+
}
|
|
76443
|
+
}
|
|
76444
|
+
|
|
76445
|
+
// Text
|
|
76446
|
+
const formatText = s => {
|
|
76447
|
+
this.builder.saveForUndo();
|
|
76448
|
+
this.builder.util.restoreSelection();
|
|
76449
|
+
this.builder.formatTextNonToggle(s);
|
|
76450
|
+
this.builder.util.saveSelection();
|
|
76451
|
+
};
|
|
76452
|
+
if (intent === 'bold') {
|
|
76453
|
+
formatText('bold');
|
|
76454
|
+
return false;
|
|
76455
|
+
}
|
|
76456
|
+
if (intent === 'italic') {
|
|
76457
|
+
formatText('italic');
|
|
76458
|
+
return false;
|
|
76459
|
+
}
|
|
76460
|
+
if (intent === 'underline') {
|
|
76461
|
+
formatText('underline');
|
|
76462
|
+
return false;
|
|
76463
|
+
}
|
|
76464
|
+
if (intent === 'strikethrough') {
|
|
76465
|
+
formatText('strikethrough');
|
|
76466
|
+
return false;
|
|
76467
|
+
}
|
|
76468
|
+
if (intent === 'superscript') {
|
|
76469
|
+
formatText('superscript');
|
|
76470
|
+
return false;
|
|
76471
|
+
}
|
|
76472
|
+
if (intent === 'subscript') {
|
|
76473
|
+
formatText('subscript');
|
|
76474
|
+
return false;
|
|
76475
|
+
}
|
|
76476
|
+
if (intent === 'uppercase') {
|
|
76477
|
+
formatText('uppercase');
|
|
76478
|
+
return false;
|
|
76479
|
+
}
|
|
76480
|
+
if (intent === 'lowercase') {
|
|
76481
|
+
formatText('lowercase');
|
|
76482
|
+
return false;
|
|
76483
|
+
}
|
|
76484
|
+
if (intent === 'capitalize') {
|
|
76485
|
+
formatText('capitalize');
|
|
76486
|
+
return false;
|
|
76487
|
+
}
|
|
76488
|
+
if (intent === 'clean') {
|
|
76489
|
+
formatText('clean');
|
|
76490
|
+
return false;
|
|
76491
|
+
}
|
|
76492
|
+
return command;
|
|
76493
|
+
}
|
|
76494
|
+
getCurrentBackground(activeBox) {
|
|
76495
|
+
let currentImage = '';
|
|
76496
|
+
const overlayBgs = activeBox.querySelectorAll('.is-overlay-bg');
|
|
76497
|
+
overlayBgs.forEach(overlayBg => {
|
|
76498
|
+
if (overlayBg.style.backgroundImage) {
|
|
76499
|
+
if (overlayBg.style.backgroundImage.indexOf('url(') !== -1) {
|
|
76500
|
+
let url = overlayBg.style.backgroundImage.slice(4, -1).replace(/["']/g, '');
|
|
76501
|
+
// let filename = url.substring(url.lastIndexOf('/') + 1);
|
|
76502
|
+
if (currentImage !== '') currentImage = ', ';
|
|
76503
|
+
// currentImage+= `${filename}`;
|
|
76504
|
+
currentImage += `${url}`;
|
|
76505
|
+
}
|
|
76506
|
+
}
|
|
76507
|
+
});
|
|
76508
|
+
return currentImage;
|
|
76509
|
+
}
|
|
76510
|
+
clearBackgroundColor(activeBox) {
|
|
76511
|
+
let overlayBg = activeBox.querySelector('.is-overlay');
|
|
76512
|
+
if (overlayBg) {
|
|
76513
|
+
overlayBg.style.backgroundColor = '';
|
|
76514
|
+
}
|
|
76515
|
+
}
|
|
76516
|
+
clearBackgroundImage(activeBox) {
|
|
76517
|
+
let overlayBg = activeBox.querySelector('.is-overlay-bg');
|
|
76518
|
+
if (overlayBg) {
|
|
76519
|
+
overlayBg.parentNode.removeChild(overlayBg);
|
|
76520
|
+
}
|
|
76521
|
+
}
|
|
76522
|
+
updateBackgroundImage(activeBox, url) {
|
|
76523
|
+
let overlay = activeBox.querySelector('.is-overlay');
|
|
76524
|
+
if (!overlay) {
|
|
76525
|
+
activeBox.insertAdjacentHTML('afterbegin', '<div class="is-overlay"></div>');
|
|
76526
|
+
overlay = activeBox.querySelector('.is-overlay');
|
|
76527
|
+
}
|
|
76528
|
+
if (activeBox.classList.contains('is-section')) {
|
|
76529
|
+
if (activeBox.classList.contains('min-height-20') || activeBox.classList.contains('min-height-25') || activeBox.classList.contains('min-height-30') || activeBox.classList.contains('min-height-40') || activeBox.classList.contains('min-height-50') || activeBox.classList.contains('min-height-60') || activeBox.classList.contains('min-height-70') || activeBox.classList.contains('min-height-75') || activeBox.classList.contains('min-height-80') || activeBox.classList.contains('min-height-90') || activeBox.classList.contains('min-height-100')) ; else {
|
|
76530
|
+
activeBox.classList.add('min-height-60');
|
|
76531
|
+
}
|
|
76532
|
+
}
|
|
76533
|
+
let overlayBg = overlay.querySelector('.is-overlay-bg');
|
|
76534
|
+
if (!overlayBg) {
|
|
76535
|
+
overlay.insertAdjacentHTML('beforeend', '<div class="is-overlay-bg"></div>');
|
|
76536
|
+
overlayBg = overlay.querySelector('.is-overlay-bg');
|
|
76537
|
+
}
|
|
76538
|
+
overlayBg.style.backgroundImage = 'url(\'' + url + '\')';
|
|
76539
|
+
overlayBg.style.backgroundPosition = 50 + '%' + ' ' + 60 + '%'; //default
|
|
76540
|
+
|
|
76541
|
+
// Reset position & filter (grayscale)
|
|
76542
|
+
overlayBg.style.filter = '';
|
|
76543
|
+
overlay.style.filter = '';
|
|
76544
|
+
}
|
|
76545
|
+
moveContent(activeBox, val) {
|
|
76546
|
+
const container = activeBox.querySelector('.is-container');
|
|
76547
|
+
if (val === 'left' || val === 'center' || val === 'right') {
|
|
76548
|
+
container.classList.remove('is-content-left');
|
|
76549
|
+
container.classList.remove('is-content-right');
|
|
76550
|
+
container.classList.remove('edge-x--1');
|
|
76551
|
+
container.classList.remove('edge-x--0-75');
|
|
76552
|
+
container.classList.remove('edge-x--0-5');
|
|
76553
|
+
container.classList.remove('edge-x--0-25');
|
|
76554
|
+
container.classList.remove('edge-x-0');
|
|
76555
|
+
container.classList.remove('edge-x-0-25');
|
|
76556
|
+
container.classList.remove('edge-x-0-5');
|
|
76557
|
+
container.classList.remove('edge-x-0-75');
|
|
76558
|
+
container.classList.remove('edge-x-1');
|
|
76559
|
+
container.classList.remove('edge-x-2');
|
|
76560
|
+
container.classList.remove('edge-x-3');
|
|
76561
|
+
container.classList.remove('edge-x-4');
|
|
76562
|
+
container.classList.remove('edge-x-5');
|
|
76563
|
+
container.classList.remove('edge-x-6');
|
|
76564
|
+
}
|
|
76565
|
+
if (val === 'left') {
|
|
76566
|
+
container.classList.add('is-content-left');
|
|
76567
|
+
container.classList.add('edge-x-2');
|
|
76568
|
+
}
|
|
76569
|
+
if (val === 'right') {
|
|
76570
|
+
container.classList.add('is-content-right');
|
|
76571
|
+
container.classList.add('edge-x-2');
|
|
76572
|
+
}
|
|
76573
|
+
if (val === 'top' || val === 'middle' || val === 'bottom') {
|
|
76574
|
+
activeBox.classList.remove('is-content-top');
|
|
76575
|
+
activeBox.classList.remove('is-content-bottom');
|
|
76576
|
+
activeBox.classList.remove('edge-y--5');
|
|
76577
|
+
activeBox.classList.remove('edge-y--4');
|
|
76578
|
+
activeBox.classList.remove('edge-y--3');
|
|
76579
|
+
activeBox.classList.remove('edge-y--2');
|
|
76580
|
+
activeBox.classList.remove('edge-y--1');
|
|
76581
|
+
activeBox.classList.remove('edge-y-0');
|
|
76582
|
+
activeBox.classList.remove('edge-y-0-25');
|
|
76583
|
+
activeBox.classList.remove('edge-y-0-5');
|
|
76584
|
+
activeBox.classList.remove('edge-y-0-75');
|
|
76585
|
+
activeBox.classList.remove('edge-y-1');
|
|
76586
|
+
activeBox.classList.remove('edge-y-2');
|
|
76587
|
+
activeBox.classList.remove('edge-y-3');
|
|
76588
|
+
activeBox.classList.remove('edge-y-4');
|
|
76589
|
+
activeBox.classList.remove('edge-y-5');
|
|
76590
|
+
activeBox.classList.remove('edge-y-6');
|
|
76591
|
+
activeBox.classList.remove('edge-y-7');
|
|
76592
|
+
activeBox.classList.remove('edge-y-8');
|
|
76593
|
+
}
|
|
76594
|
+
if (val === 'top') {
|
|
76595
|
+
activeBox.classList.add('is-content-top');
|
|
76596
|
+
activeBox.classList.add('edge-y-2');
|
|
76597
|
+
}
|
|
76598
|
+
if (val === 'bottom') {
|
|
76599
|
+
activeBox.classList.add('is-content-bottom');
|
|
76600
|
+
activeBox.classList.add('edge-y-2');
|
|
76601
|
+
}
|
|
76602
|
+
}
|
|
76603
|
+
updateContentSize(activeBox, val) {
|
|
76604
|
+
const container = activeBox.querySelector('.is-container');
|
|
76605
|
+
// const contentSizes = this.builder.contentSizes;
|
|
76606
|
+
const contentSizes = [300, 320, 360, 400, 440, 480, 520, 560, 600, 640, 680, 720, 760, 800, 840, 880, 920, 960, 1000, 1040, 1080, 1120, 1160, 1200, 1240, 1280, 1320, 1360, 1400, 1440, 1480, 1520, 1560, 1600, 1640, 1680, 1720, 1760, 1800, 1840, 1880, 1920, 1960, 2000, 2040, 2080, 2120, 2160, 2200, 2240, 2280, 2320, 2360, 2400, 2440, 2480, 2520, 2560, 2600, 2640, 2680, 2700];
|
|
76607
|
+
if (val === '') {
|
|
76608
|
+
container.style.maxWidth = '';
|
|
76609
|
+
container.classList.forEach(item => {
|
|
76610
|
+
if (item.indexOf('is-content-') !== -1 && item !== 'is-content-left' && item !== 'is-content-right') {
|
|
76611
|
+
container.classList.remove(item);
|
|
76612
|
+
}
|
|
76613
|
+
});
|
|
76614
|
+
container.classList.add('is-content-none');
|
|
76615
|
+
return;
|
|
76616
|
+
}
|
|
76617
|
+
let targetWidth;
|
|
76618
|
+
for (let i = 0; i < contentSizes.length; i++) {
|
|
76619
|
+
if (container.classList.contains(`is-content-${contentSizes[i]}`)) {
|
|
76620
|
+
if (val === '+') {
|
|
76621
|
+
if (i + 1 >= contentSizes.length) {
|
|
76622
|
+
targetWidth = contentSizes[i];
|
|
76623
|
+
} else {
|
|
76624
|
+
targetWidth = contentSizes[i + 1];
|
|
76625
|
+
}
|
|
76626
|
+
break;
|
|
76627
|
+
}
|
|
76628
|
+
if (val === '-') {
|
|
76629
|
+
if (i - 1 < 0) {
|
|
76630
|
+
targetWidth = contentSizes[i];
|
|
76631
|
+
} else {
|
|
76632
|
+
targetWidth = contentSizes[i - 1];
|
|
76633
|
+
}
|
|
76634
|
+
break;
|
|
76635
|
+
}
|
|
76636
|
+
}
|
|
76637
|
+
}
|
|
76638
|
+
if (!targetWidth) {
|
|
76639
|
+
const currentWidth = container.offsetWidth;
|
|
76640
|
+
// let targetWidth;
|
|
76641
|
+
|
|
76642
|
+
for (let i = 0; i < contentSizes.length; i++) {
|
|
76643
|
+
if (contentSizes[i] <= currentWidth && currentWidth < contentSizes[i + 1]) {
|
|
76644
|
+
if (val === '+') {
|
|
76645
|
+
targetWidth = contentSizes[i + 1];
|
|
76646
|
+
break;
|
|
76647
|
+
}
|
|
76648
|
+
}
|
|
76649
|
+
if (contentSizes[i] < currentWidth && currentWidth <= contentSizes[i + 1]) {
|
|
76650
|
+
if (val === '-') {
|
|
76651
|
+
targetWidth = contentSizes[i];
|
|
76652
|
+
break;
|
|
76653
|
+
}
|
|
76654
|
+
}
|
|
76655
|
+
}
|
|
76656
|
+
}
|
|
76657
|
+
if (!targetWidth) targetWidth = 800;
|
|
76658
|
+
container.style.maxWidth = ''; //remove inline style
|
|
76659
|
+
|
|
76660
|
+
container.classList.forEach(item => {
|
|
76661
|
+
if (item.indexOf('is-content-') !== -1 && item !== 'is-content-left' && item !== 'is-content-right') {
|
|
76662
|
+
container.classList.remove(item);
|
|
76663
|
+
}
|
|
76664
|
+
});
|
|
76665
|
+
container.classList.add('is-content-' + targetWidth);
|
|
76666
|
+
}
|
|
76667
|
+
updateContentColor(activeBox, val) {
|
|
76668
|
+
if (val == 'light') {
|
|
76669
|
+
activeBox.classList.remove('is-dark-text');
|
|
76670
|
+
activeBox.classList.add('is-light-text');
|
|
76671
|
+
}
|
|
76672
|
+
if (val == 'dark') {
|
|
76673
|
+
activeBox.classList.remove('is-light-text');
|
|
76674
|
+
activeBox.classList.add('is-dark-text');
|
|
76675
|
+
}
|
|
76676
|
+
if (val == '') {
|
|
76677
|
+
activeBox.classList.remove('is-light-text');
|
|
76678
|
+
activeBox.classList.remove('is-dark-text');
|
|
76679
|
+
}
|
|
76680
|
+
}
|
|
76681
|
+
chooseHeadline() {
|
|
76682
|
+
let list = ['We create simple and effective designs.', 'Ultimate Experiences With Story, Emotion, And Purpose.', 'Build Anything Beautifully', 'With Less Stuff and More Compassion', 'We\'re [CompanyName]. Full stack development with a spark of creativity.', 'Transforming your digital experience with [CompanyName]. Achieve your online goals with our customized solutions.', 'Revolutionizing web development with [CompanyName]. Unleash your digital potential with our high-performance solutions.', 'Creative and Inspiring'];
|
|
76683
|
+
if (this.builder.headlineList) list = this.builder.headlineList;
|
|
76684
|
+
let randomIndex = Math.floor(Math.random() * list.length);
|
|
76685
|
+
return list[randomIndex];
|
|
76686
|
+
}
|
|
76687
|
+
_addBlock(activeBox, html, pos) {
|
|
76688
|
+
/*
|
|
76689
|
+
let bSnippet = false;
|
|
76690
|
+
let attr;
|
|
76691
|
+
|
|
76692
|
+
if(activeBox.querySelector('.cell-active')) {
|
|
76693
|
+
// This is needed before calling addSnippet()
|
|
76694
|
+
const builderStuff = this.builder.builderStuff;
|
|
76695
|
+
let quickadd = builderStuff.querySelector('.quickadd');
|
|
76696
|
+
quickadd.setAttribute('data-mode','row');
|
|
76697
|
+
// ----
|
|
76698
|
+
if(html!=='') this.builder.addSnippet(html, bSnippet);
|
|
76699
|
+
return;
|
|
76700
|
+
}
|
|
76701
|
+
*/
|
|
76702
|
+
|
|
76703
|
+
let container = activeBox.querySelector('.is-container');
|
|
76704
|
+
if (activeBox.classList.contains('is-container')) container = activeBox;
|
|
76705
|
+
let row;
|
|
76706
|
+
if (activeBox.querySelector('.row-active')) {
|
|
76707
|
+
row = activeBox.querySelector('.row-active');
|
|
76708
|
+
} else {
|
|
76709
|
+
const rows = this.builder.dom.elementChildren(container);
|
|
76710
|
+
row = rows[rows.length - 1]; // last row
|
|
76711
|
+
}
|
|
76712
|
+
|
|
76713
|
+
let rowElement, cellElement;
|
|
76714
|
+
if (this.builder.opts.row === '') {
|
|
76715
|
+
rowElement = this.htmlToElement(this.builder.opts.rowFormat);
|
|
76716
|
+
let s = this.builder.opts.cellFormat;
|
|
76717
|
+
let pos = s.indexOf('</');
|
|
76718
|
+
html = s.substring(0, pos) + html + s.substring(pos);
|
|
76719
|
+
|
|
76720
|
+
// go to last deeper level
|
|
76721
|
+
let targetrow = this.builder.dom.elementChildren(rowElement);
|
|
76722
|
+
while (targetrow.length > 0) {
|
|
76723
|
+
targetrow = targetrow[0];
|
|
76724
|
+
if (this.builder.dom.elementChildren(targetrow).length > 0) {
|
|
76725
|
+
targetrow = this.builder.dom.elementChildren(targetrow);
|
|
76726
|
+
} else {
|
|
76727
|
+
break;
|
|
76728
|
+
}
|
|
76729
|
+
}
|
|
76730
|
+
targetrow.innerHTML = html;
|
|
76731
|
+
cellElement = targetrow.firstChild;
|
|
76732
|
+
// if(attr) {
|
|
76733
|
+
// cellElement.setAttribute(attr,'');
|
|
76734
|
+
// }
|
|
76735
|
+
} else {
|
|
76736
|
+
cellElement = document.createElement('div');
|
|
76737
|
+
cellElement.classList.add(this.builder.opts.cols[this.builder.opts.cols.length - 1]);
|
|
76738
|
+
cellElement.innerHTML = html;
|
|
76739
|
+
|
|
76740
|
+
// if(attr) {
|
|
76741
|
+
// cellElement.setAttribute(attr,'');
|
|
76742
|
+
// }
|
|
76743
|
+
|
|
76744
|
+
rowElement = document.createElement('div');
|
|
76745
|
+
rowElement.classList.add(this.builder.opts.row);
|
|
76746
|
+
rowElement.appendChild(cellElement);
|
|
76747
|
+
}
|
|
76748
|
+
row.parentNode.insertBefore(rowElement, row);
|
|
76749
|
+
if (pos === 'after') this.builder.dom.moveAfter(rowElement, row);
|
|
76750
|
+
this.builder.applyBehaviorOn(container);
|
|
76751
|
+
cellElement.click();
|
|
76752
|
+
}
|
|
76753
|
+
addBlock(activeBox, val, pos) {
|
|
76754
|
+
let html = '';
|
|
76755
|
+
// let bSnippet = true;
|
|
76756
|
+
|
|
76757
|
+
if (val === 'headline') {
|
|
76758
|
+
html = `
|
|
76759
|
+
<h1 class="font-normal leading-11 size-54">${this.chooseHeadline()}</h1>
|
|
76760
|
+
`;
|
|
76761
|
+
}
|
|
76762
|
+
if (val === 'paragraph') {
|
|
76763
|
+
html = `
|
|
76764
|
+
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.
|
|
76765
|
+
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s,
|
|
76766
|
+
when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
|
|
76767
|
+
`;
|
|
76768
|
+
}
|
|
76769
|
+
if (val === 'image') {
|
|
76770
|
+
html = `<img src="${this.builder.opts.snippetPath}example.png" alt="" />`;
|
|
76771
|
+
if (this.builder.opts.snippetSampleImage) {
|
|
76772
|
+
html = `<img src="${this.builder.opts.snippetSampleImage}" alt="" />`;
|
|
76773
|
+
}
|
|
76774
|
+
}
|
|
76775
|
+
if (val === 'space') {
|
|
76776
|
+
html = '<div class="spacer height-40"></div>';
|
|
76777
|
+
}
|
|
76778
|
+
if (val === 'button') {
|
|
76779
|
+
html = `
|
|
76780
|
+
<div>
|
|
76781
|
+
<a href="#" role="button" class="transition-all inline-block whitespace-nowrap cursor-pointer no-underline border-2 border-solid mr-2 mt-2 mb-1 py-2 size-17 px-6 text-black leading-14 rounded border-transparent hover:border-transparent font-normal tracking-wide" style="background-color: rgb(240, 240, 240);">Read More</a>
|
|
76782
|
+
</div>
|
|
76783
|
+
`;
|
|
76784
|
+
}
|
|
76785
|
+
if (val === 'twobuttons') {
|
|
76786
|
+
html = `
|
|
76787
|
+
<div>
|
|
76788
|
+
<a href="#" role="button" class="transition-all inline-block whitespace-nowrap cursor-pointer no-underline border-2 border-solid mr-2 mt-2 mb-1 py-2 size-17 px-6 text-black leading-14 rounded border-transparent hover:border-transparent font-normal tracking-wide" style="background-color: rgb(240, 240, 240);">Read More</a>
|
|
76789
|
+
<a href="#" role="button" class="transition-all inline-block whitespace-nowrap cursor-pointer no-underline border-2 border-solid mr-2 mt-2 mb-1 py-2 size-17 px-6 border-current hover:border-current font-normal leading-14 rounded tracking-wide">Get Started</a>
|
|
76790
|
+
</div>
|
|
76791
|
+
`;
|
|
76792
|
+
}
|
|
76793
|
+
if (val === 'icon') {
|
|
76794
|
+
html = `
|
|
76795
|
+
<div class="text-center">
|
|
76796
|
+
<i class="icon ion-android-alarm-clock size-80"></i>
|
|
76797
|
+
</div>
|
|
76798
|
+
`;
|
|
76799
|
+
}
|
|
76800
|
+
if (val === 'youtube') {
|
|
76801
|
+
html = `
|
|
76802
|
+
<div class="embed-responsive embed-responsive-16by9">
|
|
76803
|
+
<iframe width="560" height="315" src="https://www.youtube.com/embed/P5yHEKqx86U?rel=0" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen=""></iframe>
|
|
76804
|
+
</div>
|
|
76805
|
+
`;
|
|
76806
|
+
}
|
|
76807
|
+
if (val === 'video') {
|
|
76808
|
+
html = `<video style="width: 100%;" loop="" autoplay="">
|
|
76809
|
+
<source src="${this.builder.opts.snippetPath}example.mp4" type="video/mp4"></video>`;
|
|
76810
|
+
if (this.builder.opts.snippetSampleVideo) {
|
|
76811
|
+
html = `<video style="width: 100%;" loop="" autoplay="">
|
|
76812
|
+
<source src="${this.builder.opts.snippetSampleVideo}" type="video/mp4"></video>`;
|
|
76813
|
+
}
|
|
76814
|
+
}
|
|
76815
|
+
if (val === 'audio') {
|
|
76816
|
+
html = `<div style="display:flex;width:100%;position:relative;margin:15px 0;background:transparent;">
|
|
76817
|
+
<audio controls="" style="width:100%">
|
|
76818
|
+
<source src="${this.builder.opts.snippetPath}example.mp3" type="audio/mpeg">
|
|
76819
|
+
Your browser does not support the audio element.
|
|
76820
|
+
</audio>
|
|
76821
|
+
</div>`;
|
|
76822
|
+
if (this.builder.opts.snippetSampleAudio) {
|
|
76823
|
+
html = `<div style="display:flex;width:100%;position:relative;margin:15px 0;background:transparent;">
|
|
76824
|
+
<audio controls="" style="width:100%">
|
|
76825
|
+
<source src="${this.builder.opts.snippetSampleAudio}" type="audio/mpeg">
|
|
76826
|
+
Your browser does not support the audio element.
|
|
76827
|
+
</audio>
|
|
76828
|
+
</div>`;
|
|
76829
|
+
}
|
|
76830
|
+
}
|
|
76831
|
+
if (val === 'map') {
|
|
76832
|
+
html = `<div class="embed-responsive embed-responsive-16by9">
|
|
76833
|
+
<iframe width="100%" height="400" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" class="mg1" src="https://maps.google.com/maps?q=Melbourne,+Victoria,+Australia&hl=en&sll=-7.981898,112.626504&sspn=0.009084,0.016512&oq=melbourne&hnear=Melbourne+Victoria,+Australia&t=m&z=10&output=embed"></iframe>
|
|
76834
|
+
</div>`;
|
|
76835
|
+
}
|
|
76836
|
+
if (val === 'social') {
|
|
76837
|
+
html = `<div class="is-social" style="text-align: center;">
|
|
76838
|
+
<a href="https://twitter.com/"><i class="icon ion-social-twitter" style="margin-right: 1em"></i></a>
|
|
76839
|
+
<a href="https://www.facebook.com/"><i class="icon ion-social-facebook" style="margin-right: 1em"></i></a>
|
|
76840
|
+
<a href="mailto:you@example.com"><i class="icon ion-android-drafts"></i></a>
|
|
76841
|
+
</div>`;
|
|
76842
|
+
}
|
|
76843
|
+
if (val === 'table') {
|
|
76844
|
+
html = `<table class="default" style="border-collapse:collapse;width:100%;">
|
|
76845
|
+
<thead>
|
|
76846
|
+
<tr>
|
|
76847
|
+
<td style="vertical-align:top;"><br></td>
|
|
76848
|
+
<td style="vertical-align:top;"><br></td>
|
|
76849
|
+
</tr>
|
|
76850
|
+
</thead>
|
|
76851
|
+
<tr>
|
|
76852
|
+
<td style="vertical-align:top;"><br></td>
|
|
76853
|
+
<td style="vertical-align:top;"><br></td>
|
|
76854
|
+
</tr>
|
|
76855
|
+
</table>`;
|
|
76856
|
+
}
|
|
76857
|
+
this._addBlock(activeBox, html, pos);
|
|
76858
|
+
}
|
|
76859
|
+
alignContent(activeBox, command) {
|
|
76860
|
+
activeBox.classList.remove('is-align-left');
|
|
76861
|
+
activeBox.classList.remove('is-align-center');
|
|
76862
|
+
activeBox.classList.remove('is-align-right');
|
|
76863
|
+
activeBox.classList.remove('is-align-justify');
|
|
76864
|
+
if (command === 'left') activeBox.classList.add('is-align-left');
|
|
76865
|
+
if (command === 'center') activeBox.classList.add('is-align-center');
|
|
76866
|
+
if (command === 'right') activeBox.classList.add('is-align-right');
|
|
76867
|
+
if (command === 'justify') activeBox.classList.add('is-align-justify');
|
|
76868
|
+
let elms = activeBox.querySelectorAll('.is-builder > div > div, .is-builder > div > div > *');
|
|
76869
|
+
elms.forEach(elm => {
|
|
76870
|
+
if (elm.closest('.is-section-tool') || elm.closest('.is-box-tool') || elm.closest('.is-tool') || elm.closest('.is-rowadd-tool')) return;
|
|
76871
|
+
elm.style.textAlign = '';
|
|
76872
|
+
elm.classList.remove('left');
|
|
76873
|
+
elm.classList.remove('right');
|
|
76874
|
+
elm.classList.remove('center');
|
|
76875
|
+
elm.classList.remove(this.builder.cssClasses.textAlign.left);
|
|
76876
|
+
elm.classList.remove(this.builder.cssClasses.textAlign.center);
|
|
76877
|
+
elm.classList.remove(this.builder.cssClasses.textAlign.right);
|
|
76878
|
+
elm.classList.remove(this.builder.cssClasses.textAlign.justify);
|
|
76879
|
+
this.builder.dom.doFunction(elm, theEl => {
|
|
76880
|
+
if (theEl.closest('.is-section-tool') || theEl.closest('.is-box-tool') || theEl.closest('.is-tool') || theEl.closest('.is-rowadd-tool')) return;
|
|
76881
|
+
theEl.style.textAlign = '';
|
|
76882
|
+
elm.classList.remove('left');
|
|
76883
|
+
elm.classList.remove('right');
|
|
76884
|
+
elm.classList.remove('center');
|
|
76885
|
+
elm.classList.remove(this.builder.cssClasses.textAlign.left);
|
|
76886
|
+
elm.classList.remove(this.builder.cssClasses.textAlign.center);
|
|
76887
|
+
elm.classList.remove(this.builder.cssClasses.textAlign.right);
|
|
76888
|
+
elm.classList.remove(this.builder.cssClasses.textAlign.justify);
|
|
76889
|
+
}, true);
|
|
76890
|
+
});
|
|
76891
|
+
}
|
|
76892
|
+
alignText(element, command) {
|
|
76893
|
+
if (this.builder.useCssClasses) {
|
|
76894
|
+
element.style.textAlign = '';
|
|
76895
|
+
element.classList.remove(this.builder.cssClasses.textAlign.left);
|
|
76896
|
+
element.classList.remove(this.builder.cssClasses.textAlign.center);
|
|
76897
|
+
element.classList.remove(this.builder.cssClasses.textAlign.right);
|
|
76898
|
+
element.classList.remove(this.builder.cssClasses.textAlign.justify);
|
|
76899
|
+
if (command === 'left') element.classList.add(this.builder.cssClasses.textAlign.left);
|
|
76900
|
+
if (command === 'center') element.classList.add(this.builder.cssClasses.textAlign.center);
|
|
76901
|
+
if (command === 'right') element.classList.add(this.builder.cssClasses.textAlign.right);
|
|
76902
|
+
if (command === 'justify') element.classList.add(this.builder.cssClasses.textAlign.justify);
|
|
76903
|
+
} else {
|
|
76904
|
+
element.style.textAlign = command;
|
|
76905
|
+
}
|
|
76906
|
+
}
|
|
76907
|
+
increaseLineHeight(element, isContainer) {
|
|
76908
|
+
let lineHeightClasses = Object.values(this.builder.cssClasses.leading);
|
|
76909
|
+
if (isContainer) {
|
|
76910
|
+
const classList = this.builder.cssClasses.leading;
|
|
76911
|
+
lineHeightClasses = [classList.leading_10, classList.leading_11, classList.leading_12, classList.leading_13, classList.leading_14, 'leading-15', classList.leading_16, classList.leading_17, classList.leading_18, classList.leading_19, 'leading-20'];
|
|
76912
|
+
}
|
|
76913
|
+
const currentClass = this.getCurrentLineHeightClass(element, isContainer);
|
|
76914
|
+
const currentIndex = lineHeightClasses.indexOf(currentClass);
|
|
76915
|
+
if (currentIndex !== -1 && currentIndex < lineHeightClasses.length - 1) {
|
|
76916
|
+
const newClass = lineHeightClasses[currentIndex + 1];
|
|
76917
|
+
element.classList.remove(currentClass);
|
|
76918
|
+
element.classList.add(newClass);
|
|
76919
|
+
}
|
|
76920
|
+
}
|
|
76921
|
+
decreaseLineHeight(element, isContainer) {
|
|
76922
|
+
let lineHeightClasses = Object.values(this.builder.cssClasses.leading);
|
|
76923
|
+
if (isContainer) {
|
|
76924
|
+
const classList = this.builder.cssClasses.leading;
|
|
76925
|
+
lineHeightClasses = [classList.leading_10, classList.leading_11, classList.leading_12, classList.leading_13, classList.leading_14, 'leading-15', classList.leading_16, classList.leading_17, classList.leading_18, classList.leading_19, 'leading-20'];
|
|
76926
|
+
}
|
|
76927
|
+
const currentClass = this.getCurrentLineHeightClass(element, isContainer);
|
|
76928
|
+
const currentIndex = lineHeightClasses.indexOf(currentClass);
|
|
76929
|
+
if (currentIndex !== -1 && currentIndex > 0) {
|
|
76930
|
+
const newClass = lineHeightClasses[currentIndex - 1];
|
|
76931
|
+
element.classList.remove(currentClass);
|
|
76932
|
+
element.classList.add(newClass);
|
|
76933
|
+
}
|
|
76934
|
+
}
|
|
76935
|
+
getCurrentLineHeightClass(element, isContainer) {
|
|
76936
|
+
const classes = element.classList;
|
|
76937
|
+
for (let i = 0; i < classes.length; i++) {
|
|
76938
|
+
const classValue = classes[i];
|
|
76939
|
+
if (classValue.startsWith('leading-')) {
|
|
76940
|
+
return classValue;
|
|
76941
|
+
}
|
|
76942
|
+
}
|
|
76943
|
+
const computedStyle = window.getComputedStyle(element);
|
|
76944
|
+
let lineHeight = parseFloat(computedStyle.lineHeight);
|
|
76945
|
+
let fontSize = parseFloat(computedStyle.fontSize);
|
|
76946
|
+
let currentClassName = '';
|
|
76947
|
+
lineHeight = (lineHeight / fontSize).toFixed(1);
|
|
76948
|
+
const classList = this.builder.cssClasses.leading;
|
|
76949
|
+
if (isContainer) {
|
|
76950
|
+
if (lineHeight === '1') {
|
|
76951
|
+
currentClassName = classList.leading_10;
|
|
76952
|
+
} else if (lineHeight === '1.1') {
|
|
76953
|
+
currentClassName = classList.leading_11;
|
|
76954
|
+
} else if (lineHeight === '1.2') {
|
|
76955
|
+
currentClassName = classList.leading_12;
|
|
76956
|
+
} else if (lineHeight === '1.3') {
|
|
76957
|
+
currentClassName = classList.leading_13;
|
|
76958
|
+
} else if (lineHeight === '1.4') {
|
|
76959
|
+
currentClassName = classList.leading_14;
|
|
76960
|
+
} else if (lineHeight === '1.5') {
|
|
76961
|
+
currentClassName = 'leading-15';
|
|
76962
|
+
} else if (lineHeight === '1.6') {
|
|
76963
|
+
currentClassName = classList.leading_16;
|
|
76964
|
+
} else if (lineHeight === '1.7') {
|
|
76965
|
+
currentClassName = classList.leading_17;
|
|
76966
|
+
} else if (lineHeight === '1.8') {
|
|
76967
|
+
currentClassName = classList.leading_18;
|
|
76968
|
+
} else if (lineHeight === '1.9') {
|
|
76969
|
+
currentClassName = classList.leading_19;
|
|
76970
|
+
} else if (lineHeight === '2') {
|
|
76971
|
+
currentClassName = classList.leading_20;
|
|
76972
|
+
}
|
|
76973
|
+
} else {
|
|
76974
|
+
if (lineHeight === '0.5') {
|
|
76975
|
+
currentClassName = classList.leading_5;
|
|
76976
|
+
} else if (lineHeight === '0.6') {
|
|
76977
|
+
currentClassName = classList.leading_6;
|
|
76978
|
+
} else if (lineHeight === '0.7') {
|
|
76979
|
+
currentClassName = classList.leading_7;
|
|
76980
|
+
} else if (lineHeight === '0.8') {
|
|
76981
|
+
currentClassName = classList.leading_8;
|
|
76982
|
+
} else if (lineHeight === '0.9') {
|
|
76983
|
+
currentClassName = classList.leading_9;
|
|
76984
|
+
} else if (lineHeight === '1') {
|
|
76985
|
+
currentClassName = classList.leading_10;
|
|
76986
|
+
} else if (lineHeight === '1.1') {
|
|
76987
|
+
currentClassName = classList.leading_11;
|
|
76988
|
+
} else if (lineHeight === '1.2') {
|
|
76989
|
+
currentClassName = classList.leading_12;
|
|
76990
|
+
} else if (lineHeight === '1.3') {
|
|
76991
|
+
currentClassName = classList.leading_13;
|
|
76992
|
+
} else if (lineHeight === '1.4') {
|
|
76993
|
+
currentClassName = classList.leading_14;
|
|
76994
|
+
} else if (lineHeight === '1.5') {
|
|
76995
|
+
currentClassName = classList.leading_15;
|
|
76996
|
+
} else if (lineHeight === '1.6') {
|
|
76997
|
+
currentClassName = classList.leading_16;
|
|
76998
|
+
} else if (lineHeight === '1.7') {
|
|
76999
|
+
currentClassName = classList.leading_17;
|
|
77000
|
+
} else if (lineHeight === '1.8') {
|
|
77001
|
+
currentClassName = classList.leading_18;
|
|
77002
|
+
} else if (lineHeight === '1.9') {
|
|
77003
|
+
currentClassName = classList.leading_19;
|
|
77004
|
+
} else if (lineHeight === '2') {
|
|
77005
|
+
currentClassName = classList.leading_20;
|
|
77006
|
+
} else if (lineHeight === '2.1') {
|
|
77007
|
+
currentClassName = classList.leading_21;
|
|
77008
|
+
} else if (lineHeight === '2.2') {
|
|
77009
|
+
currentClassName = classList.leading_22;
|
|
77010
|
+
} else if (lineHeight === '2.3') {
|
|
77011
|
+
currentClassName = classList.leading_23;
|
|
77012
|
+
} else if (lineHeight === '2.4') {
|
|
77013
|
+
currentClassName = classList.leading_24;
|
|
77014
|
+
} else if (lineHeight === '2.5') {
|
|
77015
|
+
currentClassName = classList.leading_25;
|
|
77016
|
+
} else if (lineHeight === '2.6') {
|
|
77017
|
+
currentClassName = classList.leading_26;
|
|
77018
|
+
} else if (lineHeight === '2.7') {
|
|
77019
|
+
currentClassName = classList.leading_27;
|
|
77020
|
+
} else if (lineHeight === '2.8') {
|
|
77021
|
+
currentClassName = classList.leading_28;
|
|
77022
|
+
} else if (lineHeight === '2.9') {
|
|
77023
|
+
currentClassName = classList.leading_29;
|
|
77024
|
+
} else if (lineHeight === '3') {
|
|
77025
|
+
currentClassName = classList.leading_30;
|
|
77026
|
+
}
|
|
77027
|
+
}
|
|
77028
|
+
if (currentClassName !== '') return currentClassName;
|
|
77029
|
+
return classList.leading_14;
|
|
77030
|
+
}
|
|
77031
|
+
|
|
77032
|
+
// Font Size Stuff
|
|
77033
|
+
increaseFontSize(activeElement, isDefaultSize) {
|
|
77034
|
+
const fontSizeClassValues = this.builder.opts.fontSizeClassValues;
|
|
77035
|
+
const currentFontSize = this.getCurrentFontSize(activeElement);
|
|
77036
|
+
const currentIndex = fontSizeClassValues.indexOf(currentFontSize);
|
|
77037
|
+
if (currentIndex < fontSizeClassValues.length - 1) {
|
|
77038
|
+
const nextFontSize = fontSizeClassValues[currentIndex + 1];
|
|
77039
|
+
const nextSizeClass = `size-${nextFontSize}`;
|
|
77040
|
+
if (isDefaultSize) if (nextSizeClass === 'size-24') return; // max for is-container font size is size-21
|
|
77041
|
+
|
|
77042
|
+
if (this.hasSizeClass(activeElement)) {
|
|
77043
|
+
activeElement.classList.remove(this.getSizeClass(activeElement));
|
|
77044
|
+
}
|
|
77045
|
+
activeElement.classList.add(nextSizeClass);
|
|
77046
|
+
}
|
|
77047
|
+
}
|
|
77048
|
+
decreaseFontSize(activeElement, isDefaultSize) {
|
|
77049
|
+
const fontSizeClassValues = this.builder.opts.fontSizeClassValues;
|
|
77050
|
+
const currentFontSize = this.getCurrentFontSize(activeElement);
|
|
77051
|
+
const currentIndex = fontSizeClassValues.indexOf(currentFontSize);
|
|
77052
|
+
if (currentIndex > 0) {
|
|
77053
|
+
const previousFontSize = fontSizeClassValues[currentIndex - 1];
|
|
77054
|
+
const previousSizeClass = `size-${previousFontSize}`;
|
|
77055
|
+
if (isDefaultSize) if (previousFontSize === 'size-15') return; // min for is-container font size is size-15
|
|
77056
|
+
|
|
77057
|
+
if (this.hasSizeClass(activeElement)) {
|
|
77058
|
+
activeElement.classList.remove(this.getSizeClass(activeElement));
|
|
77059
|
+
}
|
|
77060
|
+
activeElement.classList.add(previousSizeClass);
|
|
77061
|
+
}
|
|
77062
|
+
}
|
|
77063
|
+
clearFontSize(activeElement) {
|
|
77064
|
+
activeElement.classList.remove(this.getSizeClass(activeElement));
|
|
77065
|
+
}
|
|
77066
|
+
|
|
77067
|
+
// Function to get the current font size dynamically
|
|
77068
|
+
getCurrentFontSize(activeElement) {
|
|
77069
|
+
const fontSizeClassValues = this.builder.opts.fontSizeClassValues;
|
|
77070
|
+
if (this.hasSizeClass(activeElement)) {
|
|
77071
|
+
const sizeClass = this.getSizeClass(activeElement);
|
|
77072
|
+
const fontSizeString = sizeClass.split('-')[1];
|
|
77073
|
+
return Number(fontSizeString);
|
|
77074
|
+
} else {
|
|
77075
|
+
const computedStyle = window.getComputedStyle(activeElement);
|
|
77076
|
+
const fontSizeString = computedStyle.getPropertyValue('font-size');
|
|
77077
|
+
const currentFontSize = Number(fontSizeString.match(/\d+/)[0]);
|
|
77078
|
+
|
|
77079
|
+
// Check if the font size exists in the array
|
|
77080
|
+
if (fontSizeClassValues.includes(currentFontSize)) {
|
|
77081
|
+
return currentFontSize;
|
|
77082
|
+
} else {
|
|
77083
|
+
// Find the closest font size in the array
|
|
77084
|
+
const closestFontSize = this.findClosestFontSize(currentFontSize);
|
|
77085
|
+
return closestFontSize;
|
|
77086
|
+
}
|
|
77087
|
+
}
|
|
77088
|
+
}
|
|
77089
|
+
|
|
77090
|
+
// Function to check if paragraph has 'size-' class
|
|
77091
|
+
hasSizeClass(element) {
|
|
77092
|
+
if (Array.from(element.classList).some(value => value.startsWith('size-'))) {
|
|
77093
|
+
return true;
|
|
77094
|
+
}
|
|
77095
|
+
|
|
77096
|
+
// let currentElement = element.parentElement;
|
|
77097
|
+
|
|
77098
|
+
// while (currentElement) {
|
|
77099
|
+
// if (Array.from(currentElement.classList).some((value) => value.startsWith('size-'))) {
|
|
77100
|
+
// return true;
|
|
77101
|
+
// }
|
|
77102
|
+
// currentElement = currentElement.parentElement;
|
|
77103
|
+
// }
|
|
77104
|
+
return false;
|
|
77105
|
+
}
|
|
77106
|
+
|
|
77107
|
+
// Function to get the 'size-' class if present
|
|
77108
|
+
getSizeClass(activeElement) {
|
|
77109
|
+
return Array.from(activeElement.classList).find(value => value.startsWith('size-'));
|
|
77110
|
+
}
|
|
77111
|
+
// getSizeClass(activeElement) {
|
|
77112
|
+
// let sizeClass = Array.from(activeElement.classList).find((value) => value.startsWith('size-'));
|
|
77113
|
+
|
|
77114
|
+
// if (!sizeClass) {
|
|
77115
|
+
// let parentElement = activeElement.parentElement;
|
|
77116
|
+
|
|
77117
|
+
// while (parentElement) {
|
|
77118
|
+
// sizeClass = Array.from(parentElement.classList).find((value) => value.startsWith('size-'));
|
|
77119
|
+
// if (sizeClass) {
|
|
77120
|
+
// break;
|
|
77121
|
+
// }
|
|
77122
|
+
// parentElement = parentElement.parentElement;
|
|
77123
|
+
// }
|
|
77124
|
+
// }
|
|
77125
|
+
|
|
77126
|
+
// return sizeClass;
|
|
77127
|
+
// }
|
|
77128
|
+
|
|
77129
|
+
// Function to find the closest font size in the array
|
|
77130
|
+
findClosestFontSize(currentFontSize) {
|
|
77131
|
+
const fontSizeClassValues = this.builder.opts.fontSizeClassValues;
|
|
77132
|
+
let closestFontSize = null;
|
|
77133
|
+
|
|
77134
|
+
// Find the closest font size smaller than currentFontSize
|
|
77135
|
+
for (let i = fontSizeClassValues.length - 1; i >= 0; i--) {
|
|
77136
|
+
if (fontSizeClassValues[i] < currentFontSize) {
|
|
77137
|
+
closestFontSize = fontSizeClassValues[i];
|
|
77138
|
+
break;
|
|
77139
|
+
}
|
|
77140
|
+
}
|
|
77141
|
+
|
|
77142
|
+
// If no smaller font size found, find the closest font size larger than currentFontSize
|
|
77143
|
+
if (closestFontSize === null) {
|
|
77144
|
+
for (let i = 0; i < fontSizeClassValues.length; i++) {
|
|
77145
|
+
if (fontSizeClassValues[i] > currentFontSize) {
|
|
77146
|
+
closestFontSize = fontSizeClassValues[i];
|
|
77147
|
+
break;
|
|
77148
|
+
}
|
|
77149
|
+
}
|
|
77150
|
+
}
|
|
77151
|
+
|
|
77152
|
+
// If no closest font size found, use the first font size in the array
|
|
77153
|
+
if (closestFontSize === null) {
|
|
77154
|
+
closestFontSize = fontSizeClassValues[0];
|
|
77155
|
+
}
|
|
77156
|
+
return closestFontSize;
|
|
77157
|
+
}
|
|
77158
|
+
|
|
77159
|
+
// Space Stuff
|
|
77160
|
+
|
|
77161
|
+
// Increase the height of an element
|
|
77162
|
+
increaseElementHeight(element) {
|
|
77163
|
+
const currentHeightClass = this.getCurrentHeightClass(element);
|
|
77164
|
+
const nextHeightClass = this.getNextHeightClass(currentHeightClass, true);
|
|
77165
|
+
if (nextHeightClass) {
|
|
77166
|
+
element.classList.remove(currentHeightClass);
|
|
77167
|
+
element.classList.add(nextHeightClass);
|
|
77168
|
+
}
|
|
77169
|
+
}
|
|
77170
|
+
|
|
77171
|
+
// Decrease the height of an element
|
|
77172
|
+
decreaseElementHeight(element) {
|
|
77173
|
+
const currentHeightClass = this.getCurrentHeightClass(element);
|
|
77174
|
+
const prevHeightClass = this.getNextHeightClass(currentHeightClass, false);
|
|
77175
|
+
if (prevHeightClass) {
|
|
77176
|
+
element.classList.remove(currentHeightClass);
|
|
77177
|
+
element.classList.add(prevHeightClass);
|
|
77178
|
+
}
|
|
77179
|
+
}
|
|
77180
|
+
|
|
77181
|
+
// Get the current height class of an element
|
|
77182
|
+
getCurrentHeightClass(element) {
|
|
77183
|
+
const classes = Array.from(element.classList);
|
|
77184
|
+
return classes.find(className => className.startsWith('height-'));
|
|
77185
|
+
}
|
|
77186
|
+
|
|
77187
|
+
// Get the next height class based on the current height class and direction
|
|
77188
|
+
getNextHeightClass(currentHeightClass, increase) {
|
|
77189
|
+
const heightClasses = ['height-20', 'height-40', 'height-60', 'height-80', 'height-100', 'height-120', 'height-140', 'height-160', 'height-180', 'height-200', 'height-220', 'height-240', 'height-260', 'height-280', 'height-300'];
|
|
77190
|
+
const currentIndex = heightClasses.indexOf(currentHeightClass);
|
|
77191
|
+
const nextIndex = increase ? currentIndex + 1 : currentIndex - 1;
|
|
77192
|
+
if (nextIndex >= 0 && nextIndex < heightClasses.length) {
|
|
77193
|
+
return heightClasses[nextIndex];
|
|
77194
|
+
}
|
|
77195
|
+
return null;
|
|
77196
|
+
}
|
|
77197
|
+
}
|
|
77198
|
+
|
|
77199
|
+
const dom = new Dom();
|
|
77200
|
+
class Dictation {
|
|
77201
|
+
constructor(opts = {}, builder) {
|
|
77202
|
+
let defaults = {
|
|
77203
|
+
send: () => {},
|
|
77204
|
+
abort: () => {}
|
|
77205
|
+
};
|
|
77206
|
+
this.opts = Object.assign(this, defaults, opts);
|
|
77207
|
+
this.builder = builder;
|
|
77208
|
+
const util = this.builder.util;
|
|
77209
|
+
this.util = util;
|
|
77210
|
+
const builderStuff = this.builder.builderStuff;
|
|
77211
|
+
this.builderStuff = builderStuff;
|
|
77212
|
+
let html = `
|
|
77213
|
+
<style>
|
|
77214
|
+
.is-modal.page-command {
|
|
77215
|
+
width: 300px !important;
|
|
77216
|
+
height: 200px !important;
|
|
77217
|
+
top: auto !important;
|
|
77218
|
+
bottom: 30px !important;
|
|
77219
|
+
left: auto !important;
|
|
77220
|
+
right: 30px !important;
|
|
77221
|
+
z-index: 10002 !important;
|
|
77222
|
+
font-size: 12px;
|
|
77223
|
+
}
|
|
77224
|
+
.page-command-overlay {
|
|
77225
|
+
background: rgb(148 148 148 / 22%);
|
|
77226
|
+
display: none;
|
|
77227
|
+
z-index: 10004;
|
|
77228
|
+
justify-content: center;
|
|
77229
|
+
align-items:center;
|
|
77230
|
+
}
|
|
77231
|
+
.is-modal.page-command {
|
|
77232
|
+
z-index: 10005 !important;
|
|
77233
|
+
}
|
|
77234
|
+
|
|
77235
|
+
.spinner {
|
|
77236
|
+
-webkit-animation: rotator 1.4s linear infinite;
|
|
77237
|
+
animation: rotator 1.4s linear infinite;
|
|
77238
|
+
}
|
|
77239
|
+
@-webkit-keyframes rotator {
|
|
77240
|
+
0% {
|
|
77241
|
+
transform: rotate(0deg);
|
|
77242
|
+
}
|
|
77243
|
+
100% {
|
|
77244
|
+
transform: rotate(270deg);
|
|
77245
|
+
}
|
|
77246
|
+
}
|
|
77247
|
+
@keyframes rotator {
|
|
77248
|
+
0% {
|
|
77249
|
+
transform: rotate(0deg);
|
|
77250
|
+
}
|
|
77251
|
+
100% {
|
|
77252
|
+
transform: rotate(270deg);
|
|
77253
|
+
}
|
|
77254
|
+
}
|
|
77255
|
+
.path {
|
|
77256
|
+
stroke: #b7b7b7;
|
|
77257
|
+
stroke-dasharray: 187;
|
|
77258
|
+
stroke-dashoffset: 0;
|
|
77259
|
+
transform-origin: center;
|
|
77260
|
+
-webkit-animation: dash 1.4s ease-in-out infinite;
|
|
77261
|
+
animation: dash 1.4s ease-in-out infinite;
|
|
77262
|
+
}
|
|
77263
|
+
@-webkit-keyframes dash {
|
|
77264
|
+
0% {
|
|
77265
|
+
stroke-dashoffset: 187;
|
|
77266
|
+
}
|
|
77267
|
+
50% {
|
|
77268
|
+
stroke-dashoffset: 46.75;
|
|
77269
|
+
transform: rotate(135deg);
|
|
77270
|
+
}
|
|
77271
|
+
100% {
|
|
77272
|
+
stroke-dashoffset: 187;
|
|
77273
|
+
transform: rotate(450deg);
|
|
77274
|
+
}
|
|
77275
|
+
}
|
|
77276
|
+
@keyframes dash {
|
|
77277
|
+
0% {
|
|
77278
|
+
stroke-dashoffset: 187;
|
|
77279
|
+
}
|
|
77280
|
+
50% {
|
|
77281
|
+
stroke-dashoffset: 46.75;
|
|
77282
|
+
transform: rotate(135deg);
|
|
77283
|
+
}
|
|
77284
|
+
100% {
|
|
77285
|
+
stroke-dashoffset: 187;
|
|
77286
|
+
transform: rotate(450deg);
|
|
77287
|
+
}
|
|
77288
|
+
}
|
|
77289
|
+
</style>
|
|
77290
|
+
<div class="is-overlay page-command-overlay">
|
|
77291
|
+
<svg class="spinner" width="40px" height="40px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
|
|
77292
|
+
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
|
|
77293
|
+
</svg>
|
|
77294
|
+
</div>
|
|
77295
|
+
<div class="is-modal is-modal-content page-command" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">
|
|
77296
|
+
<div class="is-modal-bar is-draggable" draggable="">
|
|
77297
|
+
<span style="display: flex;
|
|
77298
|
+
justify-content: center;
|
|
77299
|
+
align-items: center;">
|
|
77300
|
+
${util.out('Send a Command')}</span>
|
|
77301
|
+
<button class="is-modal-close" tabindex="-1" title="${util.out('Close')}">
|
|
77302
|
+
<svg class="is-icon-flex" style="width:23px;height:23px;"><use xlink:href="#ion-ios-close-empty"></use></svg>
|
|
77303
|
+
</button>
|
|
77304
|
+
</div>
|
|
77305
|
+
<div style="display:flex;flex-direction:column;justify-content:space-between;position:absolute;box-sizing:border-box;top:0;left:0;width:100%;height:100%;border-top:transparent 35px solid;overflow-y:hidden;overflow-x:auto;">
|
|
77306
|
+
|
|
77307
|
+
<textarea class="inp-command" style="width:100%;height:121px;border:none;outline:none;background:transparent;line-height: 1.2;
|
|
77308
|
+
font-family: sans-serif;font-weight: 300;font-size: 17px;"></textarea>
|
|
77309
|
+
<div style="display:flex">
|
|
77310
|
+
<button title="${util.out('Mic')}" class="cmd-enable-dictation classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
|
|
77311
|
+
<svg class="is-icon-flex" style="width: 18px; height: 18px;"><use xlink:href="#icon-microphone"></use></svg>
|
|
77312
|
+
</button>
|
|
77313
|
+
<button title="${util.out('Clear')}" class="cmd-clear-command classic-secondary" style="width:40px;height:43px;flex:none;padding:0;outline-offset:-2px;">
|
|
77314
|
+
<svg class="is-icon-flex" style="width: 18px; height: 18px;"><use xlink:href="#icon-eraser"></use></svg>
|
|
77315
|
+
</button>
|
|
77316
|
+
<label for="chkAutoSendCommand" style="margin:0;display:flex;padding-left:10px;padding-right:10px;white-space:nowrap;width:100%;align-items:center;letter-spacing:0"><input id="chkAutoSendCommand" type="checkbox"> <span style="margin-left:3px">${util.out('Auto Send')}</span></label>
|
|
77317
|
+
<button title="${util.out('Send')}" class="cmd-send-command classic-primary" style="width:100%;padding-left:5px;padding-right:5px;height:43px;outline-offset:-2px;">Send</button>
|
|
77318
|
+
</div>
|
|
77319
|
+
</div>
|
|
77320
|
+
</div>
|
|
77321
|
+
`;
|
|
77322
|
+
dom.appendHtml(builderStuff, html);
|
|
77323
|
+
const modalCommand = builderStuff.querySelector('.page-command');
|
|
77324
|
+
this.modalCommand = modalCommand;
|
|
77325
|
+
this.builder.commandText = '';
|
|
77326
|
+
this.builder.autoSendCommand = false;
|
|
77327
|
+
this.aborted = true;
|
|
77328
|
+
if (localStorage.getItem('_dictation') !== null) {
|
|
77329
|
+
if (localStorage.getItem('_dictation') === '1') {
|
|
77330
|
+
this.modalCommand.classList.add('active');
|
|
77331
|
+
if (localStorage.getItem('_mic') !== null) {
|
|
77332
|
+
if (localStorage.getItem('_mic') === '1') {
|
|
77333
|
+
this.startDictation();
|
|
77334
|
+
}
|
|
77335
|
+
} else {
|
|
77336
|
+
this.startDictation();
|
|
77337
|
+
}
|
|
77338
|
+
}
|
|
77339
|
+
}
|
|
77340
|
+
const btnDictation = builderStuff.querySelector('.cmd-enable-dictation');
|
|
77341
|
+
if (localStorage.getItem('_mic') !== null) {
|
|
77342
|
+
if (localStorage.getItem('_mic') === '0') {
|
|
77343
|
+
btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
|
|
77344
|
+
}
|
|
77345
|
+
}
|
|
77346
|
+
const chkAutoSend = builderStuff.querySelector('#chkAutoSendCommand');
|
|
77347
|
+
if (localStorage.getItem('_autosendcommand') !== null) {
|
|
77348
|
+
if (localStorage.getItem('_autosendcommand') === '1') {
|
|
77349
|
+
chkAutoSend.checked = true;
|
|
77350
|
+
}
|
|
77351
|
+
}
|
|
77352
|
+
this.modalCommand.addEventListener('focus', () => {
|
|
77353
|
+
util.saveSelection(); // must be called in case used by formatText()
|
|
77354
|
+
});
|
|
77355
|
+
|
|
77356
|
+
btnDictation.addEventListener('click', () => {
|
|
77357
|
+
if (this.aborted) {
|
|
77358
|
+
this.startDictation();
|
|
77359
|
+
btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone"></use></svg>';
|
|
77360
|
+
} else {
|
|
77361
|
+
this.stopDictation();
|
|
77362
|
+
btnDictation.innerHTML = '<svg class="is-icon-flex" style="width:18px; height:18px;"><use xlink:href="#icon-microphone-off"></use></svg>';
|
|
77363
|
+
}
|
|
77364
|
+
});
|
|
77365
|
+
chkAutoSend.addEventListener('change', () => {
|
|
77366
|
+
if (chkAutoSend.checked) {
|
|
77367
|
+
this.builder.autoSendCommand = true;
|
|
77368
|
+
localStorage.setItem('_autosendcommand', '1');
|
|
77369
|
+
} else {
|
|
77370
|
+
this.builder.autoSendCommand = false;
|
|
77371
|
+
localStorage.setItem('_autosendcommand', '0');
|
|
77372
|
+
}
|
|
77373
|
+
});
|
|
77374
|
+
const btnClear = builderStuff.querySelector('.cmd-clear-command');
|
|
77375
|
+
btnClear.addEventListener('click', () => {
|
|
77376
|
+
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
|
77377
|
+
this.builder.commandText = '';
|
|
77378
|
+
inpCommand.value = '';
|
|
77379
|
+
});
|
|
77380
|
+
const btnSend = builderStuff.querySelector('.cmd-send-command');
|
|
77381
|
+
btnSend.addEventListener('click', async () => {
|
|
77382
|
+
if (this.builder.isInProgress) {
|
|
77383
|
+
// Abort
|
|
77384
|
+
|
|
77385
|
+
this.opts.abort();
|
|
77386
|
+
this.finish();
|
|
77387
|
+
return;
|
|
77388
|
+
}
|
|
77389
|
+
const inpCommand = this.modalCommand.querySelector('.inp-command');
|
|
77390
|
+
let question = inpCommand.value;
|
|
77391
|
+
question = question.trim();
|
|
77392
|
+
if (question === '') {
|
|
77393
|
+
return;
|
|
77394
|
+
}
|
|
77395
|
+
|
|
77396
|
+
// this.startSending();
|
|
77397
|
+
|
|
77398
|
+
this.opts.send(question);
|
|
77399
|
+
});
|
|
77400
|
+
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
|
77401
|
+
inpCommand.addEventListener('keydown', e => {
|
|
77402
|
+
if (e.keyCode === 13 && !e.shiftKey) {
|
|
77403
|
+
e.preventDefault();
|
|
77404
|
+
return;
|
|
77405
|
+
}
|
|
77406
|
+
});
|
|
77407
|
+
inpCommand.addEventListener('keyup', e => {
|
|
77408
|
+
if (e.keyCode === 13 && !e.shiftKey) {
|
|
77409
|
+
btnSend.click();
|
|
77410
|
+
e.preventDefault();
|
|
77411
|
+
return;
|
|
77412
|
+
}
|
|
77413
|
+
this.builder.commandText = inpCommand.value;
|
|
77414
|
+
});
|
|
77415
|
+
const btnClose = this.modalCommand.querySelector('.is-modal-close');
|
|
77416
|
+
btnClose.addEventListener('click', () => {
|
|
77417
|
+
this.modalCommand.classList.remove('active');
|
|
77418
|
+
this.stopDictation();
|
|
77419
|
+
localStorage.setItem('_dictation', '0');
|
|
77420
|
+
});
|
|
77421
|
+
}
|
|
77422
|
+
openDictation() {
|
|
77423
|
+
this.modalCommand.classList.add('active');
|
|
77424
|
+
this.startDictation();
|
|
77425
|
+
localStorage.setItem('_dictation', '1');
|
|
77426
|
+
}
|
|
77427
|
+
stopDictation() {
|
|
77428
|
+
this.recognition.abort();
|
|
77429
|
+
this.aborted = true;
|
|
77430
|
+
localStorage.setItem('_mic', '0');
|
|
77431
|
+
}
|
|
77432
|
+
startDictation() {
|
|
77433
|
+
this.aborted = false;
|
|
77434
|
+
if ('SpeechRecognition' in window || 'webkitSpeechRecognition' in window) {
|
|
77435
|
+
var SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
77436
|
+
this.recognition = new SpeechRecognition();
|
|
77437
|
+
this.recognition.continuous = true;
|
|
77438
|
+
this.recognition.interimResults = true;
|
|
77439
|
+
let lang = 'en-US';
|
|
77440
|
+
if (this.builder.speechRecognitionLang) lang = this.builder.speechRecognitionLang;
|
|
77441
|
+
this.recognition.lang = lang;
|
|
77442
|
+
this.recognition.start();
|
|
77443
|
+
let speechTimeout;
|
|
77444
|
+
this.recognition.onresult = event => {
|
|
77445
|
+
clearTimeout(speechTimeout);
|
|
77446
|
+
if (this.builder.isInProgress) return;
|
|
77447
|
+
var interimTranscripts = '';
|
|
77448
|
+
var finalTranscripts = '';
|
|
77449
|
+
for (var i = event.resultIndex; i < event.results.length; ++i) {
|
|
77450
|
+
if (event.results[i].isFinal) {
|
|
77451
|
+
finalTranscripts += event.results[i][0].transcript;
|
|
77452
|
+
} else {
|
|
77453
|
+
interimTranscripts += event.results[i][0].transcript;
|
|
77454
|
+
}
|
|
77455
|
+
}
|
|
77456
|
+
if (interimTranscripts.indexOf('send') !== -1 || finalTranscripts.indexOf('send') !== -1) {
|
|
77457
|
+
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
|
77458
|
+
btnSend.click();
|
|
77459
|
+
return;
|
|
77460
|
+
}
|
|
77461
|
+
this.builder.commandText += finalTranscripts; // + '<i style="color:#999">' + interimTranscripts + '</i>';
|
|
77462
|
+
|
|
77463
|
+
const inpCommand = this.modalCommand.querySelector('.inp-command');
|
|
77464
|
+
inpCommand.value = this.builder.commandText;
|
|
77465
|
+
if (this.builder.autoSendCommand) {
|
|
77466
|
+
speechTimeout = setTimeout(() => {
|
|
77467
|
+
if (inpCommand.value.trim() === '') return;
|
|
77468
|
+
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
|
77469
|
+
btnSend.click();
|
|
77470
|
+
}, 1000);
|
|
77471
|
+
}
|
|
77472
|
+
};
|
|
77473
|
+
this.recognition.onend = () => {
|
|
77474
|
+
if (!this.aborted) this.startDictation();
|
|
77475
|
+
};
|
|
77476
|
+
this.recognition.onstart = () => {
|
|
77477
|
+
localStorage.setItem('_mic', '1');
|
|
77478
|
+
};
|
|
77479
|
+
this.recognition.onerror = () => {
|
|
77480
|
+
// console.log(e.error);
|
|
77481
|
+
};
|
|
77482
|
+
} else {
|
|
77483
|
+
// this.aborted = true;
|
|
77484
|
+
alert(this.util.out('Speech recognition not supported in this browser.'));
|
|
77485
|
+
}
|
|
77486
|
+
}
|
|
77487
|
+
startSending() {
|
|
77488
|
+
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
|
77489
|
+
btnSend.innerHTML = `
|
|
77490
|
+
<svg class="spinner" width="14px" height="14px" viewBox="0 0 66 66" xmlns="http://www.w3.org/2000/svg">
|
|
77491
|
+
<circle class="path" fill="none" stroke-width="6" stroke-linecap="round" cx="33" cy="33" r="30"></circle>
|
|
77492
|
+
</svg>
|
|
77493
|
+
<span style="margin-left:5px">${this.util.out('Abort')}</span>
|
|
77494
|
+
`;
|
|
77495
|
+
const ovl = this.builderStuff.querySelector('.page-command-overlay');
|
|
77496
|
+
ovl.style.display = 'flex';
|
|
77497
|
+
this.builder.isInProgress = true;
|
|
77498
|
+
}
|
|
77499
|
+
finish() {
|
|
77500
|
+
const btnSend = this.modalCommand.querySelector('.cmd-send-command');
|
|
77501
|
+
btnSend.innerText = this.util.out('Send');
|
|
77502
|
+
const ovl = this.builderStuff.querySelector('.page-command-overlay');
|
|
77503
|
+
ovl.style.display = 'none';
|
|
77504
|
+
this.builder.isInProgress = false;
|
|
77505
|
+
if (this.builder.autoSendCommand) {
|
|
77506
|
+
// Clear
|
|
77507
|
+
const inpCommand = this.builderStuff.querySelector('.inp-command');
|
|
77508
|
+
this.builder.commandText = '';
|
|
77509
|
+
inpCommand.value = '';
|
|
77510
|
+
}
|
|
77511
|
+
const elmTool = this.builderStuff.querySelector('.is-element-tool');
|
|
77512
|
+
elmTool.style.display = '';
|
|
77513
|
+
}
|
|
77514
|
+
}
|
|
77515
|
+
|
|
77516
|
+
var src = {
|
|
77517
|
+
compareTwoStrings:compareTwoStrings,
|
|
77518
|
+
findBestMatch:findBestMatch
|
|
77519
|
+
};
|
|
77520
|
+
|
|
77521
|
+
function compareTwoStrings(first, second) {
|
|
77522
|
+
first = first.replace(/\s+/g, '');
|
|
77523
|
+
second = second.replace(/\s+/g, '');
|
|
77524
|
+
|
|
77525
|
+
if (first === second) return 1; // identical or empty
|
|
77526
|
+
if (first.length < 2 || second.length < 2) return 0; // if either is a 0-letter or 1-letter string
|
|
77527
|
+
|
|
77528
|
+
let firstBigrams = new Map();
|
|
77529
|
+
for (let i = 0; i < first.length - 1; i++) {
|
|
77530
|
+
const bigram = first.substring(i, i + 2);
|
|
77531
|
+
const count = firstBigrams.has(bigram)
|
|
77532
|
+
? firstBigrams.get(bigram) + 1
|
|
77533
|
+
: 1;
|
|
77534
|
+
|
|
77535
|
+
firstBigrams.set(bigram, count);
|
|
77536
|
+
}
|
|
77537
|
+
let intersectionSize = 0;
|
|
77538
|
+
for (let i = 0; i < second.length - 1; i++) {
|
|
77539
|
+
const bigram = second.substring(i, i + 2);
|
|
77540
|
+
const count = firstBigrams.has(bigram)
|
|
77541
|
+
? firstBigrams.get(bigram)
|
|
77542
|
+
: 0;
|
|
77543
|
+
|
|
77544
|
+
if (count > 0) {
|
|
77545
|
+
firstBigrams.set(bigram, count - 1);
|
|
77546
|
+
intersectionSize++;
|
|
77547
|
+
}
|
|
77548
|
+
}
|
|
77549
|
+
|
|
77550
|
+
return (2.0 * intersectionSize) / (first.length + second.length - 2);
|
|
77551
|
+
}
|
|
77552
|
+
|
|
77553
|
+
function findBestMatch(mainString, targetStrings) {
|
|
77554
|
+
if (!areArgsValid(mainString, targetStrings)) throw new Error('Bad arguments: First argument should be a string, second should be an array of strings');
|
|
77555
|
+
|
|
77556
|
+
const ratings = [];
|
|
77557
|
+
let bestMatchIndex = 0;
|
|
77558
|
+
|
|
77559
|
+
for (let i = 0; i < targetStrings.length; i++) {
|
|
77560
|
+
const currentTargetString = targetStrings[i];
|
|
77561
|
+
const currentRating = compareTwoStrings(mainString, currentTargetString);
|
|
77562
|
+
ratings.push({target: currentTargetString, rating: currentRating});
|
|
77563
|
+
if (currentRating > ratings[bestMatchIndex].rating) {
|
|
77564
|
+
bestMatchIndex = i;
|
|
77565
|
+
}
|
|
77566
|
+
}
|
|
77567
|
+
|
|
77568
|
+
|
|
77569
|
+
const bestMatch = ratings[bestMatchIndex];
|
|
77570
|
+
|
|
77571
|
+
return { ratings: ratings, bestMatch: bestMatch, bestMatchIndex: bestMatchIndex };
|
|
77572
|
+
}
|
|
77573
|
+
|
|
77574
|
+
function areArgsValid(mainString, targetStrings) {
|
|
77575
|
+
if (typeof mainString !== 'string') return false;
|
|
77576
|
+
if (!Array.isArray(targetStrings)) return false;
|
|
77577
|
+
if (!targetStrings.length) return false;
|
|
77578
|
+
if (targetStrings.find( function (s) { return typeof s !== 'string'})) return false;
|
|
77579
|
+
return true;
|
|
77580
|
+
}
|
|
77581
|
+
|
|
77582
|
+
class Similarity {
|
|
77583
|
+
constructor(settings = {}) {
|
|
77584
|
+
const defaults = {
|
|
77585
|
+
commandList: {
|
|
77586
|
+
add_bg_color: ['add a background color', 'add background color'],
|
|
77587
|
+
add_bg_image: ['add a background image', 'add background image', 'add a background', 'add background'],
|
|
77588
|
+
change_bg_color: ['change the background color', 'change background color'],
|
|
77589
|
+
change_bg_image: ['change the background image', 'change background image', 'change the background', 'change background'],
|
|
77590
|
+
remove_bg_color: ['remove background color', 'remove the background color', 'clear background color', 'clear the background color'],
|
|
77591
|
+
remove_bg: ['remove background', 'remove background image', 'remove the background', 'remove the background image', 'clear background', 'clear background image', 'clear the background', 'clear the background image'],
|
|
77592
|
+
increase_content_width: ['increase content width', 'enlarge content width'],
|
|
77593
|
+
decrease_content_width: ['decrease content width', 'reduce content width'],
|
|
77594
|
+
clear_content_width: ['clear content width', 'remove content width', 'make content full', 'full width content'],
|
|
77595
|
+
make_content_light: ['make the content white', 'make the content light', 'make the text white', 'make the text light', 'make content white', 'make content light', 'make text white', 'make text light', 'change the content white', 'change the content light', 'change the text white', 'change the text light', 'change to white content', 'change to light content', 'change to white text', 'change to light text'],
|
|
77596
|
+
make_content_dark: ['make the content black', 'make the content dark', 'make the text black', 'make the text dark', 'make content black', 'make content dark', 'make text black', 'make text dark', 'change the content black', 'change the content dark', 'change the text black', 'change the text dark', 'change to black content', 'change to dark content', 'change to black text', 'change to dark text'],
|
|
77597
|
+
make_section_height_10: ['make section height 10'],
|
|
77598
|
+
make_section_height_15: ['make section height 15'],
|
|
77599
|
+
make_section_height_20: ['make section height 20'],
|
|
77600
|
+
make_section_height_25: ['make section height 25'],
|
|
77601
|
+
make_section_height_30: ['make section height 30'],
|
|
77602
|
+
make_section_height_40: ['make section height 40'],
|
|
77603
|
+
make_section_height_50: ['make section height 50'],
|
|
77604
|
+
make_section_height_60: ['make section height 60'],
|
|
77605
|
+
make_section_height_70: ['make section height 70'],
|
|
77606
|
+
make_section_height_75: ['make section height 75'],
|
|
77607
|
+
make_section_height_80: ['make section height 80'],
|
|
77608
|
+
make_section_height_85: ['make section height 85'],
|
|
77609
|
+
make_section_height_90: ['make section height 90'],
|
|
77610
|
+
make_section_height_100: ['make section height 100'],
|
|
77611
|
+
make_section_height_auto: ['make section height auto'],
|
|
77612
|
+
suggest_headline: ['suggest a headline', 'suggest headline', 'suggest a header', 'suggest header', 'suggest a title', 'suggest title', 'write a headline', 'write headline', 'write a header', 'write header', 'write a title', 'write title'],
|
|
77613
|
+
add_headline: ['add a headline', 'add headline', 'add a header', 'add header', 'add a title', 'add title'],
|
|
77614
|
+
add_paragraph: ['add a paragraph', 'add paragraph'],
|
|
77615
|
+
add_image: ['add an image', 'add image'],
|
|
77616
|
+
add_youtube: ['add a youtube', 'add youtube'],
|
|
77617
|
+
add_video: ['add a video', 'add video', 'add an HTML5 video', 'add HTML5 video', 'add an mp4 video', 'add mp4 video'],
|
|
77618
|
+
add_audio: ['add an audio', 'add audio', 'add a music', 'add music', 'add an mp3', 'add mp3'],
|
|
77619
|
+
add_map: ['add a map', 'add map', 'add a google map', 'add google map'],
|
|
77620
|
+
add_table: ['add a table', 'add table'],
|
|
77621
|
+
add_social: ['add a social', 'add social'],
|
|
77622
|
+
add_icon: ['add an icon', 'add icon'],
|
|
77623
|
+
add_button: ['add a button', 'add button'],
|
|
77624
|
+
add_2buttons: ['add 2 button', 'add 2 button', 'add 2 buttons', 'add 2 buttons'],
|
|
77625
|
+
add_space: ['add a space', 'add space'],
|
|
77626
|
+
position_before: ['above', 'before'],
|
|
77627
|
+
increase_line_height: ['increase line height', 'increase line spacing', 'increase text spacing', 'increase the line height', 'increase the line spacing', 'increase the text spacing', 'enlarge line height', 'enlarge line spacing', 'enlarge text spacing', 'enlarge the line height', 'enlarge the line spacing', 'enlarge the text spacing', 'bigger line height', 'bigger line spacing', 'bigger text spacing', 'bigger the line height', 'bigger the line spacing', 'bigger the text spacing', 'make line height bigger', 'make line spacing bigger', 'make text spacing bigger', 'make the line height bigger', 'make the line spacing bigger', 'make the text spacing bigger'],
|
|
77628
|
+
increase_default_line_height: ['increase default line height', 'increase default line spacing', 'increase default text spacing', 'increase the default line height', 'increase the default line spacing', 'increase the default text spacing', 'enlarge default line height', 'enlarge default line spacing', 'enlarge default text spacing', 'enlarge the default line height', 'enlarge the default line spacing', 'enlarge the default text spacing', 'bigger default line height', 'bigger default line spacing', 'bigger default text spacing', 'bigger the default line height', 'bigger the default line spacing', 'bigger the default text spacing', 'make default line height bigger', 'make default line spacing bigger', 'make default text spacing bigger', 'make the default line height bigger', 'make the default line spacing bigger', 'make the default text spacing bigger'],
|
|
77629
|
+
decrease_line_height: ['decrease line height', 'decrease line spacing', 'decrease text spacing', 'decrease the line height', 'decrease the line spacing', 'decrease the text spacing', 'reduce line height', 'reduce line spacing', 'reduce text spacing', 'reduce the line height', 'reduce the line spacing', 'reduce the text spacing', 'smaller line height', 'smaller line spacing', 'smaller text spacing', 'smaller the line height', 'smaller the line spacing', 'smaller the text spacing', 'make line height smaller', 'make line spacing smaller', 'make text spacing smaller', 'make the line height smaller', 'make the line spacing smaller', 'make the text spacing smaller'],
|
|
77630
|
+
decrease_default_line_height: ['decrease default line height', 'decrease default line spacing', 'decrease default text spacing', 'decrease the default line height', 'decrease the default line spacing', 'decrease the default text spacing', 'reduce default line height', 'reduce default line spacing', 'reduce default text spacing', 'reduce the default line height', 'reduce the default line spacing', 'reduce the default text spacing', 'smaller default line height', 'smaller default line spacing', 'smaller default text spacing', 'smaller the default line height', 'smaller the default line spacing', 'smaller the default text spacing', 'make default line height smaller', 'make default line spacing smaller', 'make default text spacing smaller', 'make the default line height smaller', 'make the default line spacing smaller', 'make the default text spacing smaller'],
|
|
77631
|
+
increase_font_size: ['increase font', 'increase size', 'increase font size', 'increase the font', 'increase the size', 'increase the font size', 'increase text', 'increase size', 'increase text size', 'increase the text', 'increase the text size', 'enlarge font', 'enlarge size', 'enlarge font size', 'enlarge the font', 'enlarge the size', 'enlarge the font size', 'enlarge text', 'enlarge size', 'enlarge text size', 'enlarge the text', 'enlarge the text size', 'text bigger', 'font bigger', 'size bigger'],
|
|
77632
|
+
decrease_font_size: ['decrease font', 'decrease size', 'decrease font size', 'decrease the font', 'decrease the size', 'decrease the font size', 'decrease text', 'decrease size', 'decrease text size', 'decrease the text', 'decrease the text size', 'reduce font', 'reduce size', 'reduce font size', 'reduce the font', 'reduce the size', 'reduce the font size', 'reduce text', 'reduce size', 'reduce text size', 'reduce the text', 'reduce the text size', 'text smaller', 'font smaller', 'size smaller'],
|
|
77633
|
+
increase_default_font_size: ['increase default font', 'increase default size', 'increase default font size', 'increase the default font', 'increase the default size', 'increase the default font size', 'increase default text', 'increase default size', 'increase default text size', 'increase the default text', 'increase the default text size', 'enlarge default font', 'enlarge default size', 'enlarge default font size', 'enlarge the default font', 'enlarge the default size', 'enlarge the default font size', 'enlarge default text', 'enlarge default text size', 'enlarge the default text', 'enlarge the default text size', 'default text bigger', 'default font bigger', 'default size bigger', 'increase default content', 'increase default content size', 'increase the default content', 'increase the default content size', 'enlarge default content', 'enlarge default content size', 'enlarge the default content', 'enlarge the default content size'],
|
|
77634
|
+
decrease_default_font_size: ['decrease default font', 'decrease default size', 'decrease default font size', 'decrease the default font', 'decrease the default size', 'decrease the default font size', 'decrease default text', 'decrease default size', 'decrease default text size', 'decrease the default text', 'decrease the default text size', 'reduce default font', 'reduce default size', 'reduce default font size', 'reduce the default font', 'reduce the default size', 'reduce the default font size', 'reduce default text', 'reduce default text size', 'reduce the default text', 'reduce the default text size', 'default text smaller', 'default font smaller', 'default size smaller', 'decrease default content', 'decrease default content size', 'decrease the default content', 'decrease the default content size', 'reduce default content', 'reduce default content size', 'reduce the default content', 'reduce the default content size'],
|
|
77635
|
+
clear_font_size: ['clear font size', 'remove font size', 'clear text size', 'remove text size', 'use default font size', 'ude the default font size'],
|
|
77636
|
+
align_left: ['align left', 'align the text left', 'align text left', 'left aligned'],
|
|
77637
|
+
align_center: ['align center', 'align the text center', 'align text center', 'center aligned'],
|
|
77638
|
+
align_right: ['align right', 'align the text right', 'align text right', 'right aligned'],
|
|
77639
|
+
align_full: ['align full', 'align justify', 'justify', 'justify text', 'justify the text', 'justify full'],
|
|
77640
|
+
clear_alignment: ['clear alignment', 'remove alignment', 'clear the text alignment', 'remove the text alignment', 'clear text alignment', 'remove text alignment'],
|
|
77641
|
+
make_content_centered: ['make the content center', 'make the content centered'],
|
|
77642
|
+
move_content_left: ['move content left', 'move content to left', 'move the content left', 'move content to the left', 'move content to the left', 'place content on the left', 'move the content to the left', 'move the content to the left', 'place the content on the left'],
|
|
77643
|
+
move_content_center: ['move content center', 'move content to center', 'move the content center', 'move content to the center', 'move content to the center', 'place content on the center', 'move the content to the center', 'move the content to the center', 'place the content on the center'],
|
|
77644
|
+
move_content_right: ['move content right', 'move content to right', 'move the content right', 'move content to the right', 'move content to the right', 'place content on the right', 'move the content to the right', 'move the content to the right', 'place the content on the right'],
|
|
77645
|
+
move_content_top: ['move content top', 'move content to top', 'move the content top', 'move content to the top', 'move content to the top', 'place content on the top', 'move the content to the top', 'move the content to the top', 'place the content on the top'],
|
|
77646
|
+
move_content_middle: ['move content middle', 'move content to middle', 'move the content middle', 'move content to the middle', 'move content to the middle', 'place content on the middle', 'move the content to the middle', 'move the content to the middle', 'place the content on the middle'],
|
|
77647
|
+
move_content_bottom: ['move content bottom', 'move content to bottom', 'move the content bottom', 'move content to the bottom', 'move content to the bottom', 'place content on the bottom', 'move the content to the bottom', 'move the content to the bottom', 'place the content on the bottom'],
|
|
77648
|
+
increase_space: ['more space', 'increase space', 'increase the space', 'enlarge the space'],
|
|
77649
|
+
decrease_space: ['less space', 'decrease space', 'decrease the space', 'reduce the space'],
|
|
77650
|
+
move_row_up: ['move up', 'move row up'],
|
|
77651
|
+
move_row_down: ['move down', 'move row down'],
|
|
77652
|
+
duplicate_row: ['duplicate row', 'copy row'],
|
|
77653
|
+
remove_row: ['remove row', 'delete row'],
|
|
77654
|
+
move_col_left: ['move left', 'move column left'],
|
|
77655
|
+
move_col_right: ['move right', 'move column right'],
|
|
77656
|
+
duplicate_col: ['duplicate column', 'copy column'],
|
|
77657
|
+
remove_col: ['remove column', 'delete column'],
|
|
77658
|
+
move_column_up: ['move column up'],
|
|
77659
|
+
move_column_down: ['move column down']
|
|
77660
|
+
}
|
|
77661
|
+
};
|
|
77662
|
+
this.settings = Object.assign(this, defaults, settings);
|
|
77663
|
+
}
|
|
77664
|
+
check(command) {
|
|
77665
|
+
const {
|
|
77666
|
+
commandList
|
|
77667
|
+
} = this.settings;
|
|
77668
|
+
let maxSimilarity = 0;
|
|
77669
|
+
let maxKey = '';
|
|
77670
|
+
for (const [key, value] of Object.entries(commandList)) {
|
|
77671
|
+
const similarity = this.calculate(command, value);
|
|
77672
|
+
if (similarity > maxSimilarity) {
|
|
77673
|
+
maxSimilarity = similarity;
|
|
77674
|
+
maxKey = key;
|
|
77675
|
+
}
|
|
77676
|
+
}
|
|
77677
|
+
const similarityThreshold = 0.5;
|
|
77678
|
+
if (maxSimilarity >= similarityThreshold) {
|
|
77679
|
+
return maxKey;
|
|
77680
|
+
}
|
|
77681
|
+
return false;
|
|
77682
|
+
}
|
|
77683
|
+
calculate(command, list) {
|
|
77684
|
+
const normalizedCommand = command.toLowerCase();
|
|
77685
|
+
let maxSimilarity = 0;
|
|
77686
|
+
for (const cmd of list) {
|
|
77687
|
+
const similarity = src.compareTwoStrings(normalizedCommand, cmd);
|
|
77688
|
+
if (similarity > maxSimilarity) {
|
|
77689
|
+
// console.log(list)
|
|
77690
|
+
// console.log(similarity)
|
|
77691
|
+
maxSimilarity = similarity;
|
|
77692
|
+
}
|
|
77693
|
+
}
|
|
77694
|
+
return maxSimilarity;
|
|
77695
|
+
}
|
|
77696
|
+
}
|
|
77697
|
+
|
|
77698
|
+
class Command {
|
|
77699
|
+
constructor(builder) {
|
|
77700
|
+
this.builder = builder;
|
|
77701
|
+
const builderStuff = this.builder.builderStuff;
|
|
77702
|
+
this.builderStuff = builderStuff;
|
|
77703
|
+
const controller = new AbortController(); // Abort
|
|
77704
|
+
let signal = controller.signal;
|
|
77705
|
+
if (this.builder.commandList) {
|
|
77706
|
+
this.cp = new Similarity({
|
|
77707
|
+
commandList: this.builder.commandList
|
|
77708
|
+
});
|
|
77709
|
+
} else {
|
|
77710
|
+
this.cp = new Similarity();
|
|
77711
|
+
}
|
|
77712
|
+
|
|
77713
|
+
// Dictation Panel
|
|
77714
|
+
this.dictation = this.builder.dictation;
|
|
77715
|
+
this.dictation.opts.send = async question => {
|
|
77716
|
+
if (question === '') {
|
|
77717
|
+
return;
|
|
77718
|
+
}
|
|
77719
|
+
question = this.builder.lib.processShortCommand(question);
|
|
77720
|
+
if (!question) {
|
|
77721
|
+
this.dictation.finish(); // Must be called after finished
|
|
77722
|
+
return;
|
|
77723
|
+
}
|
|
77724
|
+
question = this.processPrompt(question);
|
|
77725
|
+
if (!question) {
|
|
77726
|
+
this.dictation.finish(); // Must be called after finished
|
|
77727
|
+
return;
|
|
77728
|
+
}
|
|
77729
|
+
let currentHtml = this.builder.html();
|
|
77730
|
+
|
|
77731
|
+
// Update prompt
|
|
77732
|
+
question = `${question}:
|
|
77733
|
+
|
|
77734
|
+
${currentHtml}`;
|
|
77735
|
+
const response = await fetch('http://localhost:8081/answer', {
|
|
77736
|
+
signal,
|
|
77737
|
+
// Abort
|
|
77738
|
+
method: 'POST',
|
|
77739
|
+
headers: {
|
|
77740
|
+
'Content-Type': 'application/json'
|
|
77741
|
+
},
|
|
77742
|
+
body: JSON.stringify({
|
|
77743
|
+
question
|
|
77744
|
+
})
|
|
77745
|
+
});
|
|
77746
|
+
if (!response.ok) {
|
|
77747
|
+
const error = await response.json();
|
|
77748
|
+
console.error('Error:', error.error);
|
|
77749
|
+
this.dictation.finish(); // Must be called after finished
|
|
77750
|
+
|
|
77751
|
+
return;
|
|
77752
|
+
}
|
|
77753
|
+
const data = await response.json();
|
|
77754
|
+
let html = this.getHtmlResult(data.answer);
|
|
77755
|
+
this.builder.saveForUndo();
|
|
77756
|
+
|
|
77757
|
+
// Update HTML
|
|
77758
|
+
this.builder.loadHtml(html);
|
|
77759
|
+
|
|
77760
|
+
//Trigger Change event
|
|
77761
|
+
this.builder.settings.onChange();
|
|
77762
|
+
this.dictation.finish(); // Must be called after finished
|
|
77763
|
+
};
|
|
77764
|
+
|
|
77765
|
+
this.dictation.opts.abort = () => {
|
|
77766
|
+
// console.log('abort');
|
|
77767
|
+
|
|
77768
|
+
controller.abort();
|
|
77769
|
+
this.dictation.finish(); // Must be called after finished
|
|
77770
|
+
};
|
|
77771
|
+
}
|
|
77772
|
+
|
|
77773
|
+
//-------------------
|
|
77774
|
+
|
|
77775
|
+
processPrompt(question) {
|
|
77776
|
+
const activeBox = this.builder.activeBox;
|
|
77777
|
+
let intent = this.builder.similarity.check(question);
|
|
77778
|
+
// console.log(intent);
|
|
77779
|
+
|
|
77780
|
+
if (!intent) return question;
|
|
77781
|
+
if (intent === 'add_bg_color' || intent === 'change_bg_color' || intent === 'suggest_headline') {
|
|
77782
|
+
return question; // Pass to ChatGPT
|
|
77783
|
+
}
|
|
77784
|
+
|
|
77785
|
+
this.builder.saveForUndo();
|
|
77786
|
+
if (intent === 'move_row_up') {
|
|
77787
|
+
this.builder.moveRowUp();
|
|
77788
|
+
} else if (intent === 'move_row_down') {
|
|
77789
|
+
this.builder.moveRowDown();
|
|
77790
|
+
} else if (intent === 'duplicate_row') {
|
|
77791
|
+
this.builder.duplicateRow();
|
|
77792
|
+
} else if (intent === 'remove_row') {
|
|
77793
|
+
this.builder.removeRow();
|
|
77794
|
+
} else if (intent === 'move_col_left') {
|
|
77795
|
+
this.builder.moveColumnLeft();
|
|
77796
|
+
} else if (intent === 'move_col_right') {
|
|
77797
|
+
this.builder.moveColumnRight();
|
|
77798
|
+
} else if (intent === 'duplicate_col') {
|
|
77799
|
+
this.builder.duplicateColumn();
|
|
77800
|
+
} else if (intent === 'remove_col') {
|
|
77801
|
+
this.builder.removeColumn();
|
|
77802
|
+
} else if (intent === 'move_column_up') {
|
|
77803
|
+
this.builder.moveColumnUp();
|
|
77804
|
+
} else if (intent === 'move_column_down') {
|
|
77805
|
+
this.builder.moveColumnDown();
|
|
77806
|
+
} else if (intent === 'add_headline') {
|
|
77807
|
+
this.builder.lib.addBlock(activeBox, 'headline', 'after');
|
|
77808
|
+
} else if (intent === 'add_paragraph') {
|
|
77809
|
+
this.builder.lib.addBlock(activeBox, 'paragraph', 'after');
|
|
77810
|
+
} else if (intent === 'add_image') {
|
|
77811
|
+
this.builder.lib.addBlock(activeBox, 'image', 'after');
|
|
77812
|
+
} else if (intent === 'add_youtube') {
|
|
77813
|
+
this.builder.lib.addBlock(activeBox, 'youtube', 'after');
|
|
77814
|
+
} else if (intent === 'add_video') {
|
|
77815
|
+
this.builder.lib.addBlock(activeBox, 'video', 'after');
|
|
77816
|
+
} else if (intent === 'add_audio') {
|
|
77817
|
+
this.builder.lib.addBlock(activeBox, 'audio', 'after');
|
|
77818
|
+
} else if (intent === 'add_map') {
|
|
77819
|
+
this.builder.lib.addBlock(activeBox, 'map', 'after');
|
|
77820
|
+
} else if (intent === 'add_table') {
|
|
77821
|
+
this.builder.lib.addBlock(activeBox, 'table', 'after');
|
|
77822
|
+
} else if (intent === 'add_social') {
|
|
77823
|
+
this.builder.lib.addBlock(activeBox, 'social', 'after');
|
|
77824
|
+
} else if (intent === 'add_icon') {
|
|
77825
|
+
this.builder.lib.addBlock(activeBox, 'icon', 'after');
|
|
77826
|
+
} else if (intent === 'add_button') {
|
|
77827
|
+
this.builder.lib.addBlock(activeBox, 'button', 'after');
|
|
77828
|
+
} else if (intent === 'add_2buttons') {
|
|
77829
|
+
this.builder.lib.addBlock(activeBox, 'twobuttons', 'after');
|
|
77830
|
+
} else if (intent === 'add_space') {
|
|
77831
|
+
this.builder.lib.addBlock(activeBox, 'space', 'after');
|
|
77832
|
+
} else if (intent === 'increase_font_size') {
|
|
77833
|
+
let elm = this.builder.activeElement;
|
|
77834
|
+
if (elm) {
|
|
77835
|
+
this.builder.lib.increaseFontSize(elm);
|
|
77836
|
+
}
|
|
77837
|
+
} else if (intent === 'decrease_font_size') {
|
|
77838
|
+
let elm = this.builder.activeElement;
|
|
77839
|
+
if (elm) {
|
|
77840
|
+
this.builder.lib.decreaseFontSize(elm);
|
|
77841
|
+
}
|
|
77842
|
+
} else if (intent === 'clear_font_size') {
|
|
77843
|
+
let elm = this.builder.activeElement;
|
|
77844
|
+
if (elm) {
|
|
77845
|
+
this.builder.lib.clearFontSize(elm);
|
|
77846
|
+
}
|
|
77847
|
+
} else if (intent === 'align_left') {
|
|
77848
|
+
let elm = this.builder.activeElement;
|
|
77849
|
+
if (elm) {
|
|
77850
|
+
this.builder.lib.alignText(elm, 'left');
|
|
77851
|
+
} else {
|
|
77852
|
+
this.builder.lib.alignContent(activeBox, 'left');
|
|
77853
|
+
}
|
|
77854
|
+
} else if (intent === 'align_center') {
|
|
77855
|
+
let elm = this.builder.activeElement;
|
|
77856
|
+
if (elm) {
|
|
77857
|
+
this.builder.lib.alignText(elm, 'center');
|
|
77858
|
+
} else {
|
|
77859
|
+
this.builder.lib.alignContent(activeBox, 'center');
|
|
77860
|
+
}
|
|
77861
|
+
} else if (intent === 'align_right') {
|
|
77862
|
+
let elm = this.builder.activeElement;
|
|
77863
|
+
if (elm) {
|
|
77864
|
+
this.builder.lib.alignText(elm, 'right');
|
|
77865
|
+
} else {
|
|
77866
|
+
this.builder.lib.alignContent(activeBox, 'right');
|
|
77867
|
+
}
|
|
77868
|
+
} else if (intent === 'align_full') {
|
|
77869
|
+
let elm = this.builder.activeElement;
|
|
77870
|
+
if (elm) {
|
|
77871
|
+
this.builder.lib.alignText(elm, 'justify');
|
|
77872
|
+
} else {
|
|
77873
|
+
this.builder.lib.alignContent(activeBox, 'justify');
|
|
77874
|
+
}
|
|
77875
|
+
} else if (intent === 'clear_alignment') {
|
|
77876
|
+
let elm = this.builder.activeElement;
|
|
77877
|
+
if (elm) {
|
|
77878
|
+
this.builder.lib.alignText(elm, '');
|
|
77879
|
+
} else {
|
|
77880
|
+
this.builder.lib.alignContent(activeBox, '');
|
|
77881
|
+
}
|
|
77882
|
+
} else if (intent === 'increase_space') {
|
|
77883
|
+
let elm = this.builder.activeElement;
|
|
77884
|
+
if (elm) {
|
|
77885
|
+
this.builder.lib.increaseElementHeight(elm);
|
|
77886
|
+
}
|
|
77887
|
+
} else if (intent === 'decrease_space') {
|
|
77888
|
+
let elm = this.builder.activeElement;
|
|
77889
|
+
if (elm) {
|
|
77890
|
+
this.builder.lib.decreaseElementHeight(elm);
|
|
77891
|
+
}
|
|
77892
|
+
} else if (intent === 'increase_line_height') {
|
|
77893
|
+
let elm = this.builder.activeElement;
|
|
77894
|
+
if (elm) {
|
|
77895
|
+
this.builder.lib.increaseLineHeight(elm);
|
|
77896
|
+
}
|
|
77897
|
+
} else if (intent === 'decrease_line_height') {
|
|
77898
|
+
let elm = this.builder.activeElement;
|
|
77899
|
+
if (elm) {
|
|
77900
|
+
this.builder.lib.decreaseLineHeight(elm);
|
|
77901
|
+
}
|
|
77902
|
+
}
|
|
77903
|
+
|
|
77904
|
+
//Trigger Change event
|
|
77905
|
+
this.builder.settings.onChange();
|
|
77906
|
+
return false;
|
|
77907
|
+
} // /processPrompt()
|
|
77908
|
+
|
|
77909
|
+
//-------------------
|
|
77910
|
+
|
|
77911
|
+
openDictation() {
|
|
77912
|
+
this.dictation.openDictation();
|
|
77913
|
+
}
|
|
77914
|
+
getHtmlResult(html) {
|
|
77915
|
+
if (html.indexOf('```') !== -1) {
|
|
77916
|
+
const regex = /<div[^>]*>[\s\S]*<\/div>/;
|
|
77917
|
+
const matches = html.match(regex);
|
|
77918
|
+
const extractedString = matches && matches[0];
|
|
77919
|
+
html = extractedString;
|
|
77920
|
+
}
|
|
77921
|
+
return html;
|
|
77922
|
+
}
|
|
77923
|
+
}
|
|
77924
|
+
|
|
76349
77925
|
class ContentBuilder {
|
|
76350
77926
|
constructor(opts = {}) {
|
|
76351
77927
|
let defaults = {
|
|
@@ -76589,6 +78165,7 @@ class ContentBuilder {
|
|
|
76589
78165
|
imageRenameOnEdit: true,
|
|
76590
78166
|
disableAutoEmbedVideo: false,
|
|
76591
78167
|
deleteConfirm: false,
|
|
78168
|
+
isContentBox: false,
|
|
76592
78169
|
sectionTemplate: `
|
|
76593
78170
|
<div class="is-section is-box is-section-100 type-opensans">
|
|
76594
78171
|
<div class="is-overlay"></div>
|
|
@@ -77244,6 +78821,20 @@ class ContentBuilder {
|
|
|
77244
78821
|
|
|
77245
78822
|
// Shortcut Info
|
|
77246
78823
|
this.ShortcutInfo = new ShortcutInfo(this);
|
|
78824
|
+
|
|
78825
|
+
// Prompt Stuff
|
|
78826
|
+
this.dictation = new Dictation({}, this); // Dictation Panel
|
|
78827
|
+
this.lib = new Lib(this); // Libraries of common editing functions
|
|
78828
|
+
if (this.commandList) {
|
|
78829
|
+
this.similarity = new Similarity({
|
|
78830
|
+
commandList: this.commandList
|
|
78831
|
+
});
|
|
78832
|
+
} else {
|
|
78833
|
+
this.similarity = new Similarity();
|
|
78834
|
+
}
|
|
78835
|
+
if (!this.opts.isContentBox) {
|
|
78836
|
+
this.command = new Command(this);
|
|
78837
|
+
}
|
|
77247
78838
|
if (this.iframe) {
|
|
77248
78839
|
this.win.addEventListener('scroll', this.doWindowScroll = () => {
|
|
77249
78840
|
this.util.hidePops();
|