Parse matrix URI links

This commit is contained in:
Danila Fedorin 2021-08-27 16:29:23 -07:00
parent 620cf9d93f
commit eef5cbbace

View file

@ -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"; }