2016-11-12 21:41:43 +00:00
|
|
|
import sanitize from 'sanitize-html'
|
|
|
|
|
|
|
|
export const removeAttachmentLinks = (html) => {
|
|
|
|
return sanitize(html, {
|
|
|
|
allowedTags: false,
|
|
|
|
allowedAttributes: false,
|
2016-11-12 22:18:27 +00:00
|
|
|
exclusiveFilter: ({ tag, attribs }) => tag === 'a' && attribs.class.match(/attachment/)
|
2016-11-12 21:41:43 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
export const parse = (html) => {
|
|
|
|
return removeAttachmentLinks(html)
|
|
|
|
}
|
|
|
|
|
|
|
|
export default parse
|