chayns-api 3.6.8 → 3.6.9
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.
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const reloadChaynsCss = systemFontSize => {
|
|
4
|
+
const currentLink = document.querySelector('link[rel="stylesheet"][href*="style-staging.tobit.cloud/css/"], ' + 'link[rel="stylesheet"][href*="style.tobit.cloud/css/"]');
|
|
5
|
+
if (!currentLink) {
|
|
6
|
+
console.warn('Stylesheet nicht gefunden.');
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const url = new URL(currentLink.href);
|
|
10
|
+
url.searchParams.set('systemFontSize', String(systemFontSize));
|
|
11
|
+
const newLink = document.createElement('link');
|
|
12
|
+
newLink.rel = 'stylesheet';
|
|
13
|
+
newLink.type = 'text/css';
|
|
14
|
+
newLink.href = url.toString();
|
|
15
|
+
newLink.onload = () => {
|
|
16
|
+
currentLink.remove();
|
|
17
|
+
};
|
|
18
|
+
newLink.onerror = () => {
|
|
19
|
+
newLink.remove();
|
|
20
|
+
console.error('[chayns-api] Error loading chayns-css with systemFontSize:', systemFontSize);
|
|
21
|
+
};
|
|
22
|
+
currentLink.after(newLink);
|
|
23
|
+
};
|
|
@@ -815,7 +815,8 @@ class AppWrapper {
|
|
|
815
815
|
enabled: true
|
|
816
816
|
}, {
|
|
817
817
|
callback: ({
|
|
818
|
-
colorMode
|
|
818
|
+
colorMode,
|
|
819
|
+
systemFontSize
|
|
819
820
|
}) => {
|
|
820
821
|
this.values = {
|
|
821
822
|
...this.values,
|
|
@@ -830,6 +831,9 @@ class AppWrapper {
|
|
|
830
831
|
value: this.values.site
|
|
831
832
|
}
|
|
832
833
|
}));
|
|
834
|
+
if (typeof systemFontSize === 'number' && systemFontSize > 0) {
|
|
835
|
+
reloadChaynsCss(systemFontSize);
|
|
836
|
+
}
|
|
833
837
|
},
|
|
834
838
|
awaitResult: true
|
|
835
839
|
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const reloadChaynsCss = systemFontSize => {
|
|
2
|
+
const currentLink = document.querySelector('link[rel="stylesheet"][href*="style-staging.tobit.cloud/css/"], ' + 'link[rel="stylesheet"][href*="style.tobit.cloud/css/"]');
|
|
3
|
+
if (!currentLink) {
|
|
4
|
+
console.warn('Stylesheet nicht gefunden.');
|
|
5
|
+
return;
|
|
6
|
+
}
|
|
7
|
+
const url = new URL(currentLink.href);
|
|
8
|
+
url.searchParams.set('systemFontSize', String(systemFontSize));
|
|
9
|
+
const newLink = document.createElement('link');
|
|
10
|
+
newLink.rel = 'stylesheet';
|
|
11
|
+
newLink.type = 'text/css';
|
|
12
|
+
newLink.href = url.toString();
|
|
13
|
+
newLink.onload = () => {
|
|
14
|
+
currentLink.remove();
|
|
15
|
+
};
|
|
16
|
+
newLink.onerror = () => {
|
|
17
|
+
newLink.remove();
|
|
18
|
+
console.error('[chayns-api] Error loading chayns-css with systemFontSize:', systemFontSize);
|
|
19
|
+
};
|
|
20
|
+
currentLink.after(newLink);
|
|
21
|
+
};
|
|
@@ -821,7 +821,8 @@ export class AppWrapper {
|
|
|
821
821
|
enabled: true
|
|
822
822
|
}, {
|
|
823
823
|
callback: ({
|
|
824
|
-
colorMode
|
|
824
|
+
colorMode,
|
|
825
|
+
systemFontSize
|
|
825
826
|
}) => {
|
|
826
827
|
this.values = {
|
|
827
828
|
...this.values,
|
|
@@ -836,6 +837,9 @@ export class AppWrapper {
|
|
|
836
837
|
value: this.values.site
|
|
837
838
|
}
|
|
838
839
|
}));
|
|
840
|
+
if (typeof systemFontSize === 'number' && systemFontSize > 0) {
|
|
841
|
+
reloadChaynsCss(systemFontSize);
|
|
842
|
+
}
|
|
839
843
|
},
|
|
840
844
|
awaitResult: true
|
|
841
845
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
declare const reloadChaynsCss: (systemFontSize: number) => void;
|