-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Raw editing of HTML being sanitized #255
Comments
This is by design with ProseMirror and its schema. You can't just add arbitrary HTML and have it save against a node. So while you can edit the raw HTML of the field, it won't necessarily save everything as you input it. This is to ensure that the HTML can be effectively represented as blocks of content (JSON). This is true for HTML elements (the tags) and the attributes on the tag. We would need to modify the default Paragraph tag to allow for any additional attributes we want to support. The way around this - while a little more work - is to create an extension for Tiptap that adds this allowed attribute to the Paragraph node. |
@engram-design Ok. I kind of figured it had something to do with ProseMirror or Tiptap. I was just unsure with all the different layers and options which needed configured to allow it. I will look at making a extension to allow it. I might have some questions though if you don't mind answering them once I get started on it. |
Yeah, it's an unfortunate limitation, and I know the presence of a HTML button makes it seem like its a free-for-all. I did spend some time looking into ways we could allow this, but it really goes against the fundamentals of these libraries. Please do ask any questions (maybe in a new issue to track there)! |
I am still facing the same issue when manually adding an ID to any HTML tag in the HTML view, as the entry is sanitized upon saving in the latest version 2.1.12. |
This is correct behavior, as per my above comments. It’s a design decision from TipTap/ProseMirror and not something easily worked-around. You cannot save arbitrary HTML against a node, because that’s not how they work. They have a specific schema that’s very strict. |
Thank you. |
Describe the bug
I am experiencing a bug where manually added HTML in the HTML view is being sanitized on saving the entry. I am trying to do an anchor link within a vizy field but manually adding a id attribute to a html tag is being sanitized. It was my assumption that when you enable the html button and click on it, that you should be able to add some custom html.
Here is the html before saving:
HTML after saving:
Here is my vizy config JSON for the field:
Steps to reproduce
id="test"
attribute to a HTML element.Craft CMS version
4.4.15
Plugin version
2.1.9
Multi-site?
No
Additional context
No response
The text was updated successfully, but these errors were encountered: