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

Change the order of focus and emit 'editor:lock'

This commit is contained in:
asmsuechan
2017-02-11 18:12:45 +09:00
parent 672d409bf2
commit e9525fae22
2 changed files with 14 additions and 5 deletions

View File

@@ -26,7 +26,7 @@ class MarkdownNoteDetail extends React.Component {
title: '',
content: ''
}, props.note),
isCODE: false,
editorStatus: false,
locked: false
}
this.dispatchTimer = null
@@ -213,8 +213,8 @@ class MarkdownNoteDetail extends React.Component {
}
handleLockButtonClick () {
ee.emit('editor:lock')
this.focus()
ee.emit('editor:lock')
this.setState({ locked: !this.state.locked })
}
@@ -227,7 +227,11 @@ class MarkdownNoteDetail extends React.Component {
}
handleShowLockButton () {
this.setState({isCODE: !this.state.isCODE})
this.setState({editorStatus: this.refs.content.state.status})
}
handleFocus (e) {
this.focus()
}
render () {
@@ -263,9 +267,10 @@ class MarkdownNoteDetail extends React.Component {
<div styleName='info-right'>
{(() => {
let faClassName=`fa ${this.toggleLockButton()}`
if (this.state.isCODE) {
if (this.state.editorStatus === 'CODE') {
return(
<button styleName='info-right-button'
onFocus={(e) => this.handleFocus(e)}
onClick={(e) => this.handleLockButtonClick(e)}
>
<i className={faClassName}/>