Fix: TipTap formatting not displaying on the review message

This commit is contained in:
Moyasee
2025-10-12 19:57:12 +03:00
parent 2240a8c9fb
commit 602b2fef91

View File

@@ -6,37 +6,7 @@ function removeZalgoText(text: string): string {
return text.replaceAll(zalgoRegex, "");
}
function decodeHtmlEntities(text: string): string {
const entityMap: { [key: string]: string } = {
"&": "&",
"&lt;": "<",
"&gt;": ">",
"&quot;": '"',
"&#39;": "'",
"&nbsp;": " ",
};
return text.replaceAll(/&[#\w]+;/g, (entity) => {
return entityMap[entity] || entity;
});
}
function removeHtmlTags(html: string): string {
let result = "";
let inTag = false;
for (const char of html) {
if (char === "<") {
inTag = true;
} else if (char === ">") {
inTag = false;
} else if (!inTag) {
result += char;
}
}
return result;
}
export function sanitizeHtml(html: string): string {
if (!html || typeof html !== "string") {