mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-07-15 00:12:17 +00:00
open the modal by click override
This commit is contained in:
parent
a210ab57b0
commit
e39b3bdd35
2 changed files with 23 additions and 3 deletions
|
|
@ -8,8 +8,22 @@ 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');
|
||||
|
||||
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');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,9 +33,15 @@ setUpLogging();
|
|||
setupAnalytics(); // just create queues for analytics, no scripts loaded at this time
|
||||
const store = getStore();
|
||||
|
||||
export default new Vue({
|
||||
const vueInstance = new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
store,
|
||||
render: h => h(AppComponent),
|
||||
});
|
||||
|
||||
export default vueInstance;
|
||||
|
||||
window.externalLink = url => {
|
||||
vueInstance.$root.$emit('bv::show::modal', 'external-link-modal', url);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue