diff --git a/.changeset/fix-html-formatting-on-long-messages.md b/.changeset/fix-html-formatting-on-long-messages.md
new file mode 100644
index 000000000..2a34189b0
--- /dev/null
+++ b/.changeset/fix-html-formatting-on-long-messages.md
@@ -0,0 +1,5 @@
+---
+default: minor
+---
+
+Re-introduced custom HTML formatting for long messages
diff --git a/src/app/components/message/MsgTypeRenderers.tsx b/src/app/components/message/MsgTypeRenderers.tsx
index 6d1a63cce..7312a319d 100644
--- a/src/app/components/message/MsgTypeRenderers.tsx
+++ b/src/app/components/message/MsgTypeRenderers.tsx
@@ -97,15 +97,6 @@ export function MText({ edited, content, renderBody, renderUrlsPreview, style }:
[customBody, body]
);
- const safeCustomBody = useMemo(() => {
- if (!customBody) return undefined;
- if (customBody.length > 8000) {
- const imageTags = customBody.match(/
]*>/g);
- return imageTags ? imageTags.join(' ') : undefined;
- }
- return customBody;
- }, [customBody]);
-
const isForwarded = useMemo(() => {
const forwardMeta = content['moe.sable.message.forward'];
return typeof forwardMeta === 'object';
@@ -122,7 +113,7 @@ export function MText({ edited, content, renderBody, renderUrlsPreview, style }:
const isJumbo = useMemo(() => {
if (!trimmedBody || trimmedBody.length >= 500) return false;
if (
- (unwrappedPerMessageProfileMessage ?? safeCustomBody)?.match(
+ (unwrappedPerMessageProfileMessage ?? customBody)?.match(
/^(
]*data-mx-emoticon[^>]*\/>){1,20}$/i
)
)
@@ -130,12 +121,12 @@ export function MText({ edited, content, renderBody, renderUrlsPreview, style }:
if (!JUMBO_EMOJI_REG.test(trimmedBody)) return false;
if (trimmedBody.includes(':')) {
- const hasImage = safeCustomBody && /
]*>/i.test(safeCustomBody);
+ const hasImage = customBody && /
]*>/i.test(customBody);
if (!hasImage) return false;
}
return true;
- }, [unwrappedPerMessageProfileMessage, trimmedBody, safeCustomBody]);
+ }, [unwrappedPerMessageProfileMessage, trimmedBody, customBody]);
if (!body && !customBody) return ;
@@ -175,13 +166,13 @@ export function MText({ edited, content, renderBody, renderUrlsPreview, style }:
return (
<>
{renderBody({
body: trimmedBody,
- customBody: safeCustomBody,
+ customBody: typeof customBody === 'string' ? customBody : undefined,
})}
{edited && }