Merge pull request #3880 from mikiher/rich-text-book-descriptionss

Support rich text book descriptions
This commit is contained in:
advplyr 2025-01-25 13:42:37 -06:00 committed by GitHub
commit a4d0f95ecc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 134 additions and 83 deletions

View file

@ -1,11 +1,9 @@
const sanitizeHtml = require('../libs/sanitizeHtml')
const { entities } = require("./htmlEntities");
const { entities } = require('./htmlEntities')
function sanitize(html) {
const sanitizerOptions = {
allowedTags: [
'p', 'ol', 'ul', 'li', 'a', 'strong', 'em', 'del', 'br'
],
allowedTags: ['p', 'ol', 'ul', 'li', 'a', 'strong', 'em', 'del', 'br', 'b', 'i'],
disallowedTagsMode: 'discard',
allowedAttributes: {
a: ['href', 'name', 'target']
@ -34,6 +32,6 @@ function decodeHTMLEntities(strToDecode) {
if (entity in entities) {
return entities[entity]
}
return entity;
return entity
})
}