fix several bugs on text's notes

This commit is contained in:
axolotle
2022-07-06 16:09:11 +02:00
parent 6e60e5b905
commit 254ea2815b
4 changed files with 25 additions and 8 deletions
+8 -4
View File
@@ -5,10 +5,10 @@
v-bind="$attrs" v-on="$listeners"
:active="active"
:variant="variant"
@mouseover="show = true"
@mouseleave="show = false"
@focus="show = true"
@blur="show = false"
@mouseover="updateShow(true)"
@mouseleave="updateShow(false)"
@focus="updateShow(true)"
@blur="updateShow(false)"
@click="onClick"
>
<span :class="pos">
@@ -38,6 +38,10 @@ export default {
methods: {
onClick (e) {
this.$el.blur()
},
updateShow (show) {
this.show = this.hovered || show
}
}
}
+8 -2
View File
@@ -26,7 +26,7 @@
<dot-button
:variant="link.variant"
class="mr-2"
active
active hovered
>
{{ $t('variants.' + link.variant) }}
</dot-button>
@@ -106,7 +106,13 @@ export default {
mounted () {
if (this.page.notes) {
const ids = this.page.notes.filter(note => (note.links)).reduce((ids, note) => {
return [...ids, ...note.links.map(link => link.id)]
note.links.forEach((link) => {
ids.push(link.id)
if (link.parents && link.parents.length) {
ids.push(link.parents[0].id)
}
})
return ids
}, [])
this.$store.dispatch('GET_NODES', { ids, dataLevel: 'initial' })
this.addFootnotes()
+8 -2
View File
@@ -67,7 +67,7 @@
<dot-button
:variant="link.variant"
class="mr-2"
active
active hovered
>
{{ $t('variants.' + link.variant) }}
</dot-button>
@@ -173,7 +173,13 @@ export default {
if (this.mode === 'view' && this.node.notes) {
// Query partial data for linked nodes in notes
const ids = this.node.notes.filter(note => (note.links)).reduce((ids, note) => {
return [...ids, ...note.links.map(link => link.id)]
note.links.forEach((link) => {
ids.push(link.id)
if (link.parents && link.parents.length) {
ids.push(link.parents[0].id)
}
})
return ids
}, [])
this.$store.dispatch('GET_NODES', { ids, dataLevel: 'initial' })
}
+1
View File
@@ -52,6 +52,7 @@ export default {
async 'QUERY_PAGE_BY_ID' ({ state, commit, dispatch, getters }, id) {
if (state.pages[id] !== undefined) return state.pages[id]
return api.query(Page, { id }).then(data => {
dispatch('PARSE_PAGE', data.page)
commit('SET_PAGE_FROM_ID', { id, page: data.page })
return state.pages[id]
})