matrix-org / matrix-rich-text-editor

Matrix Rich Text Editor
https://matrix-org.github.io/matrix-rich-text-editor/
Apache License 2.0
92 stars 23 forks source link

Crash when adding a new line right after a mention #903

Closed jmartinesp closed 9 months ago

jmartinesp commented 9 months ago

Problem

When adding a line break right after a mention, the composer crashes.

Steps to reproduce

The composer crashes. This happens because when adding a new line we're supposed to split the DOM tree in 2 and use paragraphs/line break nodes in between, but the code doesn't make an exception for mentions, which have only 1 char length.

Related issues

Proposed solution

Fix the DOM tree splitting algorithm.