search, filters, links, bug fix, misc, ALPHA

This commit is contained in:
2020-07-17 19:14:18 +02:00
parent 4c2288cf97
commit fb4cb676ac
7 changed files with 143 additions and 113 deletions
+21 -16
View File
@@ -57,22 +57,27 @@ export default {
for (var i = 0; i < links.length; i++) {
// console.log(`link ${i}:`, links[i])
linkparts = RegExp(/<a class="(.+)" href="(.+)" data-index="(.+)">(.+)<\/a>/g).exec(links[i], 'g')
index = linkparts[3]
uuid = linkparts[2].replace('#', '')
newlink = `<a` +
` class="${linkparts[1]} active-link"` +
` data-index="${index}"` +
` data-uuid="${uuid}"` +
` href="/${index}/${uuid}"` +
` @click.prevent="onClickRef"` +
` @keyup.enter="onClickRef"` +
` @mouseover="onHoverLink"` +
` @mouseleave="onLeaveLink"` +
`>${linkparts[4]}` +
`<sup class="mdi mdi-message-text-outline" />` +
`</a>`
// console.log('newlink', newlink)
this.html = this.html.replace(links[i], newlink)
// console.log('linkparts', linkparts)
if (!linkparts) {
console.warn(`link ${i} malformed:`, links[i])
} else {
index = linkparts[3]
uuid = linkparts[2].replace('#', '')
newlink = `<a` +
` class="${linkparts[1]} active-link"` +
` data-index="${index}"` +
` data-uuid="${uuid}"` +
` href="/${index}/${uuid}"` +
` @click.prevent="onClickRef"` +
` @keyup.enter="onClickRef"` +
` @mouseover="onHoverLink"` +
` @mouseleave="onLeaveLink"` +
`>${linkparts[4]}` +
`<sup class="mdi mdi-message-text-outline" />` +
`</a>`
// console.log('newlink', newlink)
this.html = this.html.replace(links[i], newlink)
}
}
// console.log('this.html', this.html)
}
+22 -7
View File
@@ -3,14 +3,22 @@
<header>
<h1>
<a
:href="result.url"
:href="'/edition/'+result.textId+'/'+result.uuid"
@click.prevent="onclick"
@keyup.enter="onclick"
v-html="result.title[0]"
/>
</h1>
<h2>
<a
:href="'/edition/'+result.textId+'/'+result.uuid"
@click.prevent="onclick"
@keyup.enter="onclick"
v-html="result.textId"
/>
</h1>
</h2>
</header>
<div class="extract" v-html="result.extract" />
<p v-if="preview" class="preview" v-html="preview" />
</article>
</template>
@@ -26,6 +34,17 @@ export default {
required: true
}
},
data: () => ({
preview: ''
}),
created () {
if (this.result.extract) {
const subString = this.result.extract.substr(0, 80)
this.preview = subString.substr(0, subString.lastIndexOf(' ')) + ' &hellip;'
} else {
console.warn(`No extract for ${this.result.textId}/${this.result.uuid}`)
}
},
methods: {
...mapActions({
addHistoryItem: 'History/addItem'
@@ -33,10 +52,6 @@ export default {
onclick () {
console.log('clicked on result item', this.result)
this.addHistoryItem(this.result)
// this.$router.push({
// name: `item`,
// params: { uuid: this.result.uuid }
// })
}
}
}