Skip to content

Instantly share code, notes, and snippets.

@mjanssen
Created March 28, 2020 17:48
Show Gist options
  • Save mjanssen/1b572a0b25fcbdbd4debe370e3e251a5 to your computer and use it in GitHub Desktop.
Save mjanssen/1b572a0b25fcbdbd4debe370e3e251a5 to your computer and use it in GitHub Desktop.
Output of rollup compiling
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var React = _interopDefault(require('react'));
function Html(_ref) {
var className = _ref.className,
children = _ref.children,
_ref$comp = _ref.comp,
C = _ref$comp === void 0 ? "div" : _ref$comp;
if (typeof children === "string") {
var tags = ["script", "style", "iframe"];
var regex = "<(".concat(tags.join("|"), ")[^>]*>.*</(").concat(tags.join("|"), ")>");
children = children.replace(new RegExp(regex), "");
}
return (
/*#__PURE__*/
// @ts-ignore for dangerouslySetInnerHTML and IntrinsicAttributes
React.createElement(C, {
className: className,
dangerouslySetInnerHTML: {
__html: children
}
})
);
}
module.exports = Html;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment