click on 'answered' to put the username of the respective comment into the editor as a mention.

This commit is contained in:
ogerly 2020-01-06 18:02:46 +01:00
parent 490fb7fdeb
commit 28839ee2b4
3 changed files with 18 additions and 14 deletions

View File

@ -56,7 +56,7 @@
<ds-space margin-bottom="small" />
</ds-card>
<ds-button
v-bind:title="antworten"
v-bind:title="answered"
icon="level-down"
style="float:right; top: -22px;"
@click.prevent="answerComment"
@ -86,6 +86,7 @@ export default {
isTarget,
isCollapsed: !isTarget,
openEditCommentMenu: false,
answered: this.$t('post.comment.answered'),
}
},
components: {
@ -176,19 +177,20 @@ export default {
}
},
answerComment() {
const slug =
'<a class="mention" href="/profile/' +
this.comment.author.id +
'" data-mention-id="' +
this.comment.author.slug +
'" target="_blank" contenteditable="false">@d' +
this.comment.author.slug +
'</a>'
document.querySelector('.editor-content div').focus()
if (document.querySelector('.is-empty')) {
document.querySelector('.is-empty').innerHTML = '@' + this.comment.author.slug
document.querySelector('.is-empty').innerHTML = slug + ' '
} else {
const html = document.querySelector('.editor-content').innerHTML
const slug =
'<a class="mention" href="/profile/' +
this.comment.author.id +
'" data-mention-id="' +
this.comment.author.slug +
'" target="_blank" contenteditable="false">@d' +
this.comment.author.slug +
'</a>'
document.querySelector('.editor-content').innerHTML = html + '' + slug
const html = document.querySelector('.editor-content').innerHTML
document.querySelector('.editor-content div').innerHTML = html + ' ' + slug + ' '
}
},
},

View File

@ -269,7 +269,8 @@
"comment": {
"submit": "Kommentiere",
"submitted": "Kommentar Gesendet",
"updated": "Änderungen gespeichert"
"updated": "Änderungen gespeichert",
"answered": "answered"
},
"edited": "bearbeitet"
},

View File

@ -423,7 +423,8 @@
"comment": {
"submit": "Comment",
"submitted": "Comment Submitted",
"updated": "Changes Saved"
"updated": "Changes Saved",
"answered": "answered"
},
"edited": "edited"
},