mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
open the modal by click override
This commit is contained in:
@@ -8,8 +8,22 @@ export default function markdown (el, { value, oldValue }) {
|
|||||||
} else {
|
} else {
|
||||||
el.innerHTML = '';
|
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');
|
const allLinks = el.getElementsByTagName('a');
|
||||||
|
|
||||||
|
for (let i = 0; i < allLinks.length; i++) {
|
||||||
|
const link = allLinks[i];
|
||||||
|
|
||||||
|
// todo middleclick or ctrl+click to open it in a new tab
|
||||||
|
// todo? should a normal click leave the current page or also open it in a new tab?
|
||||||
|
// ... hopefully this wont create memory leaks
|
||||||
|
link.addEventListener('click', e => {
|
||||||
|
e.stopPropagation();
|
||||||
|
e.preventDefault();
|
||||||
|
|
||||||
|
window.externalLink(link.href);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
el.classList.add('markdown');
|
el.classList.add('markdown');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,9 +33,15 @@ setUpLogging();
|
|||||||
setupAnalytics(); // just create queues for analytics, no scripts loaded at this time
|
setupAnalytics(); // just create queues for analytics, no scripts loaded at this time
|
||||||
const store = getStore();
|
const store = getStore();
|
||||||
|
|
||||||
export default new Vue({
|
const vueInstance = new Vue({
|
||||||
el: '#app',
|
el: '#app',
|
||||||
router,
|
router,
|
||||||
store,
|
store,
|
||||||
render: h => h(AppComponent),
|
render: h => h(AppComponent),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export default vueInstance;
|
||||||
|
|
||||||
|
window.externalLink = url => {
|
||||||
|
vueInstance.$root.$emit('bv::show::modal', 'external-link-modal', url);
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user