Skip to content
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

Ability to add new CSS attributes to the CssSchema DEFINITION #70

Open
sakhan19822 opened this issue May 26, 2016 · 8 comments
Open

Ability to add new CSS attributes to the CssSchema DEFINITION #70

sakhan19822 opened this issue May 26, 2016 · 8 comments

Comments

@sakhan19822
Copy link

Currently we can only define a whitelist using CssSchema.withProperties method, the properties mentioned in this should be present int the master-set DEFINITIONS mentioned in the class.
In case while configuring we need to add properties to this master-set we can can't as there is not public API exposed to do the same.

@mikesamuel
Copy link
Contributor

What definitions do you need to add?

@sakhan19822
Copy link
Author

There are definitions related to microsoft specific properties and addons.

@mikesamuel
Copy link
Contributor

We strip vendor prefixes so any -ms-* properties would go in the normal schema. I don't know what an "addon" is.

@sakhan19822
Copy link
Author

sakhan19822 commented May 31, 2016

we see the following some other schema attributes coming mso-margin-top-alt,mso-add-space, tab-stops, mso-fareast-font-family, mso-bidi-font-family,mso-bidi-theme-font, looking at the code pointed out by you it seems that they are not stripped.
If we can have a way to whitelist these or remove these it will be easy for the end customer to use them as per there need. Something similar was present in antisamy.

@taherjahmed
Copy link

taherjahmed commented Dec 5, 2017

I want to add "display: flex" in style attribute.
<div style="display: flex;" />

@Johannesklint
Copy link

Any update on this?
I want to add display and float properties but that is stripped away.

@jmanico
Copy link
Member

jmanico commented Jan 31, 2020 via email

@csware
Copy link
Contributor

csware commented Jan 31, 2024

Even if flex is not support out of the box, you can in principle add your own CssSchema rules (only issue, CssSchema.withProperties(Map) does not work rights now, cf. #313 :

new HtmlPolicyBuilder()
          .allowCommonInlineFormattingElements()
          .allowCommonBlockElements()
          .allowStyling(
              CssSchema.withProperties(
                  Map.of("display",
                      new CssSchema.Property(0,
                          Set.of("none", "flex"),
                          Collections.emptyMap()))))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants