Enable greentext
This commit is contained in:
parent
fd1b8ee0e8
commit
80e3c2c790
2 changed files with 14 additions and 2 deletions
|
@ -6,7 +6,7 @@
|
||||||
<img :src="require('@/assets/feather/home.svg')">
|
<img :src="require('@/assets/feather/home.svg')">
|
||||||
<span>Home</span>
|
<span>Home</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
<search />
|
<search />
|
||||||
</div>
|
</div>
|
||||||
<div id="profile">
|
<div id="profile">
|
||||||
<router-link v-if="profile" class="profile-link" :to="{ name: 'profile', params: { profileId: profile.id }}">
|
<router-link v-if="profile" class="profile-link" :to="{ name: 'profile', params: { profileId: profile.id }}">
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
@{{ mention.username }}
|
@{{ mention.username }}
|
||||||
</router-link>
|
</router-link>
|
||||||
</div>
|
</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">
|
<div class="post-attachment" v-if="post.media_attachments.length > 0">
|
||||||
<template v-for="attachment in post.media_attachments" :key="attachment.id">
|
<template v-for="attachment in post.media_attachments" :key="attachment.id">
|
||||||
<img v-if="attachment.type === 'image'" :src="attachment.url">
|
<img v-if="attachment.type === 'image'" :src="attachment.url">
|
||||||
|
@ -310,6 +310,14 @@ export default class PostComponent extends Vue {
|
||||||
return formatDate(isoDate)
|
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[] {
|
get replyingTo(): Mention[] {
|
||||||
if (this.post.in_reply_to_id === null) {
|
if (this.post.in_reply_to_id === null) {
|
||||||
return []
|
return []
|
||||||
|
@ -617,6 +625,10 @@ export default class PostComponent extends Vue {
|
||||||
:deep(ol) {
|
:deep(ol) {
|
||||||
list-style-position: inside;
|
list-style-position: inside;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:deep(.greentext) {
|
||||||
|
color: #789922;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.post-attachment {
|
.post-attachment {
|
||||||
|
|
Loading…
Reference in a new issue