diff --git a/webapp/components/Editor/index.vue b/webapp/components/Editor/index.vue index 57998fcbc..5b542b3ce 100644 --- a/webapp/components/Editor/index.vue +++ b/webapp/components/Editor/index.vue @@ -154,7 +154,10 @@ - + @@ -445,6 +448,9 @@ export default { // remove link command({ href: null }) } + }, + clear() { + this.editor.clearContent(true) } } } diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index fb3f8e5f9..459c9696d 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -107,7 +107,7 @@ color="primary" size="small" round - >{{ post.commentsCount }}  Comments + >{{ comments.length }}  Comments @@ -121,6 +121,7 @@ {{ $t('actions.cancel') }} @@ -346,15 +347,13 @@ export default { } this.$refs.commentForm.update('content', value) }, - clearEditor() { - this.form.content = ' ' + clear() { + this.$refs.editor.clear() }, addComment(comment) { this.$apollo.queries.CommentByPost.refetch() }, handleSubmit() { - const content = this.form.content - this.form.content = ' ' this.$apollo .mutate({ mutation: gql` @@ -367,11 +366,12 @@ export default { `, variables: { postId: this.post.id, - content + content: this.form.content } }) .then(res => { this.addComment(res.data.CreateComment) + this.$refs.editor.clear() this.loading = false this.disabled = false this.$toast.success(this.$t('post.comment.submitted')) @@ -395,7 +395,7 @@ export default { }, fetchPolicy: 'cache-and-network' }, - User: { + User: { query() { return gql(`{ User(orderBy: slug_asc) {