pagination navigation is working

This commit is contained in:
2020-07-19 13:00:46 +02:00
parent e32b0d1281
commit 9744b4695d
3 changed files with 171 additions and 54 deletions
+10 -4
View File
@@ -11,7 +11,8 @@ export default {
},
data: () => ({
template: null,
html: null
html: null,
pages: []
}),
watch: {
tei: function (newtei, oldtei) {
@@ -26,6 +27,9 @@ export default {
this.buildTemplate()
}
},
mounted () {
this.$emit('onNewPageBreaks', this.pages)
},
methods: {
buildTemplate () {
// console.log('EdText buildTemplate: tei', this.tei)
@@ -85,7 +89,7 @@ export default {
},
parsePageBreaks () {
let pbs = this.html.match(/<span role="pageBreak"[^>]+><\/span>/g)
console.log('pagebreaks', pbs)
// console.log('pagebreaks', pbs)
if (pbs) {
let pbparts, newpb, num
for (var i = 0; i < pbs.length; i++) {
@@ -93,14 +97,16 @@ export default {
if (!pbparts) {
console.warn(`pageBreak ${i} maformed`, pbs[i])
} else {
console.log('pbparts', pbparts)
// console.log('pbparts', pbparts)
num = pbparts[1]
this.pages.push(num)
newpb = `<span` +
// ` id="page-break-${num}"` +
` role="pageBreak"` +
` data-num="${num}"` +
` data-num-prev="${num - 1}"` +
` />`
console.log('newpb', newpb)
// console.log('newpb', newpb)
this.html = this.html.replace(pbs[i], newpb)
}
}