mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
Parse matrix URI links
This commit is contained in:
parent
620cf9d93f
commit
eef5cbbace
@ -1,5 +1,6 @@
|
|||||||
import { linkify } from "./linkify/linkify.js";
|
import { linkify } from "./linkify/linkify.js";
|
||||||
import { getIdentifierColorNumber, avatarInitials } from "../../../avatar.js";
|
import { getIdentifierColorNumber, avatarInitials } from "../../../avatar.js";
|
||||||
|
import { MatrixURL } from "matrix-uri-parser";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse text into parts such as newline, links and text.
|
* Parse text into parts such as newline, links and text.
|
||||||
@ -124,6 +125,11 @@ export class LinkPart {
|
|||||||
constructor(url, inlines) {
|
constructor(url, inlines) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
this.inlines = inlines;
|
this.inlines = inlines;
|
||||||
|
if (url.startsWith("matrix:")) {
|
||||||
|
this.matrixUrl = new MatrixURL(url);
|
||||||
|
} else {
|
||||||
|
this.matrixUrl = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get type() { return "link"; }
|
get type() { return "link"; }
|
||||||
|
Loading…
Reference in New Issue
Block a user