Skip to content

Commit c1b54b6

Browse files
make them clickable
1 parent 7619fec commit c1b54b6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/components/views/messages/TextualBody.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,13 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
439439
let target = e.target as HTMLLinkElement;
440440
// links processed by linkifyjs have their own handler so don't handle those here
441441
if (target.classList.contains(linkifyOpts.className as string)) return;
442+
// handle clicking packs
443+
const packUrl = target.getAttribute("data-mx-pack-url");
444+
if (packUrl) {
445+
// it could be converted to a localHref -> therefore handle locally
446+
e.preventDefault();
447+
window.location.hash = tryTransformPermalinkToLocalHref(packUrl);
448+
}
442449
if (target.nodeName !== "A") {
443450
// Jump to parent as the `<a>` may contain children, e.g. an anchor wrapping an inline code section
444451
target = target.closest<HTMLLinkElement>("a");

0 commit comments

Comments
 (0)