mirror of
https://github.com/paricafe/misskey.git
synced 2024-11-30 22:16:46 -06:00
fix default fonts
This commit is contained in:
parent
b9c765d904
commit
b92aca60c1
3 changed files with 18 additions and 18 deletions
|
@ -62,7 +62,7 @@ async function main() {
|
|||
}
|
||||
//#endregion
|
||||
|
||||
const fontSize = localStorage.getItem('fontSize') || 1;
|
||||
const fontSize = localStorage.getItem('fontSize') ?? 2;
|
||||
if (fontSize) {
|
||||
document.documentElement.classList.add('f-' + fontSize);
|
||||
}
|
||||
|
|
|
@ -231,6 +231,19 @@ export async function common(createVue: () => App<Element>) {
|
|||
}
|
||||
//#endregion
|
||||
|
||||
//#region Load default font
|
||||
const def_arr = miLocalStorage.getItem('defaultFontFace')?.split('_');
|
||||
const fontId = def_arr?.[0];
|
||||
if (fontId && fontId !== 'system-ui') {
|
||||
try {
|
||||
await import(`@/styles-font/${fontId}.scss`);
|
||||
document.documentElement.classList.add(`default-font-${def_arr.join('_')}`);
|
||||
} catch (e) {
|
||||
console.warn(`Failed to load font style: ${fontId}`, e);
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
try {
|
||||
await fetchCustomEmojis();
|
||||
} catch (err) { /* empty */ }
|
||||
|
@ -294,19 +307,6 @@ export async function common(createVue: () => App<Element>) {
|
|||
console.log(i18n.tsx._selfXssPrevention.description3({ link: 'https://misskey-hub.net/docs/for-users/resources/self-xss/' }));
|
||||
//#endregion
|
||||
|
||||
//#region Load default font
|
||||
const def_arr = miLocalStorage.getItem('defaultFontFace')?.split('_');
|
||||
const fontId = def_arr?.[0];
|
||||
if (fontId && fontId !== 'system-ui') {
|
||||
try {
|
||||
await import(`@/styles-font/${fontId}.scss`);
|
||||
document.documentElement.classList.add(`default-font-${def_arr.join('_')}`);
|
||||
} catch (e) {
|
||||
console.warn(`Failed to load font style: ${fontId}`, e);
|
||||
}
|
||||
}
|
||||
//#endregion
|
||||
|
||||
return {
|
||||
isClientUpdated,
|
||||
app,
|
||||
|
|
|
@ -62,11 +62,11 @@ async function loadFontStyle(fontId: string) {
|
|||
|
||||
export function getDefaultFontSettings() {
|
||||
const def_arr = miLocalStorage.getItem('defaultFontFace')?.split('_');
|
||||
const fontFace = ref(def_arr?.[0] ?? 'maokentangyuan');
|
||||
const fontFace = ref(def_arr?.[0] ?? 'system-ui');
|
||||
const fontFaceType = ref(def_arr?.[1] ?? '');
|
||||
const availableTypes = computed(() => getFontOptionsList(fontFace.value));
|
||||
|
||||
async function setDafaultFont() {
|
||||
async function setDefaultFont() {
|
||||
for (const klass of [...document.documentElement.classList.values()]) {
|
||||
if (klass.startsWith('default-font-')) {
|
||||
document.documentElement.classList.remove(klass);
|
||||
|
@ -87,11 +87,11 @@ export function getDefaultFontSettings() {
|
|||
if (optionsList.length !== 0) {
|
||||
fontFaceType.value = optionsList.find((v) => v.default)?.id ?? '';
|
||||
} else {
|
||||
setDafaultFont();
|
||||
setDefaultFont();
|
||||
}
|
||||
});
|
||||
watch(fontFaceType, () => {
|
||||
setDafaultFont();
|
||||
setDefaultFont();
|
||||
});
|
||||
|
||||
return ref({
|
||||
|
|
Loading…
Reference in a new issue