WIP(external-link): hacky attempt number one
This commit is contained in:
@@ -8,6 +8,8 @@ export default function markdown (el, { value, oldValue }) {
|
||||
} else {
|
||||
el.innerHTML = '';
|
||||
}
|
||||
// This is a hack, but it's one idea for how we might do things
|
||||
el.innerHTML = el.innerHTML.replace('href="h', 'href="/external?link=h');
|
||||
|
||||
el.classList.add('markdown');
|
||||
}
|
||||
|
||||
@@ -377,6 +377,8 @@ const router = new VueRouter({
|
||||
],
|
||||
},
|
||||
|
||||
{ name: 'externalLink', path: '/external' },
|
||||
|
||||
// Only used to handle some redirects
|
||||
// See router.beforeEach
|
||||
{ path: '/redirect/:redirect', name: 'redirect' },
|
||||
@@ -393,6 +395,11 @@ router.beforeEach(async (to, from, next) => {
|
||||
|
||||
if (to.name === 'redirect') return handleRedirect(to, from, next);
|
||||
|
||||
if (to.name === 'externalLink') {
|
||||
setTimeout(() => router.app.$emit('bv::show::modal', 'external-link-modal'), 500);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!isUserLoggedIn && routeRequiresLogin) {
|
||||
// Redirect to the login page unless the user is trying to reach the
|
||||
// root of the website, in which case show the home page.
|
||||
|
||||
Reference in New Issue
Block a user