Skip to content
Merged
Show file tree
Hide file tree
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
37 changes: 37 additions & 0 deletions browser/components/MarkdownPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,25 @@ body p {
`
}

const scrollBarStyle = `
::-webkit-scrollbar {
width: 12px;
}

::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.15);
}
`
const scrollBarDarkStyle = `
::-webkit-scrollbar {
width: 12px;
}

::-webkit-scrollbar-thumb {
background-color: rgba(0, 0, 0, 0.3);
}
`

const { shell } = require('electron')
const OSX = global.process.platform === 'darwin'

Expand Down Expand Up @@ -290,6 +309,21 @@ export default class MarkdownPreview extends React.Component {
}
}

getScrollBarStyle () {
const {
theme
} = this.props

switch (theme) {
case 'dark':
case 'solarized-dark':
case 'monokai':
return scrollBarDarkStyle
default:
return scrollBarStyle
}
}

componentDidMount () {
this.refs.root.setAttribute('sandbox', 'allow-scripts')
this.refs.root.contentWindow.document.body.addEventListener('contextmenu', this.contextMenuHandler)
Expand All @@ -298,6 +332,9 @@ export default class MarkdownPreview extends React.Component {
<style id='style'></style>
<link rel="stylesheet" id="codeTheme">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
${this.getScrollBarStyle()}
</style>
`

CSS_FILES.forEach((file) => {
Expand Down
15 changes: 13 additions & 2 deletions browser/main/global.styl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ body
font-weight 200
-webkit-font-smoothing antialiased

::-webkit-scrollbar
width 12px

::-webkit-scrollbar-thumb
background-color rgba(0, 0, 0, 0.15)

button, input, select, textarea
font-family DEFAULT_FONTS

Expand Down Expand Up @@ -85,9 +91,11 @@ modalBackColor = white
absolute top left bottom right
background-color modalBackColor
z-index modalZIndex + 1


body[data-theme="dark"]
::-webkit-scrollbar-thumb
background-color rgba(0, 0, 0, 0.3)
.ModalBase
.modalBack
background-color $ui-dark-backgroundColor
Expand Down Expand Up @@ -128,16 +136,19 @@ body[data-theme="dark"]
z-index modalZIndex + 5

body[data-theme="solarized-dark"]
::-webkit-scrollbar-thumb
background-color rgba(0, 0, 0, 0.3)
.ModalBase
.modalBack
background-color $ui-solarized-dark-backgroundColor
.sortableItemHelper
color: $ui-solarized-dark-text-color

body[data-theme="monokai"]
::-webkit-scrollbar-thumb
background-color rgba(0, 0, 0, 0.3)
.ModalBase
.modalBack
background-color $ui-monokai-backgroundColor
.sortableItemHelper
color: $ui-monokai-text-color