Fix chat @-mentions not opening in a modal (#13581)

* fix #13276

* Fix eslint no-useless-concat
This commit is contained in:
Benja Appel 2021-10-21 19:37:03 -03:00 committed by GitHub
parent 14bdb5de67
commit dc5b85097e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -282,11 +282,15 @@ export default {
mounted () {
const links = this.$refs.markdownContainer.getElementsByTagName('a');
for (let i = 0; i < links.length; i += 1) {
const link = links[i];
if (links[i].getAttribute('href').startsWith('/profile/')) {
let link = links[i].pathname;
// Internet Explorer does not provide the leading slash character in the pathname
link = link.charAt(0) === '/' ? link : `/${link}`;
if (link.startsWith('/profile/')) {
links[i].onclick = ev => {
ev.preventDefault();
this.$router.push({ path: link.getAttribute('href') });
this.$router.push({ path: link });
};
}
}