woocommerce/plugins/woocommerce-admin/client/lib/sanitize-html/index.js

14 lines
330 B
JavaScript
Raw Normal View History

/**
* External dependencies
*/
import { sanitize } from 'dompurify';
export const ALLOWED_TAGS = [ 'a', 'b', 'em', 'i', 'strong', 'p', 'br' ];
2019-05-21 19:34:33 +00:00
export const ALLOWED_ATTR = [ 'target', 'href', 'rel', 'name', 'download' ];
export default ( html ) => {
return {
__html: sanitize( html, { ALLOWED_TAGS, ALLOWED_ATTR } ),
};
};