There are 2 comments.
 
 
XWiki Platform / cid:jira-generated-image-avatar-d7d6fb12-fef1-470a-92b4-1bdf6f0a5657 XWIKI-22221 Open

Saving from Inplace Edit mode, after switching to Source, breaks the content

 
View issue   ยท   Add comment
 

2 comments

 
cid:jira-generated-image-avatar-ed4700a1-69c2-404d-8db5-6663171654ac Marius Dumitru Florea on 10/Jun/24 10:43
 

There are two problems here:

  • When saving from Source mode, the editor is supposed to submit only the source wiki syntax, not the HTML. Inspecting the HTTP requests sent by the editor shows that it is in fact sending the HTML when the source area doesn't have any changes.
  • Submitting the HTML from Source mode shouldn't be a problem normally, but it's not optional because it triggers a useless conversion when we already know the source wiki syntax. BUT, the submitted HTML is not exactly the same as the one submitted from the WYSIWYG mode. Precisely, the value of some attributes (used to mark in-line editable macros) is not property escaped:
<div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" ...

versus the expected:

<div data-xwiki-non-generated-content="java.util.List&lt;org.xwiki.rendering.block.Block&gt;" ...

Surprisingly, for me, the HTML submitted from Source mode is obtained using the standard innerHTML property, which is supposed to produce valid HTML. So it seems the server-side rendering module is not as permissive with unescaped special HTML characters in attribute values.

 
cid:jira-generated-image-avatar-ed4700a1-69c2-404d-8db5-6663171654ac Marius Dumitru Florea on 10/Jun/24 10:44
 
There are two problems here:

* When saving from Source mode, the editor is supposed to submit only the source wiki syntax, not the HTML. Inspecting the HTTP requests sent by the editor shows that it is in fact sending the HTML when the source area doesn't have any changes.
* Submitting the HTML from Source mode shouldn't be a problem normally, but it's not
optional optimal because it triggers a useless conversion when we already know the source wiki syntax. BUT, the submitted HTML is not exactly the same as the one submitted from the WYSIWYG mode. Precisely, the value of some attributes (used to mark in-line editable macros) is not property escaped:

{noformat}
<div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" ...
{noformat}

versus the expected:

{noformat}
<div data-xwiki-non-generated-content="java.util.List&lt;org.xwiki.rendering.block.Block&gt;" ...
{noformat}

Surprisingly, for me, the HTML submitted from Source mode is obtained using the standard {{innerHTML}} property, which is supposed to produce valid HTML. So it seems the server-side rendering module is not as permissive with unescaped special HTML characters in attribute values.