-
Notifications
You must be signed in to change notification settings - Fork 25
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
HTML Purifier EnableID doesn't work #304
Comments
Hi, thanks for reaching out! Custom attributes and classes are stripped out (by default) by CKEditor itself. In addition to configuring your HTML Purifier, you also have to configure the CKEditor to allow IDs. For example, this snippet allows for IDs for paragraph tags only:
You can find more info on CKEditor and HTML Purifier configuration here. I hope this helps! I’ll close this now, but feel free to reach out again if you run into any further problems. |
@i-just I’ve disabled the HTML Purifier for a specific field and tried the following CKEditor configurations:
Unfortunately, when I add HTML through the “Source” mode, the id attributes on links are still being stripped out. I need to preserve these id attributes on the anchor () tags like this:
Thx |
It seems to be a bug related to the handling of id attributes on anchor () tags. When I paste the following code into the “Source” mode and save the content, the id attribute is preserved in the frontend:
However, when I edit or update the content in the field (manually, not in “Source” mode) and save again, the id attribute on the anchor tag is stripped out.
|
I tested your CKEditor configuration (with HTML Purifier disabled), and it does preserve the ID attribute on the A tag (and on the SUP tag too). Can you double-check that the field you’re testing this on uses the CKEditor configuration you adjusted? Screen.Recording.2024-10-17.at.14.52.51.movThat said, you now have two rules in there: one that allows any styles, attributes and classes on all elements and the other that only allows an ID attribute on A tags, so one of them seems redundant, depending on the full solution you want to achieve. Let me know if I missed your point! |
Thank you for your response. It’s very strange. Here’s my video showing the same process. Bildschirmaufnahme.2024-10-17.um.16.17.47.mov |
@i-just Okay, I think I found the problem. It’s caused by the Anchor plugin! When I remove it, everything works as expected. |
Hello, I would like to allow IDs in Richtext. However, they are being stripped when saving.
Here is my config:
Here my field:
Thanks in advance!
Additional info
The text was updated successfully, but these errors were encountered: