Code field doesn't escape HTML. #927
Replies: 1 comment 1 reply
-
Hey @virtualSpoof — ok, I checked into this. I believe that what is necessary here is to extend the https://payloadcms.com/docs/fields/code#admin-config Because this is more of a feature request than a bug, as we know that we only support JS at this time, I'm gonna move this to a discussion. PS - I know I personally asked you to create this issue 👼 . Upon looking into the underlying causes, I realized this is less of a bug and more of a feature. Do you think you'd be up for taking a crack at a PR here? To add HTML support to the Code field? |
Beta Was this translation helpful? Give feedback.
-
Bug Report
The code field doesn't escape HTML, instead treating it as a HTML to be rendered.
Expected Behavior
HTML is escaped.
Current Behavior
HTML is not escaped.
![image](https://user-images.githubusercontent.com/110639374/182964647-a34474bd-034f-418d-9315-1c15b178ec4a.png)
Possible Solution
I believe this is due to a 'custom' React state addition, normally React would escape a state value.
payload/src/admin/components/forms/field-types/Code/Code.tsx
Line 53 in 28e3928
Detailed Description
Latest version. No addons / plugins. Standard.
Beta Was this translation helpful? Give feedback.
All reactions