-export function getSanitizeOptions () {
+export function getDefaultSanitizeOptions () {
return {
allowedTags: [ 'a', 'p', 'span', 'br', 'strong', 'em', 'ul', 'ol', 'li' ],
allowedSchemes: [ 'http', 'https' ],
}
}
+export function getTextOnlySanitizeOptions () {
+ return {
+ allowedTags: [] as string[]
+ }
+}
+
export function getCustomMarkupSanitizeOptions (additionalAllowedTags: string[] = []) {
- const base = getSanitizeOptions()
+ const base = getDefaultSanitizeOptions()
return {
allowedTags: [
...base.allowedTags,
...additionalAllowedTags,
- 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'
+ 'div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'img'
],
allowedSchemes: base.allowedSchemes,
allowedAttributes: {
...base.allowedAttributes,
+
+ 'img': [ 'src', 'alt' ],
'*': [ 'data-*', 'style' ]
}
}