displaying pageBreaks
This commit is contained in:
@@ -44,6 +44,7 @@ export default {
|
||||
` data-uuid="${this.uuid}"` +
|
||||
`>${this.tei}</div>`
|
||||
this.parseLinks()
|
||||
this.parsePageBreaks()
|
||||
// console.log('EdText: builded html', this.html)
|
||||
},
|
||||
parseLinks () {
|
||||
@@ -82,6 +83,29 @@ export default {
|
||||
// console.log('this.html', this.html)
|
||||
}
|
||||
},
|
||||
parsePageBreaks () {
|
||||
let pbs = this.html.match(/<span role="pageBreak"[^>]+><\/span>/g)
|
||||
console.log('pagebreaks', pbs)
|
||||
if (pbs) {
|
||||
let pbparts, newpb, num
|
||||
for (var i = 0; i < pbs.length; i++) {
|
||||
pbparts = RegExp(/<span role="pageBreak" data-num="(.+)"><\/span>/).exec(pbs[i], 'g')
|
||||
if (!pbparts) {
|
||||
console.warn(`pageBreak ${i} maformed`, pbs[i])
|
||||
} else {
|
||||
console.log('pbparts', pbparts)
|
||||
num = pbparts[1]
|
||||
newpb = `<span` +
|
||||
` role="pageBreak"` +
|
||||
` data-num="${num}"` +
|
||||
` data-num-prev="${num - 1}"` +
|
||||
` />`
|
||||
console.log('newpb', newpb)
|
||||
this.html = this.html.replace(pbs[i], newpb)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
onClickRef (e) {
|
||||
console.log('onClickRef(e)', e)
|
||||
this.$router.push({
|
||||
|
||||
Reference in New Issue
Block a user