Merge pull request #6487 from matrix-org/gsouquet/fix-18265
commit
f82744db97
|
@ -67,15 +67,21 @@ export default class ReplyTile extends React.PureComponent<IProps> {
|
||||||
};
|
};
|
||||||
|
|
||||||
private onClick = (e: React.MouseEvent): void => {
|
private onClick = (e: React.MouseEvent): void => {
|
||||||
// This allows the permalink to be opened in a new tab/window or copied as
|
const clickTarget = e.target as HTMLElement;
|
||||||
// matrix.to, but also for it to enable routing within Riot when clicked.
|
// Following a link within a reply should not dispatch the `view_room` action
|
||||||
e.preventDefault();
|
// so that the browser can direct the user to the correct location
|
||||||
dis.dispatch({
|
// The exception being the link wrapping the reply
|
||||||
action: 'view_room',
|
if (clickTarget.tagName.toLowerCase() !== "a" || clickTarget.closest("a") === null) {
|
||||||
event_id: this.props.mxEvent.getId(),
|
// This allows the permalink to be opened in a new tab/window or copied as
|
||||||
highlighted: true,
|
// matrix.to, but also for it to enable routing within Riot when clicked.
|
||||||
room_id: this.props.mxEvent.getRoomId(),
|
e.preventDefault();
|
||||||
});
|
dis.dispatch({
|
||||||
|
action: 'view_room',
|
||||||
|
event_id: this.props.mxEvent.getId(),
|
||||||
|
highlighted: true,
|
||||||
|
room_id: this.props.mxEvent.getRoomId(),
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
Loading…
Reference in New Issue