From e8e05b20cd9cd14c7cf54d2459ea8250fb8bccc2 Mon Sep 17 00:00:00 2001 From: asmsuechan Date: Fri, 13 Jan 2017 22:23:52 +0900 Subject: [PATCH] refs #226 Adds blur shortcut on Editor --- browser/components/MarkdownEditor.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/browser/components/MarkdownEditor.js b/browser/components/MarkdownEditor.js index e5041565..d31b30d4 100644 --- a/browser/components/MarkdownEditor.js +++ b/browser/components/MarkdownEditor.js @@ -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)} >