add custom font size option
This commit is contained in:
parent
0f6413d4b9
commit
55a0e11366
6 changed files with 33 additions and 2 deletions
4
locales/index.d.ts
vendored
4
locales/index.d.ts
vendored
|
|
@ -13379,6 +13379,10 @@ export interface Locale extends ILocale {
|
||||||
*/
|
*/
|
||||||
"keepFilesInUseDescription": string;
|
"keepFilesInUseDescription": string;
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* Custom font size
|
||||||
|
*/
|
||||||
|
"customFontSize": string;
|
||||||
}
|
}
|
||||||
declare const locales: {
|
declare const locales: {
|
||||||
[lang: string]: Locale;
|
[lang: string]: Locale;
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,12 @@
|
||||||
|
|
||||||
const fontSize = localStorage.getItem('fontSize');
|
const fontSize = localStorage.getItem('fontSize');
|
||||||
if (fontSize) {
|
if (fontSize) {
|
||||||
document.documentElement.classList.add('f-' + fontSize);
|
if (fontSize === "custom") {
|
||||||
|
const customFontSize = localStorage.getItem('customFontSize');
|
||||||
|
document.documentElement.style.setProperty('font-size', `${customFontSize}px`);
|
||||||
|
} else {
|
||||||
|
document.documentElement.classList.add('f-' + fontSize);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const cornerRadius = localStorage.getItem('cornerRadius');
|
const cornerRadius = localStorage.getItem('cornerRadius');
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ export type Keys = (
|
||||||
'colorScheme' |
|
'colorScheme' |
|
||||||
'useSystemFont' |
|
'useSystemFont' |
|
||||||
'fontSize' |
|
'fontSize' |
|
||||||
|
'customFontSize' |
|
||||||
'cornerRadius' |
|
'cornerRadius' |
|
||||||
'ui' |
|
'ui' |
|
||||||
'ui_temp' |
|
'ui_temp' |
|
||||||
|
|
|
||||||
|
|
@ -700,9 +700,16 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||||
<option value="1"><span style="font-size: 15px;">Aa</span></option>
|
<option value="1"><span style="font-size: 15px;">Aa</span></option>
|
||||||
<option value="2"><span style="font-size: 16px;">Aa</span></option>
|
<option value="2"><span style="font-size: 16px;">Aa</span></option>
|
||||||
<option value="3"><span style="font-size: 17px;">Aa</span></option>
|
<option value="3"><span style="font-size: 17px;">Aa</span></option>
|
||||||
|
<option value="custom"><span style="font-size: 14px;">Custom</span></option>
|
||||||
</MkRadios>
|
</MkRadios>
|
||||||
</SearchMarker>
|
</SearchMarker>
|
||||||
|
|
||||||
|
<SearchMarker :keywords="['font', 'size']">
|
||||||
|
<MkInput v-model="customFontSize" :min="12" :max="48" type="number" :step="1" :manualSave="true" :disabled="fontSize !== 'custom'">
|
||||||
|
<template #label><SearchLabel>{{ i18n.ts.customFontSize }}</SearchLabel></template>
|
||||||
|
</MkInput>
|
||||||
|
</SearchMarker>
|
||||||
|
|
||||||
<SearchMarker :keywords="['font', 'system', 'native']">
|
<SearchMarker :keywords="['font', 'system', 'native']">
|
||||||
<MkSwitch v-model="useSystemFont">
|
<MkSwitch v-model="useSystemFont">
|
||||||
<template #label><SearchLabel>{{ i18n.ts.useSystemFont }}</SearchLabel></template>
|
<template #label><SearchLabel>{{ i18n.ts.useSystemFont }}</SearchLabel></template>
|
||||||
|
|
@ -1081,6 +1088,7 @@ const defaultCW = ref($i.defaultCW);
|
||||||
const defaultCWPriority = ref($i.defaultCWPriority);
|
const defaultCWPriority = ref($i.defaultCWPriority);
|
||||||
const lang = prefer.model('lang');
|
const lang = prefer.model('lang');
|
||||||
const fontSize = prefer.model('fontSize');
|
const fontSize = prefer.model('fontSize');
|
||||||
|
const customFontSize = prefer.model('customFontSize');
|
||||||
const useSystemFont = prefer.model('useSystemFont');
|
const useSystemFont = prefer.model('useSystemFont');
|
||||||
const cornerRadius = prefer.model('cornerRadius');
|
const cornerRadius = prefer.model('cornerRadius');
|
||||||
const trustedDomains = prefer.model(
|
const trustedDomains = prefer.model(
|
||||||
|
|
|
||||||
|
|
@ -497,7 +497,18 @@ export const PREF_DEF = {
|
||||||
miLocalStorage.removeItem('fontSize');
|
miLocalStorage.removeItem('fontSize');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
} as Pref<'0' | '1' | '2' | '3'>,
|
} as Pref<'0' | '1' | '2' | '3' | 'custom'>,
|
||||||
|
customFontSize: {
|
||||||
|
default: 14,
|
||||||
|
needsReload: true,
|
||||||
|
onSet: customFontSize => {
|
||||||
|
if (customFontSize) {
|
||||||
|
miLocalStorage.setItem('customFontSize', customFontSize.toString());
|
||||||
|
} else {
|
||||||
|
miLocalStorage.removeItem('customFontSize');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
} as Pref<number>,
|
||||||
useSystemFont: {
|
useSystemFont: {
|
||||||
default: false,
|
default: false,
|
||||||
needsReload: true,
|
needsReload: true,
|
||||||
|
|
|
||||||
|
|
@ -654,3 +654,5 @@ clearCachedFilesOptions:
|
||||||
oneYear: "one year"
|
oneYear: "one year"
|
||||||
keepFilesInUse: "Don't delete files used as avatars&c"
|
keepFilesInUse: "Don't delete files used as avatars&c"
|
||||||
keepFilesInUseDescription: "this option requires more complicated database queries, you may need to increase the value of db.extra.statement_timeout in the configuration file"
|
keepFilesInUseDescription: "this option requires more complicated database queries, you may need to increase the value of db.extra.statement_timeout in the configuration file"
|
||||||
|
|
||||||
|
customFontSize: "Custom font size"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue