You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-11-08 21:42:24 +03:00
remove unused 'body' var; use a finally to clean up the temporary textfilter
This commit is contained in:
@@ -136,12 +136,13 @@ module.exports = {
|
||||
|
||||
var isHtml = (content.format === "org.matrix.custom.html");
|
||||
|
||||
var safeBody, body;
|
||||
var safeBody;
|
||||
if (isHtml) {
|
||||
// XXX: We sanitize the HTML whilst also highlighting its text nodes, to avoid accidentally trying
|
||||
// to highlight HTML tags themselves. However, this does mean that we don't highlight textnodes which
|
||||
// are interrupted by HTML tags (not that we did before) - e.g. foo<span/>bar won't get highlighted
|
||||
// by an attempt to search for 'foobar'. Then again, the search query probably wouldn't work either
|
||||
try {
|
||||
if (highlights && highlights.length > 0) {
|
||||
var highlighter = new Highlighter(isHtml, "mx_EventTile_searchHighlight", opts.onHighlightClick);
|
||||
var safeHighlights = highlights.map(function(highlight) {
|
||||
@@ -158,7 +159,10 @@ module.exports = {
|
||||
};
|
||||
}
|
||||
safeBody = sanitizeHtml(content.formatted_body, sanitizeHtmlParams);
|
||||
}
|
||||
finally {
|
||||
delete sanitizeHtmlParams.textFilter;
|
||||
}
|
||||
return <span className="markdown-body" dangerouslySetInnerHTML={{ __html: safeBody }} />;
|
||||
} else {
|
||||
safeBody = content.body;
|
||||
|
||||
Reference in New Issue
Block a user