When the composer's selection wraps only a mention and enter() is received, instead of adding a new line, the mention is removed.
Steps to reproduce
// Before:
Test {<a data-mention-type="user" href="https://matrix.to/#/@bob:matrix.org" contenteditable="false">@bob</a>}| more
// After pressing enter:
<p>Test |more </p><p> </p>
This is obviously not the required behavior. I think it can be avoided by wrapping the contents of the root node inside a paragraph first, but that would also change how pressing enter works in lots of other cases, so it's not a quick fix.
Problem
When the composer's selection wraps only a mention and
enter()
is received, instead of adding a new line, the mention is removed.Steps to reproduce
This is obviously not the required behavior. I think it can be avoided by wrapping the contents of the root node inside a paragraph first, but that would also change how pressing enter works in lots of other cases, so it's not a quick fix.
Related issues
https://github.com/matrix-org/matrix-rich-text-editor/issues/903
Proposed solution
Re-work a bit how
do_enter()
works when the root node for mentions when they're not inside paragraphs.