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

Enable to show the lock icon only the Editor state is CODE

This commit is contained in:
asmsuechan
2017-02-11 17:52:11 +09:00
parent 74ee6ae6ce
commit 672d409bf2
2 changed files with 18 additions and 6 deletions

View File

@@ -19,13 +19,11 @@ class MarkdownEditor extends React.Component {
}
this.lockEditorCode = () => this.handleLockEditor()
this.getEditorStatus = () => this.handleGetEditorStatus()
}
componentDidMount () {
this.value = this.refs.code.value
eventEmitter.on('editor:lock', this.lockEditorCode)
eventEmitter.on('editor:status', this.getEditorStatus)
}
componentDidUpdate () {
@@ -41,7 +39,6 @@ class MarkdownEditor extends React.Component {
componentWillUnmount () {
this.cancelQueue()
eventEmitter.off('editor:lock', this.lockEditorCode)
eventEmitter.off('editor:status', this.getEditorStatus)
}
queueRendering (value) {
@@ -94,6 +91,7 @@ class MarkdownEditor extends React.Component {
this.setState({
status: 'PREVIEW'
}, () => {
eventEmitter.emit('topbar:lock')
this.refs.preview.focus()
this.refs.preview.scrollTo(cursorPosition.line)
})
@@ -143,6 +141,7 @@ class MarkdownEditor extends React.Component {
this.setState({
status: 'CODE'
}, () => {
eventEmitter.emit('topbar:lock')
this.refs.code.focus()
})
} else {