import DOMPurify from 'dompurify';
import React from 'react';
import styles from './index.module.less';

const DangerouslySetInnerHTML = (props: { content?: string }) => {
  const { content = '' } = props;
  return (
    <div
      className={styles.dangerouslySetInnerHTML}
      // biome-ignore lint/security/noDangerouslySetInnerHtml: 已使用 DOMPurify 进行 HTML 净化
      dangerouslySetInnerHTML={{ __html: DOMPurify.sanitize(content) }}
    />
  );
};

export default React.memo(DangerouslySetInnerHTML);
