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

refs #226 Adds blur shortcut on Editor

This commit is contained in:
asmsuechan
2017-01-13 22:23:52 +09:00
parent 5bd0a446f1
commit e8e05b20cd

View File

@@ -142,6 +142,12 @@ class MarkdownEditor extends React.Component {
this.renderPreview(this.props.value)
}
handleKeyDown(e) {
if (this.state.status === 'CODE' && e.key == 'Escape') {
document.activeElement.blur()
}
}
render () {
let { className, value, config } = this.props
@@ -160,6 +166,7 @@ class MarkdownEditor extends React.Component {
}
onContextMenu={(e) => this.handleContextMenu(e)}
tabIndex='-1'
onKeyDown={(e) => this.handleKeyDown(e)}
>
<CodeEditor styleName='codeEditor'
ref='code'