Comment box focus (#947)

* Add fallback url to fuse devserver(closes #945)

* Only focus on reply commentform textareas. Fixes #944

Co-authored-by: Justin Hernandez <jmarthernandez@gmail.com>
This commit is contained in:
Dessalines 2020-07-11 21:47:38 -04:00 committed by GitHub
parent f3dbfcd37b
commit 74655de618
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View file

@ -33,6 +33,7 @@ interface CommentFormProps {
onReplyCancel?(): any;
edit?: boolean;
disabled?: boolean;
focus?: boolean;
}
interface CommentFormState {
@ -122,9 +123,11 @@ export class CommentForm extends Component<CommentFormProps, CommentFormState> {
setTimeout(() => autosize.update(textarea), 10);
}
if (this.props.focus) {
textarea.focus();
}
}
}
componentDidUpdate() {
if (this.state.commentForm.content) {

View file

@ -229,6 +229,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
edit
onReplyCancel={this.handleReplyCancel}
disabled={this.props.locked}
focus
/>
)}
{!this.state.showEdit && !this.state.collapsed && (
@ -697,6 +698,7 @@ export class CommentNode extends Component<CommentNodeProps, CommentNodeState> {
node={node}
onReplyCancel={this.handleReplyCancel}
disabled={this.props.locked}
focus
/>
)}
{node.children && !this.state.collapsed && (