Simplify normalizer, adjust server config

This commit is contained in:
Chi Vinh Le
2018-03-25 01:37:45 +01:00
parent 8586da97fb
commit 939df89842
2 changed files with 3 additions and 8 deletions
@@ -1,12 +1,7 @@
export function htmlNormalizer(htmlInput) {
let str = htmlInput;
// We are normalizing the input from contenteditable of each browser, also removing unnecesary html tags
// https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Editable_content#Differences_in_markup_generation
// Old browsers uses `p` normalize to `div` instead.
str = str
.replace(/<p>/g, '<div>') // IE and old browsers outputs <p> instead of <div>s
.replace(/<\/p>/g, '</div>'); // IE and old browsers outputs <p> instead of <div>s
// Some tags have not been normalized across browsers in `Coral RTE` yet.
// So we'll do this manual step here for now.
// Harmonize all to <b> tag.
str = str
@@ -14,7 +14,7 @@ const config = {
// TODO: move to admin eventually
// Super strict rules to make sure users only submit the tags they are allowed
dompurify: {
ALLOWED_TAGS: ['b', 'i', 'blockquote', 'br', 'div'],
ALLOWED_TAGS: ['b', 'i', 'blockquote', 'br', 'div', 'span'],
ALLOWED_ATTR: [],
},