Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions browser/components/MarkdownPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const CSS_FILES = [
* @param {String} opts.theme
* @param {Boolean} [opts.lineNumber] Should show line number
* @param {Boolean} [opts.scrollPastEnd]
* @param {Boolean} [opts.optimizeOverflowScroll] Should tweak body style to optimize overflow scrollbar display
* @param {Boolean} [opts.allowCustomCSS] Should add custom css
* @param {String} [opts.customCSS] Will be added to bottom, only if `opts.allowCustomCSS` is truthy
* @returns {String}
Expand All @@ -62,7 +61,6 @@ function buildStyle (opts) {
codeBlockFontFamily,
lineNumber,
scrollPastEnd,
optimizeOverflowScroll,
theme,
allowCustomCSS,
customCSS
Expand Down Expand Up @@ -107,7 +105,6 @@ body {
box-sizing: border-box;
`
: ''}
${optimizeOverflowScroll ? 'height: 100%;' : ''}
}
@media print {
body {
Expand Down Expand Up @@ -183,6 +180,10 @@ const scrollBarStyle = `
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.15);
}

::-webkit-scrollbar-track-piece {
background-color: inherit;
}
`
const scrollBarDarkStyle = `
::-webkit-scrollbar {
Expand All @@ -192,6 +193,10 @@ const scrollBarDarkStyle = `
::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-track-piece {
background-color: inherit;
}
`

const OSX = global.process.platform === 'darwin'
Expand Down Expand Up @@ -679,12 +684,10 @@ export default class MarkdownPreview extends React.Component {
codeBlockFontFamily,
lineNumber,
scrollPastEnd,
optimizeOverflowScroll: true,
theme,
allowCustomCSS,
customCSS
})
this.getWindow().document.documentElement.style.overflowY = 'hidden'
}

getCodeThemeLink (name) {
Expand Down Expand Up @@ -1066,7 +1069,7 @@ export default class MarkdownPreview extends React.Component {
if (posOfHash > -1) {
const extractedId = linkHash.slice(posOfHash + 1)
const targetId = mdurl.encode(extractedId)
const targetElement = this.refs.root.contentWindow.document.getElementById(
const targetElement = this.getWindow().document.getElementById(
targetId
)

Expand Down