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

auto scroll

This commit is contained in:
Dick Choi
2016-07-19 08:59:47 +09:00
parent 9a5653f1e3
commit 890207daee
2 changed files with 21 additions and 1 deletions

View File

@@ -48,10 +48,12 @@ class MarkdownEditor extends React.Component {
handleBlur (e) {
let { config } = this.props
if (config.editor.switchPreview === 'BLUR') {
let cursorPosition = this.refs.code.getCursorPosition()
this.setState({
status: 'PREVIEW'
}, () => {
this.refs.preview.focus()
this.refs.preview.scrollTo(cursorPosition.row)
})
}
}
@@ -62,7 +64,7 @@ class MarkdownEditor extends React.Component {
handlePreviewMouseUp (e) {
let { config } = this.props
if (config.editor.switchPreview === 'BLUR' && new Date() - this.previewMouseDownedAt < 150) {
if (config.editor.switchPreview === 'BLUR' && new Date() - this.previewMouseDownedAt < 200) {
this.setState({
status: 'CODE'
}, () => {