|
Description: |
Follow these steps to reproduce with the WYSIWYG editor :
* edit Set the same content of a wiki page in two browser tabs, in realtime to: {noformat} before
{{info}}test{{/info}} {noformat} * in Edit the first tab, type something on page with the first line WYSIWYG editor. * then press Enter Notice that the empty lines are present. * Edit the parameters of the info macro and modify some parameter (e.g. set a couple CSS class, doesn't matter) * The empty lines disappear after the content is re-rendered due to the macro parameter change
With the network tab I can see that the HTML converter is called with something like:
{noformat} <p>before</p><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><!--startmacro:info|-|--><div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" class="xwiki-metadata-container"><p>test</p></div><!--stopmacro--> {noformat}
and the result of times parsing to create some XDOM and rendering back to XWiki 2.1 syntax is:
{noformat} <p>before</p><!--startmacro:info|-||-|test--><div class="box infomessage"><div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" class="xwiki-metadata-container"><p>test</p></div></div><!--stopmacro--> {noformat}
As you can see the empty lines are missing. Note that the problem doesn't reproduce when the macro is initially inserted, where the HTML converter is called with:
{noformat} <p>before</p><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><p><!--startmacro:info|-||-|test--><!--stopmacro--></p> {noformat}
and correctly produces:
{noformat} <p>before</p><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><div class="wikimodel-emptyline"></div><!--startmacro:info|-||-|test--><div class="box infomessage"><div data-xwiki-non-generated-content="java.util.List<org.xwiki.rendering.block.Block>" class="xwiki-metadata-container"><p>test</p></div></div><!--stopmacro--> {noformat}
This suggests that the problem is in the code that handles the "data-xwiki-non-generated-content", i.e. the content of macros editable inline.
Note that this issue is * very annoying* when editing in realtime because realtime editing makes it reproduce more easily:
* Alice inserts some empty lines and then insert inserts an information info box on * While Alice is typing inside the last line info box: * switch * the changes are propagated to Bob and since there's a new macro, the second browser tab
The content is re-rendered for Bob, but due to the realtime sync the "data-xwiki-non-generated-content" DIV is present, and thus the empty lines are removed *when switching for Bob, which produces a change that gets propagated to the second tab Alice * * Alice sees the empty lines ( not before! she just entered ) disappear and blames it on Bob |
|