Files
redash/client/app/components/HtmlContent.jsx
Gabriel Dutra 76f0dcb085 Replace angular-sanitize with DOMPurify (#4502)
* Switch angular-sanitize package with dompurify

* Replace $sanitize with DOMPurify.sanitize

Co-authored-by: Arik Fraimovich <arik@arikfr.com>
2020-01-08 10:56:11 +02:00

21 lines
426 B
JavaScript

import React from "react";
import PropTypes from "prop-types";
import { sanitize } from "dompurify";
export default function HtmlContent({ children, ...props }) {
return (
<div
{...props}
dangerouslySetInnerHTML={{ __html: sanitize(children) }} // eslint-disable-line react/no-danger
/>
);
}
HtmlContent.propTypes = {
children: PropTypes.string,
};
HtmlContent.defaultProps = {
children: "",
};