diff --git a/.gitignore b/.gitignore index b512c09..006562a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -node_modules \ No newline at end of file +node_modules +.yarn \ No newline at end of file diff --git a/template/src/sanitize.tsx b/template/src/sanitize.tsx index 4d684dd..20aec95 100644 --- a/template/src/sanitize.tsx +++ b/template/src/sanitize.tsx @@ -1,12 +1,23 @@ import xss from 'xss'; +const allowed = ["class"]; + +// @ts-expect-error no types +const whiteList = Object.keys(xss.whiteList).reduce((acc, key) => { + // @ts-expect-error no types + const value = [...xss.whiteList[key], ...allowed]; + return { + ...acc, + [key]: value, + } +}, {}); + const options = { whiteList: { - // @ts-expect-error no types - ...xss.whiteList, - main: [], - svg: [], - time: [], + ...whiteList, + main: allowed, + svg: allowed, + time: allowed, } }