mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-17 17:32:22 +00:00
WIP(external-link): hacky attempt number one
This commit is contained in:
parent
3f3e0e2ae8
commit
a210ab57b0
2 changed files with 9 additions and 0 deletions
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue