There are 5 updates, 1 comment.
 
 
XWiki Platform / cid:jira-generated-image-avatar-d18e1c6a-0f0d-4b71-af8b-361aa0706847 XWIKI-22366 Closed

CKE not saving properly when editing content with iframes and text below

 
View issue   ยท   Add comment
 

5 updates

 
cid:jira-generated-image-avatar-1f18480b-cbc3-49f7-8cec-2266b20f200e Changes by Marius Dumitru Florea on 30/Jul/24 11:08
 
Documentation in Release Notes: N/A
Documentation: N/A
Assignee: Marius Dumitru Florea
Resolution: Invalid
Status: Open Closed
 
 

1 comment

 
cid:jira-generated-image-avatar-1f18480b-cbc3-49f7-8cec-2266b20f200e Marius Dumitru Florea on 30/Jul/24 11:08
 

When using the HTML macro with clean=false you are responsible for producing valid HTML. The WYSIWYG editor expects valid HTML as input. If it receives invalid HTML it tries to fix it by moving DOM nodes around, adding new nodes, splitting existing nodes, etc. which can easily break the macro marker comments used to delimit and protect the macro output which is not editable.

You don't need the Velocity macro. This is enough:

{{html clean="false"}}
<iframe></iframe>
{{/html}}

The HTML is invalid because you generate inline elements at top level, and the editor fixes this by adding a paragraph wrapper, which breaks the macro marker comments.

When using:

{{html}}
<iframe></iframe>
{{/html}}

The rendering adds the paragraph wrapper on the server side, without breaking the macro marker comments.

If you need to use clean=false then you need to add the block wrapper yourself:

{{html clean="false"}}
<p><iframe></iframe></p>
{{/html}}

Can be a DIV also, doesn't matter as long as it's a block level element that accepts iframe as child.