From eef5cbbaceac64153eed89b4c881f138538fa316 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 27 Aug 2021 16:29:23 -0700 Subject: [PATCH] Parse matrix URI links --- src/domain/session/room/timeline/MessageBody.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/domain/session/room/timeline/MessageBody.js b/src/domain/session/room/timeline/MessageBody.js index a8bf2497..663af86c 100644 --- a/src/domain/session/room/timeline/MessageBody.js +++ b/src/domain/session/room/timeline/MessageBody.js @@ -1,5 +1,6 @@ import { linkify } from "./linkify/linkify.js"; import { getIdentifierColorNumber, avatarInitials } from "../../../avatar.js"; +import { MatrixURL } from "matrix-uri-parser"; /** * Parse text into parts such as newline, links and text. @@ -124,6 +125,11 @@ export class LinkPart { constructor(url, inlines) { this.url = url; this.inlines = inlines; + if (url.startsWith("matrix:")) { + this.matrixUrl = new MatrixURL(url); + } else { + this.matrixUrl = null; + } } get type() { return "link"; }