diff --git a/app/soapbox/actions/importer/normalizer.js b/app/soapbox/actions/importer/normalizer.js index c8f1a83ef..66524b556 100644 --- a/app/soapbox/actions/importer/normalizer.js +++ b/app/soapbox/actions/importer/normalizer.js @@ -1,5 +1,7 @@ import escapeTextContentForBrowser from 'escape-html'; +import { stripCompatibilityFeatures } from 'soapbox/utils/html'; + import emojify from '../../features/emoji/emoji'; import { unescapeHTML } from '../../utils/html'; @@ -79,7 +81,7 @@ export function normalizeStatus(status, normalOldStatus, expandSpoilers) { const emojiMap = makeEmojiMap(normalStatus); normalStatus.search_index = domParser.parseFromString(searchContent, 'text/html').documentElement.textContent; - normalStatus.contentHtml = emojify(normalStatus.content, emojiMap); + normalStatus.contentHtml = stripCompatibilityFeatures(emojify(normalStatus.content, emojiMap)); normalStatus.spoilerHtml = emojify(escapeTextContentForBrowser(spoilerText), emojiMap); normalStatus.hidden = expandSpoilers ? false : spoilerText.length > 0 || normalStatus.sensitive; } diff --git a/app/soapbox/components/status_content.js b/app/soapbox/components/status_content.js index 9aa8b2486..717071a5c 100644 --- a/app/soapbox/components/status_content.js +++ b/app/soapbox/components/status_content.js @@ -75,17 +75,6 @@ class StatusContent extends React.PureComponent { } } - deleteInlineQuote() { - const node = this.node; - if (!node) return; - - const inlineQuote = node.querySelector('.quote-inline'); - - if (inlineQuote) { - inlineQuote.remove(); - } - } - setCollapse() { const node = this.node; @@ -117,7 +106,6 @@ class StatusContent extends React.PureComponent { refresh = () => { this.setCollapse(); this._updateStatusLinks(); - this.deleteInlineQuote(); this.setOnlyEmoji(); } diff --git a/app/soapbox/utils/html.js b/app/soapbox/utils/html.js index 247e98c88..fec437c03 100644 --- a/app/soapbox/utils/html.js +++ b/app/soapbox/utils/html.js @@ -4,3 +4,23 @@ export const unescapeHTML = (html) => { wrapper.innerHTML = html.replace(//g, '\n').replace(/<\/p>

/g, '\n\n').replace(/<[^>]*>/g, ''); return wrapper.textContent; }; + +export const stripCompatibilityFeatures = html => { + const node = document.createElement('div'); + node.innerHTML = html; + + const selectors = [ + '.quote-inline', + '.recipients-inline', + ]; + + selectors.forEach(selector => { + const elem = node.querySelector(selector); + + if (elem) { + elem.remove(); + } + }); + + return node.innerHTML; +}; diff --git a/app/styles/components/status.scss b/app/styles/components/status.scss index 8c68f2bd6..9633ae100 100644 --- a/app/styles/components/status.scss +++ b/app/styles/components/status.scss @@ -821,11 +821,3 @@ a.status-card.compact:hover { margin-top: 5px !important; } } - -/* Fedibird quote post compatibility */ -.status__content, -.quoted-status__content { - .quote-inline { - display: none; - } -}