mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
improved postcard excerpts
This commit is contained in:
parent
76d607033f
commit
fb3d88f3d7
@ -7,10 +7,11 @@
|
|||||||
:header="post.title"
|
:header="post.title"
|
||||||
:image="post.image"
|
:image="post.image"
|
||||||
style="cursor: pointer; position: relative;">
|
style="cursor: pointer; position: relative;">
|
||||||
<div
|
<ds-space margin-bottom="large">
|
||||||
class="hc-editor-content"
|
<div
|
||||||
v-html="excerpt" />
|
class="hc-editor-content"
|
||||||
<ds-space />
|
v-html="excerpt" />
|
||||||
|
</ds-space>
|
||||||
<ds-space
|
<ds-space
|
||||||
margin="small"
|
margin="small"
|
||||||
style="position: absolute; bottom: 44px;">
|
style="position: absolute; bottom: 44px;">
|
||||||
@ -37,6 +38,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import HcAuthor from '~/components/Author.vue'
|
import HcAuthor from '~/components/Author.vue'
|
||||||
|
import { randomBytes } from 'crypto'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'HcPostCard',
|
name: 'HcPostCard',
|
||||||
@ -56,7 +58,13 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
excerpt() {
|
excerpt() {
|
||||||
// remove all links from excerpt to prevent issues with the serounding link
|
// remove all links from excerpt to prevent issues with the serounding link
|
||||||
return this.post.contentExcerpt.replace(/<a.*>(.+)<\/a>/gim, '')
|
let excerpt = this.post.contentExcerpt.replace(/<a.*>(.+)<\/a>/gim, '')
|
||||||
|
// do not display content that is only linebreaks
|
||||||
|
if (excerpt.replace(/<br>/gim, '').trim() === '') {
|
||||||
|
excerpt = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
return excerpt
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user