1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-01-02 12:47:41 +02:00

Mobile: Configurable editor font size (#7596)

This commit is contained in:
Henry Heino 2023-01-07 09:47:52 -08:00 committed by GitHub
parent 2feed88c51
commit 0530c74924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 3 deletions

View File

@ -99,9 +99,16 @@ function useHtml(css: string): string {
}
function editorTheme(themeId: number) {
const fontSizeInPx = Setting.value('style.editor.fontSize');
// Convert from `px` to `em`. To support font size scaling based on
// system accessibility settings, we need to provide font sizes in `em`.
// 16px is about 1em with the default root font size.
const estimatedFontSizeInEm = fontSizeInPx / 16;
return {
...themeStyle(themeId),
fontSize: 0.85, // em
fontSize: estimatedFontSizeInEm,
fontFamily: fontFamilyFromSettings(),
};
}

View File

@ -331,7 +331,7 @@ class NoteScreenComponent extends BaseScreenComponent {
textAlignVertical: 'top',
color: theme.color,
backgroundColor: theme.backgroundColor,
fontSize: theme.fontSize,
fontSize: this.props.editorFontSize,
fontFamily: editorFont(this.props.editorFont),
},
noteBodyViewer: {
@ -1237,6 +1237,7 @@ const NoteScreen = connect((state: any) => {
searchQuery: state.searchQuery,
themeId: state.settings.theme,
editorFont: [state.settings['style.editor.fontFamily']],
editorFontSize: state.settings['style.editor.fontSize'],
ftsEnabled: state.settings['db.ftsEnabled'],
sharedData: state.sharedData,
showSideMenu: state.showSideMenu,

View File

@ -1194,7 +1194,19 @@ class Setting extends BaseModel {
// Deprecated in favour of windowContentZoomFactor
'style.zoom': { value: 100, type: SettingItemType.Int, public: false, storage: SettingStorage.File, isGlobal: true, appTypes: [AppType.Desktop], section: 'appearance', label: () => '', minimum: 50, maximum: 500, step: 10 },
'style.editor.fontSize': { value: 15, type: SettingItemType.Int, public: true, storage: SettingStorage.File, isGlobal: true, appTypes: [AppType.Desktop], section: 'appearance', label: () => _('Editor font size'), minimum: 4, maximum: 50, step: 1 },
'style.editor.fontSize': {
value: 15,
type: SettingItemType.Int,
public: true,
storage: SettingStorage.File,
isGlobal: true,
appTypes: [AppType.Desktop, AppType.Mobile],
section: 'appearance',
label: () => _('Editor font size'),
minimum: 4,
maximum: 50,
step: 1,
},
'style.editor.fontFamily':
(mobilePlatform) ?
({