Skip to content

Commit

Permalink
Rendered "details" component now expands/collapses as expected
Browse files Browse the repository at this point in the history
  • Loading branch information
ebkr committed Feb 28, 2025
1 parent a948491 commit 9d9d9ae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/components/v2/MarkdownRender.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,19 @@ const markdownToRender = computed(() => {
function captureClick(e: Event) {
if (e.target && e.target instanceof HTMLElement) {
if (e.target.tagName.toLowerCase() === "a") {
if (e.target.getAttribute("href").startsWith("#")) {
return e;
} else {
const href = e.target.getAttribute("href") || "";
if (!href.startsWith("#")) {
e.preventDefault();
LinkProvider.instance.openLink(e.target.getAttribute("href")!);
}
}
}
return e;
}
</script>

<template>
<p class="markdown-body" v-html="markdownToRender" @click.prevent="captureClick"></p>
<p class="markdown-body" v-html="markdownToRender" @click="captureClick"></p>
</template>

<style lang="scss" scoped>
Expand Down

0 comments on commit 9d9d9ae

Please sign in to comment.