Keep mentions when editing a comment

Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
Julius Härtl
2020-01-31 14:46:56 +01:00
parent 41d286986b
commit ac39a0d92c
4 changed files with 30 additions and 11 deletions

View File

@@ -125,7 +125,8 @@ export default {
if (!this.$refs.contentEditable) {
return
}
const mentions = this.$refs.contentEditable.querySelectorAll('span[data-at-embedded]')
const node = this.$refs.contentEditable.cloneNode(true)
const mentions = node.querySelectorAll('span[data-at-embedded]')
mentions.forEach(mention => {
// FIXME Adding a space after the mention should be improved to
// do it or not based on the next element instead of always
@@ -133,7 +134,7 @@ export default {
mention.replaceWith(' @' + mention.firstElementChild.attributes['data-mention-id'].value + ' ')
})
return rawToParsed(this.$refs.contentEditable.innerHTML)
return rawToParsed(node.innerHTML)
},
/**