element-hq / element-web

A glossy Matrix collaboration client for the web.
https://element.io
GNU Affero General Public License v3.0
11.24k stars 2.01k forks source link

Rich text editor sends HTML in plaintext body when mentioning users #28516

Open tadzik opened 21 hours ago

tadzik commented 21 hours ago

Steps to reproduce

  1. Enable devtools and the rich text editor
  2. Mention someone in a chat
  3. Check the Matrix event that was sent

Outcome

What did you expect?

An event that has a plaintext and a formatted body. That's how it looks for non-RTE:

"content": {
    "msgtype": "m.text",
    "body": "tadzik: hi",
    "format": "org.matrix.custom.html",
    "formatted_body": "<a href=\"https://matrix.to/#/@irc_tadzik:home.tadzik.net\">tadzik</a>: hi",
    "m.mentions": {
      "user_ids": [
        "@irc_tadzik:home.tadzik.net"
      ]
    }
  },

What happened instead?

The event sent contains HTML in both body and formatted_body:

{
    "msgtype": "m.text",
    "body": "<a data-mention-type=\"user\" href=\"https://matrix.to/#/@irc_tadzik:home.tadzik.net\" contenteditable=\"false\">tadzik</a> hi",
    "format": "org.matrix.custom.html",
    "formatted_body": "<a href=\"https://matrix.to/#/@irc_tadzik:home.tadzik.net\">tadzik</a> hi"
  }

Operating system

Debian Linux

Browser information

Firefox 128 ESR

URL for webapp

app.element.io

Application version

Element version: 1.11.86 Crypto version: Rust SDK 0.7.2 (517d99b), Vodozemac 0.7.0

Homeserver

Synapse v1.114.0

Will you send logs?

No