mirror of
https://github.com/paricafe/misskey.git
synced 2025-02-17 13:37:29 -06:00
frontend: fix loading fonts when boot
This commit is contained in:
parent
8caf4e33b3
commit
915137056e
2 changed files with 13 additions and 12 deletions
|
@ -294,6 +294,19 @@ 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,
|
||||
|
|
|
@ -82,18 +82,6 @@ export function getDefaultFontSettings() {
|
|||
console.log(newFontId);
|
||||
}
|
||||
|
||||
if (fontFace.value !== 'system-ui') {
|
||||
if (window.requestIdleCallback) {
|
||||
window.requestIdleCallback(() => {
|
||||
loadFontStyle(fontFace.value);
|
||||
});
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
loadFontStyle(fontFace.value);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
|
||||
watch(fontFace, (newVal) => {
|
||||
const optionsList = getFontOptionsList(newVal);
|
||||
if (optionsList.length !== 0) {
|
||||
|
|
Loading…
Add table
Reference in a new issue