-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.js
22 lines (18 loc) · 784 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//module originally from otranscribe
// https://github.com/oTranscribe/oTranscribe/blob/master/src/js/app/clean-html.js
// used in
// https://github.com/oTranscribe/oTranscribe/blob/master/src/js/app/texteditor.js
//
const sanitizeHtml = require('sanitize-html');
function cleanHTML(dirty) {
return sanitizeHtml(dirty, {
allowedTags: [ 'b', 'i', 'em', 'strong', 'a', 'p', 'span', 'br' ],
transformTags: {
'div': sanitizeHtml.simpleTransform('p'),
},
allowedAttributes: {
'span': [ 'class', 'speakerLabel', 'confidenceScore4','sectionHeader','wordnoTimeCode','editableSection','confidenceScore3','confidenceScore2','wordnoTimeCode','contentEditable','data-*' ]
}
});
};
module.exports.cleanHTML= cleanHTML;