diff --git a/src/components/Content/EdPagination.vue b/src/components/Content/EdPagination.vue
index 68d4a93..4b0213e 100644
--- a/src/components/Content/EdPagination.vue
+++ b/src/components/Content/EdPagination.vue
@@ -47,7 +47,7 @@ export default {
// },
methods: {
parsePagesToOptions (p, i = 0, l = 0) {
- console.log('EdPagination parsePagesToOptions', p)
+ // console.log('EdPagination parsePagesToOptions', p)
for (var j = 0; j < p.length; j++) {
// if it is just a section without page like a volume
if (p[j].text) {
diff --git a/src/pages/Edition.vue b/src/pages/Edition.vue
index a64fed8..04fb31f 100644
--- a/src/pages/Edition.vue
+++ b/src/pages/Edition.vue
@@ -36,7 +36,7 @@
@@ -123,11 +123,13 @@ export default {
reftoscrollto: null,
//
toc: null,
+ flattoc: null,
//
pagination: null
}),
computed: {
...mapState({
+ corpusLoaded: state => state.Corpus.corpusLoaded,
editionslist: state => state.Corpus.editionslist,
editionsbyuuid: state => state.Corpus.editionsbyuuid
})
@@ -177,7 +179,7 @@ export default {
}
// wait for editions list from Corpus Store if not already loaded
- if (!this.editionslist.length) {
+ if (!this.corpusLoaded) {
// this.getCorpuses()
// subsribe to store to get the editionbyuuid list
// https://dev.to/viniciuskneves/watch-for-vuex-state-changes-2mgj
@@ -188,8 +190,9 @@ export default {
this.title = this.metainfotitle = state.Corpus.editionsbyuuid[this.editionid].title
}
if (mutation.type === 'Corpus/setTocs') {
- // console.log('Edition state.Coprus.editionsbyuuid', this.editionid, state.Corpus.editionsbyuuid)
+ console.log('Edition Corpus/setTocs', this.editionid, state.Corpus.editionsbyuuid)
this.toc = state.Corpus.editionsbyuuid[this.editionid].toc
+ this.flattoc = state.Corpus.editionsbyuuid[this.editionid].flattoc
// if no textid in new route (e.g. edition front)
// but we have toc
// get the first item
@@ -202,8 +205,10 @@ export default {
}
})
} else {
+ // console.log('');
this.title = this.metainfotitle = this.editionsbyuuid[this.editionid].title
this.toc = this.editionsbyuuid[this.editionid].toc
+ this.flattoc = this.editionsbyuuid[this.editionid].flattoc
// if no textid in new route (e.g. edition front)
// but we have toc
// get the first item
@@ -240,10 +245,10 @@ export default {
.catch((error) => {
console.warn('Issue with getTextContent', error)
Promise.reject(error)
- this.$router.replace({
- name: 'notfound',
- query: { fullpath: this.$route.path }
- })
+ // this.$router.replace({
+ // name: 'notfound',
+ // query: { fullpath: this.$route.path }
+ // })
})
},
onCenterScrolled (e) {
@@ -254,17 +259,19 @@ export default {
this.indexitem = null
},
nextText ($state) {
- console.log('infinite loading nextText()', this.texts[this.texts.length - 1].content.itemAfterUuid, $state)
- if (this.texts[this.texts.length - 1].content.itemAfterUuid) {
- this.getTextContent(this.texts[this.texts.length - 1].content.itemAfterUuid, $state, 'next')
+ console.log('infinite loading nextText()')
+ let indexofnext = this.flattoc.indexOf(this.textsuuids[this.textsuuids.length - 1]) + 1
+ if (indexofnext < this.flattoc.length) {
+ this.getTextContent(this.flattoc[indexofnext], $state, 'next')
} else {
$state.complete()
}
},
prevText ($state) {
- console.log('infinite loading prevText()', this.texts[0].content.itemBeforeUuid, $state)
- if (this.texts[0].content.itemBeforeUuid) {
- this.getTextContent(this.texts[0].content.itemBeforeUuid, $state, 'prev')
+ console.log('infinite loading prevText()')
+ let indexofprev = this.flattoc.indexOf(this.textsuuids[0]) - 1
+ if (indexofprev >= 0) {
+ this.getTextContent(this.flattoc[indexofprev], $state, 'prev')
} else {
$state.complete()
}
diff --git a/src/store/modules/corpus.js b/src/store/modules/corpus.js
index 95d4535..f50d4c5 100644
--- a/src/store/modules/corpus.js
+++ b/src/store/modules/corpus.js
@@ -54,7 +54,7 @@ export default {
// console.log('buildFlatTocs', i, eduuid)
state.editionsbyuuid[eduuid].flattoc = []
recurseFlatToc(state, eduuid, state.editionsbyuuid[eduuid].toc)
- console.log('buildFlatTocs DONE', eduuid, state.editionsbyuuid[eduuid].flattoc)
+ // console.log('buildFlatTocs DONE', eduuid, state.editionsbyuuid[eduuid].flattoc)
})
},
setPaginations (state, paginationslist) {