Make link within replies clickable
parent
3e7aee3a87
commit
30ce7b5eab
|
@ -67,6 +67,11 @@ export default class ReplyTile extends React.PureComponent<IProps> {
|
||||||
};
|
};
|
||||||
|
|
||||||
private onClick = (e: React.MouseEvent): void => {
|
private onClick = (e: React.MouseEvent): void => {
|
||||||
|
const clickTarget = e.target as HTMLElement;
|
||||||
|
// Following a link within a reply should not dispatch the `view_room` action
|
||||||
|
// so that the browser can direct the user to the correct location
|
||||||
|
// The exceptionp being the link wrapping the reply
|
||||||
|
if (clickTarget.tagName.toLowerCase() !== "a" || clickTarget.closest("a") === null) {
|
||||||
// This allows the permalink to be opened in a new tab/window or copied as
|
// This allows the permalink to be opened in a new tab/window or copied as
|
||||||
// matrix.to, but also for it to enable routing within Riot when clicked.
|
// matrix.to, but also for it to enable routing within Riot when clicked.
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -76,6 +81,7 @@ export default class ReplyTile extends React.PureComponent<IProps> {
|
||||||
highlighted: true,
|
highlighted: true,
|
||||||
room_id: this.props.mxEvent.getRoomId(),
|
room_id: this.props.mxEvent.getRoomId(),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
Loading…
Reference in New Issue