mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-14 14:32:15 -07:00
* save work * fix reset styling * fix toast reducer * update non-react deps * update react libraries * remove jquery, use sanitize-html instead * add missing change * fix deps and dev deps * update workflow to target Node 16 * run @mui/codemod to remove @mui/styles * add default body font size * update react 17 to 18 * declare enum before use * add rel attr to links * fix font sizing issue * trailing commas * refactor deep destructuring Co-authored-by: Jeremy Letto <jeremy.letto@datasite.com>
17 lines
451 B
TypeScript
17 lines
451 B
TypeScript
import sanitize from 'sanitize-html';
|
|
|
|
export function sanitizeHtml(msg: string): string {
|
|
return sanitize(msg, {
|
|
allowedTags: ['br', 'a', 'img', 'center', 'b', 'font'],
|
|
allowedAttributes: {
|
|
'*': ['href', 'color', 'rel', 'target'],
|
|
},
|
|
allowedSchemes: ['http', 'https', 'ftp'],
|
|
transformTags: {
|
|
'a': sanitize.simpleTransform('a', {
|
|
target: '_blank',
|
|
rel: 'noopener noreferrer',
|
|
}),
|
|
}
|
|
});
|
|
}
|