@innovastudio/contentbox 1.1.4 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -829,7 +829,13 @@ class SideBar {
|
|
|
829
829
|
if (src.indexOf(contentCss.toLowerCase()) != -1) exist = true;
|
|
830
830
|
}
|
|
831
831
|
|
|
832
|
-
if (!exist)
|
|
832
|
+
if (!exist) {
|
|
833
|
+
if (this.builder.settings.cssInBody) {
|
|
834
|
+
this.builder.wrapperEl.insertAdjacentHTML('beforebegin', '<link data-name="contentstyle" data-class="' + className + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
|
|
835
|
+
} else {
|
|
836
|
+
dom$J.appendHtml(document.head, '<link data-name="contentstyle" data-class="' + className + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
|
|
837
|
+
}
|
|
838
|
+
}
|
|
833
839
|
} //Cleanup unused
|
|
834
840
|
|
|
835
841
|
|
|
@@ -888,7 +894,11 @@ class SideBar {
|
|
|
888
894
|
}); //Add new page css
|
|
889
895
|
|
|
890
896
|
if (pageCss != '') {
|
|
891
|
-
|
|
897
|
+
if (this.builder.settings.cssInBody) {
|
|
898
|
+
this.builder.wrapperEl.insertAdjacentHTML('beforebegin', '<link href="' + contentStylePath + pageCss + '" rel="stylesheet">');
|
|
899
|
+
} else {
|
|
900
|
+
dom$J.appendHtml(document.head, '<link href="' + contentStylePath + pageCss + '" rel="stylesheet">');
|
|
901
|
+
}
|
|
892
902
|
}
|
|
893
903
|
} else if (mode === 'container') {
|
|
894
904
|
let builderActive = document.querySelector('.builder-active');
|
|
@@ -913,7 +923,13 @@ class SideBar {
|
|
|
913
923
|
if (src.indexOf(contentCss.toLowerCase()) != -1) exist = true;
|
|
914
924
|
}
|
|
915
925
|
|
|
916
|
-
if (!exist)
|
|
926
|
+
if (!exist) {
|
|
927
|
+
if (this.builder.settings.cssInBody) {
|
|
928
|
+
this.builder.wrapperEl.insertAdjacentHTML('beforebegin', '<link data-name="contentstyle" data-class="' + className + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
|
|
929
|
+
} else {
|
|
930
|
+
dom$J.appendHtml(document.head, '<link data-name="contentstyle" data-class="' + className + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
|
|
931
|
+
}
|
|
932
|
+
}
|
|
917
933
|
} //Cleanup unused
|
|
918
934
|
|
|
919
935
|
|
|
@@ -959,7 +975,13 @@ class SideBar {
|
|
|
959
975
|
if (src.indexOf(contentCss.toLowerCase()) != -1) exist = true;
|
|
960
976
|
}
|
|
961
977
|
|
|
962
|
-
if (!exist)
|
|
978
|
+
if (!exist) {
|
|
979
|
+
if (this.builder.settings.cssInBody) {
|
|
980
|
+
this.builder.wrapperEl.insertAdjacentHTML('beforebegin', '<link data-name="contentstyle" data-class="' + className + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
|
|
981
|
+
} else {
|
|
982
|
+
dom$J.appendHtml(document.head, '<link data-name="contentstyle" data-class="' + className + '" href="' + contentStylePath + contentCss + '" rel="stylesheet">');
|
|
983
|
+
}
|
|
984
|
+
}
|
|
963
985
|
} //Cleanup unused
|
|
964
986
|
|
|
965
987
|
|
|
@@ -78904,6 +78926,7 @@ class ContentBox {
|
|
|
78904
78926
|
}]
|
|
78905
78927
|
}
|
|
78906
78928
|
},
|
|
78929
|
+
cssInBody: false,
|
|
78907
78930
|
|
|
78908
78931
|
/* Old Version (backward compatible) */
|
|
78909
78932
|
onAddSectionOpen: function () {},
|
|
@@ -79931,6 +79954,7 @@ class ContentBox {
|
|
|
79931
79954
|
|
|
79932
79955
|
loadStyles(mainCss, sectionCss) {
|
|
79933
79956
|
let links = document.getElementsByTagName('link');
|
|
79957
|
+
let boxCssInBody;
|
|
79934
79958
|
|
|
79935
79959
|
for (let i = 0; i < links.length; i++) {
|
|
79936
79960
|
if (links[i].getAttribute('data-name') === 'contentstyle') {
|
|
@@ -79939,9 +79963,21 @@ class ContentBox {
|
|
|
79939
79963
|
|
|
79940
79964
|
if (links[i].getAttribute('href').indexOf('basetype-') !== -1) {
|
|
79941
79965
|
links[i].setAttribute('data-rel', '_del');
|
|
79966
|
+
} // Check if main css (box.css in inside body)
|
|
79967
|
+
|
|
79968
|
+
|
|
79969
|
+
if (links[i].getAttribute('href').indexOf('/box.css') !== -1 || links[i].getAttribute('href').indexOf('/box-flex.css') !== -1) {
|
|
79970
|
+
if (links[i].closest('body')) {
|
|
79971
|
+
boxCssInBody = true;
|
|
79972
|
+
this.settings.cssInBody = true;
|
|
79973
|
+
}
|
|
79942
79974
|
}
|
|
79943
79975
|
}
|
|
79944
79976
|
|
|
79977
|
+
if (this.settings.cssInBody) {
|
|
79978
|
+
boxCssInBody = true;
|
|
79979
|
+
}
|
|
79980
|
+
|
|
79945
79981
|
let elms = document.querySelectorAll('[data-rel="_del"]');
|
|
79946
79982
|
elms.forEach(elm => {
|
|
79947
79983
|
elm.parentNode.removeChild(elm);
|
|
@@ -79949,10 +79985,18 @@ class ContentBox {
|
|
|
79949
79985
|
let page = document.head;
|
|
79950
79986
|
if (!page) page = document.body;
|
|
79951
79987
|
if (mainCss) if (mainCss !== '') {
|
|
79952
|
-
|
|
79988
|
+
if (boxCssInBody) {
|
|
79989
|
+
this.wrapperEl.insertAdjacentHTML('beforebegin', mainCss);
|
|
79990
|
+
} else {
|
|
79991
|
+
page.insertAdjacentHTML('beforeend', mainCss); // add the style on the head
|
|
79992
|
+
}
|
|
79953
79993
|
}
|
|
79954
79994
|
if (sectionCss) if (sectionCss !== '') {
|
|
79955
|
-
|
|
79995
|
+
if (boxCssInBody) {
|
|
79996
|
+
this.wrapperEl.insertAdjacentHTML('beforebegin', sectionCss);
|
|
79997
|
+
} else {
|
|
79998
|
+
page.insertAdjacentHTML('beforeend', sectionCss); // add the style on the head
|
|
79999
|
+
}
|
|
79956
80000
|
}
|
|
79957
80001
|
}
|
|
79958
80002
|
|
|
@@ -80001,33 +80045,69 @@ class ContentBox {
|
|
|
80001
80045
|
}
|
|
80002
80046
|
|
|
80003
80047
|
mainCss() {
|
|
80004
|
-
let css = '';
|
|
80005
80048
|
let links = document.getElementsByTagName('link');
|
|
80049
|
+
let arrLinks = [];
|
|
80006
80050
|
|
|
80007
80051
|
for (let i = 0; i < links.length; i++) {
|
|
80008
80052
|
let src = links[i].href.toLowerCase();
|
|
80009
80053
|
|
|
80010
80054
|
if (src.indexOf('basetype-') != -1) {
|
|
80011
|
-
|
|
80055
|
+
arrLinks.push(links[i].outerHTML);
|
|
80012
80056
|
}
|
|
80013
|
-
}
|
|
80057
|
+
} // arrLinks = [...new Set(arrLinks)]; // remove duplicates not needed, always single css
|
|
80014
80058
|
|
|
80015
|
-
|
|
80059
|
+
|
|
80060
|
+
return arrLinks.join('');
|
|
80061
|
+
}
|
|
80062
|
+
|
|
80063
|
+
mainCssList() {
|
|
80064
|
+
let links = document.getElementsByTagName('link');
|
|
80065
|
+
let arrLinks = [];
|
|
80066
|
+
|
|
80067
|
+
for (let i = 0; i < links.length; i++) {
|
|
80068
|
+
let src = links[i].href.toLowerCase();
|
|
80069
|
+
|
|
80070
|
+
if (src.indexOf('basetype-') != -1) {
|
|
80071
|
+
arrLinks.push(links[i].outerHTML);
|
|
80072
|
+
}
|
|
80073
|
+
} // arrLinks = [...new Set(arrLinks)]; // remove duplicates not needed, always single css
|
|
80074
|
+
|
|
80075
|
+
|
|
80076
|
+
return arrLinks;
|
|
80016
80077
|
}
|
|
80017
80078
|
|
|
80018
80079
|
sectionCss() {
|
|
80019
|
-
let css = '';
|
|
80020
80080
|
let links = document.getElementsByTagName('link');
|
|
80081
|
+
let arrLinks = [];
|
|
80021
80082
|
|
|
80022
80083
|
for (let i = 0; i < links.length; i++) {
|
|
80023
80084
|
let src = links[i].href.toLowerCase();
|
|
80024
80085
|
|
|
80025
80086
|
if (src.indexOf('basetype-') != -1) ; else if (src.indexOf('type-') != -1) {
|
|
80026
|
-
|
|
80087
|
+
arrLinks.push(links[i].outerHTML);
|
|
80027
80088
|
}
|
|
80028
80089
|
}
|
|
80029
80090
|
|
|
80030
|
-
|
|
80091
|
+
arrLinks = [...new Set(arrLinks)]; // remove duplicates
|
|
80092
|
+
|
|
80093
|
+
return arrLinks.join('');
|
|
80094
|
+
}
|
|
80095
|
+
|
|
80096
|
+
sectionCssList() {
|
|
80097
|
+
let links = document.getElementsByTagName('link');
|
|
80098
|
+
let arrLinks = [];
|
|
80099
|
+
|
|
80100
|
+
for (let i = 0; i < links.length; i++) {
|
|
80101
|
+
let src = links[i].href.toLowerCase();
|
|
80102
|
+
|
|
80103
|
+
if (src.indexOf('basetype-') != -1) ; else if (src.indexOf('type-') != -1) {
|
|
80104
|
+
arrLinks.push(links[i].outerHTML);
|
|
80105
|
+
}
|
|
80106
|
+
}
|
|
80107
|
+
|
|
80108
|
+
arrLinks = [...new Set(arrLinks)]; // remove duplicates
|
|
80109
|
+
|
|
80110
|
+
return arrLinks;
|
|
80031
80111
|
}
|
|
80032
80112
|
|
|
80033
80113
|
html(bForView) {
|