diff --git a/cypress/integration/common/post.js b/cypress/integration/common/post.js index 23a7d5764..e3a922139 100644 --- a/cypress/integration/common/post.js +++ b/cypress/integration/common/post.js @@ -1,6 +1,8 @@ import { When, Then } from 'cypress-cucumber-preprocessor/steps' Then('my comment should be successfully created', () => { + cy.get('.ds-form') + .submit() cy.get('.iziToast-message') .contains('Comment Submitted') }) diff --git a/webapp/components/Editor/index.vue b/webapp/components/Editor/index.vue index 5b542b3ce..7596e75e4 100644 --- a/webapp/components/Editor/index.vue +++ b/webapp/components/Editor/index.vue @@ -415,6 +415,9 @@ export default { this.$emit('input', content) } }, + update(value) { + this.editor.setContent(value) + }, showLinkMenu(attrs) { this.linkUrl = attrs.href this.linkMenuIsActive = true diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 459c9696d..c99e4e5be 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -339,13 +339,16 @@ export default { return this.$store.getters['auth/user'].id === id }, updateEditorContent(value) { - const content = value.replace(/<(?:.|\n)*?>/gm, '').trim().length - if (content < 3) { + const content = value.replace(/<(?:.|\n)*?>/gm, '').trim() + if (content.length < 3) { this.disabled = true } else { this.disabled = false } - this.$refs.commentForm.update('content', value) + console.log(value) + this.form.content = value + // this.$refs.commentForm.update('content', value) + // this.$refs.editor.update(value) }, clear() { this.$refs.editor.clear() @@ -354,6 +357,7 @@ export default { this.$apollo.queries.CommentByPost.refetch() }, handleSubmit() { + console.log('content', this.form.content) this.$apollo .mutate({ mutation: gql` @@ -372,14 +376,10 @@ export default { .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')) }) .catch(err => { this.$toast.error(err.message) - this.loading = false - this.disabled = false }) } },