Hello there
I use the Page Break | CKEditor.com plugin in xWiki. Although this works fine when printing, once the page is saved (or otherwise converted from HTML to XWIki Markup), the visual indicator of the page break is gone in CKEditor.
This is due to the conversion of the HTML to XWiki Syntax:
HTML:
<div aria-label="Page Break" class="cke_pagebreak" data-cke-display-name="pagebreak" data-cke-pagebreak="1" style="page-break-after: always" title="Page Break" contenteditable="false"></div>
Markup:
(% style="page-break-after: always" %)
(((
(% style="display:none" %)
)))
Is there a “simple” way to influence xwiki-source htmlConverter (or any other component) to convert it in a way that when rendering back HTML, it will look equal/similar to the original HTML?
Thank you
The huge difference here is not due to the HTML conversion in XWiki. This is due to this code in the page break plugin that removes the class and all other attributes except the style. However, this would be fine, the plugin would re-create the HTML code you see upon re-opening the editor. The problem is actually quite subtle: The HTML code you get during saving that is also expected by the plugin is the following:
<div style="page-break-after: always"><span style="display:none"> </span></div>
However, what XWiki actually produces is:
<div style="page-break-after: always"><p><span style="display:none"> </span></p></div>
So the problem is that XWiki adds a wrapping <p>
-tag and due to this <p>
-tag the page break plugin doesn’t recognize its syntax as it expects the <span>
-tag as direct child of the <div>
-tag. Removing this wrapping <p>
-tag is quite difficult as this is quite deep in the XWiki rendering code and I do not see a clear condition when it shouldn’t be produced. I think it is way easier to patch the plugin to optionally accept a wrapping <p>
-tag around the <span>
.