Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix other permalinks not beeing handled in app by adding prevent default
Browse files Browse the repository at this point in the history
  • Loading branch information
toger5 committed Jan 19, 2022
1 parent 3751b57 commit b4a9f67
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/linkify-matrix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,13 @@ function matrixURILinkifyParser({ scanner, parser, utils }) {
const INITIAL_TOKEN_STATE = S_START.tt(PROTOCOL);
const LOCALPART_STATE = INITIAL_TOKEN_STATE.tt(DOMAIN).tt(SLASH); //.tt(SLASH);

const AUTHORITYPART_STATE_FIRSTSLASH = INITIAL_TOKEN_STATE.tt(SLASH);
const AUTHORITYPART_STATE_SECONDSLASH = AUTHORITYPART_STATE_FIRSTSLASH.tt(
SLASH,
);
const AUTHORITYPART_STATE = AUTHORITYPART_STATE_SECONDSLASH.tt(DOMAIN);
AUTHORITYPART_STATE.tt(SLASH, LOCALPART_STATE);
// dont parse authorities for now, they make this also match with http:// links which is a problem
// const AUTHORITYPART_STATE_FIRSTSLASH = INITIAL_TOKEN_STATE.tt(SLASH);
// const AUTHORITYPART_STATE_SECONDSLASH = AUTHORITYPART_STATE_FIRSTSLASH.tt(
// SLASH,
// );
// const AUTHORITYPART_STATE = AUTHORITYPART_STATE_SECONDSLASH.tt(DOMAIN);
// AUTHORITYPART_STATE.tt(SLASH, LOCALPART_STATE);

const localpartTokens = [
DOT,
Expand Down Expand Up @@ -260,6 +261,7 @@ export const options = {
return {
// @ts-ignore see https://linkify.js.org/docs/options.html
click: function(e) {
e.preventDefault();
window.location.hash = localHref;
},
};
Expand Down

0 comments on commit b4a9f67

Please sign in to comment.