From 2d85ee6a0831ed1c3d5f1a0e2934718f4ef4a111 Mon Sep 17 00:00:00 2001 From: floatingghost Date: Thu, 18 Aug 2022 03:14:38 +0000 Subject: [PATCH] use-server-side-mfm (#133) Reviewed-on: https://akkoma.dev/AkkomaGang/pleroma-fe/pulls/133 --- src/components/rich_content/rich_content.jsx | 15 ++------------- src/components/status_body/status_body.vue | 1 - src/components/status_content/status_content.js | 3 +++ src/components/status_content/status_content.vue | 9 +++++++-- src/modules/users.js | 2 +- .../entity_normalizer.service.js | 1 - 6 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/components/rich_content/rich_content.jsx b/src/components/rich_content/rich_content.jsx index e384b745..0d4127b6 100644 --- a/src/components/rich_content/rich_content.jsx +++ b/src/components/rich_content/rich_content.jsx @@ -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() === '' diff --git a/src/components/status_body/status_body.vue b/src/components/status_body/status_body.vue index 5a5f3e5e..321f3c4b 100644 --- a/src/components/status_body/status_body.vue +++ b/src/components/status_body/status_body.vue @@ -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" diff --git a/src/components/status_content/status_content.js b/src/components/status_content/status_content.js index 96fb99b2..81e40b0b 100644 --- a/src/components/status_content/status_content.js +++ b/src/components/status_content/status_content.js @@ -103,6 +103,9 @@ const StatusContent = { renderMfmOnHover () { return this.mergedConfig.renderMfmOnHover }, + renderMisskeyMarkdown () { + return this.mergedConfig.renderMisskeyMarkdown + }, ...mapGetters(['mergedConfig']), ...mapState({ currentUser: state => state.users.currentUser diff --git a/src/components/status_content/status_content.vue b/src/components/status_content/status_content.vue index 3a99c779..b8735f2c 100644 --- a/src/components/status_content/status_content.vue +++ b/src/components/status_content/status_content.vue @@ -1,7 +1,7 @@