use sourceContent for mfm

This commit is contained in:
FloatingGhost 2022-08-17 09:16:10 +01:00
parent 64fdde52f6
commit 597de32e12
4 changed files with 11 additions and 3 deletions

View file

@ -66,6 +66,11 @@ export default {
required: false,
type: Boolean,
default: false
},
sourceContent: {
required: false,
type: String,
default: ''
}
},
// NEVER EVER TOUCH DATA INSIDE RENDER
@ -74,7 +79,8 @@ export default {
const greentext = this.mfm ? false : this.greentext
// Pre-process HTML
const { newHtml: html } = preProcessPerLine(this.html, greentext)
const useContent = this.sourceContent === '' ? this.html : this.sourceContent
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 +175,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() === ''

View file

@ -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"

View file

@ -589,7 +589,7 @@ const users = {
const response = data.error
// Authentication failed
commit('endLogin')
if (response.status === 401) {
if (response.status === 401 || response.status === 403) {
reject(new Error('Wrong username or password'))
} else {
reject(new Error('An error occurred, please try again'))

View file

@ -282,6 +282,7 @@ export const parseStatus = (data) => {
const { akkoma } = data
if (akkoma && akkoma.source) {
output.media_type = akkoma.source.mediaType
output.source_content = akkoma.source.content
}
}