-
Notifications
You must be signed in to change notification settings - Fork 24
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
Unable to allow style attribute (htmlpurifier issue?) #322
Comments
Hi, thanks for getting in touch.
It sounds like a CKEditor configuration issue. You have to configure both CKEditor and HTML Purifier for this to work. You might find those two issues helpful: #250 and #217. I’ll close this now, but feel free to reply if you’re still having problems. |
This link that you provided in one of those issue links, does not apply to this plugin. In fact none of the code examples on ckeditor.com are written in languages that are relevant to this plugin. |
How are you adding a |
Yes, source editing. |
Thanks for confirming! You need to configure both CKEditor and HTML Purifier to allow for that attribute on the tags you want it to be allowed on. To allow the
To allow the style tag only for h1-h4 tags, you could use:
The list of all the config option properties can be found here: https://ckeditor.com/docs/ckeditor5/latest/api/module_core_editor_editorconfig-EditorConfig.html. If you scroll to I hope this helps! |
Thanks for getting back to me so quick @i-just. I appreciate it. When editing the config within the Control Panel, it autocompletes as I type, however "htmlSupport" never popped up unlike all the other config options, which made me think I wasn't doing it in the right place. And merely doing it anyway and testing didn't actually occur to me since every other property had auto-completed :) |
Description
I am trying to allow our web editors to use
style
om pretty much any tag, but specificallyh1
-h6
,p
,ul
, andol
. The CK Editor plugin doesn't seem to care about the changes in the .json config file in this regard. Adding new elements toHTML.AllowedElements
works just fine, but changed toCSS.AllowedProperties
does nothing, nor does adding (for instance)h1[style]
to theHTML.Allowed
string.I don't know if this is an issue with htmlpurifier, or if it's the Craft plugin. The .json config below looks correct as it's similar to what I've used in other, non Craft projects, where it has worked fine.
I also tried disabling html purifier completely, but the style attributes are still being removed, so I'm becoming more and more confident that it's not a htmlpurifier issue.
This is my .json config for this CK Editor field:
Additional info
Plugins & versions:
The text was updated successfully, but these errors were encountered: