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

14 lines
324 B
JavaScript
Raw Normal View History

/**
* External dependencies
*/
import { sanitize } from 'dompurify';
2019-05-29 22:28:37 +00:00
export const ALLOWED_TAGS = [ 'a', 'b', 'em', 'i', 'strong', 'p' ];
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 } ),
};
};