first example dynamisch usermention for answer comments

This commit is contained in:
ogerly 2019-12-21 22:11:38 +01:00
parent 57a4309b30
commit 490fb7fdeb

View File

@ -55,6 +55,13 @@
</div>
<ds-space margin-bottom="small" />
</ds-card>
<ds-button
v-bind:title="antworten"
icon="level-down"
style="float:right; top: -22px;"
@click.prevent="answerComment"
></ds-button>
<div style="clear:both"></div>
</div>
</template>
@ -168,6 +175,22 @@ export default {
this.$toast.error(err.message)
}
},
answerComment() {
if (document.querySelector('.is-empty')) {
document.querySelector('.is-empty').innerHTML = '@' + this.comment.author.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
}
},
},
}
</script>