Skip to content

Commit

Permalink
[DOCS#2393] Replace isomorphic-dompurify with sanitize-html to remove…
Browse files Browse the repository at this point in the history
… build warnings (#1814)
  • Loading branch information
ronanc-tigera authored Dec 17, 2024
1 parent 7143faf commit 50888ba
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 189 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"@types/react-dom": "^18.2.15",
"clsx": "^2.1.1",
"framer-motion": "^4.1.17",
"isomorphic-dompurify": "^2.16.0",
"prism-react-renderer": "^2.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand All @@ -48,6 +47,7 @@
"react-modal": "^3.15.1",
"react-modal-image": "^2.6.0",
"react-player": "^2.11.0",
"sanitize-html": "^2.13.1",
"swagger-ui-react": "^4.14.0"
},
"devDependencies": {
Expand All @@ -56,6 +56,7 @@
"@playwright/test": "1.47.2",
"@testing-library/react": "^12.1.5",
"@types/jest": "^29.5.0",
"@types/sanitize-html": "^2.13.0",
"axios": "^1.7.4",
"crawlee": "^3.1.4",
"docusaurus-plugin-sass": "^0.2.2",
Expand Down
6 changes: 3 additions & 3 deletions src/___new___/components/FelixConfig/TableConfig.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import DOMPurify from 'isomorphic-dompurify';
import sanitizeHtml from 'sanitize-html';
import styles from './styles.module.css';

const getSanitizedData = ({ fieldData }) => ({
sanitizedDescription: { __html: DOMPurify.sanitize(fieldData.DescriptionHTML) },
sanitizedSchema: { __html: DOMPurify.sanitize(fieldData.StringSchemaHTML) },
sanitizedDescription: { __html: sanitizeHtml(fieldData.DescriptionHTML) },
sanitizedSchema: { __html: sanitizeHtml(fieldData.StringSchemaHTML) },
});

const TableConfig = ({ fieldData }) => {
Expand Down
6 changes: 3 additions & 3 deletions src/___new___/components/FelixConfig/TableEnv.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react';
import DOMPurify from 'isomorphic-dompurify';
import sanitizeHtml from 'sanitize-html';
import styles from './styles.module.css';

const getSanitizedData = ({ fieldData }) => ({
sanitizedDescription: { __html: DOMPurify.sanitize(fieldData.DescriptionHTML) },
sanitizedSchema: { __html: DOMPurify.sanitize(fieldData.StringSchemaHTML) },
sanitizedDescription: { __html: sanitizeHtml(fieldData.DescriptionHTML) },
sanitizedSchema: { __html: sanitizeHtml(fieldData.StringSchemaHTML) },
});

const TableEnv = ({ fieldData }) => {
Expand Down
8 changes: 4 additions & 4 deletions src/___new___/components/FelixConfig/TableResource.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import DOMPurify from 'isomorphic-dompurify';
import sanitizeHtml from 'sanitize-html';
import styles from './styles.module.css';

const getSanitizedData = ({ fieldData }) => ({
sanitizedNAMEYAML: { __html: DOMPurify.sanitize(fieldData.NameYAML) },
sanitizedDescription: { __html: DOMPurify.sanitize(fieldData.DescriptionHTML) },
sanitizedSchema: { __html: DOMPurify.sanitize(fieldData.YAMLSchemaHTML) },
sanitizedNAMEYAML: { __html: sanitizeHtml(fieldData.NameYAML) },
sanitizedDescription: { __html: sanitizeHtml(fieldData.DescriptionHTML) },
sanitizedSchema: { __html: sanitizeHtml(fieldData.YAMLSchemaHTML) },
});

const TableResource = ({ fieldData }) => {
Expand Down
Loading

0 comments on commit 50888ba

Please sign in to comment.