-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
word-break in style is discarded because it is not considered a valid value in CSSSchema #192
Comments
|
How do we get an answer for this one? It does not look like the default Style policy can be overridden - If not, then it means that there is no way to provide a custom CSS schema that can allow elements like Looking for some explanation on why |
CSS properties defined in CssSchema but not on the default list can be allowed by adding: The default CSS definitions can also be overwritten (inprinciple, but currently it does not work because of issue #313), by adding the following code to the HTMLPolicyBuilder: .allowStyling(
CssSchema.withProperties(
Map.of("word-break",
new CssSchema.Property(0,
Set.of("keep-all", "valid-values"),
Collections.emptyMap())))) |
input:
policy:
Sanitizers.BLOCKS .and(Sanitizers.FORMATTING) .and(Sanitizers.LINKS) .and(Sanitizers.TABLES) .and(Sanitizers.IMAGES) .and(Sanitizers.STYLES) .and(.and(new HtmlPolicyBuilder() .allowElements("style") .allowAttributes("style").onElements("td", "table","div") .allowAttributes("type", "word-break").onElements("style") .toFactory());
Expected output (should contain word-break).
The text was updated successfully, but these errors were encountered: