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

@ -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$/] },
},
});
};