From 62fa60f1093faad3c5374ef3f881dcd5781f085b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Thu, 11 Mar 2021 08:29:03 +0100 Subject: [PATCH 1/2] Use resourceId in formatted body MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/editor/serialize.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/editor/serialize.ts b/src/editor/serialize.ts index c1f4da306b..40ff4b59f5 100644 --- a/src/editor/serialize.ts +++ b/src/editor/serialize.ts @@ -34,6 +34,10 @@ export function mdSerialize(model: EditorModel) { case "at-room-pill": return html + part.text; case "room-pill": + // Here we use the resourceId for compatibility with non-rich text clients + // See https://github.com/vector-im/element-web/issues/16660 + return html + + `[${part.resourceId.replace(/[[\\\]]/g, c => "\\" + c)}](${makeGenericPermalink(part.resourceId)})`; case "user-pill": return html + `[${part.text.replace(/[[\\\]]/g, c => "\\" + c)}](${makeGenericPermalink(part.resourceId)})`; From d4f67d94a4ec1d2115d9b6fc150db698c9d9ceae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Thu, 11 Mar 2021 18:50:35 +0100 Subject: [PATCH 2/2] Use resourceId in plain body MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/editor/serialize.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/editor/serialize.ts b/src/editor/serialize.ts index 40ff4b59f5..d43cb4f38d 100644 --- a/src/editor/serialize.ts +++ b/src/editor/serialize.ts @@ -101,6 +101,9 @@ export function textSerialize(model: EditorModel) { case "at-room-pill": return text + part.text; case "room-pill": + // Here we use the resourceId for compatibility with non-rich text clients + // See https://github.com/vector-im/element-web/issues/16660 + return text + `${part.resourceId}`; case "user-pill": return text + `${part.text}`; }