html: allow class, title and style attributes

This commit is contained in:
bordun 2020-03-20 09:42:28 +01:00
parent f509a986d4
commit 036fd30044

View file

@ -5,7 +5,11 @@ var Widget = require('../common/widget'),
StaticProperties = require('../mixins/static_properties')
var sanitizeOptions = {
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'h1', 'h2']).filter(x=>x!=='iframe')
allowedTags: sanitizeHtml.defaults.allowedTags.concat(['img', 'h1', 'h2']).filter(x=>x!=='iframe'),
allowedAttributes: {
'*': [ 'title', 'class', 'style'],
'img': [ 'src' , 'title', 'class', 'style', 'width', 'height']
}
}
class Html extends StaticProperties(Widget, {bypass: true}) {
@ -27,7 +31,10 @@ class Html extends StaticProperties(Widget, {bypass: true}) {
'Allowed HTML tags:',
'  h1-6, blockquote, p, a, ul, ol, nl, li,',
'  b, i, strong, em, strike, code, hr, br, div,',
'  table, thead, img, caption, tbody, tr, th, td, pre'
'  table, thead, img, caption, tbody, tr, th, td, pre',
'Allowed attributes:',
'&nbsp;&nbsp;<*>: class, style, title',
'&nbsp;&nbsp;<img>: src, width, height',
]},
}, ['decimals', 'bypass'], {})