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" v-bind="$attrs" v-on="$listeners"
:active="active" :active="active"
:variant="variant" :variant="variant"
@mouseover="show = true" @mouseover="updateShow(true)"
@mouseleave="show = false" @mouseleave="updateShow(false)"
@focus="show = true" @focus="updateShow(true)"
@blur="show = false" @blur="updateShow(false)"
@click="onClick" @click="onClick"
> >
<span :class="pos"> <span :class="pos">
@@ -38,6 +38,10 @@ export default {
methods: { methods: {
onClick (e) { onClick (e) {
this.$el.blur() this.$el.blur()
},
updateShow (show) {
this.show = this.hovered || show
} }
} }
} }
+8 -2
View File
@@ -26,7 +26,7 @@
<dot-button <dot-button
:variant="link.variant" :variant="link.variant"
class="mr-2" class="mr-2"
active active hovered
> >
{{ $t('variants.' + link.variant) }} {{ $t('variants.' + link.variant) }}
</dot-button> </dot-button>
@@ -106,7 +106,13 @@ export default {
mounted () { mounted () {
if (this.page.notes) { if (this.page.notes) {
const ids = this.page.notes.filter(note => (note.links)).reduce((ids, note) => { 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.$store.dispatch('GET_NODES', { ids, dataLevel: 'initial' })
this.addFootnotes() this.addFootnotes()
+8 -2
View File
@@ -67,7 +67,7 @@
<dot-button <dot-button
:variant="link.variant" :variant="link.variant"
class="mr-2" class="mr-2"
active active hovered
> >
{{ $t('variants.' + link.variant) }} {{ $t('variants.' + link.variant) }}
</dot-button> </dot-button>
@@ -173,7 +173,13 @@ export default {
if (this.mode === 'view' && this.node.notes) { if (this.mode === 'view' && this.node.notes) {
// Query partial data for linked nodes in notes // Query partial data for linked nodes in notes
const ids = this.node.notes.filter(note => (note.links)).reduce((ids, note) => { 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' }) 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) { async 'QUERY_PAGE_BY_ID' ({ state, commit, dispatch, getters }, id) {
if (state.pages[id] !== undefined) return state.pages[id] if (state.pages[id] !== undefined) return state.pages[id]
return api.query(Page, { id }).then(data => { return api.query(Page, { id }).then(data => {
dispatch('PARSE_PAGE', data.page)
commit('SET_PAGE_FROM_ID', { id, page: data.page }) commit('SET_PAGE_FROM_ID', { id, page: data.page })
return state.pages[id] return state.pages[id]
}) })