From 3d1e28442f8812badd496ad02a1427d997695eaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Fri, 17 Nov 2023 08:59:43 +0100 Subject: [PATCH] fix: Use text content as result for comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/components/card/CommentForm.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/card/CommentForm.vue b/src/components/card/CommentForm.vue index 6327938e0..8d3046b49 100644 --- a/src/components/card/CommentForm.vue +++ b/src/components/card/CommentForm.vue @@ -114,8 +114,13 @@ export default { submit() { const content = this.validate(true) if (content) { - this.$emit('input', content) - this.$emit('submit', content) + // We need the plain text representation for the input event as otherwise it will propagate back to the contenteditable + // The input event is only used for change detection to make sure that the input is reset after posting the comment + const temp = document.createElement('div') + temp.innerHTML = content + const text = temp.textContent || temp.innerText || '' + this.$emit('input', text) + this.$emit('submit', text) } }, /* All credits for this go to the talk app