mirror of https://github.com/laurent22/joplin.git
parent
dc7871b655
commit
dab2438df0
|
@ -43,6 +43,7 @@ const WrappedNoteViewer: React.FC<WrapperProps> = (
|
||||||
<NoteBodyViewer
|
<NoteBodyViewer
|
||||||
themeId={Setting.THEME_LIGHT}
|
themeId={Setting.THEME_LIGHT}
|
||||||
style={emptyObject}
|
style={emptyObject}
|
||||||
|
fontSize={12}
|
||||||
noteBody={noteBody}
|
noteBody={noteBody}
|
||||||
noteMarkupLanguage={MarkupLanguage.Markdown}
|
noteMarkupLanguage={MarkupLanguage.Markdown}
|
||||||
highlightedKeywords={highlightedKeywords}
|
highlightedKeywords={highlightedKeywords}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import { MarkupLanguage } from '@joplin/renderer';
|
||||||
interface Props {
|
interface Props {
|
||||||
themeId: number;
|
themeId: number;
|
||||||
style: ViewStyle;
|
style: ViewStyle;
|
||||||
|
fontSize: number;
|
||||||
noteBody: string;
|
noteBody: string;
|
||||||
noteMarkupLanguage: MarkupLanguage;
|
noteMarkupLanguage: MarkupLanguage;
|
||||||
highlightedKeywords: string[];
|
highlightedKeywords: string[];
|
||||||
|
@ -80,6 +81,7 @@ export default function NoteBodyViewer(props: Props) {
|
||||||
|
|
||||||
useRerenderHandler({
|
useRerenderHandler({
|
||||||
renderer,
|
renderer,
|
||||||
|
fontSize: props.fontSize,
|
||||||
noteBody: props.noteBody,
|
noteBody: props.noteBody,
|
||||||
noteMarkupLanguage: props.noteMarkupLanguage,
|
noteMarkupLanguage: props.noteMarkupLanguage,
|
||||||
themeId: props.themeId,
|
themeId: props.themeId,
|
||||||
|
|
|
@ -25,6 +25,7 @@ interface Props {
|
||||||
noteBody: string;
|
noteBody: string;
|
||||||
noteMarkupLanguage: MarkupLanguage;
|
noteMarkupLanguage: MarkupLanguage;
|
||||||
themeId: number;
|
themeId: number;
|
||||||
|
fontSize: number;
|
||||||
|
|
||||||
highlightedKeywords: string[];
|
highlightedKeywords: string[];
|
||||||
noteResources: Record<string, ResourceInfo>;
|
noteResources: Record<string, ResourceInfo>;
|
||||||
|
@ -82,7 +83,7 @@ const useRerenderHandler = (props: Props) => {
|
||||||
const effectDependencies = [
|
const effectDependencies = [
|
||||||
props.noteBody, props.noteMarkupLanguage, props.renderer, props.highlightedKeywords,
|
props.noteBody, props.noteMarkupLanguage, props.renderer, props.highlightedKeywords,
|
||||||
props.noteHash, props.noteResources, props.themeId, props.paddingBottom, lastResourceLoadCounter,
|
props.noteHash, props.noteResources, props.themeId, props.paddingBottom, lastResourceLoadCounter,
|
||||||
createEditPopupSyntax, destroyEditPopupSyntax, pluginSettingKeys,
|
createEditPopupSyntax, destroyEditPopupSyntax, pluginSettingKeys, props.fontSize,
|
||||||
];
|
];
|
||||||
const previousDeps = usePrevious(effectDependencies, []);
|
const previousDeps = usePrevious(effectDependencies, []);
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
||||||
|
@ -149,8 +150,9 @@ const useRerenderHandler = (props: Props) => {
|
||||||
theme: JSON.stringify({
|
theme: JSON.stringify({
|
||||||
bodyPaddingTop: '0.8em',
|
bodyPaddingTop: '0.8em',
|
||||||
bodyPaddingBottom: props.paddingBottom,
|
bodyPaddingBottom: props.paddingBottom,
|
||||||
|
|
||||||
...theme,
|
...theme,
|
||||||
|
|
||||||
|
noteViewerFontSize: props.fontSize,
|
||||||
}),
|
}),
|
||||||
codeTheme: theme.codeThemeCss,
|
codeTheme: theme.codeThemeCss,
|
||||||
|
|
||||||
|
|
|
@ -9,13 +9,14 @@ const baseStyle = {
|
||||||
appearance: 'light',
|
appearance: 'light',
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontSizeLarge: 20,
|
fontSizeLarge: 20,
|
||||||
noteViewerFontSize: 16,
|
|
||||||
margin: 15, // No text and no interactive component should be within this margin
|
margin: 15, // No text and no interactive component should be within this margin
|
||||||
itemMarginTop: 10,
|
itemMarginTop: 10,
|
||||||
itemMarginBottom: 10,
|
itemMarginBottom: 10,
|
||||||
fontSizeSmaller: 14,
|
fontSizeSmaller: 14,
|
||||||
disabledOpacity: 0.2,
|
disabledOpacity: 0.2,
|
||||||
lineHeight: '1.6em',
|
lineHeight: '1.6em',
|
||||||
|
// The default, may be overridden in settings:
|
||||||
|
noteViewerFontSize: 16,
|
||||||
};
|
};
|
||||||
|
|
||||||
export type ThemeStyle = BaseTheme & typeof baseStyle & {
|
export type ThemeStyle = BaseTheme & typeof baseStyle & {
|
||||||
|
|
|
@ -82,6 +82,7 @@ interface Props extends BaseProps {
|
||||||
themeId: number;
|
themeId: number;
|
||||||
editorFontSize: number;
|
editorFontSize: number;
|
||||||
editorFont: number; // e.g. Setting.FONT_MENLO
|
editorFont: number; // e.g. Setting.FONT_MENLO
|
||||||
|
viewerFontSize: number;
|
||||||
showSideMenu: boolean;
|
showSideMenu: boolean;
|
||||||
searchQuery: string;
|
searchQuery: string;
|
||||||
ftsEnabled: number;
|
ftsEnabled: number;
|
||||||
|
@ -1459,6 +1460,7 @@ class NoteScreenComponent extends BaseScreenComponent<ComponentProps, State> imp
|
||||||
noteResources={this.state.noteResources}
|
noteResources={this.state.noteResources}
|
||||||
highlightedKeywords={keywords}
|
highlightedKeywords={keywords}
|
||||||
themeId={this.props.themeId}
|
themeId={this.props.themeId}
|
||||||
|
fontSize={this.props.viewerFontSize}
|
||||||
noteHash={this.props.noteHash}
|
noteHash={this.props.noteHash}
|
||||||
onCheckboxChange={this.onBodyViewerCheckboxChange}
|
onCheckboxChange={this.onBodyViewerCheckboxChange}
|
||||||
onMarkForDownload={this.onMarkForDownload}
|
onMarkForDownload={this.onMarkForDownload}
|
||||||
|
@ -1637,6 +1639,7 @@ const NoteScreen = connect((state: AppState) => {
|
||||||
themeId: state.settings.theme,
|
themeId: state.settings.theme,
|
||||||
editorFont: state.settings['style.editor.fontFamily'] as number,
|
editorFont: state.settings['style.editor.fontFamily'] as number,
|
||||||
editorFontSize: state.settings['style.editor.fontSize'],
|
editorFontSize: state.settings['style.editor.fontSize'],
|
||||||
|
viewerFontSize: state.settings['style.viewer.fontSize'],
|
||||||
toolbarEnabled: state.settings['editor.mobile.toolbarEnabled'],
|
toolbarEnabled: state.settings['editor.mobile.toolbarEnabled'],
|
||||||
ftsEnabled: state.settings['db.ftsEnabled'],
|
ftsEnabled: state.settings['db.ftsEnabled'],
|
||||||
sharedData: state.sharedData,
|
sharedData: state.sharedData,
|
||||||
|
|
|
@ -1057,6 +1057,20 @@ const builtInMetadata = (Setting: typeof SettingType) => {
|
||||||
// Deprecated in favour of windowContentZoomFactor
|
// 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.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.viewer.fontSize': {
|
||||||
|
value: 16,
|
||||||
|
type: SettingItemType.Int,
|
||||||
|
public: true,
|
||||||
|
storage: SettingStorage.File,
|
||||||
|
isGlobal: true,
|
||||||
|
appTypes: [AppType.Mobile],
|
||||||
|
section: 'appearance',
|
||||||
|
label: () => _('Viewer font size'),
|
||||||
|
minimum: 4,
|
||||||
|
maximum: 50,
|
||||||
|
step: 1,
|
||||||
|
},
|
||||||
|
|
||||||
'style.editor.fontSize': {
|
'style.editor.fontSize': {
|
||||||
value: 15,
|
value: 15,
|
||||||
type: SettingItemType.Int,
|
type: SettingItemType.Int,
|
||||||
|
|
Loading…
Reference in New Issue