MdView.tsx 613 B

1234567891011121314151617181920212223242526272829
  1. import { Typography } from "antd";
  2. import { TCodeConvertor, XmlToReact } from "./utilities";
  3. const { Paragraph } = Typography;
  4. interface IWidget {
  5. html?: string;
  6. className?: string;
  7. placeholder?: string;
  8. wordWidget?: boolean;
  9. convertor?: TCodeConvertor;
  10. style?: React.CSSProperties;
  11. }
  12. const Widget = ({
  13. html,
  14. className,
  15. wordWidget = false,
  16. placeholder,
  17. convertor,
  18. style,
  19. }: IWidget) => {
  20. const jsx = html ? XmlToReact(html, wordWidget, convertor) : placeholder;
  21. return (
  22. <Paragraph style={style} className={className}>
  23. {jsx}
  24. </Paragraph>
  25. );
  26. };
  27. export default Widget;