1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 17:56:25 +00:00

tweak MarkdownPreview style to optimize overflow scrollbar display, fix #2902

This commit is contained in:
hikerpig
2019-07-21 14:43:59 +08:00
parent 4e30d4b8fb
commit addf9b920f

View File

@@ -53,6 +53,7 @@ function buildStyle (
codeBlockFontFamily, codeBlockFontFamily,
lineNumber, lineNumber,
scrollPastEnd, scrollPastEnd,
optimizeOverflowScroll,
theme, theme,
allowCustomCSS, allowCustomCSS,
customCSS customCSS
@@ -86,12 +87,14 @@ function buildStyle (
url('${appPath}/resources/fonts/MaterialIcons-Regular.woff') format('woff'), url('${appPath}/resources/fonts/MaterialIcons-Regular.woff') format('woff'),
url('${appPath}/resources/fonts/MaterialIcons-Regular.ttf') format('truetype'); url('${appPath}/resources/fonts/MaterialIcons-Regular.ttf') format('truetype');
} }
${markdownStyle} ${markdownStyle}
body { body {
font-family: '${fontFamily.join("','")}'; font-family: '${fontFamily.join("','")}';
font-size: ${fontSize}px; font-size: ${fontSize}px;
${scrollPastEnd && 'padding-bottom: 90vh;'} ${scrollPastEnd ? 'padding-bottom: 90vh;' : ''}
${optimizeOverflowScroll ? 'height: 100%;' : ''}
} }
@media print { @media print {
body { body {
@@ -341,6 +344,7 @@ export default class MarkdownPreview extends React.Component {
codeBlockFontFamily, codeBlockFontFamily,
lineNumber, lineNumber,
scrollPastEnd, scrollPastEnd,
false,
theme, theme,
allowCustomCSS, allowCustomCSS,
customCSS customCSS
@@ -663,16 +667,19 @@ export default class MarkdownPreview extends React.Component {
this.getWindow().document.getElementById( this.getWindow().document.getElementById(
'codeTheme' 'codeTheme'
).href = this.GetCodeThemeLink(codeBlockTheme) ).href = this.GetCodeThemeLink(codeBlockTheme)
this.getWindow().document.getElementById('style').innerHTML = buildStyle( this.getWindow().document.getElementById('style').innerHTML = buildStyle(
fontFamily, fontFamily,
fontSize, fontSize,
codeBlockFontFamily, codeBlockFontFamily,
lineNumber, lineNumber,
scrollPastEnd, scrollPastEnd,
true,
theme, theme,
allowCustomCSS, allowCustomCSS,
customCSS customCSS,
) )
this.getWindow().document.documentElement.style.overflowY = 'hidden'
} }
GetCodeThemeLink (name) { GetCodeThemeLink (name) {