fix: isomorphic dompurify #8301

This commit is contained in:
M. Palanikannan 2025-12-10 19:51:11 +05:30 committed by GitHub
parent 67dfe91890
commit 76ebf395e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 393 additions and 14 deletions

View file

@ -1,4 +1,14 @@
import { sanitizeHTML } from "@plane/utils";
import DOMPurify from "isomorphic-dompurify";
/**
* Sanitizes HTML by removing all HTML tags, leaving only text content
* @param htmlString - The HTML string to sanitize
* @returns The sanitized text with all HTML tags removed
*/
const sanitizeHTML = (htmlString: string): string => {
const sanitizedText = DOMPurify.sanitize(htmlString, { ALLOWED_TAGS: [] }); // sanitize the string to remove all HTML tags
return sanitizedText.trim(); // trim the string to remove leading and trailing whitespaces
};
/**
* Utility function to extract text from HTML content