kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Merge branch 'recipients-inline' into 'develop'
Status: strip compatibility features from markup when importing See merge request soapbox-pub/soapbox-fe!1004improve-ci
commit
d36f0f7aae
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,3 +4,23 @@ export const unescapeHTML = (html) => {
|
|||
wrapper.innerHTML = html.replace(/<br\s*\/?>/g, '\n').replace(/<\/p><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;
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue