Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scroll Bars can now be hidden #2713

Merged
merged 8 commits into from
Feb 24, 2020
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 5 additions & 0 deletions browser/components/MarkdownPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import mermaidRender from './render/MermaidRender'
import SequenceDiagram from '@rokt33r/js-sequence-diagrams'
import Chart from 'chart.js'
import eventEmitter from 'browser/main/lib/eventEmitter'
import config from 'browser/main/lib/ConfigManager'
import htmlTextHelper from 'browser/lib/htmlTextHelper'
import convertModeName from 'browser/lib/convertModeName'
import copy from 'copy-to-clipboard'
Expand Down Expand Up @@ -186,10 +187,12 @@ ${allowCustomCSS ? customCSS : ''}

const scrollBarStyle = `
::-webkit-scrollbar {
${config.get().ui.scrollBar ? '' : 'display: none;'}
width: 12px;
}

::-webkit-scrollbar-thumb {
${config.get().ui.scrollBar ? '' : 'display: none;'}
background-color: rgba(0, 0, 0, 0.15);
}

Expand All @@ -199,10 +202,12 @@ const scrollBarStyle = `
`
const scrollBarDarkStyle = `
::-webkit-scrollbar {
${config.get().ui.scrollBar ? '' : 'display: none;'}
width: 12px;
}

::-webkit-scrollbar-thumb {
${config.get().ui.scrollBar ? '' : 'display: none;'}
background-color: rgba(0, 0, 0, 0.3);
}

Expand Down
11 changes: 11 additions & 0 deletions browser/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { store, history } from './store'
import React, { Fragment } from 'react'
import ReactDOM from 'react-dom'
require('!!style!css!stylus?sourceMap!./global.styl')
import config from 'browser/main/lib/ConfigManager'
import { Route, Switch, Redirect } from 'react-router-dom'
import { ConnectedRouter } from 'connected-react-router'
import DevTools from './DevTools'
Expand Down Expand Up @@ -77,6 +78,16 @@ document.addEventListener('click', function(e) {
if (infoPanel) infoPanel.style.display = 'none'
})

if (!config.get().ui.scrollBar) {
document.styleSheets[54].insertRule('::-webkit-scrollbar {display: none}')
document.styleSheets[54].insertRule(
'::-webkit-scrollbar-corner {display: none}'
)
document.styleSheets[54].insertRule(
'::-webkit-scrollbar-thumb {display: none}'
)
}

const el = document.getElementById('content')

function notify(...args) {
Expand Down
1 change: 1 addition & 0 deletions browser/main/lib/ConfigManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export const DEFAULT_CONFIG = {
theme: 'default',
showCopyNotification: true,
disableDirectWrite: false,
scrollBar: true,
gregueiras marked this conversation as resolved.
Show resolved Hide resolved
defaultNote: 'ALWAYS_ASK', // 'ALWAYS_ASK', 'SNIPPET_NOTE', 'MARKDOWN_NOTE'
showMenuBar: false
},
Expand Down
17 changes: 15 additions & 2 deletions browser/main/modals/PreferencesModal/UiTab.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class UiTab extends React.Component {
showTagsAlphabetically: this.refs.showTagsAlphabetically.checked,
saveTagsAlphabetically: this.refs.saveTagsAlphabetically.checked,
enableLiveNoteCounts: this.refs.enableLiveNoteCounts.checked,
scrollBar: this.refs.scrollBar.checked,
showMenuBar: this.refs.showMenuBar.checked,
disableDirectWrite:
this.refs.uiD2w != null ? this.refs.uiD2w.checked : false
Expand Down Expand Up @@ -351,9 +352,21 @@ class UiTab extends React.Component {
</label>
</div>
) : null}

<div styleName='group-checkBoxSection'>
<label>
<input
onChange={e => this.handleUIChange(e)}
checked={this.state.config.ui.scrollBar}
ref='scrollBar'
type='checkbox'
/>
&nbsp;
{i18n.__(
'Show the scroll bars in the editor and in the markdown preview (It will be applied after restarting)'
)}
</label>
</div>
<div styleName='group-header2'>Tags</div>

<div styleName='group-checkBoxSection'>
<label>
<input
Expand Down