"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
exports.__esModule = true;
exports["default"] = void 0;
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
var _react = _interopRequireDefault(require("react"));
require("./index.scss");
var _excluded = ["content", "dataList"];
// 富文本

// 用于处理富文本内容的函数
var processContent = function processContent(content) {
  // 检查内容是否为字符串
  if (typeof content !== 'string') {
    return '';
  }
  // 替换转义符号（这里可以根据需要添加更多处理逻辑）
  return content.replace(/\\/g, '');
};
var RichText = function RichText(props) {
  var content = props.content,
    dataList = props.dataList,
    otherProps = (0, _objectWithoutPropertiesLoose2["default"])(props, _excluded);
  return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
    className: "rich-text"
  }, otherProps), dataList && dataList.length > 0 ? dataList.map(function (item, index) {
    return /*#__PURE__*/_react["default"].createElement("div", {
      key: index,
      dangerouslySetInnerHTML: {
        __html: processContent(item.content)
      }
    });
  }) : /*#__PURE__*/_react["default"].createElement("div", {
    dangerouslySetInnerHTML: {
      __html: processContent(content)
    }
  }));
};
RichText.displayName = 'RichText';
var _default = exports["default"] = RichText;