Enable greentext
This commit is contained in:
parent
fd1b8ee0e8
commit
80e3c2c790
2 changed files with 14 additions and 2 deletions
|
@ -50,7 +50,7 @@
|
|||
@{{ mention.username }}
|
||||
</router-link>
|
||||
</div>
|
||||
<div class="post-content" ref="postContent" v-html="post.content"></div>
|
||||
<div class="post-content" ref="postContent" v-html="content"></div>
|
||||
<div class="post-attachment" v-if="post.media_attachments.length > 0">
|
||||
<template v-for="attachment in post.media_attachments" :key="attachment.id">
|
||||
<img v-if="attachment.type === 'image'" :src="attachment.url">
|
||||
|
@ -310,6 +310,14 @@ export default class PostComponent extends Vue {
|
|||
return formatDate(isoDate)
|
||||
}
|
||||
|
||||
get content(): string {
|
||||
// Add greentext
|
||||
const greentextRegexp = /(?<=^|>)(>.+)(?=$|<)/gm
|
||||
const content = this.post.content
|
||||
.replaceAll(greentextRegexp, '<span class="greentext">$1</span>')
|
||||
return content
|
||||
}
|
||||
|
||||
get replyingTo(): Mention[] {
|
||||
if (this.post.in_reply_to_id === null) {
|
||||
return []
|
||||
|
@ -617,6 +625,10 @@ export default class PostComponent extends Vue {
|
|||
:deep(ol) {
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
:deep(.greentext) {
|
||||
color: #789922;
|
||||
}
|
||||
}
|
||||
|
||||
.post-attachment {
|
||||
|
|
Loading…
Reference in a new issue