You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
Desktop, Mobile: Fixes #11673: Make tab size consistent between Markdown editor and viewer (and RTE) (#11940)
Co-authored-by: Henry Heino <46334387+personalizedrefrigerator@users.noreply.github.com>
This commit is contained in:
@@ -15,6 +15,7 @@ const baseStyle = {
|
|||||||
fontSizeSmaller: 14,
|
fontSizeSmaller: 14,
|
||||||
disabledOpacity: 0.2,
|
disabledOpacity: 0.2,
|
||||||
lineHeight: '1.6em',
|
lineHeight: '1.6em',
|
||||||
|
listTabSize: '1.7em',
|
||||||
// The default, may be overridden in settings:
|
// The default, may be overridden in settings:
|
||||||
noteViewerFontSize: 16,
|
noteViewerFontSize: 16,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -268,8 +268,6 @@ const createEditor = (
|
|||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
||||||
EditorState.tabSize.of(4),
|
|
||||||
|
|
||||||
// Apply styles to entire lines (block-display decorations)
|
// Apply styles to entire lines (block-display decorations)
|
||||||
decoratorExtension,
|
decoratorExtension,
|
||||||
dropCursor(),
|
dropCursor(),
|
||||||
|
|||||||
8
packages/editor/CodeMirror/theme.ts
vendored
8
packages/editor/CodeMirror/theme.ts
vendored
@@ -106,6 +106,14 @@ const createTheme = (theme: EditorTheme): Extension[] => {
|
|||||||
marginLeft: `${theme.marginLeft}px`,
|
marginLeft: `${theme.marginLeft}px`,
|
||||||
marginRight: `${theme.marginRight}px`,
|
marginRight: `${theme.marginRight}px`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'& .cm-listItem': {
|
||||||
|
// Needs to be !important because the tab-size is directly set on the element style
|
||||||
|
// attribute by CodeMirror. And the `EditorState.tabSize` function only accepts a
|
||||||
|
// number, while we need a "em" value to make it match the viewer tab size.
|
||||||
|
tabSize: `${theme.listTabSize} !important`,
|
||||||
|
},
|
||||||
|
|
||||||
'&.cm-focused .cm-cursor': baseCursorStyle,
|
'&.cm-focused .cm-cursor': baseCursorStyle,
|
||||||
|
|
||||||
// The desktop app sets the font for these elements to a specific font.
|
// The desktop app sets the font for these elements to a specific font.
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ export interface EditorTheme extends Theme {
|
|||||||
contentMaxWidth?: number;
|
contentMaxWidth?: number;
|
||||||
marginLeft?: number;
|
marginLeft?: number;
|
||||||
marginRight?: number;
|
marginRight?: number;
|
||||||
|
listTabSize?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EditorSettings {
|
export interface EditorSettings {
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ const globalStyle = (() => {
|
|||||||
mainPadding: 12,
|
mainPadding: 12,
|
||||||
topRowHeight: 50,
|
topRowHeight: 50,
|
||||||
editorPaddingLeft: 8,
|
editorPaddingLeft: 8,
|
||||||
|
listTabSize: '1.7em',
|
||||||
|
|
||||||
margin: margin,
|
margin: margin,
|
||||||
marginRight: margin,
|
marginRight: margin,
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ export default function(theme: any, options: Options = null) {
|
|||||||
}
|
}
|
||||||
ul, ol {
|
ul, ol {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
margin-left: 1.7em;
|
margin-left: ${theme.listTabSize};
|
||||||
}
|
}
|
||||||
li {
|
li {
|
||||||
margin-bottom: .4em;
|
margin-bottom: .4em;
|
||||||
|
|||||||
Reference in New Issue
Block a user