diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 301aed0751..5ec2fa7ced 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -12,8 +12,8 @@ // Configure properties specific to VS Code. "vscode": { // Add the IDs of extensions you want installed when the container is created. - "extensions": ["dbaeumer.vscode-eslint"], - }, + "extensions": ["dbaeumer.vscode-eslint"] + } }, // Use 'forwardPorts' to make a list of ports inside the container available locally. @@ -25,5 +25,5 @@ "postAttachCommand": "pnpm dev --filter=web... --filter=demo...", // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "node", + "remoteUser": "node" } diff --git a/apps/formbricks-com/components/dummyUI/HtmlBody.tsx b/apps/formbricks-com/components/dummyUI/HtmlBody.tsx index fc569df89b..4d3c7ec329 100644 --- a/apps/formbricks-com/components/dummyUI/HtmlBody.tsx +++ b/apps/formbricks-com/components/dummyUI/HtmlBody.tsx @@ -1,11 +1,10 @@ -/* import { cleanHtml } from "../../lib/cleanHtml"; */ -import { cleanHtml } from "@formbricks/lib/cleanHtml"; +import * as DOMPurify from "dompurify"; export default function HtmlBody({ htmlString, questionId }: { htmlString: string; questionId: string }) { return ( + dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(htmlString) }}> ); } diff --git a/apps/formbricks-com/lib/cleanHtml.ts b/apps/formbricks-com/lib/cleanHtml.ts deleted file mode 100644 index b61697d3e3..0000000000 --- a/apps/formbricks-com/lib/cleanHtml.ts +++ /dev/null @@ -1,97 +0,0 @@ -/*! - * Sanitize an HTML string - * (c) 2021 Chris Ferdinandi, MIT License, https://gomakethings.com - * @param {String} str The HTML string to sanitize - * @return {String} The sanitized string - */ -export function cleanHtml(str: string): string { - /** - * Convert the string to an HTML document - * @return {Node} An HTML document - */ - function stringToHTML() { - let parser = new DOMParser(); - let doc = parser.parseFromString(str, "text/html"); - return doc.body || document.createElement("body"); - } - - /** - * Remove