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

Revert "Desktop: Make font size consistent between Markdown and Rich Text editors"

This reverts commit a058e09183.

Reverts because this change means the settings are directly accessed
from the theme, which makes the themes unusable from Joplin Server.
This commit is contained in:
Laurent Cozic 2021-06-10 10:59:15 +02:00
parent 0e4c545e14
commit b2b6ad479a
2 changed files with 9 additions and 8 deletions

View File

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

View File

@ -52,7 +52,7 @@ const globalStyle: any = {
disabledOpacity: 0.3, disabledOpacity: 0.3,
buttonMinWidth: 50, buttonMinWidth: 50,
buttonMinHeight: 30, buttonMinHeight: 30,
// editorFontSize: 12, editorFontSize: 12,
textAreaLineHeight: 17, textAreaLineHeight: 17,
lineHeight: '1.6em', lineHeight: '1.6em',
headerButtonHPadding: 6, headerButtonHPadding: 6,
@ -368,22 +368,23 @@ const themeCache_: any = {};
function themeStyle(themeId: number) { function themeStyle(themeId: number) {
if (!themeId) throw new Error('Theme must be specified'); if (!themeId) throw new Error('Theme must be specified');
const cacheKey = `${themeId}_${Setting.value('style.editor.fontSize')}`; const zoomRatio = 1;
const cacheKey = themeId;
if (themeCache_[cacheKey]) return themeCache_[cacheKey]; if (themeCache_[cacheKey]) return themeCache_[cacheKey];
// Font size are not theme specific, but they must be referenced // Font size are not theme specific, but they must be referenced
// and computed here to allow them to respond to settings changes // and computed here to allow them to respond to settings changes
// without the need to restart // without the need to restart
const fontSizes: any = { const fontSizes: any = {
fontSize: 12, fontSize: Math.round(12 * zoomRatio),
toolbarIconSize: 18, toolbarIconSize: 18,
}; };
// For consistency, and now that the Markdown editor can use non-monospace fontSizes.noteViewerFontSize = Math.round(fontSizes.fontSize * 1.25);
// fonts, we use the same font size everywhere.
fontSizes.noteViewerFontSize = Setting.value('style.editor.fontSize'); // fontSizes.fontSize; //Math.round(fontSizes.fontSize * 1.25);
let output: any = {}; let output: any = {};
output.zoomRatio = zoomRatio;
// All theme are based on the light style, and just override the // All theme are based on the light style, and just override the
// relevant properties // relevant properties
@ -405,7 +406,7 @@ const cachedStyles_: any = {
// the dependencies of the style change. If the style depends only // the dependencies of the style change. If the style depends only
// on the theme, a static string can be provided as a cache key. // on the theme, a static string can be provided as a cache key.
function buildStyle(cacheKey: any, themeId: number, callback: Function) { function buildStyle(cacheKey: any, themeId: number, callback: Function) {
cacheKey = `${Array.isArray(cacheKey) ? cacheKey.join('_') : cacheKey}_${Setting.value('style.editor.fontSize')}`; cacheKey = Array.isArray(cacheKey) ? cacheKey.join('_') : cacheKey;
// We clear the cache whenever switching themes // We clear the cache whenever switching themes
if (cachedStyles_.themeId !== themeId) { if (cachedStyles_.themeId !== themeId) {