fix: isomorphic dompurify #8301
This commit is contained in:
parent
67dfe91890
commit
76ebf395e6
5 changed files with 393 additions and 14 deletions
|
|
@ -32,7 +32,6 @@
|
|||
"@hocuspocus/transformer": "2.15.2",
|
||||
"@plane/decorators": "workspace:*",
|
||||
"@plane/editor": "workspace:*",
|
||||
"@plane/utils": "workspace:*",
|
||||
"@plane/logger": "workspace:*",
|
||||
"@plane/types": "workspace:*",
|
||||
"@sentry/node": "catalog:",
|
||||
|
|
@ -46,6 +45,7 @@
|
|||
"express-ws": "^5.0.2",
|
||||
"helmet": "^7.1.0",
|
||||
"ioredis": "5.7.0",
|
||||
"isomorphic-dompurify": "^1.8.0",
|
||||
"uuid": "catalog:",
|
||||
"ws": "^8.18.3",
|
||||
"y-prosemirror": "^1.3.7",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue