Skip to content

Commit e8e05b2

Browse files
committed
refs BoostIO#226 Adds blur shortcut on Editor
1 parent 5bd0a44 commit e8e05b2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

browser/components/MarkdownEditor.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,12 @@ class MarkdownEditor extends React.Component {
142142
this.renderPreview(this.props.value)
143143
}
144144

145+
handleKeyDown(e) {
146+
if (this.state.status === 'CODE' && e.key == 'Escape') {
147+
document.activeElement.blur()
148+
}
149+
}
150+
145151
render () {
146152
let { className, value, config } = this.props
147153

@@ -160,6 +166,7 @@ class MarkdownEditor extends React.Component {
160166
}
161167
onContextMenu={(e) => this.handleContextMenu(e)}
162168
tabIndex='-1'
169+
onKeyDown={(e) => this.handleKeyDown(e)}
163170
>
164171
<CodeEditor styleName='codeEditor'
165172
ref='code'

0 commit comments

Comments
 (0)