Merge pull request #2654 from urbit/mp/ctrl-enter

link, publish: submit comment on ctrl+enter
This commit is contained in:
ixv 2020-04-02 07:34:47 -07:00 committed by GitHub
commit 75922dd017
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

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}

View File

@ -116,7 +116,13 @@ export class Comments extends Component {
"b--gray2-d mb2 focus-b--black focus-b--white-d white-d bg-gray0-d"}
aria-describedby="comment-desc"
style={{height: "4rem"}}
onChange={this.commentChange}>
onChange={this.commentChange}
onKeyPress={(e) => {
if ((e.getModifierState("Control") || event.getModifierState("Meta"))
&& e.key === "Enter") {
this.commentSubmit();
}
}}>
</textarea>
</div>
<button disabled={disableComment}