links: submit comment on ctrl+enter

This commit is contained in:
Matilde Park 2020-04-01 22:36:11 -04:00
parent 7a796549bd
commit 8bafdea10c

View File

@ -130,6 +130,12 @@ export class LinkDetail extends Component {
}}
placeholder="Leave a comment on this link"
onChange={this.setComment}
onKeyPress={(e) => {
if ((e.getModifierState("Control") || event.getModifierState("Meta"))
&& e.key === "Enter") {
this.onClickPost();
}
}}
onFocus={() => this.setState({commentFocus: true})}
onBlur={() => this.setState({commentFocus: false})}
value={this.state.comment}