add custom font size option
This commit is contained in:
parent
0f6413d4b9
commit
55a0e11366
6 changed files with 33 additions and 2 deletions
|
|
@ -129,7 +129,12 @@
|
|||
|
||||
const fontSize = localStorage.getItem('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');
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ export type Keys = (
|
|||
'colorScheme' |
|
||||
'useSystemFont' |
|
||||
'fontSize' |
|
||||
'customFontSize' |
|
||||
'cornerRadius' |
|
||||
'ui' |
|
||||
'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="2"><span style="font-size: 16px;">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>
|
||||
</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']">
|
||||
<MkSwitch v-model="useSystemFont">
|
||||
<template #label><SearchLabel>{{ i18n.ts.useSystemFont }}</SearchLabel></template>
|
||||
|
|
@ -1081,6 +1088,7 @@ const defaultCW = ref($i.defaultCW);
|
|||
const defaultCWPriority = ref($i.defaultCWPriority);
|
||||
const lang = prefer.model('lang');
|
||||
const fontSize = prefer.model('fontSize');
|
||||
const customFontSize = prefer.model('customFontSize');
|
||||
const useSystemFont = prefer.model('useSystemFont');
|
||||
const cornerRadius = prefer.model('cornerRadius');
|
||||
const trustedDomains = prefer.model(
|
||||
|
|
|
|||
|
|
@ -497,7 +497,18 @@ export const PREF_DEF = {
|
|||
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: {
|
||||
default: false,
|
||||
needsReload: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue