mirror of
https://github.com/getredash/redash.git
synced 2026-03-22 10:00:17 -04:00
* Switch angular-sanitize package with dompurify * Replace $sanitize with DOMPurify.sanitize Co-authored-by: Arik Fraimovich <arik@arikfr.com>
21 lines
426 B
JavaScript
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: "",
|
|
};
|