use akkoma-specific source for MFM unless asked not to (#132)
Reviewed-on: https://akkoma.dev/AkkomaGang/pleroma-fe/pulls/132
This commit is contained in:
parent
64fdde52f6
commit
e61228b031
5 changed files with 22 additions and 3 deletions
|
@ -10,6 +10,11 @@ import HashtagLink from 'src/components/hashtag_link/hashtag_link.vue'
|
|||
|
||||
import './rich_content.scss'
|
||||
|
||||
const selectContent = (html, sourceContent, mfm) => {
|
||||
if (!mfm) return html
|
||||
return sourceContent === '' ? html : sourceContent
|
||||
}
|
||||
|
||||
/**
|
||||
* RichContent, The Über-powered component for rendering Post HTML.
|
||||
*
|
||||
|
@ -66,6 +71,11 @@ export default {
|
|||
required: false,
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
sourceContent: {
|
||||
required: false,
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
// NEVER EVER TOUCH DATA INSIDE RENDER
|
||||
|
@ -74,7 +84,8 @@ export default {
|
|||
const greentext = this.mfm ? false : this.greentext
|
||||
|
||||
// Pre-process HTML
|
||||
const { newHtml: html } = preProcessPerLine(this.html, greentext)
|
||||
const useContent = selectContent(this.html, this.sourceContent, this.mfm)
|
||||
const { newHtml: html } = preProcessPerLine(useContent, greentext)
|
||||
let currentMentions = null // Current chain of mentions, we group all mentions together
|
||||
// This is used to recover spacing removed when parsing mentions
|
||||
let lastSpacing = ''
|
||||
|
@ -169,7 +180,7 @@ export default {
|
|||
}
|
||||
|
||||
// Processor to use with html_tree_converter
|
||||
const processItem = (item, index, array, what) => {
|
||||
const processItem = (item, index, array) => {
|
||||
// Handle text nodes - just add emoji
|
||||
if (typeof item === 'string') {
|
||||
const emptyText = item.trim() === ''
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
:emoji="status.emojis"
|
||||
:handle-links="true"
|
||||
:mfm="renderMisskeyMarkdown && (status.media_type === 'text/x.misskeymarkdown')"
|
||||
:sourceContent="status.source_content"
|
||||
:greentext="mergedConfig.greentext"
|
||||
:attentions="status.attentions"
|
||||
@parseReady="onParseReady"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue