Parse matrix-schemed URIs (#7453)
Co-authored-by: J. Ryan Stinnett <jryans@gmail.com> Co-authored-by: Dariusz Niemczyk <dariuszn@element.io> Co-authored-by: Timo K <toger5@hotmail.de> With this pr all href use matrix matrix.to links. As a consequence right-click copy link will always return get you a sharable matrix.to link.
This commit is contained in:
parent
f59ea6d7ad
commit
6712a5b1c5
12 changed files with 254 additions and 100 deletions
|
@ -175,9 +175,10 @@ const transformTags: IExtendedSanitizeOptions["transformTags"] = { // custom to
|
|||
if (attribs.href) {
|
||||
attribs.target = '_blank'; // by default
|
||||
|
||||
const transformed = tryTransformPermalinkToLocalHref(attribs.href);
|
||||
if (transformed !== attribs.href || attribs.href.match(ELEMENT_URL_PATTERN)) {
|
||||
attribs.href = transformed;
|
||||
const transformed = tryTransformPermalinkToLocalHref(attribs.href); // only used to check if it is a link that can be handled locally
|
||||
if (transformed !== attribs.href || // it could be converted so handle locally symbols e.g. @user:server.tdl, matrix: and matrix.to
|
||||
attribs.href.match(ELEMENT_URL_PATTERN) // for https:vector|riot...
|
||||
) {
|
||||
delete attribs.target;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue