use-server-side-mfm (#133)
Reviewed-on: https://akkoma.dev/AkkomaGang/pleroma-fe/pulls/133
This commit is contained in:
parent
e61228b031
commit
2d85ee6a08
6 changed files with 13 additions and 18 deletions
|
@ -10,11 +10,6 @@ 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.
|
||||
*
|
||||
|
@ -71,11 +66,6 @@ export default {
|
|||
required: false,
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
sourceContent: {
|
||||
required: false,
|
||||
type: String,
|
||||
default: ''
|
||||
}
|
||||
},
|
||||
// NEVER EVER TOUCH DATA INSIDE RENDER
|
||||
|
@ -84,8 +74,7 @@ export default {
|
|||
const greentext = this.mfm ? false : this.greentext
|
||||
|
||||
// Pre-process HTML
|
||||
const useContent = selectContent(this.html, this.sourceContent, this.mfm)
|
||||
const { newHtml: html } = preProcessPerLine(useContent, greentext)
|
||||
const { newHtml: html } = preProcessPerLine(this.html, 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 = ''
|
||||
|
@ -180,7 +169,7 @@ export default {
|
|||
}
|
||||
|
||||
// Processor to use with html_tree_converter
|
||||
const processItem = (item, index, array) => {
|
||||
const processItem = (item, index, array, what) => {
|
||||
// Handle text nodes - just add emoji
|
||||
if (typeof item === 'string') {
|
||||
const emptyText = item.trim() === ''
|
||||
|
|
|
@ -52,7 +52,6 @@
|
|||
: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"
|
||||
|
|
|
@ -103,6 +103,9 @@ const StatusContent = {
|
|||
renderMfmOnHover () {
|
||||
return this.mergedConfig.renderMfmOnHover
|
||||
},
|
||||
renderMisskeyMarkdown () {
|
||||
return this.mergedConfig.renderMisskeyMarkdown
|
||||
},
|
||||
...mapGetters(['mergedConfig']),
|
||||
...mapState({
|
||||
currentUser: state => state.users.currentUser
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<template>
|
||||
<div
|
||||
class="StatusContent"
|
||||
:class="{ '-compact': compact, 'mfm-hover': renderMfmOnHover }"
|
||||
:class="{ '-compact': compact, 'mfm-hover': renderMfmOnHover, 'mfm-disabled': !renderMisskeyMarkdown }"
|
||||
>
|
||||
<slot name="header" />
|
||||
<StatusBody
|
||||
|
@ -78,7 +78,12 @@
|
|||
|
||||
&.mfm-hover:not(:hover) {
|
||||
.mfm {
|
||||
animation: none;
|
||||
animation: none !important;
|
||||
}
|
||||
}
|
||||
&.mfm-disabled {
|
||||
.mfm {
|
||||
animation: none !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -589,7 +589,7 @@ const users = {
|
|||
const response = data.error
|
||||
// Authentication failed
|
||||
commit('endLogin')
|
||||
if (response.status === 401 || response.status === 403) {
|
||||
if (response.status === 401) {
|
||||
reject(new Error('Wrong username or password'))
|
||||
} else {
|
||||
reject(new Error('An error occurred, please try again'))
|
||||
|
|
|
@ -282,7 +282,6 @@ export const parseStatus = (data) => {
|
|||
const { akkoma } = data
|
||||
if (akkoma && akkoma.source) {
|
||||
output.media_type = akkoma.source.mediaType
|
||||
output.source_content = akkoma.source.content
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue