In On-Page Editing mode this is causing an issue. If you peek at the Value property of the IHtmlContent returned by PropertyFor, the (C# escaped) string looks like this:
The data-epi-property-rendersettings attribute is clearly supposed to contain a JSON value, but because both the attribute and the JSON use double quotation mark characters, the result is just crap.
Any idea what's going on here? I found this issue after upgrading to CMS 12, but we seem to have it in our production environment also, where CMS 11 is used.
We solved this by implementing our own IHtmlContent class that, when HTML is rendered, ensures that tags are written with single quotation mark characters, which allows any JSON content to use double quotation mark characters. 🤷♂️
We have a custom property renderer:
When this is called via a .cshtml view:
additionalViewData will contain the anonymous object:
In On-Page Editing mode this is causing an issue. If you peek at the Value property of the IHtmlContent returned by PropertyFor, the (C# escaped) string looks like this:
<h1 class=\"epi-editContainer\" data-epi-property-rendersettings=\"{\"CustomTag\":\"h1\",\"CustomCssClass\":\"if heading larger\"}\">Simple Hero block</h1>
Which results in the following HTML:
The data-epi-property-rendersettings attribute is clearly supposed to contain a JSON value, but because both the attribute and the JSON use double quotation mark characters, the result is just crap.
Any idea what's going on here? I found this issue after upgrading to CMS 12, but we seem to have it in our production environment also, where CMS 11 is used.