Split up bodyToHtml (#12840)
* Split up bodyToHtml This (very incrementally) splits up the bodyToHtml function to avoid the multiple return types and hopefully make it a touch easier to comprehend. I'd also like to see what the test coverage says about this, so this is is somewhat experimental. This shouldn't change any behaviour but the comments in this function indiciate just how subtle it is. * Remove I prefix * Missed emoji formatting part
This commit is contained in:
@@ -22,7 +22,7 @@ import { IContent } from "matrix-js-sdk/src/matrix";
|
||||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { unescape } from "lodash";
|
||||
|
||||
import { bodyToHtml, checkBlockNode, IOptsReturnString } from "../HtmlUtils";
|
||||
import { bodyToHtml, checkBlockNode, EventRenderOpts } from "../HtmlUtils";
|
||||
|
||||
function textToHtml(text: string): string {
|
||||
const container = document.createElement("div");
|
||||
@@ -31,9 +31,8 @@ function textToHtml(text: string): string {
|
||||
}
|
||||
|
||||
function getSanitizedHtmlBody(content: IContent): string {
|
||||
const opts: IOptsReturnString = {
|
||||
const opts: EventRenderOpts = {
|
||||
stripReplyFallback: true,
|
||||
returnString: true,
|
||||
};
|
||||
if (content.format === "org.matrix.custom.html") {
|
||||
return bodyToHtml(content, null, opts);
|
||||
|
||||
Reference in New Issue
Block a user