(backlinks) implement backlinks in notes

This commit is contained in:
Julien Calixte
2021-06-06 11:11:15 +02:00
parent c6dec8769f
commit bff90e6ef5
7 changed files with 117 additions and 103 deletions

View File

@@ -4,7 +4,9 @@
<h4 class="subtitle is-4">🔗 Links to this note</h4>
<ul>
<li v-for="link in backlink?.links" :key="link.sha">
{{ link.title }}
<a @click.prevent="emitNote(link.sha)">
{{ link.title }}
</a>
</li>
</ul>
</div>
@@ -12,6 +14,7 @@
<script lang="ts">
import { useBacklinks } from '@/hooks/useBacklinks.hook'
import { useQueryStackedNotes } from '@/hooks/useQueryStackedNotes.hook'
import { defineComponent } from 'vue'
export default defineComponent({
@@ -21,8 +24,15 @@ export default defineComponent({
},
setup(props) {
const { backlink } = useBacklinks(props.sha)
const { addStackedNote } = useQueryStackedNotes()
const emitNote = (sha: string) => {
addStackedNote(props.sha, sha)
}
return {
backlink: backlink.state
backlink: backlink.state,
emitNote
}
}
})