Appease the linter
This commit is contained in:
parent
fc66e69c02
commit
6b09c3e9e6
3 changed files with 4 additions and 10 deletions
|
@ -191,13 +191,6 @@ matrixLinkify.MATRIXTO_MD_LINK_PATTERN =
|
||||||
'\\[([^\\]]*)\\]\\((?:https?://)?(?:www\\.)?matrix\\.to/#/([#@!+][^\\)]*)\\)';
|
'\\[([^\\]]*)\\]\\((?:https?://)?(?:www\\.)?matrix\\.to/#/([#@!+][^\\)]*)\\)';
|
||||||
matrixLinkify.MATRIXTO_BASE_URL= baseUrl;
|
matrixLinkify.MATRIXTO_BASE_URL= baseUrl;
|
||||||
|
|
||||||
const matrixToEntityMap = {
|
|
||||||
'@': '#/user/',
|
|
||||||
'#': '#/room/',
|
|
||||||
'!': '#/room/',
|
|
||||||
'+': '#/group/',
|
|
||||||
};
|
|
||||||
|
|
||||||
matrixLinkify.options = {
|
matrixLinkify.options = {
|
||||||
events: function(href, type) {
|
events: function(href, type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
|
@ -294,13 +294,15 @@ export function isPermalinkHost(host: string): boolean {
|
||||||
/**
|
/**
|
||||||
* Transforms a permalink (or possible permalink) into a local URL if possible. If
|
* Transforms a permalink (or possible permalink) into a local URL if possible. If
|
||||||
* the given permalink is found to not be a permalink, it'll be returned unaltered.
|
* the given permalink is found to not be a permalink, it'll be returned unaltered.
|
||||||
|
* @param {string} permalink The permalink to try and transform.
|
||||||
|
* @returns {string} The transformed permalink or original URL if unable.
|
||||||
*/
|
*/
|
||||||
export function tryTransformPermalinkToLocalHref(permalink: string): string {
|
export function tryTransformPermalinkToLocalHref(permalink: string): string {
|
||||||
if (!permalink.startsWith("http:") && !permalink.startsWith("https:")) {
|
if (!permalink.startsWith("http:") && !permalink.startsWith("https:")) {
|
||||||
return permalink;
|
return permalink;
|
||||||
}
|
}
|
||||||
|
|
||||||
let m = permalink.match(matrixLinkify.VECTOR_URL_PATTERN);
|
const m = permalink.match(matrixLinkify.VECTOR_URL_PATTERN);
|
||||||
if (m) {
|
if (m) {
|
||||||
return m[1];
|
return m[1];
|
||||||
}
|
}
|
||||||
|
@ -331,7 +333,7 @@ export function getPrimaryPermalinkEntity(permalink: string): string {
|
||||||
|
|
||||||
// If not a permalink, try the vector patterns.
|
// If not a permalink, try the vector patterns.
|
||||||
if (!permalinkParts) {
|
if (!permalinkParts) {
|
||||||
let m = permalink.match(matrixLinkify.VECTOR_URL_PATTERN);
|
const m = permalink.match(matrixLinkify.VECTOR_URL_PATTERN);
|
||||||
if (m) {
|
if (m) {
|
||||||
// A bit of a hack, but it gets the job done
|
// A bit of a hack, but it gets the job done
|
||||||
const handler = new RiotPermalinkConstructor("http://localhost");
|
const handler = new RiotPermalinkConstructor("http://localhost");
|
||||||
|
|
|
@ -20,7 +20,6 @@ import PermalinkConstructor, {PermalinkParts} from "./PermalinkConstructor";
|
||||||
* Generates permalinks that self-reference the running webapp
|
* Generates permalinks that self-reference the running webapp
|
||||||
*/
|
*/
|
||||||
export default class RiotPermalinkConstructor extends PermalinkConstructor {
|
export default class RiotPermalinkConstructor extends PermalinkConstructor {
|
||||||
|
|
||||||
_riotUrl: string;
|
_riotUrl: string;
|
||||||
|
|
||||||
constructor(riotUrl: string) {
|
constructor(riotUrl: string) {
|
||||||
|
|
Loading…
Reference in a new issue