diff --git a/webapp/components/Comment/Comment.vue b/webapp/components/Comment/Comment.vue index 3063fc400..aeedb9e52 100644 --- a/webapp/components/Comment/Comment.vue +++ b/webapp/components/Comment/Comment.vue @@ -54,13 +54,14 @@ + -
@@ -86,7 +87,6 @@ export default { isTarget, isCollapsed: !isTarget, openEditCommentMenu: false, - answered: this.$t('post.comment.answered'), } }, components: { @@ -113,7 +113,6 @@ export default { if (this.isLongComment && this.isCollapsed) { return this.$filters.truncate(this.comment.content, COMMENT_TRUNCATE_TO_LENGTH) } - // console.log(this.comment.content.replace(/\?/gi, '?++')) return this.comment.content }, displaysComment() { @@ -149,6 +148,10 @@ export default { }, }, methods: { + reply(comment) { + const message = { slug: this.comment.author.slug, id: this.comment.author.id } + this.$emit('reply', message) + }, checkAnchor(anchor) { return `#${this.anchor}` === anchor }, @@ -176,23 +179,6 @@ export default { this.$toast.error(err.message) } }, - answerComment() { - const slug = - '@d' + - this.comment.author.slug + - '' - document.querySelector('.editor-content div').focus() - if (document.querySelector('.is-empty')) { - document.querySelector('.is-empty').innerHTML = slug + ' ' - } else { - const html = document.querySelector('.editor-content').innerHTML - document.querySelector('.editor-content div').innerHTML = html + ' ' + slug + ' ' - } - }, }, } @@ -218,6 +204,11 @@ export default { float: right; } +.answerbutton { + float: right; + top: 0px; +} + @keyframes highlight { 0% { border: 1px solid $color-primary; diff --git a/webapp/components/CommentForm/CommentForm.vue b/webapp/components/CommentForm/CommentForm.vue index 6cdd08af3..c2a0e4562 100644 --- a/webapp/components/CommentForm/CommentForm.vue +++ b/webapp/components/CommentForm/CommentForm.vue @@ -57,6 +57,9 @@ export default { } }, methods: { + reply(message) { + this.$refs.editor.insertReply(message) + }, updateEditorContent(value) { const sanitizedContent = this.$filters.removeHtml(value, false) if (!this.update) { diff --git a/webapp/components/CommentList/CommentList.vue b/webapp/components/CommentList/CommentList.vue index 25ed62f68..d21f2b407 100644 --- a/webapp/components/CommentList/CommentList.vue +++ b/webapp/components/CommentList/CommentList.vue @@ -8,6 +8,7 @@
{} }, }, methods: { + reply(message) { + this.$emit('reply', message) + }, checkAnchor(anchor) { return anchor === '#comments' }, diff --git a/webapp/components/Editor/Editor.vue b/webapp/components/Editor/Editor.vue index 6c8a1908a..f62d7abf7 100644 --- a/webapp/components/Editor/Editor.vue +++ b/webapp/components/Editor/Editor.vue @@ -141,7 +141,6 @@ export default { methods: { openSuggestionList({ items, query, range, command, virtualNode }, suggestionType) { this.suggestionType = suggestionType - this.query = this.sanitizeQuery(query) this.filteredItems = items this.suggestionRange = range @@ -237,6 +236,9 @@ export default { const content = e.getHTML() this.$emit('input', content) }, + insertReply(message) { + this.editor.commands.mention({ id: message.id, label: message.slug }) + }, toggleLinkInput(attrs, element) { if (!this.isLinkInputActive && attrs && element) { this.$refs.linkInput.linkUrl = attrs.href diff --git a/webapp/locales/de.json b/webapp/locales/de.json index 060892d03..a394424cb 100644 --- a/webapp/locales/de.json +++ b/webapp/locales/de.json @@ -270,7 +270,7 @@ "submit": "Kommentiere", "submitted": "Kommentar Gesendet", "updated": "Änderungen gespeichert", - "answered": "answered" + "answer": "Antworten" }, "edited": "bearbeitet" }, diff --git a/webapp/locales/en.json b/webapp/locales/en.json index 69215d484..e6e3426a7 100644 --- a/webapp/locales/en.json +++ b/webapp/locales/en.json @@ -424,7 +424,7 @@ "submit": "Comment", "submitted": "Comment Submitted", "updated": "Changes Saved", - "answered": "answered" + "answer": "Answer" }, "edited": "edited" }, diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index 067650d15..06bbe554d 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -72,12 +72,18 @@ - + @@ -150,6 +156,9 @@ export default { }, }, methods: { + reply(message) { + this.$refs.commentForm && this.$refs.commentForm.reply(message) + }, isAuthor(id) { return this.$store.getters['auth/user'].id === id },