fixes #2176, text align was not being reflected in summary sections

This commit is contained in:
Amruth Pillai
2025-01-26 01:00:38 +01:00
parent d21983aab4
commit 27b60a4df9
18 changed files with 101 additions and 78 deletions

View File

@ -9,12 +9,13 @@
"access": "public"
},
"dependencies": {
"papaparse": "^5.4.1",
"dayjs": "^1.11.11",
"unique-names-generator": "^4.7.1",
"clsx": "^2.1.1",
"tailwind-merge": "^2.3.0",
"@swc/helpers": "~0.5.11",
"clsx": "^2.1.1",
"dayjs": "^1.11.11",
"papaparse": "^5.4.1",
"sanitize-html": "^2.14.0",
"tailwind-merge": "^2.3.0",
"unique-names-generator": "^4.7.1",
"zod": "^3.24.1"
}
}

View File

@ -1,3 +1,4 @@
import sanitizeHtml from "sanitize-html";
import type { Config as UniqueNamesConfig } from "unique-names-generator";
import { adjectives, animals, uniqueNamesGenerator } from "unique-names-generator";
@ -55,3 +56,17 @@ export const parseLayoutLocator = (payload: SortablePayload | null): LayoutLocat
return { page, column, section };
};
export const sanitize = (html: string, options?: sanitizeHtml.IOptions) => {
return sanitizeHtml(html, {
...options,
allowedAttributes: {
...options?.allowedAttributes,
"*": ["class", "style"],
},
allowedStyles: {
...options?.allowedStyles,
"*": { "text-align": [/^left$/, /^right$/, /^center$/, /^justify$/] },
},
});
};