Skip to content

Commit

Permalink
Encapsulate VueCommentForm.focus()
Browse files Browse the repository at this point in the history
  • Loading branch information
danon committed Feb 7, 2024
1 parent 0ac4a30 commit 42cec2d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions resources/js/components/forum/comment-form.vue
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ export default class VueCommentForm extends Vue {
.finally(() => this.isProcessing = false);
}
focus() {
this.textarea.focus();
}
cancel() {
this.$emit('cancel');
}
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/forum/comment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
this.$store.commit('posts/edit', this.comment);
if (this.comment.is_editing) {
this.$nextTick(() => this.commentForm.textarea.focus());
this.$nextTick(() => this.commentForm.focus());
}
}
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/forum/post.vue
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ export default class VuePost extends Vue {
if (this.isCommenting) {
// @ts-ignore
this.$nextTick(() => this.commentForm.textarea.focus());
this.$nextTick(() => this.commentForm.focus());
}
}
Expand Down

0 comments on commit 42cec2d

Please sign in to comment.