refactor(editor): Apply Prettier (no-changelog) (#4920)

*  Adjust `format` script

* 🔥 Remove exemption for `editor-ui`

* 🎨 Prettify

* 👕 Fix lint
This commit is contained in:
Iván Ovejero
2022-12-14 10:04:10 +01:00
committed by GitHub
parent bcde07e032
commit 5ca2148c7e
284 changed files with 19247 additions and 15540 deletions

View File

@@ -5,8 +5,8 @@ import xss, { friendlyAttrValue } from 'xss';
*/
export function sanitizeHtml(dirtyHtml: string) {
const allowedAttributes = ['href','name', 'target', 'title', 'class', 'id'];
const allowedTags = ['p', 'strong', 'b', 'code', 'a', 'br', 'i', 'em', 'small' ];
const allowedAttributes = ['href', 'name', 'target', 'title', 'class', 'id'];
const allowedTags = ['p', 'strong', 'b', 'code', 'a', 'br', 'i', 'em', 'small'];
const sanitizedHtml = xss(dirtyHtml, {
onTagAttr: (tag, name, value) => {
@@ -20,13 +20,15 @@ export function sanitizeHtml(dirtyHtml: string) {
}
// Allow `allowedAttributes` and all `data-*` attributes
if(allowedAttributes.includes(name) || name.startsWith('data-')) return `${name}="${friendlyAttrValue(value)}"`;
if (allowedAttributes.includes(name) || name.startsWith('data-')) {
return `${name}="${friendlyAttrValue(value)}"`;
}
return;
// Return nothing, means keep the default handling measure
},
onTag: (tag) => {
if(!allowedTags.includes(tag)) return '';
if (!allowedTags.includes(tag)) return '';
return;
},
});