Skip to content

Commit

Permalink
make them clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
tenpura-shrimp committed Mar 11, 2023
1 parent 7619fec commit c1b54b6
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/views/messages/TextualBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,13 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
let target = e.target as HTMLLinkElement;
// links processed by linkifyjs have their own handler so don't handle those here
if (target.classList.contains(linkifyOpts.className as string)) return;
// handle clicking packs
const packUrl = target.getAttribute("data-mx-pack-url");
if (packUrl) {
// it could be converted to a localHref -> therefore handle locally
e.preventDefault();
window.location.hash = tryTransformPermalinkToLocalHref(packUrl);
}
if (target.nodeName !== "A") {
// Jump to parent as the `<a>` may contain children, e.g. an anchor wrapping an inline code section
target = target.closest<HTMLLinkElement>("a");
Expand Down

0 comments on commit c1b54b6

Please sign in to comment.