close input for reply on escape
This commit is contained in:
@@ -358,6 +358,7 @@ export default class Comment extends Component {
|
||||
<Input
|
||||
mix="comment__input"
|
||||
onSubmit={this.onReply}
|
||||
onCancel={this.toggleInputVisibility}
|
||||
pid={o.id}
|
||||
autoFocus
|
||||
/>
|
||||
|
||||
@@ -25,9 +25,15 @@ export default class Input extends Component {
|
||||
}
|
||||
|
||||
onKeyDown(e) {
|
||||
// send on cmd+enter / ctrl+enter
|
||||
if (e.keyCode === 13 && (e.metaKey || e.ctrlKey)) {
|
||||
this.send();
|
||||
}
|
||||
|
||||
// cancel on esc
|
||||
if (e.keyCode === 27 && this.props.onCancel) {
|
||||
this.props.onCancel();
|
||||
}
|
||||
}
|
||||
|
||||
autoResize() {
|
||||
|
||||
Reference in New Issue
Block a user