1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-13 09:46:22 +00:00

Fix a bug which cannot read a property when moves to other folder on locking

This commit is contained in:
asmsuechan
2017-03-19 00:41:55 -07:00
parent f3ed22dd51
commit 91f24d96b9
2 changed files with 7 additions and 6 deletions

View File

@@ -82,7 +82,7 @@ class MarkdownEditor extends React.Component {
this.refs.code.blur()
this.refs.preview.focus()
}
eventEmitter.emit('topbar:togglelockbutton')
eventEmitter.emit('topbar:togglelockbutton', this.state.status)
})
}
}
@@ -99,7 +99,7 @@ class MarkdownEditor extends React.Component {
this.refs.preview.focus()
this.refs.preview.scrollTo(cursorPosition.line)
})
eventEmitter.emit('topbar:togglelockbutton')
eventEmitter.emit('topbar:togglelockbutton', this.state.status)
}
}
@@ -115,7 +115,7 @@ class MarkdownEditor extends React.Component {
}, () => {
this.refs.code.focus()
})
eventEmitter.emit('topbar:togglelockbutton')
eventEmitter.emit('topbar:togglelockbutton', this.state.status)
}
}
@@ -152,7 +152,7 @@ class MarkdownEditor extends React.Component {
} else {
this.refs.code.focus()
}
eventEmitter.emit('topbar:togglelockbutton')
eventEmitter.emit('topbar:togglelockbutton', this.state.status)
}
reload () {

View File

@@ -230,8 +230,9 @@ class MarkdownNoteDetail extends React.Component {
if (e.keyCode === 27) this.handleDeleteCancelButtonClick(e)
}
handleToggleLockButton () {
if (this.props.config.editor.switchPreview === 'BLUR' && this.refs.content.state.status === 'CODE') {
handleToggleLockButton (event, noteStatus) {
// first argument event is not used
if (this.props.config.editor.switchPreview === 'BLUR' && noteStatus === 'CODE') {
this.setState({isLockButtonShown: true})
} else {
this.setState({isLockButtonShown: false})